Compare commits
No commits in common. "5f63c4cf4bbc774bc01851d184026553281bceea" and "5c3d48abab2cf0754b58d1f9f0392b80456cf29b" have entirely different histories.
5f63c4cf4b
...
5c3d48abab
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -4,6 +4,3 @@
|
|||||||
[submodule "submodules/permission"]
|
[submodule "submodules/permission"]
|
||||||
path = submodules/permission
|
path = submodules/permission
|
||||||
url = git@git.xiongxiao.me:kevisual/kevsiual-permission.git
|
url = git@git.xiongxiao.me:kevisual/kevsiual-permission.git
|
||||||
[submodule "submodules/oss"]
|
|
||||||
path = submodules/oss
|
|
||||||
url = git@git.xiongxiao.me:kevisual/kevisual-oss.git
|
|
||||||
|
@ -35,6 +35,7 @@
|
|||||||
"license": "UNLICENSED",
|
"license": "UNLICENSED",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@kevisual/local-app-manager": "0.1.9",
|
"@kevisual/local-app-manager": "0.1.9",
|
||||||
|
"@kevisual/permission": "workspace:*",
|
||||||
"@kevisual/router": "0.0.9",
|
"@kevisual/router": "0.0.9",
|
||||||
"@kevisual/use-config": "^1.0.9",
|
"@kevisual/use-config": "^1.0.9",
|
||||||
"@types/semver": "^7.5.8",
|
"@types/semver": "^7.5.8",
|
||||||
@ -63,8 +64,6 @@
|
|||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@kevisual/code-center-module": "workspace:*",
|
"@kevisual/code-center-module": "workspace:*",
|
||||||
"@kevisual/permission": "workspace:*",
|
|
||||||
"@kevisual/oss": "workspace:*",
|
|
||||||
"@kevisual/types": "^0.0.6",
|
"@kevisual/types": "^0.0.6",
|
||||||
"@rollup/plugin-alias": "^5.1.1",
|
"@rollup/plugin-alias": "^5.1.1",
|
||||||
"@rollup/plugin-commonjs": "^28.0.3",
|
"@rollup/plugin-commonjs": "^28.0.3",
|
||||||
@ -77,7 +76,7 @@
|
|||||||
"@types/formidable": "^3.4.5",
|
"@types/formidable": "^3.4.5",
|
||||||
"@types/jsonwebtoken": "^9.0.9",
|
"@types/jsonwebtoken": "^9.0.9",
|
||||||
"@types/lodash-es": "^4.17.12",
|
"@types/lodash-es": "^4.17.12",
|
||||||
"@types/node": "^22.13.11",
|
"@types/node": "^22.13.10",
|
||||||
"@types/react": "^19.0.12",
|
"@types/react": "^19.0.12",
|
||||||
"@types/uuid": "^10.0.0",
|
"@types/uuid": "^10.0.0",
|
||||||
"concurrently": "^9.1.2",
|
"concurrently": "^9.1.2",
|
||||||
@ -86,7 +85,7 @@
|
|||||||
"rimraf": "^6.0.1",
|
"rimraf": "^6.0.1",
|
||||||
"rollup": "^4.36.0",
|
"rollup": "^4.36.0",
|
||||||
"rollup-plugin-copy": "^3.5.0",
|
"rollup-plugin-copy": "^3.5.0",
|
||||||
"rollup-plugin-dts": "^6.2.1",
|
"rollup-plugin-dts": "^6.2.0",
|
||||||
"tape": "^5.9.0",
|
"tape": "^5.9.0",
|
||||||
"tsx": "^4.19.3",
|
"tsx": "^4.19.3",
|
||||||
"turbo": "^2.4.4",
|
"turbo": "^2.4.4",
|
||||||
@ -98,5 +97,5 @@
|
|||||||
"picomatch": "^4.0.2"
|
"picomatch": "^4.0.2"
|
||||||
},
|
},
|
||||||
"pnpm": {},
|
"pnpm": {},
|
||||||
"packageManager": "pnpm@10.6.5"
|
"packageManager": "pnpm@9.15.0"
|
||||||
}
|
}
|
48
pnpm-lock.yaml
generated
48
pnpm-lock.yaml
generated
@ -135,8 +135,8 @@ importers:
|
|||||||
specifier: ^4.17.12
|
specifier: ^4.17.12
|
||||||
version: 4.17.12
|
version: 4.17.12
|
||||||
'@types/node':
|
'@types/node':
|
||||||
specifier: ^22.13.11
|
specifier: ^22.13.10
|
||||||
version: 22.13.11
|
version: 22.13.10
|
||||||
'@types/react':
|
'@types/react':
|
||||||
specifier: ^19.0.12
|
specifier: ^19.0.12
|
||||||
version: 19.0.12
|
version: 19.0.12
|
||||||
@ -162,8 +162,8 @@ importers:
|
|||||||
specifier: ^3.5.0
|
specifier: ^3.5.0
|
||||||
version: 3.5.0
|
version: 3.5.0
|
||||||
rollup-plugin-dts:
|
rollup-plugin-dts:
|
||||||
specifier: ^6.2.1
|
specifier: ^6.2.0
|
||||||
version: 6.2.1(rollup@4.36.0)(typescript@5.8.2)
|
version: 6.2.0(rollup@4.36.0)(typescript@5.8.2)
|
||||||
tape:
|
tape:
|
||||||
specifier: ^5.9.0
|
specifier: ^5.9.0
|
||||||
version: 5.9.0
|
version: 5.9.0
|
||||||
@ -286,15 +286,6 @@ importers:
|
|||||||
specifier: ^5.8.2
|
specifier: ^5.8.2
|
||||||
version: 5.8.2
|
version: 5.8.2
|
||||||
|
|
||||||
submodules/oss:
|
|
||||||
devDependencies:
|
|
||||||
minio:
|
|
||||||
specifier: ^8.0.5
|
|
||||||
version: 8.0.5
|
|
||||||
tsup:
|
|
||||||
specifier: ^8.4.0
|
|
||||||
version: 8.4.0(tsx@4.19.3)(typescript@5.8.2)
|
|
||||||
|
|
||||||
submodules/permission:
|
submodules/permission:
|
||||||
devDependencies:
|
devDependencies:
|
||||||
tsup:
|
tsup:
|
||||||
@ -862,9 +853,6 @@ packages:
|
|||||||
'@types/node@22.13.10':
|
'@types/node@22.13.10':
|
||||||
resolution: {integrity: sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==}
|
resolution: {integrity: sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==}
|
||||||
|
|
||||||
'@types/node@22.13.11':
|
|
||||||
resolution: {integrity: sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g==}
|
|
||||||
|
|
||||||
'@types/react@19.0.10':
|
'@types/react@19.0.10':
|
||||||
resolution: {integrity: sha512-JuRQ9KXLEjaUNjTWpzuR231Z2WpIwczOkBEIvbHNCzQefFIT0L8IqE6NV6ULLyC1SI/i234JnDoMkfg+RjQj2g==}
|
resolution: {integrity: sha512-JuRQ9KXLEjaUNjTWpzuR231Z2WpIwczOkBEIvbHNCzQefFIT0L8IqE6NV6ULLyC1SI/i234JnDoMkfg+RjQj2g==}
|
||||||
|
|
||||||
@ -2299,8 +2287,8 @@ packages:
|
|||||||
rollup: ^3.29.4 || ^4
|
rollup: ^3.29.4 || ^4
|
||||||
typescript: ^4.5 || ^5.0
|
typescript: ^4.5 || ^5.0
|
||||||
|
|
||||||
rollup-plugin-dts@6.2.1:
|
rollup-plugin-dts@6.2.0:
|
||||||
resolution: {integrity: sha512-sR3CxYUl7i2CHa0O7bA45mCrgADyAQ0tVtGSqi3yvH28M+eg1+g5d7kQ9hLvEz5dorK3XVsH5L2jwHLQf72DzA==}
|
resolution: {integrity: sha512-iciY+z46mUbN5nCxtJqVynwgrZZljM8of6k8Rg5rVAmu4VHDxexFPgoCa2wrJG5mMsHSGrJmjQPCM4vD0Oe3Lg==}
|
||||||
engines: {node: '>=16'}
|
engines: {node: '>=16'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
rollup: ^3.29.4 || ^4
|
rollup: ^3.29.4 || ^4
|
||||||
@ -3342,7 +3330,7 @@ snapshots:
|
|||||||
|
|
||||||
'@types/cors@2.8.17':
|
'@types/cors@2.8.17':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
'@types/crypto-js@4.2.2': {}
|
'@types/crypto-js@4.2.2': {}
|
||||||
|
|
||||||
@ -3354,21 +3342,21 @@ snapshots:
|
|||||||
|
|
||||||
'@types/formidable@3.4.5':
|
'@types/formidable@3.4.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
'@types/fs-extra@8.1.5':
|
'@types/fs-extra@8.1.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
'@types/glob@7.2.0':
|
'@types/glob@7.2.0':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/minimatch': 5.1.2
|
'@types/minimatch': 5.1.2
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
'@types/jsonwebtoken@9.0.9':
|
'@types/jsonwebtoken@9.0.9':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/ms': 0.7.34
|
'@types/ms': 0.7.34
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
'@types/lodash-es@4.17.12':
|
'@types/lodash-es@4.17.12':
|
||||||
dependencies:
|
dependencies:
|
||||||
@ -3382,16 +3370,12 @@ snapshots:
|
|||||||
|
|
||||||
'@types/node-forge@1.3.11':
|
'@types/node-forge@1.3.11':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
'@types/node@22.13.10':
|
'@types/node@22.13.10':
|
||||||
dependencies:
|
dependencies:
|
||||||
undici-types: 6.20.0
|
undici-types: 6.20.0
|
||||||
|
|
||||||
'@types/node@22.13.11':
|
|
||||||
dependencies:
|
|
||||||
undici-types: 6.20.0
|
|
||||||
|
|
||||||
'@types/react@19.0.10':
|
'@types/react@19.0.10':
|
||||||
dependencies:
|
dependencies:
|
||||||
csstype: 3.1.3
|
csstype: 3.1.3
|
||||||
@ -3402,7 +3386,7 @@ snapshots:
|
|||||||
|
|
||||||
'@types/readdir-glob@1.1.5':
|
'@types/readdir-glob@1.1.5':
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
'@types/resolve@1.20.2': {}
|
'@types/resolve@1.20.2': {}
|
||||||
|
|
||||||
@ -3813,7 +3797,7 @@ snapshots:
|
|||||||
dependencies:
|
dependencies:
|
||||||
'@types/cookie': 0.4.1
|
'@types/cookie': 0.4.1
|
||||||
'@types/cors': 2.8.17
|
'@types/cors': 2.8.17
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
accepts: 1.3.8
|
accepts: 1.3.8
|
||||||
base64id: 2.0.0
|
base64id: 2.0.0
|
||||||
cookie: 0.4.2
|
cookie: 0.4.2
|
||||||
@ -4965,7 +4949,7 @@ snapshots:
|
|||||||
optionalDependencies:
|
optionalDependencies:
|
||||||
'@babel/code-frame': 7.26.2
|
'@babel/code-frame': 7.26.2
|
||||||
|
|
||||||
rollup-plugin-dts@6.2.1(rollup@4.36.0)(typescript@5.8.2):
|
rollup-plugin-dts@6.2.0(rollup@4.36.0)(typescript@5.8.2):
|
||||||
dependencies:
|
dependencies:
|
||||||
magic-string: 0.30.17
|
magic-string: 0.30.17
|
||||||
rollup: 4.36.0
|
rollup: 4.36.0
|
||||||
@ -5591,7 +5575,7 @@ snapshots:
|
|||||||
|
|
||||||
wkx@0.5.0:
|
wkx@0.5.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
'@types/node': 22.13.11
|
'@types/node': 22.13.10
|
||||||
|
|
||||||
wrap-ansi@7.0.0:
|
wrap-ansi@7.0.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -30,16 +30,10 @@ app
|
|||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const tokernUser = ctx.state.tokenUser;
|
const tokernUser = ctx.state.tokenUser;
|
||||||
const tuid = tokernUser.id;
|
const tuid = tokernUser.id;
|
||||||
const { id, data, ...rest } = ctx.query?.data || {};
|
const { id, key, data, ...rest } = ctx.query?.data || {};
|
||||||
if (id) {
|
if (id) {
|
||||||
const config = await ConfigModel.findByPk(id);
|
const config = await ConfigModel.findByPk(id);
|
||||||
let keyIsChange = false;
|
|
||||||
if (rest?.key) {
|
|
||||||
keyIsChange = rest.key !== config?.key;
|
|
||||||
}
|
|
||||||
if (config && config.uid === tuid) {
|
if (config && config.uid === tuid) {
|
||||||
if (keyIsChange) {
|
|
||||||
const key = rest.key;
|
|
||||||
const keyConfig = await ConfigModel.findOne({
|
const keyConfig = await ConfigModel.findOne({
|
||||||
where: {
|
where: {
|
||||||
key,
|
key,
|
||||||
@ -49,8 +43,8 @@ app
|
|||||||
if (keyConfig && keyConfig.id !== id) {
|
if (keyConfig && keyConfig.id !== id) {
|
||||||
ctx.throw(403, 'key is already exists');
|
ctx.throw(403, 'key is already exists');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
await config.update({
|
await config.update({
|
||||||
|
key,
|
||||||
data: {
|
data: {
|
||||||
...config.data,
|
...config.data,
|
||||||
...data,
|
...data,
|
||||||
@ -64,9 +58,7 @@ app
|
|||||||
} else {
|
} else {
|
||||||
ctx.throw(403, 'no permission');
|
ctx.throw(403, 'no permission');
|
||||||
}
|
}
|
||||||
} else if (rest?.key) {
|
} else {
|
||||||
// id 不存在,key存在,则属于更新,key不能重复
|
|
||||||
const key = rest.key;
|
|
||||||
const keyConfig = await ConfigModel.findOne({
|
const keyConfig = await ConfigModel.findOne({
|
||||||
where: {
|
where: {
|
||||||
key,
|
key,
|
||||||
@ -74,12 +66,8 @@ app
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
if (keyConfig) {
|
if (keyConfig) {
|
||||||
await keyConfig.update({
|
ctx.throw(403, 'key is already exists');
|
||||||
data: { ...keyConfig.data, ...data },
|
}
|
||||||
...rest,
|
|
||||||
});
|
|
||||||
ctx.body = keyConfig;
|
|
||||||
} else {
|
|
||||||
const config = await ConfigModel.create({
|
const config = await ConfigModel.create({
|
||||||
key,
|
key,
|
||||||
...rest,
|
...rest,
|
||||||
@ -88,16 +76,6 @@ app
|
|||||||
});
|
});
|
||||||
ctx.body = config;
|
ctx.body = config;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (id || rest?.key) return;
|
|
||||||
|
|
||||||
// id和key不存在。创建一个新的配置
|
|
||||||
const config = await ConfigModel.create({
|
|
||||||
...rest,
|
|
||||||
data: data,
|
|
||||||
uid: tuid,
|
|
||||||
});
|
|
||||||
ctx.body = config;
|
|
||||||
})
|
})
|
||||||
.addTo(app);
|
.addTo(app);
|
||||||
|
|
||||||
|
@ -19,9 +19,6 @@ export class ConfigModel extends Model {
|
|||||||
declare title: string;
|
declare title: string;
|
||||||
declare description: string;
|
declare description: string;
|
||||||
declare tags: string[];
|
declare tags: string[];
|
||||||
/**
|
|
||||||
* 配置key, 默认可以为空,如何设置了,必须要唯一。
|
|
||||||
*/
|
|
||||||
declare key: string;
|
declare key: string;
|
||||||
declare data: ConfigData; // files
|
declare data: ConfigData; // files
|
||||||
declare uid: string;
|
declare uid: string;
|
||||||
@ -77,7 +74,7 @@ export class ConfigModel extends Model {
|
|||||||
key: 'upload',
|
key: 'upload',
|
||||||
version: '1.0.0',
|
version: '1.0.0',
|
||||||
};
|
};
|
||||||
const config = await ConfigModel.getConfig('upload.json', {
|
const config = await ConfigModel.getConfig('upload', {
|
||||||
uid: opts.uid,
|
uid: opts.uid,
|
||||||
defaultData: defaultConfig,
|
defaultData: defaultConfig,
|
||||||
});
|
});
|
||||||
@ -90,7 +87,7 @@ export class ConfigModel extends Model {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
static async setUploadConfig(opts: { uid: string; data: { key?: string; version?: string } }) {
|
static async setUploadConfig(opts: { uid: string; data: { key?: string; version?: string } }) {
|
||||||
const config = await ConfigModel.setConfig('upload.json', {
|
const config = await ConfigModel.setConfig('upload', {
|
||||||
uid: opts.uid,
|
uid: opts.uid,
|
||||||
data: opts.data,
|
data: opts.data,
|
||||||
});
|
});
|
||||||
|
@ -51,7 +51,7 @@ export class ShareConfigService extends ConfigModel {
|
|||||||
}
|
}
|
||||||
static async expireShareConfig(key: string, username: string) {
|
static async expireShareConfig(key: string, username: string) {
|
||||||
if (key && username) {
|
if (key && username) {
|
||||||
await redis.set(`config:share:${username}:${key}`, '', 'EX', 1);
|
await redis.set(`config:share:${username}:${key}`, '', 'EX', 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -99,15 +99,7 @@ app
|
|||||||
key: 'logout',
|
key: 'logout',
|
||||||
})
|
})
|
||||||
.define(async (ctx) => {
|
.define(async (ctx) => {
|
||||||
const { tokens = [] } = ctx.query?.data || {};
|
|
||||||
clearCookie(ctx);
|
clearCookie(ctx);
|
||||||
for (const token of tokens) {
|
|
||||||
await User.oauth.delToken(token);
|
|
||||||
}
|
|
||||||
ctx.body = {
|
|
||||||
code: 200,
|
|
||||||
message: 'Logout Success',
|
|
||||||
};
|
|
||||||
})
|
})
|
||||||
.addTo(app);
|
.addTo(app);
|
||||||
app
|
app
|
||||||
|
@ -1 +0,0 @@
|
|||||||
Subproject commit 5563ded0a19d60c34cce6272e272c6405bcab304
|
|
Loading…
x
Reference in New Issue
Block a user