Dorian 7a05e11834 Refactor Indeehub integration and enhance deployment documentation
- Updated Indeehub references throughout the codebase, changing the name from "IndeedHub" to "Indeehub" for consistency.
- Implemented a virtual app structure for Indeehub, allowing it to open an external URL without requiring a container.
- Enhanced deployment scripts and documentation to clarify SSH access and password management for Indeehub.
- Improved error handling and retry logic in various components to ensure better user experience during onboarding and app interactions.
- Updated CSS for visual enhancements and added new buttons for improved navigation in the AppLauncherOverlay.
2026-03-01 17:53:18 +00:00

204 lines
5.4 KiB
TypeScript

import { createRouter, createWebHistory } from 'vue-router'
import { nextTick } from 'vue'
import { useAppStore } from '../stores/app'
const router = createRouter({
history: createWebHistory(),
routes: [
{
path: '/',
component: () => import('../views/OnboardingWrapper.vue'),
meta: { public: true },
children: [
{
path: '',
component: () => import('../views/RootRedirect.vue'),
},
{
path: 'login',
name: 'login',
component: () => import('../views/Login.vue'),
},
{
path: 'onboarding/intro',
name: 'onboarding-intro',
component: () => import('../views/OnboardingIntro.vue'),
},
{
path: 'onboarding/options',
name: 'onboarding-options',
component: () => import('../views/OnboardingOptions.vue'),
},
{
path: 'onboarding/path',
name: 'onboarding-path',
component: () => import('../views/OnboardingPath.vue'),
},
{
path: 'onboarding/did',
name: 'onboarding-did',
component: () => import('../views/OnboardingDid.vue'),
},
{
path: 'onboarding/backup',
name: 'onboarding-backup',
component: () => import('../views/OnboardingBackup.vue'),
},
{
path: 'onboarding/verify',
name: 'onboarding-verify',
component: () => import('../views/OnboardingVerify.vue'),
},
{
path: 'onboarding/done',
name: 'onboarding-done',
component: () => import('../views/OnboardingDone.vue'),
},
],
},
{
path: '/dashboard',
component: () => import('../views/Dashboard.vue'),
children: [
{
path: '',
name: 'home',
component: () => import('../views/Home.vue'),
},
{
path: 'apps',
name: 'apps',
component: () => import('../views/Apps.vue'),
},
{
path: 'apps/:id',
name: 'app-details',
component: () => import('../views/AppDetails.vue'),
},
{
path: 'marketplace',
name: 'marketplace',
component: () => import('../views/Marketplace.vue'),
},
{
path: 'marketplace/:id',
name: 'marketplace-app-detail',
component: () => import('../views/MarketplaceAppDetails.vue'),
},
{
path: 'cloud',
name: 'cloud',
component: () => import('../views/Cloud.vue'),
},
{
path: 'cloud/:folderId',
name: 'cloud-folder',
component: () => import('../views/CloudFolder.vue'),
},
{
path: 'server',
name: 'server',
component: () => import('../views/Server.vue'),
},
{
path: 'web5',
name: 'web5',
component: () => import('../views/Web5.vue'),
},
{
path: 'settings',
name: 'settings',
component: () => import('../views/Settings.vue'),
},
// Containers removed: My Apps serves the same purpose. Redirect old links.
{
path: 'containers',
redirect: () => ({ path: '/dashboard/apps' }),
},
{
path: 'containers/:id',
redirect: (to) => ({ path: `/dashboard/apps/${to.params.id}` }),
},
],
},
],
})
/**
* Navigation Guard
* Handles authentication and onboarding flow routing
*/
router.beforeEach(async (to, _from, next) => {
const store = useAppStore()
const isPublic = to.meta.public
// Allow all public routes (login, onboarding) without auth check
if (isPublic) {
// If authenticated and visiting /login, validate session first
if (to.path === '/login' && store.isAuthenticated) {
if (store.needsSessionValidation()) {
const valid = await store.checkSession()
if (valid) {
next({ name: 'home' })
return
}
// Session invalid, allow login page
next()
return
}
next({ name: 'home' })
return
}
next()
return
}
// Protected routes: validate session if stale auth from localStorage
if (store.needsSessionValidation()) {
const valid = await store.checkSession()
if (!valid) {
next('/login')
return
}
next()
return
}
// Not authenticated at all
if (!store.isAuthenticated) {
const hasSession = await store.checkSession()
if (hasSession) {
next()
return
}
next('/login')
return
}
// Validated and authenticated - ensure WebSocket is connected
if (!store.isConnected && !store.isReconnecting) {
store.connectWebSocket().catch((err) => {
console.warn('[Router] WebSocket connection failed:', err)
})
}
next()
})
// Focus Home nav item for gamepad when landing on dashboard home (e.g. after login)
router.afterEach((to) => {
if (to.path === '/dashboard' || to.path === '/dashboard/') {
nextTick(() => {
setTimeout(() => {
const homeLink = document.querySelector<HTMLAnchorElement>(
'[data-controller-zone="sidebar"] a[href="/dashboard"], [data-controller-zone="sidebar"] a[href="/dashboard/"]'
)
if (homeLink) homeLink.focus()
}, 150)
})
}
})
export default router