From 5d9d2b794d9735f20c7f62bcce18099165dd0a57 Mon Sep 17 00:00:00 2001 From: Leo Vasanko Date: Tue, 2 Dec 2025 19:10:13 +0000 Subject: [PATCH] Refactor restricted app paths and naming. --- frontend/{restricted-api => restricted/api}/index.html | 2 +- frontend/restricted/{ => forward}/index.html | 2 +- frontend/src/restricted-api/main.js | 5 ----- .../RestrictedApiApp.vue => restricted/api/App.vue} | 0 frontend/src/restricted/api/main.js | 5 +++++ .../src/restricted/{RestrictedApp.vue => forward/App.vue} | 0 frontend/src/restricted/forward/main.js | 5 +++++ frontend/src/restricted/main.js | 5 ----- frontend/vite.config.js | 7 ++++--- passkey/fastapi/api.py | 4 ++-- 10 files changed, 18 insertions(+), 17 deletions(-) rename frontend/{restricted-api => restricted/api}/index.html (88%) rename frontend/restricted/{ => forward}/index.html (76%) delete mode 100644 frontend/src/restricted-api/main.js rename frontend/src/{restricted-api/RestrictedApiApp.vue => restricted/api/App.vue} (100%) create mode 100644 frontend/src/restricted/api/main.js rename frontend/src/restricted/{RestrictedApp.vue => forward/App.vue} (100%) create mode 100644 frontend/src/restricted/forward/main.js delete mode 100644 frontend/src/restricted/main.js diff --git a/frontend/restricted-api/index.html b/frontend/restricted/api/index.html similarity index 88% rename from frontend/restricted-api/index.html rename to frontend/restricted/api/index.html index 97be4a7..9c80eaa 100644 --- a/frontend/restricted-api/index.html +++ b/frontend/restricted/api/index.html @@ -1 +1 @@ -
+
diff --git a/frontend/restricted/index.html b/frontend/restricted/forward/index.html similarity index 76% rename from frontend/restricted/index.html rename to frontend/restricted/forward/index.html index b8b9fcb..a51815d 100644 --- a/frontend/restricted/index.html +++ b/frontend/restricted/forward/index.html @@ -7,6 +7,6 @@
- + diff --git a/frontend/src/restricted-api/main.js b/frontend/src/restricted-api/main.js deleted file mode 100644 index 71c4ba8..0000000 --- a/frontend/src/restricted-api/main.js +++ /dev/null @@ -1,5 +0,0 @@ -import { createApp } from 'vue' -import RestrictedApiApp from './RestrictedApiApp.vue' -import '@/assets/style.css' - -createApp(RestrictedApiApp).mount('#app') diff --git a/frontend/src/restricted-api/RestrictedApiApp.vue b/frontend/src/restricted/api/App.vue similarity index 100% rename from frontend/src/restricted-api/RestrictedApiApp.vue rename to frontend/src/restricted/api/App.vue diff --git a/frontend/src/restricted/api/main.js b/frontend/src/restricted/api/main.js new file mode 100644 index 0000000..c16e86a --- /dev/null +++ b/frontend/src/restricted/api/main.js @@ -0,0 +1,5 @@ +import { createApp } from 'vue' +import App from './App.vue' +import '@/assets/style.css' + +createApp(App).mount('#app') diff --git a/frontend/src/restricted/RestrictedApp.vue b/frontend/src/restricted/forward/App.vue similarity index 100% rename from frontend/src/restricted/RestrictedApp.vue rename to frontend/src/restricted/forward/App.vue diff --git a/frontend/src/restricted/forward/main.js b/frontend/src/restricted/forward/main.js new file mode 100644 index 0000000..c16e86a --- /dev/null +++ b/frontend/src/restricted/forward/main.js @@ -0,0 +1,5 @@ +import { createApp } from 'vue' +import App from './App.vue' +import '@/assets/style.css' + +createApp(App).mount('#app') diff --git a/frontend/src/restricted/main.js b/frontend/src/restricted/main.js deleted file mode 100644 index 1f85834..0000000 --- a/frontend/src/restricted/main.js +++ /dev/null @@ -1,5 +0,0 @@ -import { createApp } from 'vue' -import RestrictedApp from './RestrictedApp.vue' -import '@/assets/style.css' - -createApp(RestrictedApp).mount('#app') diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 5d5144f..f72fa30 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -40,8 +40,9 @@ export default defineConfig(({ command }) => ({ bypass: (req) => { const url = req.url?.split('?')[0] if (url?.startsWith('/auth/assets/')) return url.slice(5) + if (url === '/auth/api/restricted') return '/restricted/api/index.html' - const routes = { '': '/', host: '/host/index.html', admin: '/admin/', restricted: '/restricted/index.html', 'restricted-api': '/restricted-api/index.html' } + const routes = { '': '/', host: '/host/index.html', admin: '/admin/', 'restricted-forward': '/restricted/forward/index.html', 'restricted-api': '/restricted/api/index.html' } for (const [path, target] of Object.entries(routes)) { if ([`/auth/${path}`, `/auth/${path}/`, `/${path}`, `/${path}/`].includes(url)) return target } @@ -59,8 +60,8 @@ export default defineConfig(({ command }) => ({ index: resolve(__dirname, 'index.html'), admin: resolve(__dirname, 'admin/index.html'), reset: resolve(__dirname, 'reset/index.html'), - restricted: resolve(__dirname, 'restricted/index.html'), - 'restricted-api': resolve(__dirname, 'restricted-api/index.html'), + 'restricted-forward': resolve(__dirname, 'restricted/forward/index.html'), + 'restricted-api': resolve(__dirname, 'restricted/api/index.html'), host: resolve(__dirname, 'host/index.html') } } diff --git a/passkey/fastapi/api.py b/passkey/fastapi/api.py index ce844f1..87ee224 100644 --- a/passkey/fastapi/api.py +++ b/passkey/fastapi/api.py @@ -39,7 +39,7 @@ app.mount("/user", user.app) @app.get("/restricted") async def restricted_view(): """Serve the restricted/authentication UI for iframe embedding.""" - return FileResponse(frontend.file("restricted-api", "index.html")) + return FileResponse(frontend.file("restricted/api", "index.html")) @app.exception_handler(HTTPException) @@ -155,7 +155,7 @@ async def forward_authentication( return Response(status_code=204, headers=remote_headers) except HTTPException as e: # Let global handler clear cookie; still return HTML surface instead of JSON - html = frontend.file("restricted", "index.html").read_bytes() + html = frontend.file("restricted/forward", "index.html").read_bytes() status = e.status_code # If 401 we still want cookie cleared; rely on handler by raising again not feasible (we need HTML) if status == 401: