7d8e82c69f
Ship the Ops backstage 对象存储 page (browse / upload / move / delete / folder ops) backed by a new object-storage service + handler, with the shared storage client extended with List/Stat/Copy/Usage/DownloadURL so both MinIO and Aliyun providers cover the new surface. Add ForcePathStyle to the object-storage config and treat r2/s3/custom_s3 as external providers so Cloudflare R2 and other S3-compatibles can share the MinIO client path without spinning up the bundled MinIO. Also add CSV import/export + template download to the site-domain mappings page, raise gin MaxMultipartMemory to 8 MiB for the new multipart endpoints, register Ops swagger routes, and extend the descriptions-parity test to cover the ops router. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
171 lines
5.1 KiB
TypeScript
171 lines
5.1 KiB
TypeScript
import { createRouter, createWebHistory } from 'vue-router'
|
|
|
|
import { isChunkLoadError, reloadForStaleChunk } from '@/lib/chunk-reload'
|
|
import { useAuthStore } from '@/stores/auth'
|
|
import { pinia } from '@/stores/pinia'
|
|
|
|
export const router = createRouter({
|
|
history: createWebHistory(),
|
|
routes: [
|
|
{
|
|
path: '/login',
|
|
name: 'login',
|
|
component: () => import('@/views/LoginView.vue'),
|
|
meta: { title: '登录' },
|
|
},
|
|
{
|
|
path: '/',
|
|
component: () => import('@/layouts/AppShell.vue'),
|
|
meta: { requiresAuth: true },
|
|
children: [
|
|
{ path: '', redirect: '/admin-users' },
|
|
{
|
|
path: 'admin-users',
|
|
name: 'admin-users',
|
|
component: () => import('@/views/AdminUsersView.vue'),
|
|
meta: { title: '用户管理' },
|
|
},
|
|
{
|
|
path: 'kol-subscriptions',
|
|
name: 'kol-subscriptions',
|
|
component: () => import('@/views/KolSubscriptionsView.vue'),
|
|
meta: { title: '订阅包审批' },
|
|
},
|
|
{
|
|
path: 'accounts',
|
|
name: 'accounts',
|
|
component: () => import('@/views/AccountsView.vue'),
|
|
meta: { title: '操作员管理' },
|
|
},
|
|
{
|
|
path: 'audits',
|
|
name: 'audits',
|
|
component: () => import('@/views/AuditLogsView.vue'),
|
|
meta: { title: '审计日志' },
|
|
},
|
|
{
|
|
path: 'jobs',
|
|
name: 'jobs',
|
|
component: () => import('@/views/JobsView.vue'),
|
|
meta: { title: '任务中心' },
|
|
},
|
|
{
|
|
path: 'scheduler',
|
|
name: 'scheduler',
|
|
component: () => import('@/views/SchedulerView.vue'),
|
|
meta: { title: '调度中心' },
|
|
},
|
|
{
|
|
path: 'site-domain-mappings',
|
|
name: 'site-domain-mappings',
|
|
component: () => import('@/views/SiteDomainMappingsView.vue'),
|
|
meta: { title: '站点映射' },
|
|
},
|
|
{
|
|
path: 'object-storage',
|
|
name: 'object-storage',
|
|
component: () => import('@/views/ObjectStorageView.vue'),
|
|
meta: { title: '对象存储' },
|
|
},
|
|
{
|
|
path: 'desktop-client/releases',
|
|
name: 'desktop-client-releases',
|
|
component: () => import('@/views/DesktopClientReleasesView.vue'),
|
|
meta: { title: '客户端版本' },
|
|
},
|
|
{
|
|
path: 'compliance/policy',
|
|
name: 'compliance-policy',
|
|
component: () => import('@/views/compliance/CompliancePolicyView.vue'),
|
|
meta: { title: '全局合规策略' },
|
|
},
|
|
{
|
|
path: 'compliance/dictionaries',
|
|
name: 'compliance-dictionaries',
|
|
component: () => import('@/views/compliance/ComplianceDictionariesView.vue'),
|
|
meta: { title: '合规词库' },
|
|
},
|
|
{
|
|
path: 'compliance/dictionaries/new',
|
|
name: 'compliance-dictionary-new',
|
|
component: () => import('@/views/compliance/ComplianceDictionaryEditView.vue'),
|
|
meta: { title: '新建合规词库' },
|
|
},
|
|
{
|
|
path: 'compliance/dictionaries/:id/edit',
|
|
name: 'compliance-dictionary-edit',
|
|
component: () => import('@/views/compliance/ComplianceDictionaryEditView.vue'),
|
|
meta: { title: '编辑合规词库' },
|
|
},
|
|
{
|
|
path: 'compliance/manual-reviews',
|
|
name: 'compliance-manual-reviews',
|
|
component: () => import('@/views/compliance/ComplianceManualReviewsView.vue'),
|
|
meta: { title: '人工审阅' },
|
|
},
|
|
{
|
|
path: 'compliance/manual-reviews/:id',
|
|
name: 'compliance-manual-review-detail',
|
|
component: () => import('@/views/compliance/ComplianceManualReviewDetailView.vue'),
|
|
meta: { title: '人工审阅详情' },
|
|
},
|
|
{
|
|
path: 'compliance/records',
|
|
name: 'compliance-records',
|
|
component: () => import('@/views/compliance/ComplianceRecordsView.vue'),
|
|
meta: { title: '检测记录' },
|
|
},
|
|
{
|
|
path: 'compliance/stats',
|
|
name: 'compliance-stats',
|
|
component: () => import('@/views/compliance/ComplianceStatsView.vue'),
|
|
meta: { title: '合规统计' },
|
|
},
|
|
{
|
|
path: 'profile',
|
|
name: 'profile',
|
|
component: () => import('@/views/ProfileView.vue'),
|
|
meta: { title: '个人资料' },
|
|
},
|
|
],
|
|
},
|
|
{
|
|
path: '/:pathMatch(.*)*',
|
|
redirect: '/',
|
|
},
|
|
],
|
|
})
|
|
|
|
router.beforeEach((to) => {
|
|
const auth = useAuthStore(pinia)
|
|
if (!auth.initialized) {
|
|
auth.hydrate()
|
|
}
|
|
|
|
if (to.meta.requiresAuth && !auth.isAuthenticated) {
|
|
return {
|
|
name: 'login',
|
|
query: to.fullPath !== '/' ? { redirect: to.fullPath } : undefined,
|
|
}
|
|
}
|
|
|
|
if (to.name === 'login' && auth.isAuthenticated) {
|
|
return { name: 'admin-users' }
|
|
}
|
|
|
|
return true
|
|
})
|
|
|
|
router.afterEach((to) => {
|
|
if (typeof document !== 'undefined') {
|
|
const t = (to.meta.title as string | undefined) ?? '运营后台'
|
|
document.title = `${t} · 省心推`
|
|
}
|
|
})
|
|
|
|
router.onError((err) => {
|
|
if (isChunkLoadError(err)) {
|
|
reloadForStaleChunk()
|
|
}
|
|
})
|