feat: 重构权限管理,添加短链接支持,更新 API 导入路径,移除旧的 convex.ts 文件
This commit is contained in:
@@ -7,7 +7,12 @@ export type Permission = {
|
||||
password?: string; // 仅当 type 为 'protected' 时有效
|
||||
'expiration-time'?: string; // ISO 8601 格式的过期时间
|
||||
}
|
||||
|
||||
// shortLink的使用方式
|
||||
// link模式,linkType默认为redirect,使用302跳转到目标地址
|
||||
// 1. 短链跳转,直接访问对用的地址
|
||||
// 2. 请求模式,
|
||||
// 1. 访问短链去请求另一个接口,内容是code: 200,判断是否执行成功(默认不透传结果)
|
||||
//
|
||||
export default defineSchema({
|
||||
// Other tables here...
|
||||
shortLink: defineTable({
|
||||
@@ -21,7 +26,10 @@ export default defineSchema({
|
||||
data: v.object({
|
||||
// action: v.string(), // 动作类型,如 "open_url", "run_agent" 等
|
||||
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(),
|
||||
|
||||
@@ -28,7 +28,8 @@
|
||||
"nanoid": "^5.1.6"
|
||||
},
|
||||
"exports": {
|
||||
".": "./convex/_generated/api.js"
|
||||
".": "./convex/_generated/api.js",
|
||||
"./admin.ts": "./convex/admin.ts"
|
||||
},
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user