-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat(form) Form description * style: pnpm format
- Loading branch information
Showing
18 changed files
with
162 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { SvelteKitAuth } from "@auth/sveltekit" | ||
import GitHub from "@auth/sveltekit/providers/github" | ||
import { SvelteKitAuth } from '@auth/sveltekit'; | ||
import GitHub from '@auth/sveltekit/providers/github'; | ||
|
||
export const { handle, signIn, signOut } = SvelteKitAuth({ | ||
providers: [GitHub], | ||
trustHost: true | ||
}) | ||
providers: [GitHub], | ||
trustHost: true | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
import { sequence } from "@sveltejs/kit/hooks"; | ||
import { sequence } from '@sveltejs/kit/hooks'; | ||
|
||
import { prepareStylesSSR } from "@svelteuidev/core"; | ||
import { prepareStylesSSR } from '@svelteuidev/core'; | ||
|
||
import { handle as authHandle } from "./auth"; | ||
import { handle as authHandle } from './auth'; | ||
|
||
export const handle = sequence(authHandle, prepareStylesSSR); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,37 @@ | ||
import { writable } from "svelte/store"; | ||
import { writable } from 'svelte/store'; | ||
|
||
export type NavItem = | ||
| { | ||
badge?: string; | ||
href: string; | ||
label: string; | ||
} | ||
| "separator"; | ||
| { | ||
badge?: string; | ||
href: string; | ||
label: string; | ||
} | ||
| 'separator'; | ||
|
||
export interface Navbar { | ||
selectedProject: string; | ||
links: NavItem[]; | ||
selectedProject: string; | ||
links: NavItem[]; | ||
} | ||
|
||
export let navbar = writable<Navbar>({ | ||
selectedProject: "RustLangES", | ||
links: [], | ||
selectedProject: 'RustLangES', | ||
links: [] | ||
}); | ||
|
||
export function loadNavbar( | ||
links: NavItem[], | ||
selectedProject = "RustLangES", | ||
): { navbar: Navbar } { | ||
navbar.update((v) => { | ||
v.selectedProject = selectedProject; | ||
v.links = links; | ||
return v; | ||
}); | ||
export function loadNavbar(links: NavItem[], selectedProject = 'RustLangES'): { navbar: Navbar } { | ||
navbar.update((v) => { | ||
v.selectedProject = selectedProject; | ||
v.links = links; | ||
return v; | ||
}); | ||
|
||
return { | ||
navbar: { links, selectedProject }, | ||
}; | ||
return { | ||
navbar: { links, selectedProject } | ||
}; | ||
} | ||
|
||
export function receiveNavbar(data: unknown) { | ||
if (typeof data === "object" && data !== null && "navbar" in data) { | ||
navbar.set(data.navbar as Navbar); | ||
} | ||
if (typeof data === 'object' && data !== null && 'navbar' in data) { | ||
navbar.set(data.navbar as Navbar); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
import * as env from "$env/static/private"; | ||
import { error } from "@sveltejs/kit"; | ||
import type { LayoutServerLoad } from "./$types"; | ||
import * as env from '$env/static/private'; | ||
import { error } from '@sveltejs/kit'; | ||
import type { LayoutServerLoad } from './$types'; | ||
|
||
export const load: LayoutServerLoad = async (event) => { | ||
const session = await event.locals.auth(); | ||
const session = await event.locals.auth(); | ||
|
||
const isNotAdmin = !session?.user || !session.user.email || | ||
!env.ADMINS.split(";").includes(session.user.email); | ||
const isNotAdmin = | ||
!session?.user || !session.user.email || !env.ADMINS.split(';').includes(session.user.email); | ||
|
||
if (event.url.pathname !== "/" && isNotAdmin) { | ||
return error(403) | ||
} | ||
if (event.url.pathname !== '/' && isNotAdmin) { | ||
return error(403); | ||
} | ||
|
||
if (isNotAdmin) { | ||
event.cookies.delete("sessionToken", { path: "/" }); | ||
event.cookies.delete("authjs.session-token", { path: "/" }); | ||
return {}; | ||
} | ||
if (isNotAdmin) { | ||
event.cookies.delete('sessionToken', { path: '/' }); | ||
event.cookies.delete('authjs.session-token', { path: '/' }); | ||
return {}; | ||
} | ||
|
||
return { session }; | ||
return { session }; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.