feat: 收口知识库分享链路

- 新增 shareKey 单参数 URL 分享页与失效页

- 新增知识库分享后端鉴权、审计与迁移脚本

- 在访问令牌中增加知识库分享授权入口
This commit is contained in:
2026-04-13 14:44:31 +08:00
parent 8cfe5400fe
commit 31a755a8bc
57 changed files with 5158 additions and 143 deletions

View File

@@ -28,6 +28,10 @@ interface NetworkConnectionLike {
const CHUNK_ERROR_RELOAD_KEY = '__easyflow_chunk_error_reload_path__';
function isKnowledgeShareRoute(path: string) {
return path === '/share/knowledge' || path === '/share/knowledge/expired';
}
function isSlowNetworkConnection() {
if (typeof navigator === 'undefined') {
return false;
@@ -238,6 +242,10 @@ function setupAccessGuard(router: Router) {
return buildForcePasswordRoute();
}
if (isKnowledgeShareRoute(to.path)) {
return true;
}
// 是否已经生成过动态路由
if (accessStore.isAccessChecked) {
return true;

View File

@@ -0,0 +1,32 @@
import type { RouteRecordRaw } from 'vue-router';
const routes: RouteRecordRaw[] = [
{
name: 'KnowledgeShare',
path: '/share/knowledge',
component: () =>
import('#/views/ai/documentCollection/KnowledgeShareView.vue'),
meta: {
title: 'Knowledge Share',
noBasicLayout: true,
hideInMenu: true,
hideInBreadcrumb: true,
hideInTab: true,
},
},
{
name: 'KnowledgeShareExpired',
path: '/share/knowledge/expired',
component: () =>
import('#/views/ai/documentCollection/KnowledgeShareExpired.vue'),
meta: {
title: 'Knowledge Share Expired',
noBasicLayout: true,
hideInMenu: true,
hideInBreadcrumb: true,
hideInTab: true,
},
},
];
export default routes;

View File

@@ -9,17 +9,18 @@ const dynamicRouteFiles = import.meta.glob('./modules/**/*.ts', {
});
// 有需要可以自行打开注释,并创建文件夹
// const externalRouteFiles = import.meta.glob('./external/**/*.ts', { eager: true });
const externalRouteFiles = import.meta.glob('./external/**/*.ts', {
eager: true,
});
// const staticRouteFiles = import.meta.glob('./static/**/*.ts', { eager: true });
/** 动态路由 */
const dynamicRoutes: RouteRecordRaw[] = mergeRouteModules(dynamicRouteFiles);
/** 外部路由列表访问这些页面可以不需要Layout可能用于内嵌在别的系统(不会显示在菜单中) */
// const externalRoutes: RouteRecordRaw[] = mergeRouteModules(externalRouteFiles);
const externalRoutes: RouteRecordRaw[] = mergeRouteModules(externalRouteFiles);
// const staticRoutes: RouteRecordRaw[] = mergeRouteModules(staticRouteFiles);
const staticRoutes: RouteRecordRaw[] = [];
const externalRoutes: RouteRecordRaw[] = [];
/** 路由列表由基本路由、外部路由和404兜底路由组成
* 无需走权限验证(会一直显示在菜单中) */