Files
ClaudeMarketing/app/api/settings/route.ts
T
Trey t 66c2bbec8b feat: complete marketing command center with pipeline, UI, and asset generation
- Dashboard with campaign management, asset gallery, and publishing queue
- 7-agent pipeline: trend scout, research, scripts, ad creative, video, copy, distribution
- Campaign form with screenshot upload, goal picker, platform selection
- Campaign detail view with Details/Pipeline/Assets/Chat tabs
- Two-set image generation: Gemini AI (NanoBanana MCP) + Canvas Design posters
- Remotion video rendering with phone.png frame and real screenshot alignment
- honeyDue branding: blue #0079FF, orange #FF9400, Inter font, warm off-white
- Asset cards with source badges (Gemini/Canvas/Remotion/Playwright)
- Markdown/JSON render endpoint for viewing pipeline outputs as HTML
- Settings page with Tavily, Gemini, Postiz, Nextdoor integration management
- Claude Chat for campaign feedback loop with streaming SSE
- Postiz publishing modal with scheduling
- Auth with NextAuth credentials + JWT sessions
- SQLite via Prisma with better-sqlite3 adapter

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-23 21:05:26 -05:00

58 lines
1.5 KiB
TypeScript

import { auth } from "@/lib/auth";
import {
getAllSettings,
saveSetting,
checkIntegrationStatus,
SETTINGS_CONFIG,
type SettingKey,
} from "@/lib/settings";
export async function GET(request: Request) {
const session = await auth();
if (!session) return new Response("Unauthorized", { status: 401 });
const { searchParams } = new URL(request.url);
const includeStatus = searchParams.get("status") === "true";
const settings = await getAllSettings();
// Mask secret values for display
const masked: Record<string, string> = {};
for (const [key, value] of Object.entries(settings)) {
const config = SETTINGS_CONFIG[key as SettingKey];
if (config && "secret" in config && config.secret && value) {
masked[key] = value.slice(0, 4) + "..." + value.slice(-4);
} else {
masked[key] = value;
}
}
const result: Record<string, unknown> = { settings: masked };
if (includeStatus) {
result.status = await checkIntegrationStatus();
}
return Response.json(result);
}
export async function PUT(request: Request) {
const session = await auth();
if (!session) return new Response("Unauthorized", { status: 401 });
const body = await request.json();
const { key, value } = body;
if (!key || typeof value !== "string") {
return Response.json({ error: "key and value required" }, { status: 400 });
}
if (!(key in SETTINGS_CONFIG)) {
return Response.json({ error: "Invalid setting key" }, { status: 400 });
}
await saveSetting(key as SettingKey, value);
return Response.json({ ok: true });
}