feat: 收口知识库分享链路
- 新增 shareKey 单参数 URL 分享页与失效页 - 新增知识库分享后端鉴权、审计与迁移脚本 - 在访问令牌中增加知识库分享授权入口
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
export function buildKnowledgePath(endpointPrefix = '', path = '') {
|
||||
if (!endpointPrefix) {
|
||||
return path;
|
||||
}
|
||||
const normalizedPrefix = endpointPrefix.endsWith('/')
|
||||
? endpointPrefix.slice(0, -1)
|
||||
: endpointPrefix;
|
||||
const normalizedPath = path.startsWith('/') ? path : `/${path}`;
|
||||
if (normalizedPath.startsWith(`${normalizedPrefix}/`)) {
|
||||
return normalizedPath;
|
||||
}
|
||||
if (normalizedPath.startsWith('/api/v1/')) {
|
||||
return `${normalizedPrefix}${normalizedPath.slice('/api/v1'.length)}`;
|
||||
}
|
||||
return `${normalizedPrefix}${normalizedPath}`;
|
||||
}
|
||||
Reference in New Issue
Block a user