From 1c820c30838c41d634d5f56c4dc9ef5f0e6a3841 Mon Sep 17 00:00:00 2001 From: xion Date: Tue, 11 Mar 2025 11:04:10 +0800 Subject: [PATCH] feat: add download micro-app for cli --- package.json | 13 +- pnpm-lock.yaml | 270 +++++++++++++-------------- src/routes-simple/code/upload.ts | 19 +- src/routes-simple/middleware/auth.ts | 13 +- src/routes-simple/upload.ts | 2 +- src/routes/app-manager/list.ts | 11 +- src/routes/micro-app/upload-list.ts | 13 +- src/scripts/user-change-pwd.ts | 0 8 files changed, 186 insertions(+), 155 deletions(-) create mode 100644 src/scripts/user-change-pwd.ts diff --git a/package.json b/package.json index 3d808eb..e7129f7 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@kevisual/code-center", - "version": "0.0.6-alpha.3", + "version": "0.0.6", "description": "code center", "type": "module", "main": "index.js", @@ -14,9 +14,10 @@ "deploy": "rsync -avz --delete ./dist/ --exclude='app.config.json5' light:~/apps/codecenter/dist", "clean": "rm -rf dist", "reload": "ssh light pm2 restart codecenter", - "pub": "npm run build && npm run deploy && npm run reload", + "pub:me": "npm run build && npm run deploy && npm run reload", "start": "pm2 start dist/app.mjs --name codecenter", "release": "node ./config/release/index.mjs", + "pub": "envision pack -p -u", "ssl": "ssl -L 6379:localhost:6379 light " }, "keywords": [], @@ -42,7 +43,7 @@ "jsonwebtoken": "^9.0.2", "lodash-es": "^4.17.21", "minio": "^8.0.4", - "nanoid": "^5.1.2", + "nanoid": "^5.1.3", "node-fetch": "^3.3.2", "p-queue": "^8.1.0", "pg": "^8.13.3", @@ -60,7 +61,7 @@ "@kevisual/code-center-module": "0.0.13", "@kevisual/types": "^0.0.6", "@rollup/plugin-alias": "^5.1.1", - "@rollup/plugin-commonjs": "^28.0.2", + "@rollup/plugin-commonjs": "^28.0.3", "@rollup/plugin-json": "^6.1.0", "@rollup/plugin-node-resolve": "^16.0.0", "@rollup/plugin-replace": "^6.0.2", @@ -70,14 +71,14 @@ "@types/formidable": "^3.4.5", "@types/jsonwebtoken": "^9.0.9", "@types/lodash-es": "^4.17.12", - "@types/node": "^22.13.9", + "@types/node": "^22.13.10", "@types/react": "^19.0.10", "@types/uuid": "^10.0.0", "concurrently": "^9.1.2", "cross-env": "^7.0.3", "nodemon": "^3.1.9", "rimraf": "^6.0.1", - "rollup": "^4.34.9", + "rollup": "^4.35.0", "rollup-plugin-copy": "^3.5.0", "rollup-plugin-dts": "^6.1.1", "tape": "^5.9.0", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 7ed7748..6f02685 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -56,8 +56,8 @@ importers: specifier: ^8.0.4 version: 8.0.4 nanoid: - specifier: ^5.1.2 - version: 5.1.2 + specifier: ^5.1.3 + version: 5.1.3 node-fetch: specifier: ^3.3.2 version: 3.3.2 @@ -72,7 +72,7 @@ importers: version: 5.4.3 rollup-plugin-esbuild: specifier: ^6.2.1 - version: 6.2.1(esbuild@0.25.0)(rollup@4.34.9) + version: 6.2.1(esbuild@0.25.0)(rollup@4.35.0) semver: specifier: ^7.7.1 version: 7.7.1 @@ -103,22 +103,22 @@ importers: version: 0.0.6 '@rollup/plugin-alias': specifier: ^5.1.1 - version: 5.1.1(rollup@4.34.9) + version: 5.1.1(rollup@4.35.0) '@rollup/plugin-commonjs': - specifier: ^28.0.2 - version: 28.0.2(rollup@4.34.9) + specifier: ^28.0.3 + version: 28.0.3(rollup@4.35.0) '@rollup/plugin-json': specifier: ^6.1.0 - version: 6.1.0(rollup@4.34.9) + version: 6.1.0(rollup@4.35.0) '@rollup/plugin-node-resolve': specifier: ^16.0.0 - version: 16.0.0(rollup@4.34.9) + version: 16.0.0(rollup@4.35.0) '@rollup/plugin-replace': specifier: ^6.0.2 - version: 6.0.2(rollup@4.34.9) + version: 6.0.2(rollup@4.35.0) '@rollup/plugin-typescript': specifier: ^12.1.2 - version: 12.1.2(rollup@4.34.9)(tslib@2.8.1)(typescript@5.8.2) + version: 12.1.2(rollup@4.35.0)(tslib@2.8.1)(typescript@5.8.2) '@types/archiver': specifier: ^6.0.3 version: 6.0.3 @@ -135,8 +135,8 @@ importers: specifier: ^4.17.12 version: 4.17.12 '@types/node': - specifier: ^22.13.9 - version: 22.13.9 + specifier: ^22.13.10 + version: 22.13.10 '@types/react': specifier: ^19.0.10 version: 19.0.10 @@ -156,14 +156,14 @@ importers: specifier: latest version: 6.0.1 rollup: - specifier: ^4.34.9 - version: 4.34.9 + specifier: ^4.35.0 + version: 4.35.0 rollup-plugin-copy: specifier: ^3.5.0 version: 3.5.0 rollup-plugin-dts: specifier: ^6.1.1 - version: 6.1.1(rollup@4.34.9)(typescript@5.8.2) + version: 6.1.1(rollup@4.35.0)(typescript@5.8.2) tape: specifier: ^5.9.0 version: 5.9.0 @@ -428,8 +428,8 @@ packages: rollup: optional: true - '@rollup/plugin-commonjs@28.0.2': - resolution: {integrity: sha512-BEFI2EDqzl+vA1rl97IDRZ61AIwGH093d9nz8+dThxJNH8oSoB7MjWvPCX3dkaK1/RCJ/1v/R1XB15FuSs0fQw==} + '@rollup/plugin-commonjs@28.0.3': + resolution: {integrity: sha512-pyltgilam1QPdn+Zd9gaCfOLcnjMEJ9gV+bTw6/r73INdvzf1ah9zLIJBm+kW7R6IUFIQ1YO+VqZtYxZNWFPEQ==} engines: {node: '>=16.0.0 || 14 >= 14.17'} peerDependencies: rollup: ^2.68.0||^3.0.0||^4.0.0 @@ -486,98 +486,98 @@ packages: rollup: optional: true - '@rollup/rollup-android-arm-eabi@4.34.9': - resolution: {integrity: sha512-qZdlImWXur0CFakn2BJ2znJOdqYZKiedEPEVNTBrpfPjc/YuTGcaYZcdmNFTkUj3DU0ZM/AElcM8Ybww3xVLzA==} + '@rollup/rollup-android-arm-eabi@4.35.0': + resolution: {integrity: sha512-uYQ2WfPaqz5QtVgMxfN6NpLD+no0MYHDBywl7itPYd3K5TjjSghNKmX8ic9S8NU8w81NVhJv/XojcHptRly7qQ==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.34.9': - resolution: {integrity: sha512-4KW7P53h6HtJf5Y608T1ISKvNIYLWRKMvfnG0c44M6In4DQVU58HZFEVhWINDZKp7FZps98G3gxwC1sb0wXUUg==} + '@rollup/rollup-android-arm64@4.35.0': + resolution: {integrity: sha512-FtKddj9XZudurLhdJnBl9fl6BwCJ3ky8riCXjEw3/UIbjmIY58ppWwPEvU3fNu+W7FUsAsB1CdH+7EQE6CXAPA==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.34.9': - resolution: {integrity: sha512-0CY3/K54slrzLDjOA7TOjN1NuLKERBgk9nY5V34mhmuu673YNb+7ghaDUs6N0ujXR7fz5XaS5Aa6d2TNxZd0OQ==} + '@rollup/rollup-darwin-arm64@4.35.0': + resolution: {integrity: sha512-Uk+GjOJR6CY844/q6r5DR/6lkPFOw0hjfOIzVx22THJXMxktXG6CbejseJFznU8vHcEBLpiXKY3/6xc+cBm65Q==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.34.9': - resolution: {integrity: sha512-eOojSEAi/acnsJVYRxnMkPFqcxSMFfrw7r2iD9Q32SGkb/Q9FpUY1UlAu1DH9T7j++gZ0lHjnm4OyH2vCI7l7Q==} + '@rollup/rollup-darwin-x64@4.35.0': + resolution: {integrity: sha512-3IrHjfAS6Vkp+5bISNQnPogRAW5GAV1n+bNCrDwXmfMHbPl5EhTmWtfmwlJxFRUCBZ+tZ/OxDyU08aF6NI/N5Q==} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.34.9': - resolution: {integrity: sha512-2lzjQPJbN5UnHm7bHIUKFMulGTQwdvOkouJDpPysJS+QFBGDJqcfh+CxxtG23Ik/9tEvnebQiylYoazFMAgrYw==} + '@rollup/rollup-freebsd-arm64@4.35.0': + resolution: {integrity: sha512-sxjoD/6F9cDLSELuLNnY0fOrM9WA0KrM0vWm57XhrIMf5FGiN8D0l7fn+bpUeBSU7dCgPV2oX4zHAsAXyHFGcQ==} cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.34.9': - resolution: {integrity: sha512-SLl0hi2Ah2H7xQYd6Qaiu01kFPzQ+hqvdYSoOtHYg/zCIFs6t8sV95kaoqjzjFwuYQLtOI0RZre/Ke0nPaQV+g==} + '@rollup/rollup-freebsd-x64@4.35.0': + resolution: {integrity: sha512-2mpHCeRuD1u/2kruUiHSsnjWtHjqVbzhBkNVQ1aVD63CcexKVcQGwJ2g5VphOd84GvxfSvnnlEyBtQCE5hxVVw==} cpu: [x64] os: [freebsd] - '@rollup/rollup-linux-arm-gnueabihf@4.34.9': - resolution: {integrity: sha512-88I+D3TeKItrw+Y/2ud4Tw0+3CxQ2kLgu3QvrogZ0OfkmX/DEppehus7L3TS2Q4lpB+hYyxhkQiYPJ6Mf5/dPg==} + '@rollup/rollup-linux-arm-gnueabihf@4.35.0': + resolution: {integrity: sha512-mrA0v3QMy6ZSvEuLs0dMxcO2LnaCONs1Z73GUDBHWbY8tFFocM6yl7YyMu7rz4zS81NDSqhrUuolyZXGi8TEqg==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.34.9': - resolution: {integrity: sha512-3qyfWljSFHi9zH0KgtEPG4cBXHDFhwD8kwg6xLfHQ0IWuH9crp005GfoUUh/6w9/FWGBwEHg3lxK1iHRN1MFlA==} + '@rollup/rollup-linux-arm-musleabihf@4.35.0': + resolution: {integrity: sha512-DnYhhzcvTAKNexIql8pFajr0PiDGrIsBYPRvCKlA5ixSS3uwo/CWNZxB09jhIapEIg945KOzcYEAGGSmTSpk7A==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.34.9': - resolution: {integrity: sha512-6TZjPHjKZUQKmVKMUowF3ewHxctrRR09eYyvT5eFv8w/fXarEra83A2mHTVJLA5xU91aCNOUnM+DWFMSbQ0Nxw==} + '@rollup/rollup-linux-arm64-gnu@4.35.0': + resolution: {integrity: sha512-uagpnH2M2g2b5iLsCTZ35CL1FgyuzzJQ8L9VtlJ+FckBXroTwNOaD0z0/UF+k5K3aNQjbm8LIVpxykUOQt1m/A==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.34.9': - resolution: {integrity: sha512-LD2fytxZJZ6xzOKnMbIpgzFOuIKlxVOpiMAXawsAZ2mHBPEYOnLRK5TTEsID6z4eM23DuO88X0Tq1mErHMVq0A==} + '@rollup/rollup-linux-arm64-musl@4.35.0': + resolution: {integrity: sha512-XQxVOCd6VJeHQA/7YcqyV0/88N6ysSVzRjJ9I9UA/xXpEsjvAgDTgH3wQYz5bmr7SPtVK2TsP2fQ2N9L4ukoUg==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-loongarch64-gnu@4.34.9': - resolution: {integrity: sha512-dRAgTfDsn0TE0HI6cmo13hemKpVHOEyeciGtvlBTkpx/F65kTvShtY/EVyZEIfxFkV5JJTuQ9tP5HGBS0hfxIg==} + '@rollup/rollup-linux-loongarch64-gnu@4.35.0': + resolution: {integrity: sha512-5pMT5PzfgwcXEwOaSrqVsz/LvjDZt+vQ8RT/70yhPU06PTuq8WaHhfT1LW+cdD7mW6i/J5/XIkX/1tCAkh1W6g==} cpu: [loong64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.34.9': - resolution: {integrity: sha512-PHcNOAEhkoMSQtMf+rJofwisZqaU8iQ8EaSps58f5HYll9EAY5BSErCZ8qBDMVbq88h4UxaNPlbrKqfWP8RfJA==} + '@rollup/rollup-linux-powerpc64le-gnu@4.35.0': + resolution: {integrity: sha512-c+zkcvbhbXF98f4CtEIP1EBA/lCic5xB0lToneZYvMeKu5Kamq3O8gqrxiYYLzlZH6E3Aq+TSW86E4ay8iD8EA==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.34.9': - resolution: {integrity: sha512-Z2i0Uy5G96KBYKjeQFKbbsB54xFOL5/y1P5wNBsbXB8yE+At3oh0DVMjQVzCJRJSfReiB2tX8T6HUFZ2k8iaKg==} + '@rollup/rollup-linux-riscv64-gnu@4.35.0': + resolution: {integrity: sha512-s91fuAHdOwH/Tad2tzTtPX7UZyytHIRR6V4+2IGlV0Cej5rkG0R61SX4l4y9sh0JBibMiploZx3oHKPnQBKe4g==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.34.9': - resolution: {integrity: sha512-U+5SwTMoeYXoDzJX5dhDTxRltSrIax8KWwfaaYcynuJw8mT33W7oOgz0a+AaXtGuvhzTr2tVKh5UO8GVANTxyQ==} + '@rollup/rollup-linux-s390x-gnu@4.35.0': + resolution: {integrity: sha512-hQRkPQPLYJZYGP+Hj4fR9dDBMIM7zrzJDWFEMPdTnTy95Ljnv0/4w/ixFw3pTBMEuuEuoqtBINYND4M7ujcuQw==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.34.9': - resolution: {integrity: sha512-FwBHNSOjUTQLP4MG7y6rR6qbGw4MFeQnIBrMe161QGaQoBQLqSUEKlHIiVgF3g/mb3lxlxzJOpIBhaP+C+KP2A==} + '@rollup/rollup-linux-x64-gnu@4.35.0': + resolution: {integrity: sha512-Pim1T8rXOri+0HmV4CdKSGrqcBWX0d1HoPnQ0uw0bdp1aP5SdQVNBy8LjYncvnLgu3fnnCt17xjWGd4cqh8/hA==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.34.9': - resolution: {integrity: sha512-cYRpV4650z2I3/s6+5/LONkjIz8MBeqrk+vPXV10ORBnshpn8S32bPqQ2Utv39jCiDcO2eJTuSlPXpnvmaIgRA==} + '@rollup/rollup-linux-x64-musl@4.35.0': + resolution: {integrity: sha512-QysqXzYiDvQWfUiTm8XmJNO2zm9yC9P/2Gkrwg2dH9cxotQzunBHYr6jk4SujCTqnfGxduOmQcI7c2ryuW8XVg==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.34.9': - resolution: {integrity: sha512-z4mQK9dAN6byRA/vsSgQiPeuO63wdiDxZ9yg9iyX2QTzKuQM7T4xlBoeUP/J8uiFkqxkcWndWi+W7bXdPbt27Q==} + '@rollup/rollup-win32-arm64-msvc@4.35.0': + resolution: {integrity: sha512-OUOlGqPkVJCdJETKOCEf1mw848ZyJ5w50/rZ/3IBQVdLfR5jk/6Sr5m3iO2tdPgwo0x7VcncYuOvMhBWZq8ayg==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.34.9': - resolution: {integrity: sha512-KB48mPtaoHy1AwDNkAJfHXvHp24H0ryZog28spEs0V48l3H1fr4i37tiyHsgKZJnCmvxsbATdZGBpbmxTE3a9w==} + '@rollup/rollup-win32-ia32-msvc@4.35.0': + resolution: {integrity: sha512-2/lsgejMrtwQe44glq7AFFHLfJBPafpsTa6JvP2NGef/ifOa4KBoglVf7AKN7EV9o32evBPRqfg96fEHzWo5kw==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.34.9': - resolution: {integrity: sha512-AyleYRPU7+rgkMWbEh71fQlrzRfeP6SyMnRf9XX4fCdDPAJumdSBqYEcWPMzVQ4ScAl7E4oFfK0GUVn77xSwbw==} + '@rollup/rollup-win32-x64-msvc@4.35.0': + resolution: {integrity: sha512-PIQeY5XDkrOysbQblSW7v3l1MDZzkTEzAfTPkj5VAu3FW8fS4ynyLg2sINp0fp3SjZ8xkRYpLqoKcYqAkhU1dw==} cpu: [x64] os: [win32] @@ -632,8 +632,8 @@ packages: '@types/node-forge@1.3.11': resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} - '@types/node@22.13.9': - resolution: {integrity: sha512-acBjXdRJ3A6Pb3tqnw9HZmyR3Fiol3aGxRCK1x3d+6CDAMjl7I649wpSd+yNURCjbOUGu9tqtLKnTGxmK6CyGw==} + '@types/node@22.13.10': + resolution: {integrity: sha512-I6LPUvlRH+O6VRUqYOcMudhaIdUVWfsjnZavnsraHvpBwaEyMN29ry+0UVJhImYL16xsscu0aske3yA+uPOWfw==} '@types/react@19.0.10': resolution: {integrity: sha512-JuRQ9KXLEjaUNjTWpzuR231Z2WpIwczOkBEIvbHNCzQefFIT0L8IqE6NV6ULLyC1SI/i234JnDoMkfg+RjQj2g==} @@ -1662,8 +1662,8 @@ packages: mute-stream@0.0.8: resolution: {integrity: sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==} - nanoid@5.1.2: - resolution: {integrity: sha512-b+CiXQCNMUGe0Ri64S9SXFcP9hogjAJ2Rd6GdVxhPLRm7mhGaM7VgOvCAJ1ZshfHbqVDI3uqTI5C8/GaKuLI7g==} + nanoid@5.1.3: + resolution: {integrity: sha512-zAbEOEr7u2CbxwoMRlz/pNSpRP0FdAU4pRaYunCdEezWohXFs+a0Xw7RfkKaezMsmSM1vttcLthJtwRnVtOfHQ==} engines: {node: ^18 || >=20} hasBin: true @@ -1985,8 +1985,8 @@ packages: esbuild: '>=0.18.0' rollup: ^1.20.0 || ^2.0.0 || ^3.0.0 || ^4.0.0 - rollup@4.34.9: - resolution: {integrity: sha512-nF5XYqWWp9hx/LrpC8sZvvvmq0TeTjQgaZHYmAgwysT9nh8sWnZhBnM8ZyVbbJFIQBLwHDNoMqsBZBbUo4U8sQ==} + rollup@4.35.0: + resolution: {integrity: sha512-kg6oI4g+vc41vePJyO6dHt/yl0Rz3Thv0kJeVQ3D1kS3E5XSuKbPc29G4IpT/Kv1KQwgHVcN+HtyS+HYLNSvQg==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -2574,7 +2574,7 @@ snapshots: '@kevisual/router': 0.0.9 '@kevisual/use-config': 1.0.9 ioredis: 5.6.0 - nanoid: 5.1.2 + nanoid: 5.1.3 pg: 8.13.3 sequelize: 6.37.6(pg@8.13.3) socket.io: 4.8.1 @@ -2685,13 +2685,13 @@ snapshots: transitivePeerDependencies: - supports-color - '@rollup/plugin-alias@5.1.1(rollup@4.34.9)': + '@rollup/plugin-alias@5.1.1(rollup@4.35.0)': optionalDependencies: - rollup: 4.34.9 + rollup: 4.35.0 - '@rollup/plugin-commonjs@28.0.2(rollup@4.34.9)': + '@rollup/plugin-commonjs@28.0.3(rollup@4.35.0)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.34.9) + '@rollup/pluginutils': 5.1.2(rollup@4.35.0) commondir: 1.0.1 estree-walker: 2.0.2 fdir: 6.3.0(picomatch@4.0.2) @@ -2699,103 +2699,103 @@ snapshots: magic-string: 0.30.11 picomatch: 4.0.2 optionalDependencies: - rollup: 4.34.9 + rollup: 4.35.0 - '@rollup/plugin-json@6.1.0(rollup@4.34.9)': + '@rollup/plugin-json@6.1.0(rollup@4.35.0)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.34.9) + '@rollup/pluginutils': 5.1.2(rollup@4.35.0) optionalDependencies: - rollup: 4.34.9 + rollup: 4.35.0 - '@rollup/plugin-node-resolve@16.0.0(rollup@4.34.9)': + '@rollup/plugin-node-resolve@16.0.0(rollup@4.35.0)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.34.9) + '@rollup/pluginutils': 5.1.2(rollup@4.35.0) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-module: 1.0.0 resolve: 1.22.8 optionalDependencies: - rollup: 4.34.9 + rollup: 4.35.0 - '@rollup/plugin-replace@6.0.2(rollup@4.34.9)': + '@rollup/plugin-replace@6.0.2(rollup@4.35.0)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.34.9) + '@rollup/pluginutils': 5.1.2(rollup@4.35.0) magic-string: 0.30.11 optionalDependencies: - rollup: 4.34.9 + rollup: 4.35.0 - '@rollup/plugin-typescript@12.1.2(rollup@4.34.9)(tslib@2.8.1)(typescript@5.8.2)': + '@rollup/plugin-typescript@12.1.2(rollup@4.35.0)(tslib@2.8.1)(typescript@5.8.2)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.34.9) + '@rollup/pluginutils': 5.1.2(rollup@4.35.0) resolve: 1.22.8 typescript: 5.8.2 optionalDependencies: - rollup: 4.34.9 + rollup: 4.35.0 tslib: 2.8.1 - '@rollup/pluginutils@5.1.2(rollup@4.34.9)': + '@rollup/pluginutils@5.1.2(rollup@4.35.0)': dependencies: '@types/estree': 1.0.6 estree-walker: 2.0.2 picomatch: 4.0.2 optionalDependencies: - rollup: 4.34.9 + rollup: 4.35.0 - '@rollup/rollup-android-arm-eabi@4.34.9': + '@rollup/rollup-android-arm-eabi@4.35.0': optional: true - '@rollup/rollup-android-arm64@4.34.9': + '@rollup/rollup-android-arm64@4.35.0': optional: true - '@rollup/rollup-darwin-arm64@4.34.9': + '@rollup/rollup-darwin-arm64@4.35.0': optional: true - '@rollup/rollup-darwin-x64@4.34.9': + '@rollup/rollup-darwin-x64@4.35.0': optional: true - '@rollup/rollup-freebsd-arm64@4.34.9': + '@rollup/rollup-freebsd-arm64@4.35.0': optional: true - '@rollup/rollup-freebsd-x64@4.34.9': + '@rollup/rollup-freebsd-x64@4.35.0': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.34.9': + '@rollup/rollup-linux-arm-gnueabihf@4.35.0': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.34.9': + '@rollup/rollup-linux-arm-musleabihf@4.35.0': optional: true - '@rollup/rollup-linux-arm64-gnu@4.34.9': + '@rollup/rollup-linux-arm64-gnu@4.35.0': optional: true - '@rollup/rollup-linux-arm64-musl@4.34.9': + '@rollup/rollup-linux-arm64-musl@4.35.0': optional: true - '@rollup/rollup-linux-loongarch64-gnu@4.34.9': + '@rollup/rollup-linux-loongarch64-gnu@4.35.0': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.34.9': + '@rollup/rollup-linux-powerpc64le-gnu@4.35.0': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.34.9': + '@rollup/rollup-linux-riscv64-gnu@4.35.0': optional: true - '@rollup/rollup-linux-s390x-gnu@4.34.9': + '@rollup/rollup-linux-s390x-gnu@4.35.0': optional: true - '@rollup/rollup-linux-x64-gnu@4.34.9': + '@rollup/rollup-linux-x64-gnu@4.35.0': optional: true - '@rollup/rollup-linux-x64-musl@4.34.9': + '@rollup/rollup-linux-x64-musl@4.35.0': optional: true - '@rollup/rollup-win32-arm64-msvc@4.34.9': + '@rollup/rollup-win32-arm64-msvc@4.35.0': optional: true - '@rollup/rollup-win32-ia32-msvc@4.34.9': + '@rollup/rollup-win32-ia32-msvc@4.35.0': optional: true - '@rollup/rollup-win32-x64-msvc@4.34.9': + '@rollup/rollup-win32-x64-msvc@4.35.0': optional: true '@socket.io/component-emitter@3.1.2': {} @@ -2810,7 +2810,7 @@ snapshots: '@types/cors@2.8.17': dependencies: - '@types/node': 22.13.9 + '@types/node': 22.13.10 '@types/crypto-js@4.2.2': {} @@ -2822,21 +2822,21 @@ snapshots: '@types/formidable@3.4.5': dependencies: - '@types/node': 22.13.9 + '@types/node': 22.13.10 '@types/fs-extra@8.1.5': dependencies: - '@types/node': 22.13.9 + '@types/node': 22.13.10 '@types/glob@7.2.0': dependencies: '@types/minimatch': 5.1.2 - '@types/node': 22.13.9 + '@types/node': 22.13.10 '@types/jsonwebtoken@9.0.9': dependencies: '@types/ms': 0.7.34 - '@types/node': 22.13.9 + '@types/node': 22.13.10 '@types/lodash-es@4.17.12': dependencies: @@ -2850,9 +2850,9 @@ snapshots: '@types/node-forge@1.3.11': dependencies: - '@types/node': 22.13.9 + '@types/node': 22.13.10 - '@types/node@22.13.9': + '@types/node@22.13.10': dependencies: undici-types: 6.20.0 @@ -2862,7 +2862,7 @@ snapshots: '@types/readdir-glob@1.1.5': dependencies: - '@types/node': 22.13.9 + '@types/node': 22.13.10 '@types/resolve@1.20.2': {} @@ -3256,7 +3256,7 @@ snapshots: dependencies: '@types/cookie': 0.4.1 '@types/cors': 2.8.17 - '@types/node': 22.13.9 + '@types/node': 22.13.10 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.4.2 @@ -3990,7 +3990,7 @@ snapshots: mute-stream@0.0.8: {} - nanoid@5.1.2: {} + nanoid@5.1.3: {} needle@2.4.0: dependencies: @@ -4367,48 +4367,48 @@ snapshots: globby: 10.0.1 is-plain-object: 3.0.1 - rollup-plugin-dts@6.1.1(rollup@4.34.9)(typescript@5.8.2): + rollup-plugin-dts@6.1.1(rollup@4.35.0)(typescript@5.8.2): dependencies: magic-string: 0.30.11 - rollup: 4.34.9 + rollup: 4.35.0 typescript: 5.8.2 optionalDependencies: '@babel/code-frame': 7.26.2 - rollup-plugin-esbuild@6.2.1(esbuild@0.25.0)(rollup@4.34.9): + rollup-plugin-esbuild@6.2.1(esbuild@0.25.0)(rollup@4.35.0): dependencies: debug: 4.4.0 es-module-lexer: 1.6.0 esbuild: 0.25.0 get-tsconfig: 4.10.0 - rollup: 4.34.9 + rollup: 4.35.0 unplugin-utils: 0.2.4 transitivePeerDependencies: - supports-color - rollup@4.34.9: + rollup@4.35.0: dependencies: '@types/estree': 1.0.6 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.34.9 - '@rollup/rollup-android-arm64': 4.34.9 - '@rollup/rollup-darwin-arm64': 4.34.9 - '@rollup/rollup-darwin-x64': 4.34.9 - '@rollup/rollup-freebsd-arm64': 4.34.9 - '@rollup/rollup-freebsd-x64': 4.34.9 - '@rollup/rollup-linux-arm-gnueabihf': 4.34.9 - '@rollup/rollup-linux-arm-musleabihf': 4.34.9 - '@rollup/rollup-linux-arm64-gnu': 4.34.9 - '@rollup/rollup-linux-arm64-musl': 4.34.9 - '@rollup/rollup-linux-loongarch64-gnu': 4.34.9 - '@rollup/rollup-linux-powerpc64le-gnu': 4.34.9 - '@rollup/rollup-linux-riscv64-gnu': 4.34.9 - '@rollup/rollup-linux-s390x-gnu': 4.34.9 - '@rollup/rollup-linux-x64-gnu': 4.34.9 - '@rollup/rollup-linux-x64-musl': 4.34.9 - '@rollup/rollup-win32-arm64-msvc': 4.34.9 - '@rollup/rollup-win32-ia32-msvc': 4.34.9 - '@rollup/rollup-win32-x64-msvc': 4.34.9 + '@rollup/rollup-android-arm-eabi': 4.35.0 + '@rollup/rollup-android-arm64': 4.35.0 + '@rollup/rollup-darwin-arm64': 4.35.0 + '@rollup/rollup-darwin-x64': 4.35.0 + '@rollup/rollup-freebsd-arm64': 4.35.0 + '@rollup/rollup-freebsd-x64': 4.35.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.35.0 + '@rollup/rollup-linux-arm-musleabihf': 4.35.0 + '@rollup/rollup-linux-arm64-gnu': 4.35.0 + '@rollup/rollup-linux-arm64-musl': 4.35.0 + '@rollup/rollup-linux-loongarch64-gnu': 4.35.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.35.0 + '@rollup/rollup-linux-riscv64-gnu': 4.35.0 + '@rollup/rollup-linux-s390x-gnu': 4.35.0 + '@rollup/rollup-linux-x64-gnu': 4.35.0 + '@rollup/rollup-linux-x64-musl': 4.35.0 + '@rollup/rollup-win32-arm64-msvc': 4.35.0 + '@rollup/rollup-win32-ia32-msvc': 4.35.0 + '@rollup/rollup-win32-x64-msvc': 4.35.0 fsevents: 2.3.3 run-parallel@1.2.0: @@ -4861,7 +4861,7 @@ snapshots: wkx@0.5.0: dependencies: - '@types/node': 22.13.9 + '@types/node': 22.13.10 wrap-ansi@7.0.0: dependencies: diff --git a/src/routes-simple/code/upload.ts b/src/routes-simple/code/upload.ts index d0c1b02..f26a63b 100644 --- a/src/routes-simple/code/upload.ts +++ b/src/routes-simple/code/upload.ts @@ -129,18 +129,27 @@ router.get('/api/micro-app/download/:id', async (req, res) => { res.end(error('Key parameter is required')); return; } - + const query = new URL(req.url || '', 'http://localhost'); + const notNeedToken = query.searchParams.get('notNeedToken') || ''; + const fileTitle = query.searchParams.get('title') || ''; if (res.headersSent) return; // 如果响应已发送,不再处理 let tokenUser; - if (!DEV_SERVER) { + if (!DEV_SERVER && !notNeedToken) { const auth = await checkAuth(req, res); tokenUser = auth.tokenUser; if (!tokenUser) return; } - const file = await MicroAppUploadModel.findByPk(id); + let file: MicroAppUploadModel | null = null; if (!DEV_SERVER) { - file.uid !== tokenUser.id && res.end(error('No permission', 403)); - return; + // file.uid !== tokenUser.id && res.end(error('No permission', 403)); + // return; + } + if (fileTitle) { + file = await MicroAppUploadModel.findOne({ + where: { title: fileTitle }, + }); + } else if (id) { + file = await MicroAppUploadModel.findByPk(id); } if (!file) { diff --git a/src/routes-simple/middleware/auth.ts b/src/routes-simple/middleware/auth.ts index 812643c..9e8a361 100644 --- a/src/routes-simple/middleware/auth.ts +++ b/src/routes-simple/middleware/auth.ts @@ -5,13 +5,22 @@ export const error = (msg: string, code = 500) => { return JSON.stringify({ code, message: msg }); }; export const checkAuth = async (req: http.IncomingMessage, res: http.ServerResponse) => { + let token = ''; const authroization = req.headers?.['authorization'] as string; - if (!authroization) { + const url = new URL(req.url || '', 'http://localhost'); + const resNoPermission = () => { res.statusCode = 401; res.end(error('Invalid authorization')); return { tokenUser: null, token: null }; + }; + if (authroization) { + // return resNoPermission(); + token = authroization.split(' ')[1]; + } else if (url.searchParams.get('token')) { + token = url.searchParams.get('token') || ''; + } else { + return resNoPermission(); } - const token = authroization.split(' ')[1]; let tokenUser; try { tokenUser = await User.verifyToken(token); diff --git a/src/routes-simple/upload.ts b/src/routes-simple/upload.ts index 2bfe301..19ee692 100644 --- a/src/routes-simple/upload.ts +++ b/src/routes-simple/upload.ts @@ -159,7 +159,7 @@ router.post('/api/app/upload', async (req, res) => { } if (username) { const user = await User.getUserByToken(token); - const has = user.hasUser(username); + const has = await user.hasUser(username, true); if (!has) { res.end(error('username is not found')); clearFiles(); diff --git a/src/routes/app-manager/list.ts b/src/routes/app-manager/list.ts index 9278aba..26ad9a3 100644 --- a/src/routes/app-manager/list.ts +++ b/src/routes/app-manager/list.ts @@ -241,8 +241,15 @@ app key: 'getApp', }) .define(async (ctx) => { - const { user, key } = ctx.query.data; - const app = await AppModel.findOne({ where: { user, key } }); + const { user, key, id } = ctx.query.data; + let app; + if (id) { + app = await AppModel.findByPk(id); + } else if (user && key) { + app = await AppModel.findOne({ where: { user, key } }); + } else { + throw new CustomError('user or key is required'); + } if (!app) { throw new CustomError('app not found'); } diff --git a/src/routes/micro-app/upload-list.ts b/src/routes/micro-app/upload-list.ts index a94ea1c..b8f42f4 100644 --- a/src/routes/micro-app/upload-list.ts +++ b/src/routes/micro-app/upload-list.ts @@ -27,10 +27,15 @@ app description: 'Get a single micro app upload', }) .define(async (ctx) => { - const { id } = ctx.query; - const upload = await MicroAppUploadModel.findOne({ - where: { id }, - }); + const { id, title } = ctx.query; + let upload: MicroAppUploadModel | null = null; + if (id) { + upload = await MicroAppUploadModel.findByPk(id); + } else if (title) { + upload = await MicroAppUploadModel.findOne({ + where: { title }, + }); + } if (upload) { ctx.body = upload; } else { diff --git a/src/scripts/user-change-pwd.ts b/src/scripts/user-change-pwd.ts new file mode 100644 index 0000000..e69de29