forked from urvishpatelce/lxd-app
test
This commit is contained in:
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
api/vendor/*
|
||||||
|
|
||||||
@ -53,6 +53,7 @@ definePageMeta({
|
|||||||
// This is an example of inline middleware
|
// This is an example of inline middleware
|
||||||
middleware: async nuxtApp => {
|
middleware: async nuxtApp => {
|
||||||
const host = useRequestURL().origin
|
const host = useRequestURL().origin
|
||||||
|
console.log(useRequestURL())
|
||||||
const res = await $fetch(host + '/api/status')
|
const res = await $fetch(host + '/api/status')
|
||||||
if (res.status === 'ready') {
|
if (res.status === 'ready') {
|
||||||
navigateTo(host, { external: true })
|
navigateTo(host, { external: true })
|
||||||
@ -82,13 +83,6 @@ const status = ref('starting')
|
|||||||
|
|
||||||
const POLL_MS = 5000
|
const POLL_MS = 5000
|
||||||
const ALLOWED_REDIRECTS = new Set(['/', '/login', '/signin'])
|
const ALLOWED_REDIRECTS = new Set(['/', '/login', '/signin'])
|
||||||
function sanitizeRedirect(raw) {
|
|
||||||
if (typeof raw !== 'string') return '/login'
|
|
||||||
if (raw.startsWith('http://') || raw.startsWith('https://')) return '/login'
|
|
||||||
if (!raw.startsWith('/')) return '/login'
|
|
||||||
const pathOnly = raw.split('?')[0]
|
|
||||||
return ALLOWED_REDIRECTS.has(pathOnly) ? raw : '/login'
|
|
||||||
}
|
|
||||||
|
|
||||||
async function checkStatus () {
|
async function checkStatus () {
|
||||||
try {
|
try {
|
||||||
|
|||||||
Reference in New Issue
Block a user