race condition security patch
This commit is contained in:
@@ -5,11 +5,9 @@
|
||||
import StravaSettingsModal from "$lib/components/settings/integrations/strava_settings_modal.svelte";
|
||||
import {
|
||||
Integration,
|
||||
type BaseIntegration,
|
||||
type KomootIntegration,
|
||||
type StravaIntegration,
|
||||
type StravaIntegration
|
||||
} from "$lib/models/integration.js";
|
||||
import { pb } from "$lib/pocketbase.js";
|
||||
import {
|
||||
integrations_create,
|
||||
integrations_update,
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { pb } from "$lib/pocketbase";
|
||||
import { integrations_index, integrations_update } from "$lib/stores/integration_store";
|
||||
import { error, redirect, type RequestEvent, type ServerLoad } from "@sveltejs/kit";
|
||||
import { error, redirect, type ServerLoad } from "@sveltejs/kit";
|
||||
import { ClientResponseError } from "pocketbase";
|
||||
|
||||
export const load: ServerLoad = async ({ url, fetch }) => {
|
||||
export const load: ServerLoad = async ({ url, fetch, locals }) => {
|
||||
const oauthError = url.searchParams.get('error');
|
||||
if (oauthError) {
|
||||
// user cancelled
|
||||
@@ -22,7 +20,7 @@ export const load: ServerLoad = async ({ url, fetch }) => {
|
||||
}
|
||||
|
||||
try {
|
||||
await pb.send("/integration/strava/token", {
|
||||
await locals.pb.send("/integration/strava/token", {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
|
||||
Reference in New Issue
Block a user