diff --git a/.gitignore b/.gitignore index 76a65fc..0877746 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ node_modules/ /build/ /.svelte-kit/ /.yarn/install-state.gz +.env +.env.local diff --git a/package.json b/package.json index 8c7c32a..29cef56 100644 --- a/package.json +++ b/package.json @@ -15,7 +15,7 @@ "devDependencies": { "@eslint/js": "^10.0.1", "@sveltejs/adapter-static": "^3.0.10", - "@sveltejs/kit": "^2.49.1", + "@sveltejs/kit": "^2.70.3", "@sveltejs/vite-plugin-svelte": "^6.2.1", "@types/node": "^24", "eslint": "^10.4.1", @@ -28,7 +28,8 @@ "svelte-check": "^4.3.4", "typescript": "^5.9.3", "typescript-eslint": "^8.60.1", - "vite": "^7.2.6" + "vite": "^7.2.6", + "zod": "^4.5.4" }, "packageManager": "yarn@4.17.0" } diff --git a/src/app.html b/src/app.html index 83057d1..adf8bd8 100644 --- a/src/app.html +++ b/src/app.html @@ -2,12 +2,7 @@ - - %sveltekit.head% diff --git a/src/env.ts b/src/env.ts new file mode 100644 index 0000000..063274b --- /dev/null +++ b/src/env.ts @@ -0,0 +1,14 @@ +import { defineEnvVars } from "@sveltejs/kit/env"; + +import { z } from "zod"; + +export const variables = defineEnvVars({ + ANONYMOUS: { + public: false, // this should only be used serverside to ensure no leakage + static: true, + schema: z + .string() + .optional() + .transform((x) => x === "true"), + }, +}); diff --git a/src/lib/config/anon.ts b/src/lib/config/anon.ts new file mode 100644 index 0000000..10d7b9b --- /dev/null +++ b/src/lib/config/anon.ts @@ -0,0 +1,20 @@ +import logo from "$lib/assets/image/logo.png"; + +export const public_config = { + name: "PurePy", + logo: logo, + github: "https://github.com/pure-py/pure-py-spec", + spec: "https://github.com/pure-py/pure-py-spec/releases/latest", + favicon: "/favicon.png", +} as const; + +const NO_LOGO = + "data:image/gif;base64,R0lGODlhAQABAAAAACH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="; + +export const anon_config = { + name: "This Project", + logo: NO_LOGO, + github: "https://github.com", + spec: "https://github.com", // we need an anoymous spec + favicon: NO_LOGO, +}; diff --git a/src/routes/+layout.server.ts b/src/routes/+layout.server.ts new file mode 100644 index 0000000..643abfe --- /dev/null +++ b/src/routes/+layout.server.ts @@ -0,0 +1,8 @@ +import * as env from "$app/env/private"; +import { anon_config, public_config } from "$lib/config/anon"; + +export const load = () => { + return { + config: env.ANONYMOUS ? anon_config : public_config, + }; +}; diff --git a/src/routes/+layout.svelte b/src/routes/+layout.svelte index 000451c..bc93241 100644 --- a/src/routes/+layout.svelte +++ b/src/routes/+layout.svelte @@ -1,14 +1,25 @@ + + {data.config.name} + + + + +