AeThex-OS/temp-forge-extract/aethex-forge-main/api/_supabase.ts
MrPiglr b3c308b2c8 Add functional marketplace modules, bottom nav bar, root terminal, arcade games
- ModuleManager: Central tracking for installed marketplace modules
- DataAnalyzerWidget: Real-time CPU/RAM/Battery/Storage widget (unlocked by Data Analyzer module)
- BottomNavBar: Navigation bar for Projects/Chat/Marketplace/Settings
- RootShell: Real root command execution utility
- TerminalActivity: Full root shell with neofetch, sysinfo, real Linux commands
- Terminal Pro module: Adds aliases (ll, la, h), command history
- ArcadeActivity + SnakeGame: Pixel Arcade module unlocks retro games
- fade_in/fade_out animations for smooth transitions
2026-02-18 22:03:50 -07:00

41 lines
1.4 KiB
TypeScript

import type { VercelRequest, VercelResponse } from "@vercel/node";
import { createClient } from "@supabase/supabase-js";
// Prioritize VITE_SUPABASE_URL (main instance with actual data)
// Fall back to SUPABASE_URL (custom domain alias)
const SUPABASE_URL =
process.env.VITE_SUPABASE_URL || process.env.SUPABASE_URL || "";
const SUPABASE_SERVICE_ROLE = process.env.SUPABASE_SERVICE_ROLE || "";
console.log("[Supabase Init] SUPABASE_URL configured:", !!SUPABASE_URL);
console.log(
"[Supabase Init] SUPABASE_SERVICE_ROLE configured:",
!!SUPABASE_SERVICE_ROLE,
);
export function getAdminClient() {
if (!SUPABASE_URL) {
console.error("[Supabase] SUPABASE_URL not set");
throw new Error("SUPABASE_URL not set");
}
if (!SUPABASE_SERVICE_ROLE) {
console.error("[Supabase] SUPABASE_SERVICE_ROLE not set");
throw new Error("SUPABASE_SERVICE_ROLE not set");
}
console.log(
"[Supabase] Creating client with URL:",
SUPABASE_URL.substring(0, 30) + "...",
);
return createClient(SUPABASE_URL, SUPABASE_SERVICE_ROLE, {
auth: { autoRefreshToken: false, persistSession: false },
});
}
// Alias for backward compatibility
export const supabase = getAdminClient();
// Dummy default export for Vercel (this file is a utility, not a handler)
export default async function handler(req: VercelRequest, res: VercelResponse) {
return res.status(501).json({ error: "Not a handler" });
}