mirror of
https://github.com/Nezumi-2711/9router.git
synced 2026-09-22 20:00:47 +00:00
fix: prevent cached settings responses (#951)
This commit is contained in:
@@ -4,6 +4,13 @@ import { applyOutboundProxyEnv } from "@/lib/network/outboundProxy";
|
||||
import { resetComboRotation } from "open-sse/services/combo.js";
|
||||
import bcrypt from "bcryptjs";
|
||||
|
||||
export const dynamic = "force-dynamic";
|
||||
export const revalidate = 0;
|
||||
|
||||
const SETTINGS_RESPONSE_HEADERS = {
|
||||
"Cache-Control": "no-store"
|
||||
};
|
||||
|
||||
export async function GET() {
|
||||
try {
|
||||
const settings = await getSettings();
|
||||
@@ -17,7 +24,7 @@ export async function GET() {
|
||||
enableRequestLogs,
|
||||
enableTranslator,
|
||||
hasPassword: !!password
|
||||
});
|
||||
}, { headers: SETTINGS_RESPONSE_HEADERS });
|
||||
} catch (error) {
|
||||
console.log("Error getting settings:", error);
|
||||
return NextResponse.json({ error: error.message }, { status: 500 });
|
||||
@@ -77,7 +84,7 @@ export async function PATCH(request) {
|
||||
}
|
||||
|
||||
const { password, ...safeSettings } = settings;
|
||||
return NextResponse.json(safeSettings);
|
||||
return NextResponse.json(safeSettings, { headers: SETTINGS_RESPONSE_HEADERS });
|
||||
} catch (error) {
|
||||
console.log("Error updating settings:", error);
|
||||
return NextResponse.json({ error: error.message }, { status: 500 });
|
||||
|
||||
Reference in New Issue
Block a user