From e5e5f1d483f21eccac9faa21ead9458c00660d81 Mon Sep 17 00:00:00 2001 From: sirpiglr <49359077-sirpiglr@users.noreply.replit.com> Date: Wed, 3 Dec 2025 18:56:42 +0000 Subject: [PATCH] Remove direct Discord post synchronization from server Removes the HTTP-based Discord post synchronization logic from the server, as the Discord bot now handles this directly via polling Supabase. Replit-Commit-Author: Agent Replit-Commit-Session-Id: 9203795e-937a-4306-b81d-b4d5c78c240e Replit-Commit-Checkpoint-Type: intermediate_checkpoint Replit-Commit-Event-Id: eb03098a-a2c8-4077-bc43-43ade85b9f51 Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/7c94b7a0-29c7-4f2e-94ef-44b2153872b7/9203795e-937a-4306-b81d-b4d5c78c240e/duiWnI1 Replit-Helium-Checkpoint-Created: true --- .replit | 4 ---- client/lib/supabase-service.ts | 10 ++------- server/index.ts | 41 ---------------------------------- 3 files changed, 2 insertions(+), 53 deletions(-) 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));