fix: prevent cached settings responses (#951)
This commit is contained in:
parent
b9c61804d4
commit
62a42851f4
1 changed files with 9 additions and 2 deletions
|
|
@ -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 });
|
||||
|
|
|
|||
Loading…
Reference in a new issue