Migrate from Node.js built-ins to Bun-native APIs (#1)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
2026-03-04 12:49:38 -05:00
committed by GitHub
co-authored by Claude
parent 36afbcb8c0
commit 83456c6a21
15 changed files with 99 additions and 106 deletions
+6 -3
View File
@@ -1,6 +1,5 @@
"use server";
import crypto from "node:crypto";
import { and, eq } from "drizzle-orm";
import { headers } from "next/headers";
import { auth } from "@/lib/auth/server";
@@ -56,7 +55,9 @@ export async function saveWebhookConnection(
};
}
const token = crypto.randomBytes(32).toString("hex");
const token = Buffer.from(
crypto.getRandomValues(new Uint8Array(32)),
).toString("hex");
const now = new Date();
const connection = db
@@ -103,7 +104,9 @@ export async function regenerateWebhookToken(provider: "plex" | "jellyfin") {
throw new Error("Invalid provider");
}
const newToken = crypto.randomBytes(32).toString("hex");
const newToken = Buffer.from(
crypto.getRandomValues(new Uint8Array(32)),
).toString("hex");
const connection = db
.update(webhookConnections)
@@ -19,17 +19,17 @@ async function getAdminSession() {
export async function createBackupAction(): Promise<BackupInfo> {
await getAdminSession();
return createBackup();
return await createBackup();
}
export async function listBackupsAction(): Promise<BackupInfo[]> {
await getAdminSession();
return listBackups();
return await listBackups();
}
export async function deleteBackupAction(filename: string): Promise<void> {
await getAdminSession();
deleteBackup(filename);
await deleteBackup(filename);
}
export async function setScheduledBackupAction(
+1 -1
View File
@@ -57,7 +57,7 @@ export default async function SettingsPage() {
? getSetting("registrationOpen") === "true"
: false;
const backups = isAdmin ? listBackups() : [];
const backups = isAdmin ? await listBackups() : [];
const scheduledBackupsEnabled = isAdmin
? getSetting("scheduledBackups") === "true"
: false;