Abandoned Commit
This commit is contained in:
7
src/app.d.ts
vendored
7
src/app.d.ts
vendored
@@ -122,13 +122,6 @@ declare global {
|
|||||||
servername: string
|
servername: string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface AuthData {
|
|
||||||
User: {
|
|
||||||
Id: string
|
|
||||||
}
|
|
||||||
AccessToken: string
|
|
||||||
}
|
|
||||||
|
|
||||||
interface User {
|
interface User {
|
||||||
Name: string
|
Name: string
|
||||||
Id: string
|
Id: string
|
||||||
|
|||||||
@@ -30,8 +30,11 @@ export const POST: RequestHandler = async ({ request, fetch }) => {
|
|||||||
})
|
})
|
||||||
if (!authResponse.ok) return new Response('Failed to authenticate', { status: 401 })
|
if (!authResponse.ok) return new Response('Failed to authenticate', { status: 401 })
|
||||||
|
|
||||||
const authData: Jellyfin.AuthData = await authResponse.json()
|
const authData = await authResponse.json()
|
||||||
return Response.json(authData)
|
return Response.json({
|
||||||
|
userId: authData.User.Id,
|
||||||
|
accessToken: authData.AccessToken,
|
||||||
|
})
|
||||||
} catch {
|
} catch {
|
||||||
return new Response('Fetch request failed', { status: 404 })
|
return new Response('Fetch request failed', { status: 404 })
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -36,15 +36,15 @@ export const actions: Actions = {
|
|||||||
return fail(500, { message: 'Internal Server Error' })
|
return fail(500, { message: 'Internal Server Error' })
|
||||||
}
|
}
|
||||||
|
|
||||||
const authData: Jellyfin.AuthData = await jellyfinAuthResponse.json()
|
const authData = await jellyfinAuthResponse.json()
|
||||||
|
|
||||||
const serviceData: Jellyfin.JFService = {
|
const serviceData: Jellyfin.JFService = {
|
||||||
type: 'jellyfin',
|
type: 'jellyfin',
|
||||||
userId: authData.User.Id,
|
userId: authData.userId,
|
||||||
urlOrigin: serverUrl.toString(),
|
urlOrigin: serverUrl.toString(),
|
||||||
}
|
}
|
||||||
const tokenData: Jellyfin.JFTokens = {
|
const tokenData: Jellyfin.JFTokens = {
|
||||||
accessToken: authData.AccessToken,
|
accessToken: authData.accessToken,
|
||||||
}
|
}
|
||||||
|
|
||||||
const newConnectionResponse = await fetch(`/api/users/${locals.user.id}/connections`, {
|
const newConnectionResponse = await fetch(`/api/users/${locals.user.id}/connections`, {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import adapter from '@sveltejs/adapter-auto';
|
import adapter from '@sveltejs/adapter-auto'
|
||||||
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';
|
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte'
|
||||||
|
|
||||||
/** @type {import('@sveltejs/kit').Config} */
|
/** @type {import('@sveltejs/kit').Config} */
|
||||||
const config = {
|
const config = {
|
||||||
@@ -11,8 +11,12 @@ const config = {
|
|||||||
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
// adapter-auto only supports some environments, see https://kit.svelte.dev/docs/adapter-auto for a list.
|
||||||
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
// If your environment is not supported or you settled on a specific environment, switch out the adapter.
|
||||||
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
// See https://kit.svelte.dev/docs/adapters for more information about adapters.
|
||||||
adapter: adapter()
|
adapter: adapter(),
|
||||||
}
|
csrf: {
|
||||||
};
|
// REMOVE THIS WHEN SHIPPING
|
||||||
|
checkOrigin: false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
export default config;
|
export default config
|
||||||
|
|||||||
Reference in New Issue
Block a user