From 87014f4d74528c1a4dff98e49e2d10e8bad83051 Mon Sep 17 00:00:00 2001 From: xion Date: Sun, 30 Mar 2025 00:38:10 +0800 Subject: [PATCH] fix bug for user app login --- package.json | 12 +- pnpm-lock.yaml | 318 +++++++++++++++++++++---------------- src/middleware/auth.ts | 63 ++++++++ src/module/get-user-app.ts | 27 +++- src/module/index.ts | 24 ++- src/module/models.ts | 9 +- 6 files changed, 296 insertions(+), 157 deletions(-) create mode 100644 src/middleware/auth.ts diff --git a/package.json b/package.json index b6b7716..2d885f9 100644 --- a/package.json +++ b/package.json @@ -36,25 +36,27 @@ "@rollup/plugin-node-resolve": "^16.0.1", "@rollup/plugin-typescript": "^12.1.2", "@types/http-proxy": "^1.17.16", - "@types/node": "^22.13.11", + "@types/node": "^22.13.14", "@types/send": "^0.17.4", "concurrently": "^9.1.2", "cross-env": "^7.0.3", "nodemon": "^3.1.9", - "rollup": "^4.37.0", + "rollup": "^4.38.0", "tslib": "^2.8.1", "typescript": "^5.8.2" }, "dependencies": { - "@kevisual/code-center-module": "0.0.13", + "@kevisual/code-center-module": "0.0.16", + "@kevisual/permission": "^0.0.1", "@kevisual/router": "0.0.9", "@kevisual/use-config": "^1.0.10", "archiver": "^7.0.1", + "cookie": "^1.0.2", "ioredis": "^5.6.0", "minio": "^8.0.5", "nanoid": "^5.1.5", - "send": "^1.1.0", - "sequelize": "^6.37.6" + "send": "^1.2.0", + "sequelize": "^6.37.7" }, "resolutions": { "picomatch": "^4.0.2" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index cf2a207..3e6e19e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -12,8 +12,11 @@ importers: .: dependencies: '@kevisual/code-center-module': - specifier: 0.0.13 - version: 0.0.13(@kevisual/auth@1.0.5)(@kevisual/router@0.0.9)(@kevisual/use-config@1.0.10(dotenv@16.4.7))(ioredis@5.6.0)(pg@8.13.3)(sequelize@6.37.6(pg@8.13.3)) + specifier: 0.0.16 + version: 0.0.16(@kevisual/auth@1.0.5)(@kevisual/router@0.0.9)(@kevisual/use-config@1.0.10(dotenv@16.4.7))(ioredis@5.6.0)(pg@8.13.3)(sequelize@6.37.7(pg@8.13.3)) + '@kevisual/permission': + specifier: ^0.0.1 + version: 0.0.1 '@kevisual/router': specifier: 0.0.9 version: 0.0.9 @@ -23,6 +26,9 @@ importers: archiver: specifier: ^7.0.1 version: 7.0.1 + cookie: + specifier: ^1.0.2 + version: 1.0.2 ioredis: specifier: ^5.6.0 version: 5.6.0 @@ -33,30 +39,30 @@ importers: specifier: ^5.1.5 version: 5.1.5 send: - specifier: ^1.1.0 - version: 1.1.0 + specifier: ^1.2.0 + version: 1.2.0 sequelize: - specifier: ^6.37.6 - version: 6.37.6(pg@8.13.3) + specifier: ^6.37.7 + version: 6.37.7(pg@8.13.3) devDependencies: '@rollup/plugin-commonjs': specifier: ^28.0.3 - version: 28.0.3(rollup@4.36.0) + version: 28.0.3(rollup@4.38.0) '@rollup/plugin-json': specifier: ^6.1.0 - version: 6.1.0(rollup@4.36.0) + version: 6.1.0(rollup@4.38.0) '@rollup/plugin-node-resolve': specifier: ^16.0.1 - version: 16.0.1(rollup@4.36.0) + version: 16.0.1(rollup@4.38.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.38.0)(tslib@2.8.1)(typescript@5.8.2) '@types/http-proxy': specifier: ^1.17.16 version: 1.17.16 '@types/node': - specifier: ^22.13.11 - version: 22.13.11 + specifier: ^22.13.14 + version: 22.13.14 '@types/send': specifier: ^0.17.4 version: 0.17.4 @@ -70,8 +76,8 @@ importers: specifier: ^3.1.9 version: 3.1.9 rollup: - specifier: ^4.36.0 - version: 4.36.0 + specifier: ^4.38.0 + version: 4.38.0 tslib: specifier: ^2.8.1 version: 2.8.1 @@ -94,8 +100,8 @@ packages: '@kevisual/auth@1.0.5': resolution: {integrity: sha512-GwsLj7unKXi7lmMiIIgdig4LwwLiDJnOy15HHZR5gMbyK6s5/uJiMY5RXPB2+onGzTNDqFo/hXjsD2wkerHPVg==} - '@kevisual/code-center-module@0.0.13': - resolution: {integrity: sha512-A82sX8rdG2igyVLIF+0dagcUsGfk2b0JAga1BDDr9mrChrG1HbG1uYN7JJdjJbGE6zGYqGxRZwxKZmzB/+KMnw==} + '@kevisual/code-center-module@0.0.16': + resolution: {integrity: sha512-RmS6c7B3potQFPCmFXZoxCAWmiHdsp/D2TKSsGBU0ewVdhgts1KItYNoatIa7Yoy2mfwKG33rYMw+OUgUlHaQQ==} peerDependencies: '@kevisual/auth': ^1.0.5 '@kevisual/router': ^0.0.7 @@ -107,6 +113,9 @@ packages: '@kevisual/load@0.0.4': resolution: {integrity: sha512-TJBieKsEoEPfP4+tDyhNZdMX2LMAGiDZ/IrAXPFWB4jeFP0Ywm1W5xDV52LhhHq4nwTmuhyTVmPxJYiEVYTHtA==} + '@kevisual/permission@0.0.1': + resolution: {integrity: sha512-nSX2LzbPkU3YAMegbUFGU8tfmtFb7dcF5edqzm+gI6crcyCL1JzIB9HAYNEeEVIljLxuREwM/vVg9aFmF4cz9Q==} + '@kevisual/router@0.0.9': resolution: {integrity: sha512-qPyC2GVJ7iOIdJCCKNDsWMAKOQeSJW9HBpL5ZWKHTbi+t4jJBGTzIlXmjKeMHRd0lr/Qq1imQvlkSh4hlrbodA==} @@ -168,98 +177,103 @@ packages: rollup: optional: true - '@rollup/rollup-android-arm-eabi@4.36.0': - resolution: {integrity: sha512-jgrXjjcEwN6XpZXL0HUeOVGfjXhPyxAbbhD0BlXUB+abTOpbPiN5Wb3kOT7yb+uEtATNYF5x5gIfwutmuBA26w==} + '@rollup/rollup-android-arm-eabi@4.38.0': + resolution: {integrity: sha512-ldomqc4/jDZu/xpYU+aRxo3V4mGCV9HeTgUBANI3oIQMOL+SsxB+S2lxMpkFp5UamSS3XuTMQVbsS24R4J4Qjg==} cpu: [arm] os: [android] - '@rollup/rollup-android-arm64@4.36.0': - resolution: {integrity: sha512-NyfuLvdPdNUfUNeYKUwPwKsE5SXa2J6bCt2LdB/N+AxShnkpiczi3tcLJrm5mA+eqpy0HmaIY9F6XCa32N5yzg==} + '@rollup/rollup-android-arm64@4.38.0': + resolution: {integrity: sha512-VUsgcy4GhhT7rokwzYQP+aV9XnSLkkhlEJ0St8pbasuWO/vwphhZQxYEKUP3ayeCYLhk6gEtacRpYP/cj3GjyQ==} cpu: [arm64] os: [android] - '@rollup/rollup-darwin-arm64@4.36.0': - resolution: {integrity: sha512-JQ1Jk5G4bGrD4pWJQzWsD8I1n1mgPXq33+/vP4sk8j/z/C2siRuxZtaUA7yMTf71TCZTZl/4e1bfzwUmFb3+rw==} + '@rollup/rollup-darwin-arm64@4.38.0': + resolution: {integrity: sha512-buA17AYXlW9Rn091sWMq1xGUvWQFOH4N1rqUxGJtEQzhChxWjldGCCup7r/wUnaI6Au8sKXpoh0xg58a7cgcpg==} cpu: [arm64] os: [darwin] - '@rollup/rollup-darwin-x64@4.36.0': - resolution: {integrity: sha512-6c6wMZa1lrtiRsbDziCmjE53YbTkxMYhhnWnSW8R/yqsM7a6mSJ3uAVT0t8Y/DGt7gxUWYuFM4bwWk9XCJrFKA==} + '@rollup/rollup-darwin-x64@4.38.0': + resolution: {integrity: sha512-Mgcmc78AjunP1SKXl624vVBOF2bzwNWFPMP4fpOu05vS0amnLcX8gHIge7q/lDAHy3T2HeR0TqrriZDQS2Woeg==} cpu: [x64] os: [darwin] - '@rollup/rollup-freebsd-arm64@4.36.0': - resolution: {integrity: sha512-KXVsijKeJXOl8QzXTsA+sHVDsFOmMCdBRgFmBb+mfEb/7geR7+C8ypAml4fquUt14ZyVXaw2o1FWhqAfOvA4sg==} + '@rollup/rollup-freebsd-arm64@4.38.0': + resolution: {integrity: sha512-zzJACgjLbQTsscxWqvrEQAEh28hqhebpRz5q/uUd1T7VTwUNZ4VIXQt5hE7ncs0GrF+s7d3S4on4TiXUY8KoQA==} cpu: [arm64] os: [freebsd] - '@rollup/rollup-freebsd-x64@4.36.0': - resolution: {integrity: sha512-dVeWq1ebbvByI+ndz4IJcD4a09RJgRYmLccwlQ8bPd4olz3Y213uf1iwvc7ZaxNn2ab7bjc08PrtBgMu6nb4pQ==} + '@rollup/rollup-freebsd-x64@4.38.0': + resolution: {integrity: sha512-hCY/KAeYMCyDpEE4pTETam0XZS4/5GXzlLgpi5f0IaPExw9kuB+PDTOTLuPtM10TlRG0U9OSmXJ+Wq9J39LvAg==} cpu: [x64] os: [freebsd] - '@rollup/rollup-linux-arm-gnueabihf@4.36.0': - resolution: {integrity: sha512-bvXVU42mOVcF4le6XSjscdXjqx8okv4n5vmwgzcmtvFdifQ5U4dXFYaCB87namDRKlUL9ybVtLQ9ztnawaSzvg==} + '@rollup/rollup-linux-arm-gnueabihf@4.38.0': + resolution: {integrity: sha512-mimPH43mHl4JdOTD7bUMFhBdrg6f9HzMTOEnzRmXbOZqjijCw8LA5z8uL6LCjxSa67H2xiLFvvO67PT05PRKGg==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm-musleabihf@4.36.0': - resolution: {integrity: sha512-JFIQrDJYrxOnyDQGYkqnNBtjDwTgbasdbUiQvcU8JmGDfValfH1lNpng+4FWlhaVIR4KPkeddYjsVVbmJYvDcg==} + '@rollup/rollup-linux-arm-musleabihf@4.38.0': + resolution: {integrity: sha512-tPiJtiOoNuIH8XGG8sWoMMkAMm98PUwlriOFCCbZGc9WCax+GLeVRhmaxjJtz6WxrPKACgrwoZ5ia/uapq3ZVg==} cpu: [arm] os: [linux] - '@rollup/rollup-linux-arm64-gnu@4.36.0': - resolution: {integrity: sha512-KqjYVh3oM1bj//5X7k79PSCZ6CvaVzb7Qs7VMWS+SlWB5M8p3FqufLP9VNp4CazJ0CsPDLwVD9r3vX7Ci4J56A==} + '@rollup/rollup-linux-arm64-gnu@4.38.0': + resolution: {integrity: sha512-wZco59rIVuB0tjQS0CSHTTUcEde+pXQWugZVxWaQFdQQ1VYub/sTrNdY76D1MKdN2NB48JDuGABP6o6fqos8mA==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-arm64-musl@4.36.0': - resolution: {integrity: sha512-QiGnhScND+mAAtfHqeT+cB1S9yFnNQ/EwCg5yE3MzoaZZnIV0RV9O5alJAoJKX/sBONVKeZdMfO8QSaWEygMhw==} + '@rollup/rollup-linux-arm64-musl@4.38.0': + resolution: {integrity: sha512-fQgqwKmW0REM4LomQ+87PP8w8xvU9LZfeLBKybeli+0yHT7VKILINzFEuggvnV9M3x1Ed4gUBmGUzCo/ikmFbQ==} cpu: [arm64] os: [linux] - '@rollup/rollup-linux-loongarch64-gnu@4.36.0': - resolution: {integrity: sha512-1ZPyEDWF8phd4FQtTzMh8FQwqzvIjLsl6/84gzUxnMNFBtExBtpL51H67mV9xipuxl1AEAerRBgBwFNpkw8+Lg==} + '@rollup/rollup-linux-loongarch64-gnu@4.38.0': + resolution: {integrity: sha512-hz5oqQLXTB3SbXpfkKHKXLdIp02/w3M+ajp8p4yWOWwQRtHWiEOCKtc9U+YXahrwdk+3qHdFMDWR5k+4dIlddg==} cpu: [loong64] os: [linux] - '@rollup/rollup-linux-powerpc64le-gnu@4.36.0': - resolution: {integrity: sha512-VMPMEIUpPFKpPI9GZMhJrtu8rxnp6mJR3ZzQPykq4xc2GmdHj3Q4cA+7avMyegXy4n1v+Qynr9fR88BmyO74tg==} + '@rollup/rollup-linux-powerpc64le-gnu@4.38.0': + resolution: {integrity: sha512-NXqygK/dTSibQ+0pzxsL3r4Xl8oPqVoWbZV9niqOnIHV/J92fe65pOir0xjkUZDRSPyFRvu+4YOpJF9BZHQImw==} cpu: [ppc64] os: [linux] - '@rollup/rollup-linux-riscv64-gnu@4.36.0': - resolution: {integrity: sha512-ttE6ayb/kHwNRJGYLpuAvB7SMtOeQnVXEIpMtAvx3kepFQeowVED0n1K9nAdraHUPJ5hydEMxBpIR7o4nrm8uA==} + '@rollup/rollup-linux-riscv64-gnu@4.38.0': + resolution: {integrity: sha512-GEAIabR1uFyvf/jW/5jfu8gjM06/4kZ1W+j1nWTSSB3w6moZEBm7iBtzwQ3a1Pxos2F7Gz+58aVEnZHU295QTg==} cpu: [riscv64] os: [linux] - '@rollup/rollup-linux-s390x-gnu@4.36.0': - resolution: {integrity: sha512-4a5gf2jpS0AIe7uBjxDeUMNcFmaRTbNv7NxI5xOCs4lhzsVyGR/0qBXduPnoWf6dGC365saTiwag8hP1imTgag==} + '@rollup/rollup-linux-riscv64-musl@4.38.0': + resolution: {integrity: sha512-9EYTX+Gus2EGPbfs+fh7l95wVADtSQyYw4DfSBcYdUEAmP2lqSZY0Y17yX/3m5VKGGJ4UmIH5LHLkMJft3bYoA==} + cpu: [riscv64] + os: [linux] + + '@rollup/rollup-linux-s390x-gnu@4.38.0': + resolution: {integrity: sha512-Mpp6+Z5VhB9VDk7RwZXoG2qMdERm3Jw07RNlXHE0bOnEeX+l7Fy4bg+NxfyN15ruuY3/7Vrbpm75J9QHFqj5+Q==} cpu: [s390x] os: [linux] - '@rollup/rollup-linux-x64-gnu@4.36.0': - resolution: {integrity: sha512-5KtoW8UWmwFKQ96aQL3LlRXX16IMwyzMq/jSSVIIyAANiE1doaQsx/KRyhAvpHlPjPiSU/AYX/8m+lQ9VToxFQ==} + '@rollup/rollup-linux-x64-gnu@4.38.0': + resolution: {integrity: sha512-vPvNgFlZRAgO7rwncMeE0+8c4Hmc+qixnp00/Uv3ht2x7KYrJ6ERVd3/R0nUtlE6/hu7/HiiNHJ/rP6knRFt1w==} cpu: [x64] os: [linux] - '@rollup/rollup-linux-x64-musl@4.36.0': - resolution: {integrity: sha512-sycrYZPrv2ag4OCvaN5js+f01eoZ2U+RmT5as8vhxiFz+kxwlHrsxOwKPSA8WyS+Wc6Epid9QeI/IkQ9NkgYyQ==} + '@rollup/rollup-linux-x64-musl@4.38.0': + resolution: {integrity: sha512-q5Zv+goWvQUGCaL7fU8NuTw8aydIL/C9abAVGCzRReuj5h30TPx4LumBtAidrVOtXnlB+RZkBtExMsfqkMfb8g==} cpu: [x64] os: [linux] - '@rollup/rollup-win32-arm64-msvc@4.36.0': - resolution: {integrity: sha512-qbqt4N7tokFwwSVlWDsjfoHgviS3n/vZ8LK0h1uLG9TYIRuUTJC88E1xb3LM2iqZ/WTqNQjYrtmtGmrmmawB6A==} + '@rollup/rollup-win32-arm64-msvc@4.38.0': + resolution: {integrity: sha512-u/Jbm1BU89Vftqyqbmxdq14nBaQjQX1HhmsdBWqSdGClNaKwhjsg5TpW+5Ibs1mb8Es9wJiMdl86BcmtUVXNZg==} cpu: [arm64] os: [win32] - '@rollup/rollup-win32-ia32-msvc@4.36.0': - resolution: {integrity: sha512-t+RY0JuRamIocMuQcfwYSOkmdX9dtkr1PbhKW42AMvaDQa+jOdpUYysroTF/nuPpAaQMWp7ye+ndlmmthieJrQ==} + '@rollup/rollup-win32-ia32-msvc@4.38.0': + resolution: {integrity: sha512-mqu4PzTrlpNHHbu5qleGvXJoGgHpChBlrBx/mEhTPpnAL1ZAYFlvHD7rLK839LLKQzqEQMFJfGrrOHItN4ZQqA==} cpu: [ia32] os: [win32] - '@rollup/rollup-win32-x64-msvc@4.36.0': - resolution: {integrity: sha512-aRXd7tRZkWLqGbChgcMMDEHjOKudo1kChb1Jt1IfR8cY/KIpgNviLeJy5FUb9IpSuQj8dU2fAYNMPW/hLKOSTw==} + '@rollup/rollup-win32-x64-msvc@4.38.0': + resolution: {integrity: sha512-jjqy3uWlecfB98Psxb5cD6Fny9Fupv9LrDSPTQZUROqjvZmcCqNu4UMl7qqhlUUGpwiAkotj6GYu4SZdcr/nLw==} cpu: [x64] os: [win32] @@ -275,6 +289,9 @@ packages: '@types/estree@1.0.6': resolution: {integrity: sha512-AYnb1nQyY49te+VRAVgmzfcgjYS91mY5P0TKUDCLEM+gNnA+3T6rWITXRLYCpahpqSQbN5cE+gHpnPyXjHWxcw==} + '@types/estree@1.0.7': + resolution: {integrity: sha512-w28IoSUCJpidD/TGviZwwMJckNESJZXFu7NBZ5YJ4mEUnNraUn9Pm8HSZm/jDF1pDWYKspWE7oVphigUPRakIQ==} + '@types/http-proxy@1.17.16': resolution: {integrity: sha512-sdWoUajOB1cd0A8cRRQ1cfyWNbmFKLAqBB89Y8x5iYyG/mkJHc0YUH8pdWBy2omi9qtCpiIgGjuwO0dQST2l5w==} @@ -287,8 +304,8 @@ packages: '@types/node-forge@1.3.11': resolution: {integrity: sha512-FQx220y22OKNTqaByeBGqHWYz4cl94tpcxeFdvBo3wjG6XPBuZ0BNgNZRV5J5TFmmcsJ4IzsLkmGRiQbnYsBEQ==} - '@types/node@22.13.11': - resolution: {integrity: sha512-iEUCUJoU0i3VnrCmgoWCXttklWcvoCIx4jzcP22fioIVSdTmjgoEvmAO/QPw6TcS9k5FrNgn4w7q5lGOd1CT5g==} + '@types/node@22.13.14': + resolution: {integrity: sha512-Zs/Ollc1SJ8nKUAgc7ivOEdIBM8JAKgrqqUYi2J997JuKO7/tpQC+WCetQ1sypiKCQWHdvdg9wBNpUPEWZae7w==} '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -442,6 +459,10 @@ packages: resolution: {integrity: sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w==} engines: {node: '>= 0.6'} + cookie@1.0.2: + resolution: {integrity: sha512-9Kr/j4O16ISv8zBBhJoi4bXOYNTkFLOqSL3UDB0njXxCXNezjeyVrJyGOWtgfs/q2km1gwBcfH8q1yEGoMYunA==} + engines: {node: '>=18'} + core-util-is@1.0.3: resolution: {integrity: sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==} @@ -500,10 +521,6 @@ packages: resolution: {integrity: sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw==} engines: {node: '>= 0.8'} - destroy@1.2.0: - resolution: {integrity: sha512-2sJGJTaXIIaR1w4iJSNoN0hnMY7Gpc/n8D4qSCJw8QqFWXf7cuAgnEHxBpweaVcPevC2l3KpjYCx3NypQQgaJg==} - engines: {node: '>= 0.8', npm: 1.2.8000 || >= 1.4.16} - dotenv@16.4.7: resolution: {integrity: sha512-47qPchRCykZC03FhkYAhrvwU4xDBFIj1QPqaarj6mdM/hgUzfPHcpkHJOn3mJAufFeeAxAzeGsr5X0M4k6fLZQ==} engines: {node: '>=12'} @@ -607,9 +624,9 @@ packages: resolution: {integrity: sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==} engines: {node: '>=14'} - fresh@0.5.2: - resolution: {integrity: sha512-zJ2mQYM18rEFOudeV4GShTGIQ7RbzA7ozbU9I/XBpm7kqgMywgmylMwXHxZJmkVoYkna9d2pVXVXPdYTP9ej8Q==} - engines: {node: '>= 0.6'} + fresh@2.0.0: + resolution: {integrity: sha512-Rx/WycZ60HOaqLKAi6cHRKKI7zxWbJ31MhntmtwMoaTeF7XFH9hhBp8vITaMidfljRQ6eYWCKkaTK+ykVJHP2A==} + engines: {node: '>= 0.8'} fsevents@2.3.3: resolution: {integrity: sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==} @@ -784,10 +801,18 @@ packages: resolution: {integrity: sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==} engines: {node: '>= 0.6'} + mime-db@1.54.0: + resolution: {integrity: sha512-aU5EJuIN2WDemCcAp2vFBfp/m4EAhWJnUNSSw0ixs7/kXbd6Pg64EmwJkNdFhB8aWt1sH2CTXrLxo/iAGV3oPQ==} + engines: {node: '>= 0.6'} + mime-types@2.1.35: resolution: {integrity: sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==} engines: {node: '>= 0.6'} + mime-types@3.0.1: + resolution: {integrity: sha512-xRc4oEhT6eaBpU1XF7AjpOFD+xQmXNB5OVKwp4tqCuBpHLS/ZbBDrc07mYTDqVMg6PfxUjjNp85O6Cd2Z/5HWA==} + engines: {node: '>= 0.6'} + minimatch@3.1.2: resolution: {integrity: sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==} @@ -977,8 +1002,8 @@ packages: retry-as-promised@7.1.1: resolution: {integrity: sha512-hMD7odLOt3LkTjcif8aRZqi/hybjpLNgSk5oF5FCowfCjok6LukpN2bDX7R5wDmbgBQFn7YoBxSagmtXHaJYJw==} - rollup@4.36.0: - resolution: {integrity: sha512-zwATAXNQxUcd40zgtQG0ZafcRK4g004WtEl7kbuhTWPvf07PsfohXl39jVUvPF7jvNAIkKPQ2XrsDlWuxBd++Q==} + rollup@4.38.0: + resolution: {integrity: sha512-5SsIRtJy9bf1ErAOiFMFzl64Ex9X5V7bnJ+WlFMb+zmP459OSWCEG7b0ERZ+PEU7xPt4OG3RHbrp1LJlXxYTrw==} engines: {node: '>=18.0.0', npm: '>=8.0.0'} hasBin: true @@ -1007,16 +1032,16 @@ packages: engines: {node: '>=10'} hasBin: true - send@1.1.0: - resolution: {integrity: sha512-v67WcEouB5GxbTWL/4NeToqcZiAWEq90N888fczVArY8A79J0L4FD7vj5hm3eUMua5EpoQ59wa/oovY6TLvRUA==} + send@1.2.0: + resolution: {integrity: sha512-uaW0WwXKpL9blXE2o0bRhoL2EGXIrZxQ2ZQ4mgcfoBxdFmQold+qWsD2jLrfZ0trjKL6vOw0j//eAwcALFjKSw==} engines: {node: '>= 18'} sequelize-pool@7.1.0: resolution: {integrity: sha512-G9c0qlIWQSK29pR/5U2JF5dDQeqqHRragoyahj/Nx4KOOQ3CPPfzxnfqFPCSB7x5UgjOgnZ61nSxz+fjDpRlJg==} engines: {node: '>= 10.0.0'} - sequelize@6.37.6: - resolution: {integrity: sha512-4Slqjqpktofs7AVqWviFOInzP9w8ZRQDhF+DnRtm4WKIdIATpyzGgedyseP3xbgpBxapvfQcJv6CeIdZe4ZL2A==} + sequelize@6.37.7: + resolution: {integrity: sha512-mCnh83zuz7kQxxJirtFD7q6Huy6liPanI67BSlbzSYgVNl5eXVdE2CN1FuAeZwG1SNpGsNRCV+bJAVVnykZAFA==} engines: {node: '>=10.0.0'} peerDependencies: ibm_db: '*' @@ -1310,7 +1335,7 @@ snapshots: '@kevisual/auth@1.0.5': {} - '@kevisual/code-center-module@0.0.13(@kevisual/auth@1.0.5)(@kevisual/router@0.0.9)(@kevisual/use-config@1.0.10(dotenv@16.4.7))(ioredis@5.6.0)(pg@8.13.3)(sequelize@6.37.6(pg@8.13.3))': + '@kevisual/code-center-module@0.0.16(@kevisual/auth@1.0.5)(@kevisual/router@0.0.9)(@kevisual/use-config@1.0.10(dotenv@16.4.7))(ioredis@5.6.0)(pg@8.13.3)(sequelize@6.37.7(pg@8.13.3))': dependencies: '@kevisual/auth': 1.0.5 '@kevisual/router': 0.0.9 @@ -1318,7 +1343,7 @@ snapshots: ioredis: 5.6.0 nanoid: 5.1.5 pg: 8.13.3 - sequelize: 6.37.6(pg@8.13.3) + sequelize: 6.37.7(pg@8.13.3) socket.io: 4.8.1 zod: 3.24.2 transitivePeerDependencies: @@ -1330,6 +1355,8 @@ snapshots: dependencies: eventemitter3: 5.0.1 + '@kevisual/permission@0.0.1': {} + '@kevisual/router@0.0.9': dependencies: path-to-regexp: 8.2.0 @@ -1347,9 +1374,9 @@ snapshots: '@pkgjs/parseargs@0.11.0': optional: true - '@rollup/plugin-commonjs@28.0.3(rollup@4.36.0)': + '@rollup/plugin-commonjs@28.0.3(rollup@4.38.0)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.36.0) + '@rollup/pluginutils': 5.1.2(rollup@4.38.0) commondir: 1.0.1 estree-walker: 2.0.2 fdir: 6.4.0(picomatch@4.0.2) @@ -1357,103 +1384,106 @@ snapshots: magic-string: 0.30.11 picomatch: 4.0.2 optionalDependencies: - rollup: 4.36.0 + rollup: 4.38.0 - '@rollup/plugin-json@6.1.0(rollup@4.36.0)': + '@rollup/plugin-json@6.1.0(rollup@4.38.0)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.36.0) + '@rollup/pluginutils': 5.1.2(rollup@4.38.0) optionalDependencies: - rollup: 4.36.0 + rollup: 4.38.0 - '@rollup/plugin-node-resolve@16.0.1(rollup@4.36.0)': + '@rollup/plugin-node-resolve@16.0.1(rollup@4.38.0)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.36.0) + '@rollup/pluginutils': 5.1.2(rollup@4.38.0) '@types/resolve': 1.20.2 deepmerge: 4.3.1 is-module: 1.0.0 resolve: 1.22.8 optionalDependencies: - rollup: 4.36.0 + rollup: 4.38.0 - '@rollup/plugin-typescript@12.1.2(rollup@4.36.0)(tslib@2.8.1)(typescript@5.8.2)': + '@rollup/plugin-typescript@12.1.2(rollup@4.38.0)(tslib@2.8.1)(typescript@5.8.2)': dependencies: - '@rollup/pluginutils': 5.1.2(rollup@4.36.0) + '@rollup/pluginutils': 5.1.2(rollup@4.38.0) resolve: 1.22.8 typescript: 5.8.2 optionalDependencies: - rollup: 4.36.0 + rollup: 4.38.0 tslib: 2.8.1 - '@rollup/pluginutils@5.1.2(rollup@4.36.0)': + '@rollup/pluginutils@5.1.2(rollup@4.38.0)': dependencies: '@types/estree': 1.0.6 estree-walker: 2.0.2 picomatch: 4.0.2 optionalDependencies: - rollup: 4.36.0 + rollup: 4.38.0 - '@rollup/rollup-android-arm-eabi@4.36.0': + '@rollup/rollup-android-arm-eabi@4.38.0': optional: true - '@rollup/rollup-android-arm64@4.36.0': + '@rollup/rollup-android-arm64@4.38.0': optional: true - '@rollup/rollup-darwin-arm64@4.36.0': + '@rollup/rollup-darwin-arm64@4.38.0': optional: true - '@rollup/rollup-darwin-x64@4.36.0': + '@rollup/rollup-darwin-x64@4.38.0': optional: true - '@rollup/rollup-freebsd-arm64@4.36.0': + '@rollup/rollup-freebsd-arm64@4.38.0': optional: true - '@rollup/rollup-freebsd-x64@4.36.0': + '@rollup/rollup-freebsd-x64@4.38.0': optional: true - '@rollup/rollup-linux-arm-gnueabihf@4.36.0': + '@rollup/rollup-linux-arm-gnueabihf@4.38.0': optional: true - '@rollup/rollup-linux-arm-musleabihf@4.36.0': + '@rollup/rollup-linux-arm-musleabihf@4.38.0': optional: true - '@rollup/rollup-linux-arm64-gnu@4.36.0': + '@rollup/rollup-linux-arm64-gnu@4.38.0': optional: true - '@rollup/rollup-linux-arm64-musl@4.36.0': + '@rollup/rollup-linux-arm64-musl@4.38.0': optional: true - '@rollup/rollup-linux-loongarch64-gnu@4.36.0': + '@rollup/rollup-linux-loongarch64-gnu@4.38.0': optional: true - '@rollup/rollup-linux-powerpc64le-gnu@4.36.0': + '@rollup/rollup-linux-powerpc64le-gnu@4.38.0': optional: true - '@rollup/rollup-linux-riscv64-gnu@4.36.0': + '@rollup/rollup-linux-riscv64-gnu@4.38.0': optional: true - '@rollup/rollup-linux-s390x-gnu@4.36.0': + '@rollup/rollup-linux-riscv64-musl@4.38.0': optional: true - '@rollup/rollup-linux-x64-gnu@4.36.0': + '@rollup/rollup-linux-s390x-gnu@4.38.0': optional: true - '@rollup/rollup-linux-x64-musl@4.36.0': + '@rollup/rollup-linux-x64-gnu@4.38.0': optional: true - '@rollup/rollup-win32-arm64-msvc@4.36.0': + '@rollup/rollup-linux-x64-musl@4.38.0': optional: true - '@rollup/rollup-win32-ia32-msvc@4.36.0': + '@rollup/rollup-win32-arm64-msvc@4.38.0': optional: true - '@rollup/rollup-win32-x64-msvc@4.36.0': + '@rollup/rollup-win32-ia32-msvc@4.38.0': + optional: true + + '@rollup/rollup-win32-x64-msvc@4.38.0': optional: true '@socket.io/component-emitter@3.1.2': {} '@types/cors@2.8.17': dependencies: - '@types/node': 22.13.11 + '@types/node': 22.13.14 '@types/debug@4.1.12': dependencies: @@ -1461,9 +1491,11 @@ snapshots: '@types/estree@1.0.6': {} + '@types/estree@1.0.7': {} + '@types/http-proxy@1.17.16': dependencies: - '@types/node': 22.13.11 + '@types/node': 22.13.14 '@types/mime@1.3.5': {} @@ -1471,9 +1503,9 @@ snapshots: '@types/node-forge@1.3.11': dependencies: - '@types/node': 22.13.11 + '@types/node': 22.13.14 - '@types/node@22.13.11': + '@types/node@22.13.14': dependencies: undici-types: 6.20.0 @@ -1482,7 +1514,7 @@ snapshots: '@types/send@0.17.4': dependencies: '@types/mime': 1.3.5 - '@types/node': 22.13.11 + '@types/node': 22.13.14 '@types/validator@13.12.2': {} @@ -1650,6 +1682,8 @@ snapshots: cookie@0.7.2: {} + cookie@1.0.2: {} + core-util-is@1.0.3: {} cors@2.8.5: @@ -1700,8 +1734,6 @@ snapshots: depd@2.0.0: {} - destroy@1.2.0: {} - dotenv@16.4.7: {} dottie@2.0.6: {} @@ -1727,7 +1759,7 @@ snapshots: engine.io@6.6.4: dependencies: '@types/cors': 2.8.17 - '@types/node': 22.13.11 + '@types/node': 22.13.14 accepts: 1.3.8 base64id: 2.0.0 cookie: 0.7.2 @@ -1787,7 +1819,7 @@ snapshots: cross-spawn: 7.0.6 signal-exit: 4.1.0 - fresh@0.5.2: {} + fresh@2.0.0: {} fsevents@2.3.3: optional: true @@ -1962,10 +1994,16 @@ snapshots: mime-db@1.52.0: {} + mime-db@1.54.0: {} + mime-types@2.1.35: dependencies: mime-db: 1.52.0 + mime-types@3.0.1: + dependencies: + mime-db: 1.54.0 + minimatch@3.1.2: dependencies: brace-expansion: 1.1.11 @@ -2157,29 +2195,30 @@ snapshots: retry-as-promised@7.1.1: {} - rollup@4.36.0: + rollup@4.38.0: dependencies: - '@types/estree': 1.0.6 + '@types/estree': 1.0.7 optionalDependencies: - '@rollup/rollup-android-arm-eabi': 4.36.0 - '@rollup/rollup-android-arm64': 4.36.0 - '@rollup/rollup-darwin-arm64': 4.36.0 - '@rollup/rollup-darwin-x64': 4.36.0 - '@rollup/rollup-freebsd-arm64': 4.36.0 - '@rollup/rollup-freebsd-x64': 4.36.0 - '@rollup/rollup-linux-arm-gnueabihf': 4.36.0 - '@rollup/rollup-linux-arm-musleabihf': 4.36.0 - '@rollup/rollup-linux-arm64-gnu': 4.36.0 - '@rollup/rollup-linux-arm64-musl': 4.36.0 - '@rollup/rollup-linux-loongarch64-gnu': 4.36.0 - '@rollup/rollup-linux-powerpc64le-gnu': 4.36.0 - '@rollup/rollup-linux-riscv64-gnu': 4.36.0 - '@rollup/rollup-linux-s390x-gnu': 4.36.0 - '@rollup/rollup-linux-x64-gnu': 4.36.0 - '@rollup/rollup-linux-x64-musl': 4.36.0 - '@rollup/rollup-win32-arm64-msvc': 4.36.0 - '@rollup/rollup-win32-ia32-msvc': 4.36.0 - '@rollup/rollup-win32-x64-msvc': 4.36.0 + '@rollup/rollup-android-arm-eabi': 4.38.0 + '@rollup/rollup-android-arm64': 4.38.0 + '@rollup/rollup-darwin-arm64': 4.38.0 + '@rollup/rollup-darwin-x64': 4.38.0 + '@rollup/rollup-freebsd-arm64': 4.38.0 + '@rollup/rollup-freebsd-x64': 4.38.0 + '@rollup/rollup-linux-arm-gnueabihf': 4.38.0 + '@rollup/rollup-linux-arm-musleabihf': 4.38.0 + '@rollup/rollup-linux-arm64-gnu': 4.38.0 + '@rollup/rollup-linux-arm64-musl': 4.38.0 + '@rollup/rollup-linux-loongarch64-gnu': 4.38.0 + '@rollup/rollup-linux-powerpc64le-gnu': 4.38.0 + '@rollup/rollup-linux-riscv64-gnu': 4.38.0 + '@rollup/rollup-linux-riscv64-musl': 4.38.0 + '@rollup/rollup-linux-s390x-gnu': 4.38.0 + '@rollup/rollup-linux-x64-gnu': 4.38.0 + '@rollup/rollup-linux-x64-musl': 4.38.0 + '@rollup/rollup-win32-arm64-msvc': 4.38.0 + '@rollup/rollup-win32-ia32-msvc': 4.38.0 + '@rollup/rollup-win32-x64-msvc': 4.38.0 fsevents: 2.3.3 rxjs@7.8.2: @@ -2205,16 +2244,15 @@ snapshots: semver@7.6.3: {} - send@1.1.0: + send@1.2.0: dependencies: debug: 4.3.7(supports-color@5.5.0) - destroy: 1.2.0 encodeurl: 2.0.0 escape-html: 1.0.3 etag: 1.8.1 - fresh: 0.5.2 + fresh: 2.0.0 http-errors: 2.0.0 - mime-types: 2.1.35 + mime-types: 3.0.1 ms: 2.1.3 on-finished: 2.4.1 range-parser: 1.2.1 @@ -2224,7 +2262,7 @@ snapshots: sequelize-pool@7.1.0: {} - sequelize@6.37.6(pg@8.13.3): + sequelize@6.37.7(pg@8.13.3): dependencies: '@types/debug': 4.1.12 '@types/validator': 13.12.2 @@ -2440,7 +2478,7 @@ snapshots: wkx@0.5.0: dependencies: - '@types/node': 22.13.11 + '@types/node': 22.13.14 wrap-ansi@7.0.0: dependencies: diff --git a/src/middleware/auth.ts b/src/middleware/auth.ts new file mode 100644 index 0000000..f3f9f2f --- /dev/null +++ b/src/middleware/auth.ts @@ -0,0 +1,63 @@ +import { User } from '@/module/models.ts'; +import http from 'http'; +import cookie from 'cookie'; +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 = (req.headers?.['authorization'] as string) || (req.headers?.['Authorization'] as string) || ''; + const url = new URL(req.url || '', 'http://localhost'); + const resNoPermission = () => { + res.statusCode = 401; + res.end(error('Invalid authorization')); + return { tokenUser: null, token: null }; + }; + if (!token) { + token = url.searchParams.get('token') || ''; + } + if (!token) { + const parsedCookies = cookie.parse(req.headers.cookie || ''); + token = parsedCookies.token || ''; + } + if (!token) { + return resNoPermission(); + } + if (token) { + token = token.replace('Bearer ', ''); + } + let tokenUser; + try { + tokenUser = await User.verifyToken(token); + } catch (e) { + console.log('checkAuth error', e); + res.statusCode = 401; + res.end(error('Invalid token')); + return { tokenUser: null, token: null }; + } + return { tokenUser, token }; +}; + +export const getLoginUser = async (req: http.IncomingMessage) => { + let token = (req.headers?.['authorization'] as string) || (req.headers?.['Authorization'] as string) || ''; + const url = new URL(req.url || '', 'http://localhost'); + if (!token) { + token = url.searchParams.get('token') || ''; + } + if (!token) { + const parsedCookies = cookie.parse(req.headers.cookie || ''); + token = parsedCookies.token || ''; + } + const parsedCookies = cookie.parse(req.headers.cookie || ''); + console.log('getLoginUser', parsedCookies, 'parsedCookies.token', parsedCookies.token); + + if (token) { + token = token.replace('Bearer ', ''); + } + let tokenUser; + try { + tokenUser = await User.verifyToken(token); + return { tokenUser, token }; + } catch (e) { + return null; + } +}; diff --git a/src/module/get-user-app.ts b/src/module/get-user-app.ts index 19620a2..a593c62 100644 --- a/src/module/get-user-app.ts +++ b/src/module/get-user-app.ts @@ -63,16 +63,25 @@ export class UserApp { const app = this.app; const user = this.user; const key = 'user:app:exist:' + app + ':' + user; + const permissionKey = 'user:app:permission:' + app + ':' + user; const value = await redis.get(key); + const permission = await redis.get(permissionKey); if (!value) { return false; } const [indexFilePath, etag, proxy] = value.split('||'); - return { - indexFilePath, - etag, - proxy: proxy === 'true', - }; + try { + return { + indexFilePath, + etag, + proxy: proxy === 'true', + permission: permission ? JSON.parse(permission) : { share: 'private' }, + }; + } catch (e) { + console.error('getExist error parse', e); + await this.clearCacheData(); + return false; + } } /** * 获取缓存数据,不存在不会加载 @@ -197,7 +206,7 @@ export class UserApp { console.error('fetchData status is not running', fetchData.user, fetchData.key); return { code: 500, message: 'app status is not running' }; } - console.log('fetchData', JSON.stringify(fetchData.data.files, null, 2)); + // console.log('fetchData', JSON.stringify(fetchData.data.files, null, 2)); this.setLoaded('loading', 'loading'); const loadProxy = async () => { @@ -206,6 +215,7 @@ export class UserApp { const version = value.version; let indexHtml = resources + '/' + user + '/' + app + '/' + version + '/index.html'; const files = value?.data?.files || []; + const permission = value?.data?.permission || { share: 'private' }; const data = {}; // 将文件名和路径添加到 `data` 对象中 @@ -216,6 +226,7 @@ export class UserApp { data[file.name] = resources + '/' + file.path; }); await redis.set('user:app:exist:' + app + ':' + user, indexHtml + '||etag||true', 'EX', 60 * 60 * 24 * 7); // 7天 + await redis.set('user:app:permission:' + app + ':' + user, JSON.stringify(permission), 'EX', 60 * 60 * 24 * 7); // 7天 await redis.hset('user:app:set:' + app + ':' + user, data); this.setLoaded('running', 'loaded'); }; @@ -241,6 +252,7 @@ export class UserApp { } await redis.set(key, JSON.stringify(value)); const files = value.data.files; + const permission = fetchData?.data?.permission || { share: 'private' }; const data = {}; let indexHtml = path.join(fileStore, user, app, 'index.html') + '||etag||false'; // 将文件名和路径添加到 `data` 对象中 @@ -251,7 +263,7 @@ export class UserApp { } }); await redis.set('user:app:exist:' + app + ':' + user, indexHtml, 'EX', 60 * 60 * 24 * 7); // 7天 - + await redis.set('user:app:permission:' + app + ':' + user, JSON.stringify(permission), 'EX', 60 * 60 * 24 * 7); // 7天 await redis.hset('user:app:set:' + app + ':' + user, data); this.setLoaded('running', 'loaded'); }; @@ -293,6 +305,7 @@ export class UserApp { await redis.del('user:app:exist:' + app + ':' + user); await redis.del('user:app:set:' + app + ':' + user); await redis.del('user:app:status:' + app + ':' + user); + await redis.del('user:app:permission:' + app + ':' + user); const userDomainApp = 'user:domain:app:' + user + ':' + app; const domainKeys = await redis.get(userDomainApp); if (domainKeys) { diff --git a/src/module/index.ts b/src/module/index.ts index 39219bb..9b5139b 100644 --- a/src/module/index.ts +++ b/src/module/index.ts @@ -8,7 +8,8 @@ import { getContentType } from './get-content-type.ts'; import { createRefreshHtml } from './html/create-refresh-html.ts'; import { fileProxy } from './proxy/file-proxy.ts'; import { getTextFromStreamAndAddStat, httpProxy } from './proxy/http-proxy.ts'; - +import { UserPermission } from '@kevisual/permission'; +import { getLoginUser } from '@/middleware/auth.ts'; const api = config?.api || { host: 'kevisual.xiongxiao.me', path: '/api/router' }; const domain = config?.proxy?.domain || 'kevisual.xiongxiao.me'; const allowedOrigins = config?.proxy?.allowedOrigin || []; @@ -16,6 +17,10 @@ const home = config?.proxy?.home || '/ai/chat'; const noProxyUrl = ['/', '/favicon.ico']; export const handleRequest = async (req: http.IncomingMessage, res: http.ServerResponse) => { + const querySearch = new URL(req.url, `http://${req.headers.host}`).searchParams; + const password = querySearch.get('p'); + const loginUser = await getLoginUser(req); + console.log('loginUser', loginUser); if (req.url === '/favicon.ico') { res.writeHead(200, { 'Content-Type': 'image/x-icon' }); res.end('proxy no favicon.ico\n'); @@ -44,6 +49,7 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR const host = req.headers['host']; console.log('host', host); console.log('headers', headers); + headers.forEach((item) => { header[item] = req.headers[item]; }); @@ -97,7 +103,6 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR let user, app; let domainApp = false; - console.log('dns.hostName', dns.hostName, domain); if (isLocalhost(dns.hostName)) { // 本地开发环境 测试 // user = 'root'; @@ -132,6 +137,7 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR } // const url = req.url; const pathname = new URL(req.url, `http://${dns.hostName}`).pathname; + /** * url是pathname的路径 */ @@ -207,6 +213,20 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR if (!isExist) { return createNotFoundPage(); } + const notAuthUser = ['root', 'admin', 'user', 'public']; + if (!notAuthUser.includes(user)) { + const { permission } = isExist; + const permissionInstance = new UserPermission({ permission, owner: user }); + const loginUser = await getLoginUser(req); + const checkPermission = permissionInstance.checkPermissionSuccess({ + username: loginUser?.tokenUser?.username || '', + password: password, + }); + console.log('checkPermission', loginUser, permission); + if (!checkPermission.success) { + return createNotFoundPage('no permission'); + } + } const indexFile = isExist.indexFilePath; // 已经必定存在了 try { let appFileUrl: string; diff --git a/src/module/models.ts b/src/module/models.ts index a193ff3..3f0a414 100644 --- a/src/module/models.ts +++ b/src/module/models.ts @@ -1,5 +1,8 @@ -import { User, UserInit, Org, OrgInit } from '@kevisual/code-center-module'; +import { User, UserInit, Org, OrgInit } from '@kevisual/code-center-module/models'; export { User, Org }; -UserInit(); -OrgInit(); + +export const initModels = () => { + OrgInit(); + UserInit(); +};