From 7fae2bd64eae218ce62c848d732c08fafcf91d4c Mon Sep 17 00:00:00 2001 From: jenstandstad Date: Fri, 3 Jul 2026 23:57:26 +0200 Subject: [PATCH] Improving Win95 styling --- DEPLOY.md | 38 +- backend/admin/src/main.tsx | 62 ++- backend/admin/src/styles.css | 245 +++++++++++- backend/dist/caStudioApi.js | 9 +- backend/dist/caStudioApi.js.map | 2 +- backend/dist/labAuth.js | 236 +++++++++++ backend/dist/labAuth.js.map | 1 + backend/package-lock.json | 183 +++++++++ backend/package.json | 4 + .../{index-BXPDm7zD.js => index-Bo_SPfbl.js} | 368 +++++++++--------- .../public/admin/assets/index-C7KqEE0-.css | 1 + .../public/admin/assets/index-DN6CRbyT.css | 1 - backend/public/admin/index.html | 4 +- backend/src/caStudioApi.ts | 9 +- backend/src/labAuth.ts | 297 ++++++++++++++ backend/test/labAuth.test.ts | 200 ++++++++++ deploy.sh | 2 +- docker-compose.prod.yml | 9 + 18 files changed, 1471 insertions(+), 200 deletions(-) create mode 100644 backend/dist/labAuth.js create mode 100644 backend/dist/labAuth.js.map rename backend/public/admin/assets/{index-BXPDm7zD.js => index-Bo_SPfbl.js} (72%) create mode 100644 backend/public/admin/assets/index-C7KqEE0-.css delete mode 100644 backend/public/admin/assets/index-DN6CRbyT.css create mode 100644 backend/src/labAuth.ts create mode 100644 backend/test/labAuth.test.ts diff --git a/DEPLOY.md b/DEPLOY.md index 9a29a57..275783b 100644 --- a/DEPLOY.md +++ b/DEPLOY.md @@ -1,6 +1,6 @@ # Deploy CA Lab Studio -Deploy `glitch_voxel_automata_lab`, not `glitch_voxel_automata`. +Deploy this CA Lab Studio app into `/opt/glitch_automata_lab` on the server. This app is the CA Lab Studio service: @@ -8,6 +8,42 @@ This app is the CA Lab Studio service: - React admin app at `/admin` - React viewer/recorder routes at `/view/*` - Postgres database via `DATABASE_URL` +- Cross-subdomain lab access via the shared gnommoweb `auth_token` JWT cookie + +## Lab Access + +In production, the lab expects gnommoweb to be the identity issuer: + +```env +JWT_SECRET=... # same value as gnommoweb +LAB_AUTH_ENABLED=true +LAB_KEYCARD_REQUIRED=true +GNOMMOWEB_URL=https://glitch.university +LAB_KEYCARD_MERIT_SLUG=lab-keycard +LAB_USER_PROFILE_URL=https://glitch.university/api/user/profile +LAB_SIGN_IN_URL=https://glitch.university/auth/google?returnTo={returnTo} +``` + +The gnommoweb side should set `auth_token` with `Domain=.glitch.university` +and expose `LAB_USER_PROFILE_URL`. Access is granted immediately if the verified +JWT contains: + +```json +{ "merit_slug": "lab-keycard" } +``` + +If the JWT does not contain that claim, the lab calls the user profile endpoint +with the same `auth_token` cookie and expects the profile to include: + +```json +{ + "merits": [ + { "slug": "lab-keycard" } + ] +} +``` + +Local development keeps auth disabled unless `LAB_AUTH_ENABLED=true` is set. ## Build diff --git a/backend/admin/src/main.tsx b/backend/admin/src/main.tsx index efe2fef..7c1a16e 100644 --- a/backend/admin/src/main.tsx +++ b/backend/admin/src/main.tsx @@ -33,6 +33,7 @@ const SKIN_STORAGE_KEY = 'ca-studio-skin' const GALLERY_TAB_STORAGE_KEY = 'ca-studio-gallery-tab' const ENGINE_DIMENSION_STORAGE_KEY = 'ca-studio-engine-dimension' const ICG_DIMENSION_STORAGE_KEY = 'ca-studio-icg-dimension' +const DEFAULT_SKIN = 'windows-95' const SKINS = [ { id: 'retro-crt', label: 'Retro CRT' }, @@ -571,7 +572,7 @@ function App() { const [route, setRoute] = React.useState(routeFromLocation) const [skin, setSkin] = React.useState(() => { const stored = window.localStorage.getItem(SKIN_STORAGE_KEY) - return SKINS.some((item) => item.id === stored) ? (stored as StudioSkin) : 'retro-crt' + return SKINS.some((item) => item.id === stored) ? (stored as StudioSkin) : DEFAULT_SKIN }) React.useEffect(() => { @@ -614,8 +615,16 @@ function AppFooter({ skin: StudioSkin onSkinChange: (skin: StudioSkin) => void }) { + const [clock, setClock] = React.useState(() => formatTaskbarClock(new Date())) + + React.useEffect(() => { + const timer = window.setInterval(() => setClock(formatTaskbarClock(new Date())), 30_000) + return () => window.clearInterval(timer) + }, []) + return (
+

CA Lab is developed by Glitch University.

+
{clock}
) } +function formatTaskbarClock(date: Date) { + return date.toLocaleTimeString([], { hour: 'numeric', minute: '2-digit' }) +} + +function Win95WindowControls() { + return ( + + ) +} + function DeckGallery({ initialTab }: { initialTab: GalleryTab }) { const [activeTab, setActiveTab] = React.useState(initialTab) const [engineDimension, setEngineDimension] = React.useState(() => { @@ -960,6 +984,7 @@ function DeckGallery({ initialTab }: { initialTab: GalleryTab }) {

{status}
+