diff --git a/app/admin/backend/actions.ts b/app/admin/backend/actions.ts index 1e9f52d..4169588 100644 --- a/app/admin/backend/actions.ts +++ b/app/admin/backend/actions.ts @@ -1,18 +1,11 @@ "use server"; import { revalidateTag } from "next/cache"; - -import { readdirSync } from "fs"; -import { join } from "path"; +const validPlatforms = ["youtube", "roblox", "discord", "tiktok"]; export async function refetchPlatform( platform: string ): Promise<{ count: number | null }> { - // Validate platform against actual files to prevent path traversal - const dir = join(process.cwd(), "lib", "followers"); - const validPlatforms = readdirSync(dir) - .filter((f) => f.endsWith(".ts") && f !== "index.ts") - .map((f) => f.replace(".ts", "")); if (!validPlatforms.includes(platform)) { throw new Error("Invalid platform"); diff --git a/app/admin/backend/page.tsx b/app/admin/backend/page.tsx index c4a5b62..47e7cf6 100644 --- a/app/admin/backend/page.tsx +++ b/app/admin/backend/page.tsx @@ -1,17 +1,9 @@ import { AdminShellServer } from "@/components/admin-shell-server"; -import { readdirSync } from "fs"; -import { join } from "path"; import { BackendClient } from "./client"; - export const dynamic = "force-dynamic"; +const platforms = ["youtube", "roblox", "discord", "tiktok"]; export default async function BackendPage() { - // Auto-discover platform files from lib/followers/ - const dir = join(process.cwd(), "lib", "followers"); - const platforms = readdirSync(dir) - .filter((f) => f.endsWith(".ts") && f !== "index.ts") - .map((f) => f.replace(".ts", "")); - // Read current cached counts from Redis let counts: Record = {}; try {