web/api: don't request/send session token to custom instances

This commit is contained in:
dumbmoron 2024-09-08 15:51:44 +00:00
parent b4599e68bb
commit 1f86faad12
No known key found for this signature in database

View file

@ -9,9 +9,9 @@ import type { Optional } from "$lib/types/generic";
import type { CobaltAPIResponse, CobaltErrorResponse } from "$lib/types/api";
const request = async (url: string) => {
const gSettings = get(settings);
const saveSettings = gSettings.save;
const privacySettings = gSettings.privacy;
const currentSettings = get(settings);
const saveSettings = currentSettings.save;
const privacySettings = currentSettings.privacy;
const request = {
url,
@ -36,8 +36,12 @@ const request = async (url: string) => {
}
await apiOverrideWarning();
const usingCustomInstance = currentSettings.processing.enableCustomInstances
&& currentSettings.processing.customInstanceURL;
const api = currentApiURL();
const session = await getSession();
// FIXME: rewrite this to allow custom instances to specify their own turnstile tokens
const session = usingCustomInstance ? undefined : await getSession();
let extraHeaders = {}