feat: 重构权限管理,添加短链接支持,更新 API 导入路径,移除旧的 convex.ts 文件

This commit is contained in:
2026-03-03 15:48:43 +08:00
parent 2f2064a803
commit 92e80bd93a
4 changed files with 13 additions and 4 deletions

View File

@@ -7,7 +7,12 @@ export type Permission = {
password?: string; // 仅当 type 为 'protected' 时有效 password?: string; // 仅当 type 为 'protected' 时有效
'expiration-time'?: string; // ISO 8601 格式的过期时间 'expiration-time'?: string; // ISO 8601 格式的过期时间
} }
// shortLink的使用方式
// link模式linkType默认为redirect使用302跳转到目标地址
// 1. 短链跳转,直接访问对用的地址
// 2. 请求模式,
// 1. 访问短链去请求另一个接口内容是code: 200判断是否执行成功默认不透传结果
//
export default defineSchema({ export default defineSchema({
// Other tables here... // Other tables here...
shortLink: defineTable({ shortLink: defineTable({
@@ -21,7 +26,10 @@ export default defineSchema({
data: v.object({ data: v.object({
// action: v.string(), // 动作类型,如 "open_url", "run_agent" 等 // action: v.string(), // 动作类型,如 "open_url", "run_agent" 等
permission: v.optional(v.any()), // 权限设置 permission: v.optional(v.any()), // 权限设置
link: v.optional(v.string()), // 仅当 type 为 'link' 时有效,表示跳转链接 // 仅当 type 为 'link' 时有效,表示跳转链接
link: v.optional(v.string()),
// 仅当 type 为 'link' 时有效,表示链接类型,如 'redirect' 等,默认为 'redirect'
linkType: v.optional(v.string()),
}), }),
// 码的标题 // 码的标题
title: v.string(), title: v.string(),

View File

@@ -28,7 +28,8 @@
"nanoid": "^5.1.6" "nanoid": "^5.1.6"
}, },
"exports": { "exports": {
".": "./convex/_generated/api.js" ".": "./convex/_generated/api.js",
"./admin.ts": "./convex/admin.ts"
}, },
"publishConfig": { "publishConfig": {
"access": "public" "access": "public"

View File

@@ -1,4 +1,4 @@
import { client, api } from '../src/convex.ts' import { client, api } from '../src/admin.ts'
// client.query(api.nCode.getList, {}).then((res) => { // client.query(api.nCode.getList, {}).then((res) => {