Compare commits
2 Commits
64c70ce527
...
7d93f0eef3
Author | SHA1 | Date | |
---|---|---|---|
7d93f0eef3 | |||
501a92eb88 |
3
.gitignore
vendored
3
.gitignore
vendored
@ -18,7 +18,8 @@ release/*
|
||||
|
||||
.turbo
|
||||
|
||||
.env
|
||||
.env*
|
||||
!.env.example
|
||||
|
||||
pack-dist
|
||||
app.config.json5.envision
|
||||
|
3
.gitmodules
vendored
3
.gitmodules
vendored
@ -7,3 +7,6 @@
|
||||
[submodule "submodules/oss"]
|
||||
path = submodules/oss
|
||||
url = git@git.xiongxiao.me:kevisual/kevisual-oss.git
|
||||
[submodule "submodules/pay-center-code"]
|
||||
path = submodules/pay-center-code
|
||||
url = git@git.xiongxiao.me:kevisual/pay-center-code.git
|
||||
|
@ -1,23 +0,0 @@
|
||||
{
|
||||
port: 4005, // 端口
|
||||
tokenSecret: '<TOKEN_SECRET>',
|
||||
appPath: 'apps',
|
||||
appName: 'codeflow',
|
||||
domain: '*',
|
||||
mainApp: 'https://kevisual.xiongxiao.me',
|
||||
postgres: {
|
||||
username: 'root',
|
||||
host: 'localhost',
|
||||
database: 'postgres',
|
||||
password: '*****',
|
||||
port: 5432,
|
||||
},
|
||||
redis: {},
|
||||
minio: {
|
||||
endPoint: 'minio.xiongxiao.me',
|
||||
bucketName: 'resources',
|
||||
useSSL: false,
|
||||
accessKey: 'username',
|
||||
secretKey: 'password',
|
||||
},
|
||||
}
|
11
package.json
11
package.json
@ -25,7 +25,7 @@
|
||||
"start": "pm2 start dist/app.mjs --name codecenter",
|
||||
"release": "node ./config/release/index.mjs",
|
||||
"pub": "envision pack -p -u",
|
||||
"ssh": "ssh -L 6379:localhost:6379 light ",
|
||||
"ssh": "ssh -L 6379:localhost:6379 -L 5432:localhost:5432 light ",
|
||||
"ssh:sky": "ssh -L 6379:172.21.32.13:6379 sky",
|
||||
"dev:lib": "turbo run dev:lib",
|
||||
"build:lib": "turbo run build",
|
||||
@ -38,13 +38,14 @@
|
||||
],
|
||||
"license": "UNLICENSED",
|
||||
"dependencies": {
|
||||
"@kevisual/local-app-manager": "0.1.9",
|
||||
"@kevisual/local-app-manager": "0.1.10",
|
||||
"@kevisual/router": "0.0.9",
|
||||
"@kevisual/use-config": "^1.0.10",
|
||||
"@types/semver": "^7.5.8",
|
||||
"archiver": "^7.0.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dayjs": "^1.11.13",
|
||||
"dotenv": "^16.4.7",
|
||||
"formidable": "^3.5.2",
|
||||
"ioredis": "^5.6.0",
|
||||
"json5": "^2.2.3",
|
||||
@ -67,8 +68,8 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@kevisual/code-center-module": "workspace:*",
|
||||
"@kevisual/permission": "workspace:*",
|
||||
"@kevisual/oss": "workspace:*",
|
||||
"@kevisual/permission": "workspace:*",
|
||||
"@kevisual/types": "^0.0.6",
|
||||
"@rollup/plugin-alias": "^5.1.1",
|
||||
"@rollup/plugin-commonjs": "^28.0.3",
|
||||
@ -81,14 +82,14 @@
|
||||
"@types/formidable": "^3.4.5",
|
||||
"@types/jsonwebtoken": "^9.0.9",
|
||||
"@types/lodash-es": "^4.17.12",
|
||||
"@types/node": "^22.13.11",
|
||||
"@types/node": "^22.13.13",
|
||||
"@types/react": "^19.0.12",
|
||||
"@types/uuid": "^10.0.0",
|
||||
"concurrently": "^9.1.2",
|
||||
"cross-env": "^7.0.3",
|
||||
"nodemon": "^3.1.9",
|
||||
"rimraf": "^6.0.1",
|
||||
"rollup": "^4.36.0",
|
||||
"rollup": "^4.37.0",
|
||||
"rollup-plugin-copy": "^3.5.0",
|
||||
"rollup-plugin-dts": "^6.2.1",
|
||||
"tape": "^5.9.0",
|
||||
|
338
pnpm-lock.yaml
generated
338
pnpm-lock.yaml
generated
@ -14,8 +14,8 @@ importers:
|
||||
.:
|
||||
dependencies:
|
||||
'@kevisual/local-app-manager':
|
||||
specifier: 0.1.9
|
||||
version: 0.1.9(@kevisual/router@0.0.9)(@kevisual/types@0.0.6)(@kevisual/use-config@1.0.10(dotenv@16.4.7))(pm2@6.0.5)
|
||||
specifier: 0.1.10
|
||||
version: 0.1.10(@kevisual/router@0.0.9)(@kevisual/types@0.0.6)(@kevisual/use-config@1.0.10(dotenv@16.4.7))(pm2@6.0.5)
|
||||
'@kevisual/router':
|
||||
specifier: 0.0.9
|
||||
version: 0.0.9
|
||||
@ -34,6 +34,9 @@ importers:
|
||||
dayjs:
|
||||
specifier: ^1.11.13
|
||||
version: 1.11.13
|
||||
dotenv:
|
||||
specifier: ^16.4.7
|
||||
version: 16.4.7
|
||||
formidable:
|
||||
specifier: ^3.5.2
|
||||
version: 3.5.2
|
||||
@ -69,7 +72,7 @@ importers:
|
||||
version: 6.0.5
|
||||
rollup-plugin-esbuild:
|
||||
specifier: ^6.2.1
|
||||
version: 6.2.1(esbuild@0.25.0)(rollup@4.36.0)
|
||||
version: 6.2.1(esbuild@0.25.0)(rollup@4.37.0)
|
||||
semver:
|
||||
specifier: ^7.7.1
|
||||
version: 7.7.1
|
||||
@ -106,22 +109,22 @@ importers:
|
||||
version: 0.0.6
|
||||
'@rollup/plugin-alias':
|
||||
specifier: ^5.1.1
|
||||
version: 5.1.1(rollup@4.36.0)
|
||||
version: 5.1.1(rollup@4.37.0)
|
||||
'@rollup/plugin-commonjs':
|
||||
specifier: ^28.0.3
|
||||
version: 28.0.3(rollup@4.36.0)
|
||||
version: 28.0.3(rollup@4.37.0)
|
||||
'@rollup/plugin-json':
|
||||
specifier: ^6.1.0
|
||||
version: 6.1.0(rollup@4.36.0)
|
||||
version: 6.1.0(rollup@4.37.0)
|
||||
'@rollup/plugin-node-resolve':
|
||||
specifier: ^16.0.1
|
||||
version: 16.0.1(rollup@4.36.0)
|
||||
version: 16.0.1(rollup@4.37.0)
|
||||
'@rollup/plugin-replace':
|
||||
specifier: ^6.0.2
|
||||
version: 6.0.2(rollup@4.36.0)
|
||||
version: 6.0.2(rollup@4.37.0)
|
||||
'@rollup/plugin-typescript':
|
||||
specifier: ^12.1.2
|
||||
version: 12.1.2(rollup@4.36.0)(tslib@2.8.1)(typescript@5.8.2)
|
||||
version: 12.1.2(rollup@4.37.0)(tslib@2.8.1)(typescript@5.8.2)
|
||||
'@types/archiver':
|
||||
specifier: ^6.0.3
|
||||
version: 6.0.3
|
||||
@ -138,8 +141,8 @@ importers:
|
||||
specifier: ^4.17.12
|
||||
version: 4.17.12
|
||||
'@types/node':
|
||||
specifier: ^22.13.11
|
||||
version: 22.13.11
|
||||
specifier: ^22.13.13
|
||||
version: 22.13.13
|
||||
'@types/react':
|
||||
specifier: ^19.0.12
|
||||
version: 19.0.12
|
||||
@ -159,14 +162,14 @@ importers:
|
||||
specifier: latest
|
||||
version: 6.0.1
|
||||
rollup:
|
||||
specifier: ^4.36.0
|
||||
version: 4.36.0
|
||||
specifier: ^4.37.0
|
||||
version: 4.37.0
|
||||
rollup-plugin-copy:
|
||||
specifier: ^3.5.0
|
||||
version: 3.5.0
|
||||
rollup-plugin-dts:
|
||||
specifier: ^6.2.1
|
||||
version: 6.2.1(rollup@4.36.0)(typescript@5.8.2)
|
||||
version: 6.2.1(rollup@4.37.0)(typescript@5.8.2)
|
||||
tape:
|
||||
specifier: ^5.9.0
|
||||
version: 5.9.0
|
||||
@ -301,6 +304,12 @@ importers:
|
||||
specifier: ^8.4.0
|
||||
version: 8.4.0(tsx@4.19.3)(typescript@5.8.2)
|
||||
|
||||
submodules/pay-center-code:
|
||||
dependencies:
|
||||
dotenv:
|
||||
specifier: ^16.4.7
|
||||
version: 16.4.7
|
||||
|
||||
submodules/permission:
|
||||
devDependencies:
|
||||
tsup:
|
||||
@ -502,10 +511,10 @@ packages:
|
||||
'@kevisual/load@0.0.4':
|
||||
resolution: {integrity: sha512-TJBieKsEoEPfP4+tDyhNZdMX2LMAGiDZ/IrAXPFWB4jeFP0Ywm1W5xDV52LhhHq4nwTmuhyTVmPxJYiEVYTHtA==}
|
||||
|
||||
'@kevisual/local-app-manager@0.1.9':
|
||||
resolution: {integrity: sha512-oppYUjvpPg/7gBw1h3dX63fhxB8MvGc74yGgIM4JifvSuOYLcZ9oZyauYV+5lQVh2tjJImOuUmRHnVXu1FWKDQ==}
|
||||
'@kevisual/local-app-manager@0.1.10':
|
||||
resolution: {integrity: sha512-4zE3ndsGe5eA0Wl8b8JgWIbulX8uH8vZWuvBkgnAP9ry99XFYHx5Z3XGO990ZKqzRMy3jIFlfooAc1x1iMoZvQ==}
|
||||
peerDependencies:
|
||||
'@kevisual/router': ^0.0.6-alpha-2
|
||||
'@kevisual/router': ^0.0.6
|
||||
'@kevisual/types': ^0.0.1
|
||||
'@kevisual/use-config': ^1.0.5
|
||||
pm2: ^5.4.3
|
||||
@ -631,96 +640,196 @@ packages:
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
|
||||
'@rollup/rollup-android-arm-eabi@4.37.0':
|
||||
resolution: {integrity: sha512-l7StVw6WAa8l3vA1ov80jyetOAEo1FtHvZDbzXDO/02Sq/QVvqlHkYoFwDJPIMj0GKiistsBudfx5tGFnwYWDQ==}
|
||||
cpu: [arm]
|
||||
os: [android]
|
||||
|
||||
'@rollup/rollup-android-arm64@4.36.0':
|
||||
resolution: {integrity: sha512-NyfuLvdPdNUfUNeYKUwPwKsE5SXa2J6bCt2LdB/N+AxShnkpiczi3tcLJrm5mA+eqpy0HmaIY9F6XCa32N5yzg==}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@rollup/rollup-android-arm64@4.37.0':
|
||||
resolution: {integrity: sha512-6U3SlVyMxezt8Y+/iEBcbp945uZjJwjZimu76xoG7tO1av9VO691z8PkhzQ85ith2I8R2RddEPeSfcbyPfD4hA==}
|
||||
cpu: [arm64]
|
||||
os: [android]
|
||||
|
||||
'@rollup/rollup-darwin-arm64@4.36.0':
|
||||
resolution: {integrity: sha512-JQ1Jk5G4bGrD4pWJQzWsD8I1n1mgPXq33+/vP4sk8j/z/C2siRuxZtaUA7yMTf71TCZTZl/4e1bfzwUmFb3+rw==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@rollup/rollup-darwin-arm64@4.37.0':
|
||||
resolution: {integrity: sha512-+iTQ5YHuGmPt10NTzEyMPbayiNTcOZDWsbxZYR1ZnmLnZxG17ivrPSWFO9j6GalY0+gV3Jtwrrs12DBscxnlYA==}
|
||||
cpu: [arm64]
|
||||
os: [darwin]
|
||||
|
||||
'@rollup/rollup-darwin-x64@4.36.0':
|
||||
resolution: {integrity: sha512-6c6wMZa1lrtiRsbDziCmjE53YbTkxMYhhnWnSW8R/yqsM7a6mSJ3uAVT0t8Y/DGt7gxUWYuFM4bwWk9XCJrFKA==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@rollup/rollup-darwin-x64@4.37.0':
|
||||
resolution: {integrity: sha512-m8W2UbxLDcmRKVjgl5J/k4B8d7qX2EcJve3Sut7YGrQoPtCIQGPH5AMzuFvYRWZi0FVS0zEY4c8uttPfX6bwYQ==}
|
||||
cpu: [x64]
|
||||
os: [darwin]
|
||||
|
||||
'@rollup/rollup-freebsd-arm64@4.36.0':
|
||||
resolution: {integrity: sha512-KXVsijKeJXOl8QzXTsA+sHVDsFOmMCdBRgFmBb+mfEb/7geR7+C8ypAml4fquUt14ZyVXaw2o1FWhqAfOvA4sg==}
|
||||
cpu: [arm64]
|
||||
os: [freebsd]
|
||||
|
||||
'@rollup/rollup-freebsd-arm64@4.37.0':
|
||||
resolution: {integrity: sha512-FOMXGmH15OmtQWEt174v9P1JqqhlgYge/bUjIbiVD1nI1NeJ30HYT9SJlZMqdo1uQFyt9cz748F1BHghWaDnVA==}
|
||||
cpu: [arm64]
|
||||
os: [freebsd]
|
||||
|
||||
'@rollup/rollup-freebsd-x64@4.36.0':
|
||||
resolution: {integrity: sha512-dVeWq1ebbvByI+ndz4IJcD4a09RJgRYmLccwlQ8bPd4olz3Y213uf1iwvc7ZaxNn2ab7bjc08PrtBgMu6nb4pQ==}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@rollup/rollup-freebsd-x64@4.37.0':
|
||||
resolution: {integrity: sha512-SZMxNttjPKvV14Hjck5t70xS3l63sbVwl98g3FlVVx2YIDmfUIy29jQrsw06ewEYQ8lQSuY9mpAPlmgRD2iSsA==}
|
||||
cpu: [x64]
|
||||
os: [freebsd]
|
||||
|
||||
'@rollup/rollup-linux-arm-gnueabihf@4.36.0':
|
||||
resolution: {integrity: sha512-bvXVU42mOVcF4le6XSjscdXjqx8okv4n5vmwgzcmtvFdifQ5U4dXFYaCB87namDRKlUL9ybVtLQ9ztnawaSzvg==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-arm-gnueabihf@4.37.0':
|
||||
resolution: {integrity: sha512-hhAALKJPidCwZcj+g+iN+38SIOkhK2a9bqtJR+EtyxrKKSt1ynCBeqrQy31z0oWU6thRZzdx53hVgEbRkuI19w==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.36.0':
|
||||
resolution: {integrity: sha512-JFIQrDJYrxOnyDQGYkqnNBtjDwTgbasdbUiQvcU8JmGDfValfH1lNpng+4FWlhaVIR4KPkeddYjsVVbmJYvDcg==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.37.0':
|
||||
resolution: {integrity: sha512-jUb/kmn/Gd8epbHKEqkRAxq5c2EwRt0DqhSGWjPFxLeFvldFdHQs/n8lQ9x85oAeVb6bHcS8irhTJX2FCOd8Ag==}
|
||||
cpu: [arm]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.36.0':
|
||||
resolution: {integrity: sha512-KqjYVh3oM1bj//5X7k79PSCZ6CvaVzb7Qs7VMWS+SlWB5M8p3FqufLP9VNp4CazJ0CsPDLwVD9r3vX7Ci4J56A==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.37.0':
|
||||
resolution: {integrity: sha512-oNrJxcQT9IcbcmKlkF+Yz2tmOxZgG9D9GRq+1OE6XCQwCVwxixYAa38Z8qqPzQvzt1FCfmrHX03E0pWoXm1DqA==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.36.0':
|
||||
resolution: {integrity: sha512-QiGnhScND+mAAtfHqeT+cB1S9yFnNQ/EwCg5yE3MzoaZZnIV0RV9O5alJAoJKX/sBONVKeZdMfO8QSaWEygMhw==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.37.0':
|
||||
resolution: {integrity: sha512-pfxLBMls+28Ey2enpX3JvjEjaJMBX5XlPCZNGxj4kdJyHduPBXtxYeb8alo0a7bqOoWZW2uKynhHxF/MWoHaGQ==}
|
||||
cpu: [arm64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-loongarch64-gnu@4.36.0':
|
||||
resolution: {integrity: sha512-1ZPyEDWF8phd4FQtTzMh8FQwqzvIjLsl6/84gzUxnMNFBtExBtpL51H67mV9xipuxl1AEAerRBgBwFNpkw8+Lg==}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-loongarch64-gnu@4.37.0':
|
||||
resolution: {integrity: sha512-yCE0NnutTC/7IGUq/PUHmoeZbIwq3KRh02e9SfFh7Vmc1Z7atuJRYWhRME5fKgT8aS20mwi1RyChA23qSyRGpA==}
|
||||
cpu: [loong64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-powerpc64le-gnu@4.36.0':
|
||||
resolution: {integrity: sha512-VMPMEIUpPFKpPI9GZMhJrtu8rxnp6mJR3ZzQPykq4xc2GmdHj3Q4cA+7avMyegXy4n1v+Qynr9fR88BmyO74tg==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-powerpc64le-gnu@4.37.0':
|
||||
resolution: {integrity: sha512-NxcICptHk06E2Lh3a4Pu+2PEdZ6ahNHuK7o6Np9zcWkrBMuv21j10SQDJW3C9Yf/A/P7cutWoC/DptNLVsZ0VQ==}
|
||||
cpu: [ppc64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.36.0':
|
||||
resolution: {integrity: sha512-ttE6ayb/kHwNRJGYLpuAvB7SMtOeQnVXEIpMtAvx3kepFQeowVED0n1K9nAdraHUPJ5hydEMxBpIR7o4nrm8uA==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.37.0':
|
||||
resolution: {integrity: sha512-PpWwHMPCVpFZLTfLq7EWJWvrmEuLdGn1GMYcm5MV7PaRgwCEYJAwiN94uBuZev0/J/hFIIJCsYw4nLmXA9J7Pw==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-riscv64-musl@4.37.0':
|
||||
resolution: {integrity: sha512-DTNwl6a3CfhGTAOYZ4KtYbdS8b+275LSLqJVJIrPa5/JuIufWWZ/QFvkxp52gpmguN95eujrM68ZG+zVxa8zHA==}
|
||||
cpu: [riscv64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.36.0':
|
||||
resolution: {integrity: sha512-4a5gf2jpS0AIe7uBjxDeUMNcFmaRTbNv7NxI5xOCs4lhzsVyGR/0qBXduPnoWf6dGC365saTiwag8hP1imTgag==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.37.0':
|
||||
resolution: {integrity: sha512-hZDDU5fgWvDdHFuExN1gBOhCuzo/8TMpidfOR+1cPZJflcEzXdCy1LjnklQdW8/Et9sryOPJAKAQRw8Jq7Tg+A==}
|
||||
cpu: [s390x]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.36.0':
|
||||
resolution: {integrity: sha512-5KtoW8UWmwFKQ96aQL3LlRXX16IMwyzMq/jSSVIIyAANiE1doaQsx/KRyhAvpHlPjPiSU/AYX/8m+lQ9VToxFQ==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.37.0':
|
||||
resolution: {integrity: sha512-pKivGpgJM5g8dwj0ywBwe/HeVAUSuVVJhUTa/URXjxvoyTT/AxsLTAbkHkDHG7qQxLoW2s3apEIl26uUe08LVQ==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.36.0':
|
||||
resolution: {integrity: sha512-sycrYZPrv2ag4OCvaN5js+f01eoZ2U+RmT5as8vhxiFz+kxwlHrsxOwKPSA8WyS+Wc6Epid9QeI/IkQ9NkgYyQ==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.37.0':
|
||||
resolution: {integrity: sha512-E2lPrLKE8sQbY/2bEkVTGDEk4/49UYRVWgj90MY8yPjpnGBQ+Xi1Qnr7b7UIWw1NOggdFQFOLZ8+5CzCiz143w==}
|
||||
cpu: [x64]
|
||||
os: [linux]
|
||||
|
||||
'@rollup/rollup-win32-arm64-msvc@4.36.0':
|
||||
resolution: {integrity: sha512-qbqt4N7tokFwwSVlWDsjfoHgviS3n/vZ8LK0h1uLG9TYIRuUTJC88E1xb3LM2iqZ/WTqNQjYrtmtGmrmmawB6A==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@rollup/rollup-win32-arm64-msvc@4.37.0':
|
||||
resolution: {integrity: sha512-Jm7biMazjNzTU4PrQtr7VS8ibeys9Pn29/1bm4ph7CP2kf21950LgN+BaE2mJ1QujnvOc6p54eWWiVvn05SOBg==}
|
||||
cpu: [arm64]
|
||||
os: [win32]
|
||||
|
||||
'@rollup/rollup-win32-ia32-msvc@4.36.0':
|
||||
resolution: {integrity: sha512-t+RY0JuRamIocMuQcfwYSOkmdX9dtkr1PbhKW42AMvaDQa+jOdpUYysroTF/nuPpAaQMWp7ye+ndlmmthieJrQ==}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@rollup/rollup-win32-ia32-msvc@4.37.0':
|
||||
resolution: {integrity: sha512-e3/1SFm1OjefWICB2Ucstg2dxYDkDTZGDYgwufcbsxTHyqQps1UQf33dFEChBNmeSsTOyrjw2JJq0zbG5GF6RA==}
|
||||
cpu: [ia32]
|
||||
os: [win32]
|
||||
|
||||
'@rollup/rollup-win32-x64-msvc@4.36.0':
|
||||
resolution: {integrity: sha512-aRXd7tRZkWLqGbChgcMMDEHjOKudo1kChb1Jt1IfR8cY/KIpgNviLeJy5FUb9IpSuQj8dU2fAYNMPW/hLKOSTw==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@rollup/rollup-win32-x64-msvc@4.37.0':
|
||||
resolution: {integrity: sha512-LWbXUBwn/bcLx2sSsqy7pK5o+Nr+VCoRoAohfJ5C/aBio9nfJmGQqHAhU6pwxV/RmyTk5AqdySma7uwWGlmeuA==}
|
||||
cpu: [x64]
|
||||
os: [win32]
|
||||
|
||||
'@socket.io/component-emitter@3.1.2':
|
||||
resolution: {integrity: sha512-9BCxFwvbGg/RsZK9tjXd8s4UcwR0MWeFQ1XEKIQVVvAGJyINdrqKMcTRyLoK8Rse1GjzLV9cwjWV1olXRWEXVA==}
|
||||
|
||||
@ -775,6 +884,9 @@ packages:
|
||||
'@types/node@22.13.11':
|
||||
resolution: {integrity: sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g==}
|
||||
|
||||
'@types/node@22.13.13':
|
||||
resolution: {integrity: sha512-ClsL5nMwKaBRwPcCvH8E7+nU4GxHVx1axNvMZTFHMEfNI7oahimt26P5zjVCRrjiIWj6YFXfE1v3dEp94wLcGQ==}
|
||||
|
||||
'@types/react@19.0.12':
|
||||
resolution: {integrity: sha512-V6Ar115dBDrjbtXSrS+/Oruobc+qVbbUxDFC1RSbRqLt5SYvxxyIDrSC85RWml54g+jfNeEMZhEj7wW07ONQhA==}
|
||||
|
||||
@ -2217,6 +2329,11 @@ packages:
|
||||
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
|
||||
hasBin: true
|
||||
|
||||
rollup@4.37.0:
|
||||
resolution: {integrity: sha512-iAtQy/L4QFU+rTJ1YUjXqJOJzuwEghqWzCEYD2FEghT7Gsy1VdABntrO4CLopA5IkflTyqNiLNwPcOJ3S7UKLg==}
|
||||
engines: {node: '>=18.0.0', npm: '>=8.0.0'}
|
||||
hasBin: true
|
||||
|
||||
run-parallel@1.2.0:
|
||||
resolution: {integrity: sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==}
|
||||
|
||||
@ -2902,7 +3019,7 @@ snapshots:
|
||||
dependencies:
|
||||
eventemitter3: 5.0.1
|
||||
|
||||
'@kevisual/local-app-manager@0.1.9(@kevisual/router@0.0.9)(@kevisual/types@0.0.6)(@kevisual/use-config@1.0.10(dotenv@16.4.7))(pm2@6.0.5)':
|
||||
'@kevisual/local-app-manager@0.1.10(@kevisual/router@0.0.9)(@kevisual/types@0.0.6)(@kevisual/use-config@1.0.10(dotenv@16.4.7))(pm2@6.0.5)':
|
||||
dependencies:
|
||||
'@kevisual/router': 0.0.9
|
||||
'@kevisual/types': 0.0.6
|
||||
@ -3003,6 +3120,10 @@ snapshots:
|
||||
optionalDependencies:
|
||||
rollup: 4.36.0
|
||||
|
||||
'@rollup/plugin-alias@5.1.1(rollup@4.37.0)':
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/plugin-commonjs@28.0.3(rollup@4.36.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.36.0)
|
||||
@ -3015,12 +3136,30 @@ snapshots:
|
||||
optionalDependencies:
|
||||
rollup: 4.36.0
|
||||
|
||||
'@rollup/plugin-commonjs@28.0.3(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.37.0)
|
||||
commondir: 1.0.1
|
||||
estree-walker: 2.0.2
|
||||
fdir: 6.3.0(picomatch@4.0.2)
|
||||
is-reference: 1.2.1
|
||||
magic-string: 0.30.11
|
||||
picomatch: 4.0.2
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/plugin-json@6.1.0(rollup@4.36.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.36.0)
|
||||
optionalDependencies:
|
||||
rollup: 4.36.0
|
||||
|
||||
'@rollup/plugin-json@6.1.0(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.37.0)
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/plugin-node-resolve@16.0.1(rollup@4.36.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.36.0)
|
||||
@ -3031,6 +3170,16 @@ snapshots:
|
||||
optionalDependencies:
|
||||
rollup: 4.36.0
|
||||
|
||||
'@rollup/plugin-node-resolve@16.0.1(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.37.0)
|
||||
'@types/resolve': 1.20.2
|
||||
deepmerge: 4.3.1
|
||||
is-module: 1.0.0
|
||||
resolve: 1.22.8
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/plugin-replace@6.0.2(rollup@4.36.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.36.0)
|
||||
@ -3038,6 +3187,13 @@ snapshots:
|
||||
optionalDependencies:
|
||||
rollup: 4.36.0
|
||||
|
||||
'@rollup/plugin-replace@6.0.2(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.37.0)
|
||||
magic-string: 0.30.11
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/plugin-typescript@12.1.2(rollup@4.36.0)(tslib@2.8.1)(typescript@5.8.2)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.36.0)
|
||||
@ -3047,6 +3203,15 @@ snapshots:
|
||||
rollup: 4.36.0
|
||||
tslib: 2.8.1
|
||||
|
||||
'@rollup/plugin-typescript@12.1.2(rollup@4.37.0)(tslib@2.8.1)(typescript@5.8.2)':
|
||||
dependencies:
|
||||
'@rollup/pluginutils': 5.1.2(rollup@4.37.0)
|
||||
resolve: 1.22.8
|
||||
typescript: 5.8.2
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
tslib: 2.8.1
|
||||
|
||||
'@rollup/pluginutils@5.1.2(rollup@4.36.0)':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.6
|
||||
@ -3055,63 +3220,131 @@ snapshots:
|
||||
optionalDependencies:
|
||||
rollup: 4.36.0
|
||||
|
||||
'@rollup/pluginutils@5.1.2(rollup@4.37.0)':
|
||||
dependencies:
|
||||
'@types/estree': 1.0.6
|
||||
estree-walker: 2.0.2
|
||||
picomatch: 4.0.2
|
||||
optionalDependencies:
|
||||
rollup: 4.37.0
|
||||
|
||||
'@rollup/rollup-android-arm-eabi@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-android-arm-eabi@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-android-arm64@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-android-arm64@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-darwin-arm64@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-darwin-arm64@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-darwin-x64@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-darwin-x64@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-freebsd-arm64@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-freebsd-arm64@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-freebsd-x64@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-freebsd-x64@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-arm-gnueabihf@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-arm-gnueabihf@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-arm-musleabihf@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-arm64-gnu@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-arm64-musl@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-loongarch64-gnu@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-loongarch64-gnu@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-powerpc64le-gnu@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-powerpc64le-gnu@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-riscv64-gnu@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-riscv64-musl@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-s390x-gnu@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-x64-gnu@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-linux-x64-musl@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-win32-arm64-msvc@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-win32-arm64-msvc@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-win32-ia32-msvc@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-win32-ia32-msvc@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-win32-x64-msvc@4.36.0':
|
||||
optional: true
|
||||
|
||||
'@rollup/rollup-win32-x64-msvc@4.37.0':
|
||||
optional: true
|
||||
|
||||
'@socket.io/component-emitter@3.1.2': {}
|
||||
|
||||
'@tootallnate/quickjs-emscripten@0.23.0': {}
|
||||
@ -3124,7 +3357,7 @@ snapshots:
|
||||
|
||||
'@types/cors@2.8.17':
|
||||
dependencies:
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
|
||||
'@types/crypto-js@4.2.2': {}
|
||||
|
||||
@ -3136,21 +3369,21 @@ snapshots:
|
||||
|
||||
'@types/formidable@3.4.5':
|
||||
dependencies:
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
|
||||
'@types/fs-extra@8.1.5':
|
||||
dependencies:
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
|
||||
'@types/glob@7.2.0':
|
||||
dependencies:
|
||||
'@types/minimatch': 5.1.2
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
|
||||
'@types/jsonwebtoken@9.0.9':
|
||||
dependencies:
|
||||
'@types/ms': 0.7.34
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
|
||||
'@types/lodash-es@4.17.12':
|
||||
dependencies:
|
||||
@ -3164,19 +3397,23 @@ snapshots:
|
||||
|
||||
'@types/node-forge@1.3.11':
|
||||
dependencies:
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
|
||||
'@types/node@22.13.11':
|
||||
dependencies:
|
||||
undici-types: 6.20.0
|
||||
|
||||
'@types/node@22.13.13':
|
||||
dependencies:
|
||||
undici-types: 6.20.0
|
||||
|
||||
'@types/react@19.0.12':
|
||||
dependencies:
|
||||
csstype: 3.1.3
|
||||
|
||||
'@types/readdir-glob@1.1.5':
|
||||
dependencies:
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
|
||||
'@types/resolve@1.20.2': {}
|
||||
|
||||
@ -3589,7 +3826,7 @@ snapshots:
|
||||
dependencies:
|
||||
'@types/cookie': 0.4.1
|
||||
'@types/cors': 2.8.17
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
accepts: 1.3.8
|
||||
base64id: 2.0.0
|
||||
cookie: 0.4.2
|
||||
@ -4739,6 +4976,14 @@ snapshots:
|
||||
optionalDependencies:
|
||||
'@babel/code-frame': 7.26.2
|
||||
|
||||
rollup-plugin-dts@6.2.1(rollup@4.37.0)(typescript@5.8.2):
|
||||
dependencies:
|
||||
magic-string: 0.30.17
|
||||
rollup: 4.37.0
|
||||
typescript: 5.8.2
|
||||
optionalDependencies:
|
||||
'@babel/code-frame': 7.26.2
|
||||
|
||||
rollup-plugin-esbuild@6.2.1(esbuild@0.25.0)(rollup@4.36.0):
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
@ -4750,6 +4995,17 @@ snapshots:
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
rollup-plugin-esbuild@6.2.1(esbuild@0.25.0)(rollup@4.37.0):
|
||||
dependencies:
|
||||
debug: 4.4.0
|
||||
es-module-lexer: 1.6.0
|
||||
esbuild: 0.25.0
|
||||
get-tsconfig: 4.10.0
|
||||
rollup: 4.37.0
|
||||
unplugin-utils: 0.2.4
|
||||
transitivePeerDependencies:
|
||||
- supports-color
|
||||
|
||||
rollup@4.36.0:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.6
|
||||
@ -4775,6 +5031,32 @@ snapshots:
|
||||
'@rollup/rollup-win32-x64-msvc': 4.36.0
|
||||
fsevents: 2.3.3
|
||||
|
||||
rollup@4.37.0:
|
||||
dependencies:
|
||||
'@types/estree': 1.0.6
|
||||
optionalDependencies:
|
||||
'@rollup/rollup-android-arm-eabi': 4.37.0
|
||||
'@rollup/rollup-android-arm64': 4.37.0
|
||||
'@rollup/rollup-darwin-arm64': 4.37.0
|
||||
'@rollup/rollup-darwin-x64': 4.37.0
|
||||
'@rollup/rollup-freebsd-arm64': 4.37.0
|
||||
'@rollup/rollup-freebsd-x64': 4.37.0
|
||||
'@rollup/rollup-linux-arm-gnueabihf': 4.37.0
|
||||
'@rollup/rollup-linux-arm-musleabihf': 4.37.0
|
||||
'@rollup/rollup-linux-arm64-gnu': 4.37.0
|
||||
'@rollup/rollup-linux-arm64-musl': 4.37.0
|
||||
'@rollup/rollup-linux-loongarch64-gnu': 4.37.0
|
||||
'@rollup/rollup-linux-powerpc64le-gnu': 4.37.0
|
||||
'@rollup/rollup-linux-riscv64-gnu': 4.37.0
|
||||
'@rollup/rollup-linux-riscv64-musl': 4.37.0
|
||||
'@rollup/rollup-linux-s390x-gnu': 4.37.0
|
||||
'@rollup/rollup-linux-x64-gnu': 4.37.0
|
||||
'@rollup/rollup-linux-x64-musl': 4.37.0
|
||||
'@rollup/rollup-win32-arm64-msvc': 4.37.0
|
||||
'@rollup/rollup-win32-ia32-msvc': 4.37.0
|
||||
'@rollup/rollup-win32-x64-msvc': 4.37.0
|
||||
fsevents: 2.3.3
|
||||
|
||||
run-parallel@1.2.0:
|
||||
dependencies:
|
||||
queue-microtask: 1.2.3
|
||||
@ -5142,7 +5424,7 @@ snapshots:
|
||||
picocolors: 1.1.1
|
||||
postcss-load-config: 6.0.1(tsx@4.19.3)
|
||||
resolve-from: 5.0.0
|
||||
rollup: 4.36.0
|
||||
rollup: 4.37.0
|
||||
source-map: 0.8.0-beta.0
|
||||
sucrase: 3.35.0
|
||||
tinyexec: 0.3.2
|
||||
@ -5321,7 +5603,7 @@ snapshots:
|
||||
|
||||
wkx@0.5.0:
|
||||
dependencies:
|
||||
'@types/node': 22.13.11
|
||||
'@types/node': 22.13.13
|
||||
|
||||
wrap-ansi@7.0.0:
|
||||
dependencies:
|
||||
|
@ -1,12 +1,10 @@
|
||||
import { App } from '@kevisual/router';
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
import * as redisLib from './modules/redis.ts';
|
||||
import * as minioLib from './modules/minio.ts';
|
||||
import * as sequelizeLib from './modules/sequelize.ts';
|
||||
import { useContextKey, useContext } from '@kevisual/use-config/context';
|
||||
import { SimpleRouter } from '@kevisual/router/simple';
|
||||
import { OssBase } from '@kevisual/oss/services';
|
||||
useConfig();
|
||||
export const router = useContextKey('router', () => new SimpleRouter());
|
||||
export const oss = useContextKey(
|
||||
'oss',
|
||||
|
10
src/index.ts
10
src/index.ts
@ -1,13 +1,11 @@
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
import { config } from './modules/config.ts';
|
||||
import { app } from './app.ts';
|
||||
import './route.ts';
|
||||
const config = useConfig();
|
||||
import { uploadMiddleware } from './routes-simple/upload.ts';
|
||||
import { port } from './modules/config.ts';
|
||||
|
||||
// if (import.meta.url === `file://${process.argv[1]}`) {
|
||||
app.listen(config.port, () => {
|
||||
console.log(`server is running at http://localhost:${config.port}`);
|
||||
app.listen(port, () => {
|
||||
console.log(`server is running at http://localhost:${port}`);
|
||||
});
|
||||
app.server.on(uploadMiddleware);
|
||||
|
||||
console.log(`run ${config.appName} done`);
|
||||
|
@ -1,292 +1,3 @@
|
||||
// import { useConfig } from '@kevisual/use-config';
|
||||
// import { DataTypes, Model, Op, Sequelize } from 'sequelize';
|
||||
// import { createToken, checkToken } from '@kevisual/auth';
|
||||
// import { cryptPwd } from '@kevisual/auth';
|
||||
// import { customRandom, nanoid, customAlphabet } from 'nanoid';
|
||||
// import { CustomError } from '@kevisual/router';
|
||||
// import { Org } from './org.ts';
|
||||
|
||||
// import { useContextKey } from '@kevisual/use-config/context';
|
||||
// import { Redis } from 'ioredis';
|
||||
// export const redis = useContextKey<Redis>('redis');
|
||||
// const sequelize = useContextKey<Sequelize>('sequelize');
|
||||
// const config = useConfig<{ tokenSecret: string }>();
|
||||
|
||||
// type UserData = {
|
||||
// orgs?: string[];
|
||||
// };
|
||||
// export class User extends Model {
|
||||
// declare id: string;
|
||||
// declare username: string;
|
||||
// declare nickname: string; // 昵称
|
||||
// declare alias: string; // 别名
|
||||
// declare password: string;
|
||||
// declare salt: string;
|
||||
// declare needChangePassword: boolean;
|
||||
// declare description: string;
|
||||
// declare data: UserData;
|
||||
// declare type: string; // user | org | visitor
|
||||
// declare owner: string;
|
||||
// declare orgId: string;
|
||||
// declare email: string;
|
||||
// declare avatar: string;
|
||||
// tokenUser: any;
|
||||
// setTokenUser(tokenUser: any) {
|
||||
// this.tokenUser = tokenUser;
|
||||
// }
|
||||
// /**
|
||||
// * uid 是用于 orgId 的用户id 真实用户的id
|
||||
// * @param uid
|
||||
// * @returns
|
||||
// */
|
||||
// async createToken(uid?: string, loginType?: 'default' | 'plugin' | 'month' | 'season' | 'year') {
|
||||
// const { id, username, type } = this;
|
||||
// let expireTime = 60 * 60 * 24 * 7; // 7 days
|
||||
// switch (loginType) {
|
||||
// case 'plugin':
|
||||
// expireTime = 60 * 60 * 24 * 30 * 12; // 365 days
|
||||
// break;
|
||||
// case 'month':
|
||||
// expireTime = 60 * 60 * 24 * 30; // 30 days
|
||||
// break;
|
||||
// case 'season':
|
||||
// expireTime = 60 * 60 * 24 * 30 * 3; // 90 days
|
||||
// break;
|
||||
// case 'year':
|
||||
// expireTime = 60 * 60 * 24 * 30 * 12; // 365 days
|
||||
// break;
|
||||
// }
|
||||
// const now = new Date().getTime();
|
||||
// const token = await createToken({ id, username, uid, type }, config.tokenSecret);
|
||||
// return { token, expireTime: now + expireTime };
|
||||
// }
|
||||
// static async verifyToken(token: string) {
|
||||
// const ct = await checkToken(token, config.tokenSecret);
|
||||
// const tokenUser = ct.payload;
|
||||
// return tokenUser;
|
||||
// }
|
||||
// static async createUser(username: string, password?: string, description?: string) {
|
||||
// const user = await User.findOne({ where: { username } });
|
||||
// if (user) {
|
||||
// throw new CustomError('User already exists');
|
||||
// }
|
||||
// const salt = nanoid(6);
|
||||
// let needChangePassword = !password;
|
||||
// password = password || '123456';
|
||||
// const cPassword = cryptPwd(password, salt);
|
||||
// return await User.create({ username, password: cPassword, description, salt, needChangePassword });
|
||||
// }
|
||||
// static async createOrg(username: string, owner: string, description?: string) {
|
||||
// const user = await User.findOne({ where: { username } });
|
||||
// if (user) {
|
||||
// throw new CustomError('User already exists');
|
||||
// }
|
||||
// const me = await User.findByPk(owner);
|
||||
// if (!me) {
|
||||
// throw new CustomError('Owner not found');
|
||||
// }
|
||||
// if (me.type !== 'user') {
|
||||
// throw new CustomError('Owner type is not user');
|
||||
// }
|
||||
// const org = await Org.create({ username, description, users: [{ uid: owner, role: 'owner' }] });
|
||||
// const newUser = await User.create({ username, password: '', description, type: 'org', owner, orgId: org.id });
|
||||
// // owner add
|
||||
// await redis.del(`user:${me.id}:orgs`);
|
||||
// return newUser;
|
||||
// }
|
||||
// createPassword(password: string) {
|
||||
// const salt = this.salt;
|
||||
// const cPassword = cryptPwd(password, salt);
|
||||
// this.password = cPassword;
|
||||
// return cPassword;
|
||||
// }
|
||||
// checkPassword(password: string) {
|
||||
// const salt = this.salt;
|
||||
// const cPassword = cryptPwd(password, salt);
|
||||
// return this.password === cPassword;
|
||||
// }
|
||||
// async getInfo() {
|
||||
// const orgs = await this.getOrgs();
|
||||
// return {
|
||||
// id: this.id,
|
||||
// username: this.username,
|
||||
// nickname: this.nickname,
|
||||
// description: this.description,
|
||||
// needChangePassword: this.needChangePassword,
|
||||
// type: this.type,
|
||||
// avatar: this.avatar,
|
||||
// orgs,
|
||||
// };
|
||||
// }
|
||||
// async getOrgs() {
|
||||
// let id = this.id;
|
||||
// if (this.type === 'org') {
|
||||
// if (this.tokenUser && this.tokenUser.uid) {
|
||||
// id = this.tokenUser.uid;
|
||||
// } else {
|
||||
// console.log('getOrgs', 'no uid', this.id, this.username);
|
||||
// throw new CustomError('Permission denied');
|
||||
// }
|
||||
// }
|
||||
// const cache = await redis.get(`user:${id}:orgs`);
|
||||
// if (cache) {
|
||||
// return JSON.parse(cache) as string[];
|
||||
// }
|
||||
// const orgs = await Org.findAll({
|
||||
// order: [['updatedAt', 'DESC']],
|
||||
// where: {
|
||||
// users: {
|
||||
// [Op.contains]: [
|
||||
// {
|
||||
// uid: id,
|
||||
// },
|
||||
// ],
|
||||
// },
|
||||
// },
|
||||
// });
|
||||
// const orgNames = orgs.map((org) => org.username);
|
||||
// if (orgNames.length > 0) {
|
||||
// await redis.set(`user:${id}:orgs`, JSON.stringify(orgNames), 'EX', 60 * 60); // 1 hour
|
||||
// }
|
||||
// return orgNames;
|
||||
// }
|
||||
// async expireOrgs() {
|
||||
// await redis.del(`user:${this.id}:orgs`);
|
||||
// }
|
||||
// }
|
||||
// User.init(
|
||||
// {
|
||||
// id: {
|
||||
// type: DataTypes.UUID,
|
||||
// primaryKey: true,
|
||||
// defaultValue: DataTypes.UUIDV4,
|
||||
// },
|
||||
// username: {
|
||||
// type: DataTypes.STRING,
|
||||
// allowNull: false,
|
||||
// unique: true,
|
||||
// // 用户名或者手机号
|
||||
// // 创建后避免修改的字段,当注册用户后,用户名注册则默认不能用手机号
|
||||
// },
|
||||
// nickname: {
|
||||
// type: DataTypes.TEXT,
|
||||
// allowNull: true,
|
||||
// },
|
||||
// alias: {
|
||||
// type: DataTypes.TEXT,
|
||||
// allowNull: true, // 别名,网络请求的别名,需要唯一,不能和username重复
|
||||
// defaultValue: '',
|
||||
// },
|
||||
// password: {
|
||||
// type: DataTypes.STRING,
|
||||
// allowNull: true,
|
||||
// },
|
||||
// email: {
|
||||
// type: DataTypes.STRING,
|
||||
// allowNull: true,
|
||||
// },
|
||||
// avatar: {
|
||||
// type: DataTypes.TEXT,
|
||||
// allowNull: true,
|
||||
// },
|
||||
// salt: {
|
||||
// type: DataTypes.STRING,
|
||||
// allowNull: true,
|
||||
// },
|
||||
// description: {
|
||||
// type: DataTypes.TEXT,
|
||||
// },
|
||||
// type: {
|
||||
// type: DataTypes.STRING,
|
||||
// defaultValue: 'user',
|
||||
// },
|
||||
// owner: {
|
||||
// type: DataTypes.UUID,
|
||||
// },
|
||||
// orgId: {
|
||||
// type: DataTypes.UUID,
|
||||
// },
|
||||
// needChangePassword: {
|
||||
// type: DataTypes.BOOLEAN,
|
||||
// defaultValue: false,
|
||||
// },
|
||||
// data: {
|
||||
// type: DataTypes.JSONB,
|
||||
// defaultValue: {},
|
||||
// },
|
||||
// },
|
||||
// {
|
||||
// sequelize,
|
||||
// tableName: 'cf_user', // codeflow user
|
||||
// paranoid: true,
|
||||
// },
|
||||
// );
|
||||
// User.sync({ alter: true, logging: false })
|
||||
// .then((res) => {
|
||||
// initializeUser();
|
||||
// })
|
||||
// .catch((err) => {
|
||||
// console.error('Sync User error', err);
|
||||
// });
|
||||
|
||||
// const letter = 'abcdefghijklmnopqrstuvwxyz';
|
||||
// const custom = customAlphabet(letter, 6);
|
||||
// export const initializeUser = async (pwd = custom()) => {
|
||||
// const w = await User.findOne({ where: { username: 'root' }, logging: false });
|
||||
// if (!w) {
|
||||
// const root = await User.createUser('root', pwd, '系统管理员');
|
||||
// const org = await User.createOrg('admin', root.id, '管理员');
|
||||
// console.info(' new Users name', root.username, org.username);
|
||||
// console.info('new Users root password', pwd);
|
||||
// console.info('new Users id', root.id, org.id);
|
||||
// const demo = await createDemoUser();
|
||||
// return {
|
||||
// code: 200,
|
||||
// data: { root, org, pwd: pwd, demo },
|
||||
// };
|
||||
// } else {
|
||||
// return {
|
||||
// code: 500,
|
||||
// message: 'Users has been created',
|
||||
// };
|
||||
// }
|
||||
// };
|
||||
// export const createDemoUser = async (username = 'demo', pwd = custom()) => {
|
||||
// const u = await User.findOne({ where: { username }, logging: false });
|
||||
// if (!u) {
|
||||
// const user = await User.createUser(username, pwd, 'demo');
|
||||
// console.info('new Users name', user.username, pwd);
|
||||
// return {
|
||||
// code: 200,
|
||||
// data: { user, pwd: pwd },
|
||||
// };
|
||||
// } else {
|
||||
// console.info('Users has been created', u.username);
|
||||
// return {
|
||||
// code: 500,
|
||||
// message: 'Users has been created',
|
||||
// };
|
||||
// }
|
||||
// };
|
||||
// // initializeUser();
|
||||
|
||||
// export class UserServices extends User {
|
||||
// static async loginByPhone(phone: string) {
|
||||
// let user = await User.findOne({ where: { username: phone } });
|
||||
// let isNew = false;
|
||||
// if (!user) {
|
||||
// user = await User.createUser(phone, phone.slice(-6));
|
||||
// isNew = true;
|
||||
// }
|
||||
// const token = await user.createToken(null, 'season');
|
||||
// return { ...token, isNew };
|
||||
// }
|
||||
// static initializeUser = initializeUser;
|
||||
// static createDemoUser = createDemoUser;
|
||||
// }
|
||||
|
||||
// useContextKey('UserModel', () => UserServices);
|
||||
|
||||
import { User, UserInit, UserServices } from '@kevisual/code-center-module/models';
|
||||
export { User, UserInit, UserServices };
|
||||
import { OrgInit } from '@kevisual/code-center-module/models';
|
||||
|
13
src/modules/config.ts
Normal file
13
src/modules/config.ts
Normal file
@ -0,0 +1,13 @@
|
||||
import path from 'path';
|
||||
import dotenv from 'dotenv';
|
||||
|
||||
const envFiles = [
|
||||
path.resolve(process.cwd(), '.env.dev'),
|
||||
path.resolve(process.cwd(), '.env'),
|
||||
];
|
||||
dotenv.config({
|
||||
path: envFiles,
|
||||
});
|
||||
|
||||
export const config = process.env;
|
||||
export const port = config.PORT || 4005;
|
@ -1,11 +1,5 @@
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
|
||||
type MinioConfig = {
|
||||
domain: string;
|
||||
};
|
||||
const config = useConfig<MinioConfig>();
|
||||
|
||||
/**
|
||||
* 用来放cookie的域名
|
||||
*/
|
||||
export const domain = config.domain || ''; // 请在这里填写你的域名
|
||||
export const domain = process.env.DOMAIN || ''; // 请在这里填写你的域名
|
||||
|
@ -1,14 +1,15 @@
|
||||
import { Client, ClientOptions } from 'minio';
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
|
||||
type MinioConfig = {
|
||||
minio: ClientOptions & { bucketName: string };
|
||||
const minioConfig = {
|
||||
endPoint: process.env.MINIO_ENDPOINT || 'localhost',
|
||||
port: parseInt(process.env.MINIO_PORT || '9000'),
|
||||
useSSL: process.env.MINIO_USE_SSL === 'true',
|
||||
accessKey: process.env.MINIO_ACCESS_KEY,
|
||||
secretKey: process.env.MINIO_SECRET_KEY,
|
||||
};
|
||||
const config = useConfig<MinioConfig>();
|
||||
export const minioClient = new Client(minioConfig);
|
||||
|
||||
const { bucketName, ...minioRest } = config.minio;
|
||||
export const minioClient = new Client(minioRest);
|
||||
export { bucketName };
|
||||
export const bucketName = process.env.MINIO_BUCKET_NAME || 'resources';
|
||||
if (!minioClient) {
|
||||
throw new Error('Minio client not initialized');
|
||||
}
|
||||
|
@ -1,9 +1,5 @@
|
||||
import { Redis } from 'ioredis';
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
|
||||
const config = useConfig<{
|
||||
redis: ConstructorParameters<typeof Redis>;
|
||||
}>();
|
||||
// 配置 Redis 连接
|
||||
export const redis = new Redis({
|
||||
host: 'localhost', // Redis 服务器的主机名或 IP 地址
|
||||
@ -16,7 +12,6 @@ export const redis = new Redis({
|
||||
return Math.min(times * 50, 2000); // 每次重试时延迟增加
|
||||
},
|
||||
maxRetriesPerRequest: null, // 允许请求重试的次数 (如果需要无限次重试)
|
||||
...config.redis,
|
||||
});
|
||||
|
||||
// 监听连接事件
|
||||
@ -31,4 +26,3 @@ redis.on('error', (err) => {
|
||||
// 初始化 Redis 客户端
|
||||
export const redisPublisher = new Redis(); // 用于发布消息
|
||||
export const redisSubscriber = new Redis(); // 用于订阅消息
|
||||
|
||||
|
@ -1,11 +1,7 @@
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
import childProcess from 'child_process';
|
||||
const config = useConfig<{
|
||||
appName: string;
|
||||
}>();
|
||||
|
||||
export const selfRestart = async () => {
|
||||
const appName = config.appName || 'codecenter';
|
||||
const appName = 'codecenter';
|
||||
// 检测 pm2 是否安装和是否有 appName 这个应用
|
||||
try {
|
||||
const res = childProcess.execSync(`pm2 list`);
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
import { Sequelize } from 'sequelize';
|
||||
|
||||
type PostgresConfig = {
|
||||
import { config } from './config.ts';
|
||||
export type PostgresConfig = {
|
||||
postgres: {
|
||||
username: string;
|
||||
password: string;
|
||||
@ -10,14 +9,17 @@ type PostgresConfig = {
|
||||
database: string;
|
||||
};
|
||||
};
|
||||
const config = useConfig<PostgresConfig>();
|
||||
|
||||
const postgresConfig = config.postgres;
|
||||
|
||||
if (!postgresConfig) {
|
||||
console.error('postgres config is required');
|
||||
if (!config.POSTGRES_PASSWORD || !config.POSTGRES_USER) {
|
||||
console.error('postgres config is required password and user');
|
||||
process.exit(1);
|
||||
}
|
||||
const postgresConfig = {
|
||||
username: config.POSTGRES_USER,
|
||||
password: config.POSTGRES_PASSWORD,
|
||||
host: config.POSTGRES_HOST || 'localhost',
|
||||
port: parseInt(config.POSTGRES_PORT || '5432'),
|
||||
database: config.POSTGRES_DB || 'postgres',
|
||||
};
|
||||
// connect to db
|
||||
export const sequelize = new Sequelize({
|
||||
dialect: 'postgres',
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { app } from '@/app.ts';
|
||||
import { AppModel } from './module/app.ts';
|
||||
import { AppDomainModel } from './module/app-domain.ts';
|
||||
import { AppModel } from '../module/app.ts';
|
||||
import { AppDomainModel } from '../module/app-domain.ts';
|
||||
|
||||
app
|
||||
.route({
|
||||
@ -12,7 +12,7 @@ app
|
||||
// const query = {
|
||||
// }
|
||||
const domainInfo = await AppDomainModel.findOne({ where: { domain } });
|
||||
if (!domainInfo) {
|
||||
if (!domainInfo || !domainInfo.appId) {
|
||||
ctx.throw(404, 'app not found');
|
||||
}
|
||||
const app = await AppModel.findByPk(domainInfo.appId);
|
2
src/routes/app-manager/domain/index.ts
Normal file
2
src/routes/app-manager/domain/index.ts
Normal file
@ -0,0 +1,2 @@
|
||||
import './domain-self.ts';
|
||||
import './manager.ts';
|
125
src/routes/app-manager/domain/manager.ts
Normal file
125
src/routes/app-manager/domain/manager.ts
Normal file
@ -0,0 +1,125 @@
|
||||
import { app } from '@/app.ts';
|
||||
import { AppDomainModel } from '../module/app-domain.ts';
|
||||
import { AppModel } from '../module/app.ts';
|
||||
import { CustomError } from '@kevisual/router';
|
||||
|
||||
app
|
||||
.route({
|
||||
path: 'app.domain.manager',
|
||||
key: 'list',
|
||||
middleware: ['auth-admin'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { page = 1, pageSize = 999 } = ctx.query.data || {};
|
||||
const { count, rows } = await AppDomainModel.findAndCountAll({
|
||||
offset: (page - 1) * pageSize,
|
||||
limit: pageSize,
|
||||
});
|
||||
ctx.body = { count, list: rows, pagination: { page, pageSize } };
|
||||
return ctx;
|
||||
})
|
||||
.addTo(app);
|
||||
|
||||
app
|
||||
.route({
|
||||
path: 'app.domain.manager',
|
||||
key: 'update',
|
||||
middleware: ['auth-admin'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { domain, data, id, ...rest } = ctx.query.data || {};
|
||||
if (!domain) {
|
||||
ctx.throw(400, 'domain is required');
|
||||
}
|
||||
let domainInfo: AppDomainModel;
|
||||
if (id) {
|
||||
domainInfo = await AppDomainModel.findByPk(id);
|
||||
} else {
|
||||
domainInfo = await AppDomainModel.create({ domain });
|
||||
}
|
||||
const checkAppId = async () => {
|
||||
const isUUID = (id: string) => {
|
||||
return /^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$/.test(id);
|
||||
};
|
||||
if (rest.appId) {
|
||||
if (!isUUID(rest.appId)) {
|
||||
ctx.throw(400, 'appId is not valid');
|
||||
}
|
||||
const appInfo = await AppModel.findByPk(rest.appId);
|
||||
if (!appInfo) {
|
||||
ctx.throw(400, 'appId is not exist');
|
||||
}
|
||||
}
|
||||
};
|
||||
try {
|
||||
if (!domainInfo) {
|
||||
domainInfo = await AppDomainModel.create({ domain, data: {}, ...rest });
|
||||
await checkAppId();
|
||||
} else {
|
||||
if (rest.status && domainInfo.status !== rest.status) {
|
||||
await domainInfo.clearCache();
|
||||
}
|
||||
await checkAppId();
|
||||
await domainInfo.update({
|
||||
domain,
|
||||
data: {
|
||||
...domainInfo.data,
|
||||
...data,
|
||||
},
|
||||
...rest,
|
||||
});
|
||||
}
|
||||
ctx.body = domainInfo;
|
||||
} catch (error) {
|
||||
if (error.code) {
|
||||
ctx.throw(error.code, error.message);
|
||||
}
|
||||
console.error(error);
|
||||
ctx.throw(500, 'update domain failed, please check the data');
|
||||
}
|
||||
|
||||
return ctx;
|
||||
})
|
||||
.addTo(app);
|
||||
|
||||
app
|
||||
.route({
|
||||
path: 'app.domain.manager',
|
||||
key: 'delete',
|
||||
middleware: ['auth-admin'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { id, domain } = ctx.query.data || {};
|
||||
if (!id && !domain) {
|
||||
ctx.throw(400, 'id or domain is required');
|
||||
}
|
||||
if (id) {
|
||||
await AppDomainModel.destroy({ where: { id }, force: true });
|
||||
} else {
|
||||
await AppDomainModel.destroy({ where: { domain }, force: true });
|
||||
}
|
||||
|
||||
ctx.body = { message: 'delete domain success' };
|
||||
return ctx;
|
||||
})
|
||||
.addTo(app);
|
||||
|
||||
app
|
||||
.route({
|
||||
path: 'app.domain.manager',
|
||||
key: 'get',
|
||||
middleware: ['auth-admin'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const { id, domain } = ctx.query.data || {};
|
||||
if (!id && !domain) {
|
||||
ctx.throw(400, 'id or domain is required');
|
||||
}
|
||||
const domainInfo = await AppDomainModel.findOne({ where: { id } });
|
||||
if (!domainInfo) {
|
||||
ctx.throw(404, 'domain not found');
|
||||
}
|
||||
ctx.body = domainInfo;
|
||||
return ctx;
|
||||
})
|
||||
.addTo(app);
|
@ -2,6 +2,6 @@ import './list.ts';
|
||||
import './user-app.ts';
|
||||
|
||||
import './public/index.ts';
|
||||
import './domain.ts';
|
||||
import './domain/index.ts';
|
||||
|
||||
export * from './module/index.ts';
|
||||
|
@ -1,6 +1,7 @@
|
||||
import { sequelize } from '../../../modules/sequelize.ts';
|
||||
import { DataTypes, Model } from 'sequelize';
|
||||
export type DomainList = Partial<InstanceType<typeof AppDomainModel>>;
|
||||
import { redis } from '../../../modules/redis.ts';
|
||||
|
||||
// 审核,通过,驳回
|
||||
const appDomainStatus = ['audit', 'auditReject', 'auditPending', 'running', 'stop'] as const;
|
||||
@ -16,6 +17,7 @@ export class AppDomainModel extends Model {
|
||||
// 状态,
|
||||
declare status: AppDomainStatus;
|
||||
declare uid: string;
|
||||
declare data: Record<string, any>;
|
||||
|
||||
declare createdAt: Date;
|
||||
declare updatedAt: Date;
|
||||
@ -28,6 +30,18 @@ export class AppDomainModel extends Model {
|
||||
// 原本是审核状态,不能修改。
|
||||
return false;
|
||||
}
|
||||
async clearCache() {
|
||||
// 清除缓存
|
||||
const cacheKey = `domain:${this.domain}`;
|
||||
const checkHas = async () => {
|
||||
const has = await redis.get(cacheKey);
|
||||
return has;
|
||||
};
|
||||
const has = await checkHas();
|
||||
if (has) {
|
||||
await redis.set(cacheKey, '', 'EX', 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
AppDomainModel.init(
|
||||
@ -43,13 +57,22 @@ AppDomainModel.init(
|
||||
allowNull: false,
|
||||
unique: true,
|
||||
},
|
||||
appId: {
|
||||
data: {
|
||||
type: DataTypes.JSONB,
|
||||
allowNull: true,
|
||||
},
|
||||
status: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
defaultValue: 'running',
|
||||
},
|
||||
appId: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: true,
|
||||
},
|
||||
uid: {
|
||||
type: DataTypes.STRING,
|
||||
allowNull: false,
|
||||
allowNull: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
import { app } from '@/app.ts';
|
||||
import { getFileStat, getMinioList, deleteFile, updateFileStat } from './module/get-minio-list.ts';
|
||||
import { getFileStat, getMinioList, deleteFile, updateFileStat, deleteFiles } from './module/get-minio-list.ts';
|
||||
import path from 'path';
|
||||
import { CustomError } from '@kevisual/router';
|
||||
import { get } from 'http';
|
||||
@ -147,3 +147,37 @@ app
|
||||
return ctx;
|
||||
})
|
||||
.addTo(app);
|
||||
|
||||
app
|
||||
.route({
|
||||
path: 'file',
|
||||
key: 'delete-all',
|
||||
middleware: ['auth'],
|
||||
})
|
||||
.define(async (ctx) => {
|
||||
const tokenUser = ctx.state.tokenUser;
|
||||
let directory = ctx.query.data?.directory as string;
|
||||
if (!directory) {
|
||||
ctx.throw(400, 'directory is required');
|
||||
}
|
||||
if (directory.startsWith('/')) {
|
||||
ctx.throw(400, 'directory is invalid, cannot start with /');
|
||||
}
|
||||
if (directory.endsWith('/')) {
|
||||
ctx.throw(400, 'directory is invalid, cannot end with /');
|
||||
}
|
||||
const prefix = tokenUser.username + '/' + directory + '/';
|
||||
const list = await getMinioList<true>({ prefix, recursive: true });
|
||||
if (list.length === 0) {
|
||||
ctx.throw(400, 'directory is empty');
|
||||
}
|
||||
const res = await deleteFiles(list.map((item) => item.name));
|
||||
if (!res) {
|
||||
ctx.throw(500, 'delete all failed');
|
||||
}
|
||||
ctx.body = {
|
||||
deleted: list.length,
|
||||
message: 'delete all success',
|
||||
};
|
||||
})
|
||||
.addTo(app);
|
||||
|
@ -16,10 +16,10 @@ export type MinioDirectory = {
|
||||
size: number;
|
||||
};
|
||||
export type MinioList = (MinioFile | MinioDirectory)[];
|
||||
export const getMinioList = async (opts: MinioListOpt): Promise<MinioList> => {
|
||||
export const getMinioList = async <IS_FILE extends boolean>(opts: MinioListOpt): Promise<IS_FILE extends true ? MinioFile[] : MinioDirectory[]> => {
|
||||
const prefix = opts.prefix;
|
||||
const recursive = opts.recursive ?? false;
|
||||
return await new Promise((resolve, reject) => {
|
||||
const res = await new Promise((resolve, reject) => {
|
||||
let res: any[] = [];
|
||||
let hasError = false;
|
||||
minioClient
|
||||
@ -40,6 +40,7 @@ export const getMinioList = async (opts: MinioListOpt): Promise<MinioList> => {
|
||||
}
|
||||
});
|
||||
});
|
||||
return res as IS_FILE extends true ? MinioFile[] : MinioDirectory[];
|
||||
};
|
||||
export const getFileStat = async (prefix: string, isFile?: boolean): Promise<any> => {
|
||||
try {
|
||||
|
@ -1,5 +1,5 @@
|
||||
import fetch from 'node-fetch';
|
||||
import { useConfig } from '@kevisual/use-config';
|
||||
import { useConfig } from '@kevisual/use-config/env';
|
||||
|
||||
type GithubConfig = {
|
||||
clientId: string;
|
||||
|
1
submodules/pay-center-code
Submodule
1
submodules/pay-center-code
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 0db28aecde061c597338839408d848ecfe59efdf
|
Loading…
x
Reference in New Issue
Block a user