diff --git a/frontend/admin/index.html b/frontend/admin/index.html new file mode 100644 index 0000000..e945f9e --- /dev/null +++ b/frontend/admin/index.html @@ -0,0 +1,13 @@ + + + + + + + Passkey Admin + + +
+ + + diff --git a/frontend/src/admin/AdminApp.vue b/frontend/src/admin/AdminApp.vue new file mode 100644 index 0000000..47a6f26 --- /dev/null +++ b/frontend/src/admin/AdminApp.vue @@ -0,0 +1,70 @@ + + + + + diff --git a/frontend/src/admin/main.js b/frontend/src/admin/main.js new file mode 100644 index 0000000..f8dafd2 --- /dev/null +++ b/frontend/src/admin/main.js @@ -0,0 +1,6 @@ +import '../assets/style.css' + +import { createApp } from 'vue' +import AdminApp from './AdminApp.vue' + +createApp(AdminApp).mount('#admin-app') diff --git a/frontend/vite.config.js b/frontend/vite.config.js index 1ba521c..837b2bb 100644 --- a/frontend/vite.config.js +++ b/frontend/vite.config.js @@ -1,6 +1,7 @@ import { fileURLToPath, URL } from 'node:url' import { defineConfig } from 'vite' +import { resolve } from 'node:path' import vue from '@vitejs/plugin-vue' // https://vite.dev/config/ @@ -13,6 +14,7 @@ export default defineConfig(({ command, mode }) => ({ '@': fileURLToPath(new URL('./src', import.meta.url)) }, }, + // Use absolute paths at dev, deploy under /auth/ base: command === 'build' ? '/auth/' : '/', server: { port: 4403, @@ -27,6 +29,15 @@ export default defineConfig(({ command, mode }) => ({ build: { outDir: '../passkey/frontend-build', emptyOutDir: true, - assetsDir: 'assets' + assetsDir: 'assets', + rollupOptions: { + input: { + index: resolve(__dirname, 'index.html'), + admin: resolve(__dirname, 'admin/index.html') + }, + output: { + // Ensure HTML files land as /auth/index.html and /auth/admin.html -> we will serve /auth/admin mapping in backend + } + } } })) diff --git a/passkey/fastapi/mainapp.py b/passkey/fastapi/mainapp.py index 9c5aece..6feaec3 100644 --- a/passkey/fastapi/mainapp.py +++ b/passkey/fastapi/mainapp.py @@ -70,6 +70,19 @@ async def redirect_to_index(): return FileResponse(STATIC_DIR / "index.html") +@app.get("/auth/admin") +async def serve_admin(): + """Serve the admin app entry point.""" + # Vite MPA builds admin as admin.html in the same outDir + admin_html = STATIC_DIR / "admin.html" + # If configured to emit admin/index.html, support that too + if not admin_html.exists(): + alt = STATIC_DIR / "admin" / "index.html" + if alt.exists(): + return FileResponse(alt) + return FileResponse(admin_html) + + # Register API routes register_api_routes(app) register_reset_routes(app)