Refactor restricted app paths and naming.
This commit is contained in:
@@ -1 +1 @@
|
|||||||
<html style="background: transparent"><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><div id="app"></div><script type="module" src="/src/restricted-api/main.js"></script>
|
<html style="background: transparent"><meta charset="UTF-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><div id="app"></div><script type="module" src="/src/restricted/api/main.js"></script>
|
||||||
@@ -7,6 +7,6 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
<script type="module" src="/src/restricted/main.js"></script>
|
<script type="module" src="/src/restricted/forward/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { createApp } from 'vue'
|
|
||||||
import RestrictedApiApp from './RestrictedApiApp.vue'
|
|
||||||
import '@/assets/style.css'
|
|
||||||
|
|
||||||
createApp(RestrictedApiApp).mount('#app')
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { createApp } from 'vue'
|
||||||
|
import App from './App.vue'
|
||||||
|
import '@/assets/style.css'
|
||||||
|
|
||||||
|
createApp(App).mount('#app')
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
import { createApp } from 'vue'
|
||||||
|
import App from './App.vue'
|
||||||
|
import '@/assets/style.css'
|
||||||
|
|
||||||
|
createApp(App).mount('#app')
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
import { createApp } from 'vue'
|
|
||||||
import RestrictedApp from './RestrictedApp.vue'
|
|
||||||
import '@/assets/style.css'
|
|
||||||
|
|
||||||
createApp(RestrictedApp).mount('#app')
|
|
||||||
@@ -40,8 +40,9 @@ export default defineConfig(({ command }) => ({
|
|||||||
bypass: (req) => {
|
bypass: (req) => {
|
||||||
const url = req.url?.split('?')[0]
|
const url = req.url?.split('?')[0]
|
||||||
if (url?.startsWith('/auth/assets/')) return url.slice(5)
|
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)) {
|
for (const [path, target] of Object.entries(routes)) {
|
||||||
if ([`/auth/${path}`, `/auth/${path}/`, `/${path}`, `/${path}/`].includes(url)) return target
|
if ([`/auth/${path}`, `/auth/${path}/`, `/${path}`, `/${path}/`].includes(url)) return target
|
||||||
}
|
}
|
||||||
@@ -59,8 +60,8 @@ export default defineConfig(({ command }) => ({
|
|||||||
index: resolve(__dirname, 'index.html'),
|
index: resolve(__dirname, 'index.html'),
|
||||||
admin: resolve(__dirname, 'admin/index.html'),
|
admin: resolve(__dirname, 'admin/index.html'),
|
||||||
reset: resolve(__dirname, 'reset/index.html'),
|
reset: resolve(__dirname, 'reset/index.html'),
|
||||||
restricted: resolve(__dirname, 'restricted/index.html'),
|
'restricted-forward': resolve(__dirname, 'restricted/forward/index.html'),
|
||||||
'restricted-api': resolve(__dirname, 'restricted-api/index.html'),
|
'restricted-api': resolve(__dirname, 'restricted/api/index.html'),
|
||||||
host: resolve(__dirname, 'host/index.html')
|
host: resolve(__dirname, 'host/index.html')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ app.mount("/user", user.app)
|
|||||||
@app.get("/restricted")
|
@app.get("/restricted")
|
||||||
async def restricted_view():
|
async def restricted_view():
|
||||||
"""Serve the restricted/authentication UI for iframe embedding."""
|
"""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)
|
@app.exception_handler(HTTPException)
|
||||||
@@ -155,7 +155,7 @@ async def forward_authentication(
|
|||||||
return Response(status_code=204, headers=remote_headers)
|
return Response(status_code=204, headers=remote_headers)
|
||||||
except HTTPException as e:
|
except HTTPException as e:
|
||||||
# Let global handler clear cookie; still return HTML surface instead of JSON
|
# 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
|
status = e.status_code
|
||||||
# If 401 we still want cookie cleared; rely on handler by raising again not feasible (we need HTML)
|
# If 401 we still want cookie cleared; rely on handler by raising again not feasible (we need HTML)
|
||||||
if status == 401:
|
if status == 401:
|
||||||
|
|||||||
Reference in New Issue
Block a user