diff --git a/.replit b/.replit index 7887c944..07348546 100644 --- a/.replit +++ b/.replit @@ -60,10 +60,6 @@ externalPort = 3000 localPort = 40437 externalPort = 3001 -[[ports]] -localPort = 41051 -externalPort = 3002 - [deployment] deploymentTarget = "autoscale" run = ["node", "dist/server/production.mjs"] diff --git a/client/lib/supabase-service.ts b/client/lib/supabase-service.ts index 8e8271be..d1a6af21 100644 --- a/client/lib/supabase-service.ts +++ b/client/lib/supabase-service.ts @@ -400,29 +400,23 @@ export const communityService = { "id" | "created_at" | "updated_at" | "likes_count" | "comments_count" >, ): Promise { - console.log("[createPost] Starting - calling API at", `${API_BASE}/api/posts`); try { const resp = await fetch(`${API_BASE}/api/posts`, { method: "POST", headers: { "Content-Type": "application/json" }, body: JSON.stringify(post), }); - console.log("[createPost] API response status:", resp.status); if (resp.ok) { - const result = await resp.json(); - console.log("[createPost] API success - post created via API (Discord sync enabled)"); - return result as CommunityPost; + return (await resp.json()) as CommunityPost; } if (resp.status >= 400) { const payload = await resp.json().catch(() => ({})); - console.error("[createPost] API error:", payload); throw new Error(payload?.error || `API responded with ${resp.status}`); } } catch (error) { - console.warn("[createPost] API failed, falling back to direct Supabase (NO Discord sync):", error); + console.warn("Falling back to Supabase insert for post:", error); } - console.log("[createPost] Using direct Supabase insert (Discord sync SKIPPED)"); const { data, error } = await supabase .from("community_posts") .insert(post) diff --git a/server/index.ts b/server/index.ts index 5d682884..74b595d7 100644 --- a/server/index.ts +++ b/server/index.ts @@ -2523,47 +2523,6 @@ export function createServer() { .json({ error: error.message || "Failed to create post" }); } - // Send post to Discord feed channel (fire and forget) - try { - const contentParsed = JSON.parse(String(payload.content).trim()); - // Only sync to Discord if this is NOT a Discord-sourced post - if (contentParsed.source !== "discord") { - // Get author info for the Discord embed - const { data: authorProfile } = await adminSupabase - .from("user_profiles") - .select("username, full_name, avatar_url") - .eq("id", payload.author_id) - .single(); - - const discordBotPort = process.env.DISCORD_BOT_PORT || "8044"; - const discordBridgeToken = process.env.DISCORD_BRIDGE_TOKEN || "aethex-bridge"; - - fetch(`http://localhost:${discordBotPort}/send-to-discord`, { - method: "POST", - headers: { - "Content-Type": "application/json", - "Authorization": `Bearer ${discordBridgeToken}`, - }, - body: JSON.stringify({ - ...data, - author: authorProfile, - }), - }).then(async (resp) => { - if (resp.ok) { - console.log("[Feed Bridge] ✅ Post sent to Discord"); - } else { - const errText = await resp.text(); - console.log("[Feed Bridge] Discord sync response:", resp.status, errText); - } - }).catch((err) => { - console.log("[Feed Bridge] Could not sync to Discord:", err.message); - }); - } - } catch (syncErr: any) { - // Non-blocking - just log it - console.log("[Feed Bridge] Sync error:", syncErr?.message); - } - res.json(data); } catch (e: any) { console.error("[API] /api/posts exception:", e?.message || String(e));