fix: Correct OAuth localhost/127.0.0.1 config and fix grapheme counting for Bluesky posts

- Fixed OAuth client configuration to properly use localhost for client_id and 127.0.0.1 for redirect_uris per RFC 8252 and ATproto spec
- Added proper grapheme counting using RichText API instead of character length
- Fixed thread splitting to account for link suffix and thread indicators in grapheme limits
- Added GOOGLE_EMBEDDING_DIMENSIONS env var to all env files
- Added clear-nodes.ts utility script for database management
- Added galaxy node detail page route

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-09 18:26:39 +00:00
parent 834baa5052
commit 4584584c24
14 changed files with 453 additions and 102 deletions

View File

@@ -30,12 +30,17 @@ export async function getOAuthClient(): Promise<NodeOAuthClient> {
const isDev = process.env.NODE_ENV === 'development';
const appUrl = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000';
const callbackUrl = `${appUrl}/api/auth/callback`;
// Per RFC 8252 and ATproto OAuth spec:
// - client_id must use 'localhost' hostname (NOT an IP)
// - redirect_uris must use '127.0.0.1' loopback IP (NOT 'localhost')
const callbackUrl = isDev
? 'http://127.0.0.1:3000/api/auth/callback'
: `${appUrl}/api/auth/callback`;
if (isDev) {
// Development: Use localhost loopback client
// Per ATproto spec, we encode metadata in the client_id query params
// Request 'transition:generic' scope for repository write access
// Development: Use localhost loopback client exception
// Encode metadata in client_id query params as per spec
const clientId = `http://localhost/?${new URLSearchParams({
redirect_uri: callbackUrl,
scope: 'atproto transition:generic',
@@ -43,6 +48,7 @@ export async function getOAuthClient(): Promise<NodeOAuthClient> {
console.log('[OAuth] Initializing development client with loopback exception');
console.log('[OAuth] client_id:', clientId);
console.log('[OAuth] redirect_uri:', callbackUrl);
clientInstance = new NodeOAuthClient({
clientMetadata: {