Initial commit: SSH Manager (backend + frontend)

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
liu
2026-02-03 09:10:06 +08:00
commit 1c5a44ff71
63 changed files with 6946 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
import { createRouter, createWebHistory } from 'vue-router'
import type { RouteRecordRaw } from 'vue-router'
import { useAuthStore } from '../stores/auth'
const routes: RouteRecordRaw[] = [
{
path: '/login',
name: 'Login',
component: () => import('../views/LoginView.vue'),
meta: { public: true },
},
{
path: '/',
component: () => import('../layouts/MainLayout.vue'),
meta: { requiresAuth: true },
children: [
{
path: '',
name: 'Home',
redirect: '/connections',
},
{
path: 'connections',
name: 'Connections',
component: () => import('../views/ConnectionsView.vue'),
},
{
path: 'terminal/:id',
name: 'Terminal',
component: () => import('../views/TerminalView.vue'),
},
{
path: 'sftp/:id',
name: 'Sftp',
component: () => import('../views/SftpView.vue'),
},
],
},
]
const router = createRouter({
history: createWebHistory(),
routes,
})
router.beforeEach(async (to, _from, next) => {
const authStore = useAuthStore()
if (to.meta.public) {
if (authStore.isAuthenticated && to.path === '/login') {
next('/connections')
} else {
next()
}
return
}
if (to.meta.requiresAuth && !authStore.isAuthenticated) {
next('/login')
return
}
next()
})
export default router