Restructure layout and add widget

This commit is contained in:
Dreamgineer
2025-11-12 20:52:50 -05:00 Unverified
parent b831e2f2a1
commit f2551e5d51
51 changed files with 181 additions and 121 deletions
+32
View File
@@ -0,0 +1,32 @@
"use server";
import { exec } from "node:child_process";
import { promisify } from "node:util";
import { revalidatePath } from "next/cache";
import { actionLog } from "@/lib/api";
import { db } from "@/lib/db";
import { settings } from "@/lib/db/schema";
export async function getEnka() {
const [{ enka } = { enka: true }] = await db.select().from(settings).limit(1);
return enka;
}
export async function toggleEnka(state: boolean) {
const last = await getEnka();
if (last === state) return;
await db
.insert(settings)
.values({ enka: state })
.onConflictDoUpdate({ target: settings.id, set: { enka: state } });
actionLog("Changed a settings", { enka: state });
revalidatePath("/admin/settings");
revalidatePath("/artifact");
}
export async function syncAmber() {
const res = await promisify(exec)("bun util/sync 2>&1");
actionLog("Triggered an Amber sync", { result: res.stdout });
return res.stdout;
}