From fe7863fbb8b88aa3f308adb79d7693f13d55c174 Mon Sep 17 00:00:00 2001 From: abearxiong Date: Sat, 6 Dec 2025 18:48:46 +0800 Subject: [PATCH] update --- package.json | 8 +- pnpm-lock.yaml | 270 ++++++++++++++++++++++++---- src/app.ts | 2 +- src/modules/off/ban.ts | 18 ++ src/routes-simple/handle-request.ts | 15 +- src/routes-simple/page-proxy.ts | 8 +- src/routes/index.ts | 2 +- src/routes/user/secret-key/list.ts | 10 +- src/test/nocodb.ts | 28 +++ 9 files changed, 316 insertions(+), 45 deletions(-) create mode 100644 src/test/nocodb.ts diff --git a/package.json b/package.json index a32342f..7f11a03 100644 --- a/package.json +++ b/package.json @@ -43,8 +43,8 @@ ], "license": "UNLICENSED", "dependencies": { - "@kevisual/ai": "^0.0.15", - "@kevisual/query": "^0.0.29", + "@kevisual/ai": "^0.0.16", + "@kevisual/query": "^0.0.31", "@types/busboy": "^1.5.4", "@types/send": "^1.2.1", "@types/ws": "^8.18.1", @@ -67,7 +67,7 @@ "@kevisual/logger": "^0.0.4", "@kevisual/oss": "0.0.13", "@kevisual/permission": "^0.0.3", - "@kevisual/router": "0.0.33", + "@kevisual/router": "0.0.35", "@kevisual/types": "^0.0.10", "@kevisual/use-config": "^1.0.21", "@types/archiver": "^7.0.0", @@ -83,7 +83,7 @@ "dotenv": "^17.2.3", "formidable": "3.5.4", "ioredis": "^5.8.2", - "jsonwebtoken": "^9.0.2", + "jsonwebtoken": "^9.0.3", "lodash-es": "^4.17.21", "minio": "^8.0.6", "nanoid": "^5.1.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index e7806e3..1f349a0 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -13,11 +13,11 @@ importers: .: dependencies: '@kevisual/ai': - specifier: ^0.0.15 - version: 0.0.15 + specifier: ^0.0.16 + version: 0.0.16 '@kevisual/query': - specifier: ^0.0.29 - version: 0.0.29(@kevisual/ws@8.0.0)(zod@4.1.13) + specifier: ^0.0.31 + version: 0.0.31 '@types/busboy': specifier: ^1.5.4 version: 1.5.4 @@ -80,8 +80,8 @@ importers: specifier: ^0.0.3 version: 0.0.3 '@kevisual/router': - specifier: 0.0.33 - version: 0.0.33 + specifier: 0.0.35 + version: 0.0.35 '@kevisual/types': specifier: ^0.0.10 version: 0.0.10 @@ -125,8 +125,8 @@ importers: specifier: 3.5.4 version: 3.5.4 jsonwebtoken: - specifier: ^9.0.2 - version: 9.0.2 + specifier: ^9.0.3 + version: 9.0.3 lodash-es: specifier: ^4.17.21 version: 4.17.21 @@ -192,8 +192,8 @@ packages: resolution: {integrity: sha512-wgm9Ehl2jpeqP3zw/7mo3kRHFp5MEDhqAdwy1fTGkHAwnkGOVsgpvQhL8B5n1qlb01jV3n/bI0ZfZp5lWA1k4w==} engines: {node: '>=18.0.0'} - '@kevisual/ai@0.0.15': - resolution: {integrity: sha512-7oX/wHUKJCfvphFJq7fLBGpl4f6ASEJooQVvmgHZ7fZiYBEeVAEYAB28BNqk36iOItEyWlhuOCxq1oQz3wN+XQ==} + '@kevisual/ai@0.0.16': + resolution: {integrity: sha512-K5KYm+dwHCnB61BhVFh9UcWiOS/FeS29ijvgwE/cQR8RonfPtX/oI7WhAu0jCGGSxTI6cel2LjrpU4JoVzWgnA==} '@kevisual/auth@1.0.5': resolution: {integrity: sha512-GwsLj7unKXi7lmMiIIgdig4LwwLiDJnOy15HHZR5gMbyK6s5/uJiMY5RXPB2+onGzTNDqFo/hXjsD2wkerHPVg==} @@ -228,6 +228,12 @@ packages: '@kevisual/query@0.0.29': resolution: {integrity: sha512-rQZk0J073UuC1QGzuyq+pb4Y0hu8/Qx/xYHs9NbsmslM+RuMnd1zpXmvhXNj7Kn1MdYTH90ng2MlFLBkkQFaIg==} + '@kevisual/query@0.0.30': + resolution: {integrity: sha512-mDPEaLX9LdTRgi9anmWQ4EJ491umsASu/gs6K85J5nJqtUN/kfnZ3x5IouUr6aNbgAhrNLv/vTqpQTBsQhEYHQ==} + + '@kevisual/query@0.0.31': + resolution: {integrity: sha512-bBdepjmMICLpcj/a9fnn82/0CGGYUZiCV+usWsJZKAwVlZcnj+WtKmbgKT09KpP6g3jjYzYOaXHiNFB8N0bQAQ==} + '@kevisual/router@0.0.21': resolution: {integrity: sha512-XKTxbNO924cT18UOAGplWErZ+hMze8Y53F2jYCk18v4jsdsvjRho5uXXjJb6HSVsuITMtQR4R3rG0IcM3jkDKQ==} @@ -240,6 +246,9 @@ packages: '@kevisual/router@0.0.33': resolution: {integrity: sha512-9z7TkSzCIGbXn9SuHPBdZpGwHlAuwA8iN5jNAZBUvbEvBRkBxlrbdCSe9fBYiAHueLm2AceFNrW74uulOiAkqA==} + '@kevisual/router@0.0.35': + resolution: {integrity: sha512-NcOVvVDND6cnHB7t28uXry/zpTpuGwN0oZFT56BHhPdqoXjQlUu0tnwhT4foXlkwuFnY+S5WYE6vfF9Goljw0A==} + '@kevisual/types@0.0.10': resolution: {integrity: sha512-Q73uzzjk9UidumnmCvOpgzqDDvQxsblz22bIFuoiioUFJWwaparx8bpd8ArRyFojicYL1YJoFDzDZ9j9NN8grA==} @@ -282,6 +291,10 @@ packages: cpu: [x64] os: [win32] + '@noble/hashes@1.4.0': + resolution: {integrity: sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg==} + engines: {node: '>= 16'} + '@noble/hashes@1.8.0': resolution: {integrity: sha512-jCs9ldd7NwzpgXDIf6P3+NrHh9/sD6CQdxHyjQI+h/6rDNo88ypBxxz45UDuZHz9r3tNz7N/VInSVoVdtXEI4A==} engines: {node: ^14.21.3 || >=16} @@ -301,6 +314,40 @@ packages: '@paralleldrive/cuid2@2.2.2': resolution: {integrity: sha512-ZOBkgDwEdoYVlSeRbYYXs0S9MejQofiVYoTbKzy/6GQa39/q5tQU2IX46+shYnUkpEl3wc+J6wRlar7r2EK2xA==} + '@peculiar/asn1-cms@2.6.0': + resolution: {integrity: sha512-2uZqP+ggSncESeUF/9Su8rWqGclEfEiz1SyU02WX5fUONFfkjzS2Z/F1Li0ofSmf4JqYXIOdCAZqIXAIBAT1OA==} + + '@peculiar/asn1-csr@2.6.0': + resolution: {integrity: sha512-BeWIu5VpTIhfRysfEp73SGbwjjoLL/JWXhJ/9mo4vXnz3tRGm+NGm3KNcRzQ9VMVqwYS2RHlolz21svzRXIHPQ==} + + '@peculiar/asn1-ecc@2.6.0': + resolution: {integrity: sha512-FF3LMGq6SfAOwUG2sKpPXblibn6XnEIKa+SryvUl5Pik+WR9rmRA3OCiwz8R3lVXnYnyRkSZsSLdml8H3UiOcw==} + + '@peculiar/asn1-pfx@2.6.0': + resolution: {integrity: sha512-rtUvtf+tyKGgokHHmZzeUojRZJYPxoD/jaN1+VAB4kKR7tXrnDCA/RAWXAIhMJJC+7W27IIRGe9djvxKgsldCQ==} + + '@peculiar/asn1-pkcs8@2.6.0': + resolution: {integrity: sha512-KyQ4D8G/NrS7Fw3XCJrngxmjwO/3htnA0lL9gDICvEQ+GJ+EPFqldcJQTwPIdvx98Tua+WjkdKHSC0/Km7T+lA==} + + '@peculiar/asn1-pkcs9@2.6.0': + resolution: {integrity: sha512-b78OQ6OciW0aqZxdzliXGYHASeCvvw5caqidbpQRYW2mBtXIX2WhofNXTEe7NyxTb0P6J62kAAWLwn0HuMF1Fw==} + + '@peculiar/asn1-rsa@2.6.0': + resolution: {integrity: sha512-Nu4C19tsrTsCp9fDrH+sdcOKoVfdfoQQ7S3VqjJU6vedR7tY3RLkQ5oguOIB3zFW33USDUuYZnPEQYySlgha4w==} + + '@peculiar/asn1-schema@2.6.0': + resolution: {integrity: sha512-xNLYLBFTBKkCzEZIw842BxytQQATQv+lDTCEMZ8C196iJcJJMBUZxrhSTxLaohMyKK8QlzRNTRkUmanucnDSqg==} + + '@peculiar/asn1-x509-attr@2.6.0': + resolution: {integrity: sha512-MuIAXFX3/dc8gmoZBkwJWxUWOSvG4MMDntXhrOZpJVMkYX+MYc/rUAU2uJOved9iJEoiUx7//3D8oG83a78UJA==} + + '@peculiar/asn1-x509@2.6.0': + resolution: {integrity: sha512-uzYbPEpoQiBoTq0/+jZtpM6Gq6zADBx+JNFP3yqRgziWBxQ/Dt/HcuvRfm9zJTPdRcBqPNdaRHTVwpyiq6iNMA==} + + '@peculiar/x509@1.14.2': + resolution: {integrity: sha512-r2w1Hg6pODDs0zfAKHkSS5HLkOLSeburtcgwvlLLWWCixw+MmW3U6kD5ddyvc2Y2YdbGuVwCF2S2ASoU1cFAag==} + engines: {node: '>=22.0.0'} + '@pkgjs/parseargs@0.11.0': resolution: {integrity: sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==} engines: {node: '>=14'} @@ -450,6 +497,10 @@ packages: asap@2.0.6: resolution: {integrity: sha512-BSHWgDSAiKs50o2Re8ppvp3seVHXSRM44cdSsT9FfNEUUZLOGWVCsiWaRPWM1Znn+mqZ1OfVZ3z3DWEzSp7hRA==} + asn1js@3.0.6: + resolution: {integrity: sha512-UOCGPYbl0tv8+006qks/dTgV9ajs97X2p0FAbyS2iyCRrmLSRolDaHdp+v/CLgnzHc3fVB+CwYiUmei7ndFcgA==} + engines: {node: '>=12.0.0'} + ast-types@0.13.4: resolution: {integrity: sha512-x1FCFnFifvYDDzTaLII71vG5uvDwgtmDTEVWAxrgeiR8VjMONcCXJx7E+USjDtHlwFmt9MysbqgF9b9Vjr6w+w==} engines: {node: '>=4'} @@ -527,6 +578,10 @@ packages: resolution: {integrity: sha512-8SFQbg/0hQ9xy3UNTB0YEnsNBbWfhf7RtnzpL7TkBiTBRfrQ9Fxcnz7VJsleJpyp6rVLvXiuORqjlHi5q+PYuA==} engines: {node: '>=10.16.0'} + bytestreamjs@2.0.1: + resolution: {integrity: sha512-U1Z/ob71V/bXfVABvNr/Kumf5VyeQRBEm6Txb0PQ6S7V5GpBM3w4Cbqz/xPDicR5tN0uvDifng8C+5qECeGwyQ==} + engines: {node: '>=6.0.0'} + call-bind@1.0.7: resolution: {integrity: sha512-GHTSNSYICQ7scH7sZ+M2rFopRoLh8t2bLSW6BbgrtLsahOIB5iyAVJf9GjWK3cYTDaMj4XdBpM1cA6pIS0Kv2w==} engines: {node: '>= 0.4'} @@ -1023,15 +1078,15 @@ packages: jsonfile@6.1.0: resolution: {integrity: sha512-5dgndWOriYSm5cnYaJNhalLNDKOqFwyDB/rr1E9ZsGciGvKPs8R2xYGCacuf3z6K1YKDz182fd+fY3cn3pMqXQ==} - jsonwebtoken@9.0.2: - resolution: {integrity: sha512-PRp66vJ865SSqOlgqS8hujT5U4AOgMfhrwYIuIhfKaoSCZcirrmASQr8CX7cUg+RMih+hgznrjp99o+W4pJLHQ==} + jsonwebtoken@9.0.3: + resolution: {integrity: sha512-MT/xP0CrubFRNLNKvxJ2BYfy53Zkm++5bX9dtuPbqAeQpTVe0MQTFhao8+Cp//EmJp244xt6Drw/GVEGCUj40g==} engines: {node: '>=12', npm: '>=6'} - jwa@1.4.1: - resolution: {integrity: sha512-qiLX/xhEEFKUAJ6FiBMbes3w9ATzyk5W7Hvzpa/SLYdxNtng+gcurvrI7TbACjIXlsJyr05/S1oUhZrc63evQA==} + jwa@2.0.1: + resolution: {integrity: sha512-hRF04fqJIP8Abbkq5NKGN0Bbr3JxlQ+qhZufXVr0DvujKy93ZCbXZMHDL4EOtodSbCWxOqR8MS1tXA5hwqCXDg==} - jws@3.2.2: - resolution: {integrity: sha512-YHlZCB6lMTllWDtSPHz/ZXTsi8S00usEV6v1tjq8tOUZzw7DpSDWVXjXDre6ed1w/pd495ODpHZYSdkRTsa0HA==} + jws@4.0.1: + resolution: {integrity: sha512-EKI/M/yqPncGUUh44xz0PxSidXFr/+r0pA70+gIYhjv+et7yxM+s29Y+VGDkovRofQem0fs7Uvf4+YmAdyRduA==} lazystream@1.0.1: resolution: {integrity: sha512-b94GiNHQNy6JNTrt5w6zNyffMrNkXZb3KTkCZJb2V1xaEGCk093vkZ2jk3tpaeP33/OiXC+WvK9AxUebnf5nbw==} @@ -1309,6 +1364,10 @@ packages: resolution: {integrity: sha512-g0VU+y08pKw5M8EZ2rIGiEBaB8wrQMjYGFfW2QVIfyT8V+fq8YFLkvlz4bz5ljvFDJYNFCWT3PWqcRr2FKO81w==} engines: {node: '>=10'} + pkijs@3.3.3: + resolution: {integrity: sha512-+KD8hJtqQMYoTuL1bbGOqxb4z+nZkTAwVdNtWwe8Tc2xNbEmdJYIYoc6Qt0uF55e6YW6KuTHw1DjQ18gMhzepw==} + engines: {node: '>=16.0.0'} + pm2-axon-rpc@0.7.1: resolution: {integrity: sha512-FbLvW60w+vEyvMjP/xom2UPhUN/2bVpdtLfKJeYM3gwzYhoTEEChCOICfFzxkxuoEleOlnpjie+n1nue91bDQw==} engines: {node: '>=5'} @@ -1372,6 +1431,13 @@ packages: pstree.remy@1.1.8: resolution: {integrity: sha512-77DZwxQmxKnu3aR542U+X8FypNzbfJ+C5XQDk3uWjWxn6151aIMGthWYRXTqT1E5oJvg+ljaa2OJi+VfvCOQ8w==} + pvtsutils@1.3.6: + resolution: {integrity: sha512-PLgQXQ6H2FWCaeRak8vvk1GW462lMxB5s3Jm673N82zI4vqtVUPuZdffdZbPDFRoU8kAhItWFtPCWiPpp4/EDg==} + + pvutils@1.1.5: + resolution: {integrity: sha512-KTqnxsgGiQ6ZAzZCVlJH5eOjSnvlyEgx1m8bkRJfOhmGRqfo5KLvmAlACQkrjEtOQ4B7wF9TdSLIs9O90MX9xA==} + engines: {node: '>=16.0.0'} + query-string@7.1.3: resolution: {integrity: sha512-hh2WYhq4fi8+b+/2Kg9CEge4fDPvHS534aOOvOZeQ3+Vf2mCFsaFBYj0i+iXcAq6I9Vzp5fjMFBlONvayDC1qg==} engines: {node: '>=6'} @@ -1416,6 +1482,9 @@ packages: resolution: {integrity: sha512-DJnGAeenTdpMEH6uAJRK/uiyEIH9WVsUmoLwzudwGJUwZPp80PDBWPHXSAGNPwNvIXAbe7MSUB1zQFugFml66A==} engines: {node: '>=4'} + reflect-metadata@0.2.2: + resolution: {integrity: sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==} + require-in-the-middle@5.2.0: resolution: {integrity: sha512-efCx3b+0Z69/LGJmm9Yvi4cqEdxnoGnxYxGxBghkkTTFeXRtTCmmhO0AnAfHz59k957uTSuy8WaHqOs8wbYUWg==} engines: {node: '>=6'} @@ -1457,6 +1526,10 @@ packages: resolution: {integrity: sha512-eP/1BEUCziBF/7p96ergE2JlGOMsGj9kIe77pD99G3ValgxDFwHA2oNCYW4rjlmYp8LXc684ypH0836GjSKw0A==} engines: {node: '>=10'} + selfsigned@5.2.0: + resolution: {integrity: sha512-QKF6fsJgdKn5Cy1SekTuwUQ6LOLUdnO4gVne1+TGSAyL/CD1aznNCmBna+bQB9xyon7DiYbDtTR1cLaxDXuaVA==} + engines: {node: '>=15.6.0'} + semver@7.5.4: resolution: {integrity: sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==} engines: {node: '>=10'} @@ -1691,6 +1764,10 @@ packages: tslib@2.8.1: resolution: {integrity: sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==} + tsyringe@4.10.0: + resolution: {integrity: sha512-axr3IdNuVIxnaK5XGEUFTu3YmAQ6lllgrvqfEoR16g/HGnYY/6We4oWENtAnzK6/LpJ2ur9PAb80RBt7/U4ugw==} + engines: {node: '>= 6.0.0'} + tv4@1.3.0: resolution: {integrity: sha512-afizzfpJgvPr+eDkREK4MxJ/+r8nEEHcmitwgnPUqpaP+FpwQyadnxNoSACbgc/b1LsZYtODGoPiFxQrgJgjvw==} engines: {node: '>= 0.8.0'} @@ -1830,10 +1907,11 @@ snapshots: dependencies: minipass: 7.1.2 - '@kevisual/ai@0.0.15': + '@kevisual/ai@0.0.16': dependencies: '@kevisual/logger': 0.0.4 '@kevisual/permission': 0.0.3 + '@kevisual/query': 0.0.30 '@kevisual/auth@1.0.5': {} @@ -1944,12 +2022,9 @@ snapshots: - ws - zod - '@kevisual/query@0.0.29(@kevisual/ws@8.0.0)(zod@4.1.13)': - dependencies: - openai: 5.23.2(@kevisual/ws@8.0.0)(zod@4.1.13) - transitivePeerDependencies: - - ws - - zod + '@kevisual/query@0.0.30': {} + + '@kevisual/query@0.0.31': {} '@kevisual/router@0.0.21': dependencies: @@ -1977,6 +2052,14 @@ snapshots: transitivePeerDependencies: - supports-color + '@kevisual/router@0.0.35': + dependencies: + path-to-regexp: 8.3.0 + selfsigned: 5.2.0 + send: 1.2.0 + transitivePeerDependencies: + - supports-color + '@kevisual/types@0.0.10': {} '@kevisual/use-config@1.0.21(dotenv@17.2.3)': @@ -2004,6 +2087,8 @@ snapshots: '@msgpackr-extract/msgpackr-extract-win32-x64@3.0.3': optional: true + '@noble/hashes@1.4.0': {} + '@noble/hashes@1.8.0': {} '@nodelib/fs.scandir@2.1.5': @@ -2022,6 +2107,96 @@ snapshots: dependencies: '@noble/hashes': 1.8.0 + '@peculiar/asn1-cms@2.6.0': + dependencies: + '@peculiar/asn1-schema': 2.6.0 + '@peculiar/asn1-x509': 2.6.0 + '@peculiar/asn1-x509-attr': 2.6.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-csr@2.6.0': + dependencies: + '@peculiar/asn1-schema': 2.6.0 + '@peculiar/asn1-x509': 2.6.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-ecc@2.6.0': + dependencies: + '@peculiar/asn1-schema': 2.6.0 + '@peculiar/asn1-x509': 2.6.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-pfx@2.6.0': + dependencies: + '@peculiar/asn1-cms': 2.6.0 + '@peculiar/asn1-pkcs8': 2.6.0 + '@peculiar/asn1-rsa': 2.6.0 + '@peculiar/asn1-schema': 2.6.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-pkcs8@2.6.0': + dependencies: + '@peculiar/asn1-schema': 2.6.0 + '@peculiar/asn1-x509': 2.6.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-pkcs9@2.6.0': + dependencies: + '@peculiar/asn1-cms': 2.6.0 + '@peculiar/asn1-pfx': 2.6.0 + '@peculiar/asn1-pkcs8': 2.6.0 + '@peculiar/asn1-schema': 2.6.0 + '@peculiar/asn1-x509': 2.6.0 + '@peculiar/asn1-x509-attr': 2.6.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-rsa@2.6.0': + dependencies: + '@peculiar/asn1-schema': 2.6.0 + '@peculiar/asn1-x509': 2.6.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-schema@2.6.0': + dependencies: + asn1js: 3.0.6 + pvtsutils: 1.3.6 + tslib: 2.8.1 + + '@peculiar/asn1-x509-attr@2.6.0': + dependencies: + '@peculiar/asn1-schema': 2.6.0 + '@peculiar/asn1-x509': 2.6.0 + asn1js: 3.0.6 + tslib: 2.8.1 + + '@peculiar/asn1-x509@2.6.0': + dependencies: + '@peculiar/asn1-schema': 2.6.0 + asn1js: 3.0.6 + pvtsutils: 1.3.6 + tslib: 2.8.1 + + '@peculiar/x509@1.14.2': + dependencies: + '@peculiar/asn1-cms': 2.6.0 + '@peculiar/asn1-csr': 2.6.0 + '@peculiar/asn1-ecc': 2.6.0 + '@peculiar/asn1-pkcs9': 2.6.0 + '@peculiar/asn1-rsa': 2.6.0 + '@peculiar/asn1-schema': 2.6.0 + '@peculiar/asn1-x509': 2.6.0 + pvtsutils: 1.3.6 + reflect-metadata: 0.2.2 + tslib: 2.8.1 + tsyringe: 4.10.0 + '@pkgjs/parseargs@0.11.0': optional: true @@ -2211,6 +2386,12 @@ snapshots: asap@2.0.6: {} + asn1js@3.0.6: + dependencies: + pvtsutils: 1.3.6 + pvutils: 1.1.5 + tslib: 2.8.1 + ast-types@0.13.4: dependencies: tslib: 2.8.1 @@ -2288,6 +2469,8 @@ snapshots: dependencies: streamsearch: 1.1.0 + bytestreamjs@2.0.1: {} + call-bind@1.0.7: dependencies: es-define-property: 1.0.0 @@ -2758,9 +2941,9 @@ snapshots: optionalDependencies: graceful-fs: 4.2.11 - jsonwebtoken@9.0.2: + jsonwebtoken@9.0.3: dependencies: - jws: 3.2.2 + jws: 4.0.1 lodash.includes: 4.3.0 lodash.isboolean: 3.0.3 lodash.isinteger: 4.0.4 @@ -2771,15 +2954,15 @@ snapshots: ms: 2.1.3 semver: 7.7.3 - jwa@1.4.1: + jwa@2.0.1: dependencies: buffer-equal-constant-time: 1.0.1 ecdsa-sig-formatter: 1.0.11 safe-buffer: 5.2.1 - jws@3.2.2: + jws@4.0.1: dependencies: - jwa: 1.4.1 + jwa: 2.0.1 safe-buffer: 5.2.1 lazystream@1.0.1: @@ -2955,11 +3138,6 @@ snapshots: ws: '@kevisual/ws@8.0.0' zod: 3.25.67 - openai@5.23.2(@kevisual/ws@8.0.0)(zod@4.1.13): - optionalDependencies: - ws: '@kevisual/ws@8.0.0' - zod: 4.1.13 - p-queue@9.0.1: dependencies: eventemitter3: 5.0.1 @@ -3050,6 +3228,15 @@ snapshots: dependencies: safe-buffer: 5.2.1 + pkijs@3.3.3: + dependencies: + '@noble/hashes': 1.4.0 + asn1js: 3.0.6 + bytestreamjs: 2.0.1 + pvtsutils: 1.3.6 + pvutils: 1.1.5 + tslib: 2.8.1 + pm2-axon-rpc@0.7.1: dependencies: debug: 4.4.3(supports-color@5.5.0) @@ -3160,6 +3347,12 @@ snapshots: pstree.remy@1.1.8: {} + pvtsutils@1.3.6: + dependencies: + tslib: 2.8.1 + + pvutils@1.1.5: {} + query-string@7.1.3: dependencies: decode-uri-component: 0.2.2 @@ -3215,6 +3408,8 @@ snapshots: dependencies: redis-errors: 1.2.0 + reflect-metadata@0.2.2: {} + require-in-the-middle@5.2.0: dependencies: debug: 4.4.3(supports-color@5.5.0) @@ -3256,6 +3451,11 @@ snapshots: dependencies: node-forge: 1.3.1 + selfsigned@5.2.0: + dependencies: + '@peculiar/x509': 1.14.2 + pkijs: 3.3.3 + semver@7.5.4: dependencies: lru-cache: 6.0.0 @@ -3495,6 +3695,10 @@ snapshots: tslib@2.8.1: {} + tsyringe@4.10.0: + dependencies: + tslib: 1.9.3 + tv4@1.3.0: {} tx2@1.0.5: diff --git a/src/app.ts b/src/app.ts index 0a6d572..762569a 100644 --- a/src/app.ts +++ b/src/app.ts @@ -47,6 +47,6 @@ export const app = useContextKey('app', init); export const ai = useContextKey('ai', () => { return new BailianProvider({ apiKey: process.env.BAILIAN_API_KEY || '', - model: 'qwen-turbo', + model: 'qwen-plus', }); }); \ No newline at end of file diff --git a/src/modules/off/ban.ts b/src/modules/off/ban.ts index 6315c90..32cee92 100644 --- a/src/modules/off/ban.ts +++ b/src/modules/off/ban.ts @@ -16,6 +16,9 @@ export const bannedUserNames = [ "backup", // 备份相关 "backups", // 备份相关 "tmp", // 临时相关 + "var", // 变量相关 + "www", // 网站相关 + "app", // 应用相关 ] /** @@ -40,5 +43,20 @@ export const appIsBanned = (appname: string): boolean => { if (appname.endsWith('.')) { return true; } + + return false; +} + +export const userPathIsBanned = (appname: string): boolean => { + if (appname.startsWith('.')) { + return true; + } + if (appname.endsWith('.')) { + return true; + } + const bans = ['.php', '.json', '.yml', '.db', '.env', '.backup', 'database.sql', 'db.sql', 'backup.zip',]; + if (bans.some(ban => appname.includes(ban))) { + return true; + } return false; } \ No newline at end of file diff --git a/src/routes-simple/handle-request.ts b/src/routes-simple/handle-request.ts index 4f86487..aa17a26 100644 --- a/src/routes-simple/handle-request.ts +++ b/src/routes-simple/handle-request.ts @@ -170,6 +170,17 @@ router.get('/api/container/file/:id', async (req, res) => { res.end(JSON.stringify(container)); }); +router.all('/api/nocodb-test/router', async (req, res) => { + res.writeHead(200, { 'Content-Type': 'application/json' }); + + const param = await router.getSearch(req); + const body = await router.getBody(req); + + const contentType = req.headers['content-type'] || ''; + console.log('Content-Type:', contentType); + console.log('NocoDB test router called.', req.method, param, JSON.stringify(body, null)); + res.end(JSON.stringify({ message: 'NocoDB test router is working' })); +}); const simpleAppsPrefixs = [ "/api/app/", "/api/micro-app/", @@ -177,9 +188,11 @@ const simpleAppsPrefixs = [ "/api/s1/", "/api/container/", "/api/resource/", - "/api/wxmsg" + "/api/wxmsg", + "/api/nocodb-test/" ]; + export const handleRequest = async (req: http.IncomingMessage, res: http.ServerResponse) => { if (req.url?.startsWith('/api/router')) { // router自己管理 diff --git a/src/routes-simple/page-proxy.ts b/src/routes-simple/page-proxy.ts index ed6fa7c..32d6291 100644 --- a/src/routes-simple/page-proxy.ts +++ b/src/routes-simple/page-proxy.ts @@ -13,7 +13,7 @@ import { getLoginUser } from '../modules/auth.ts'; import { rediretHome } from '../modules/user-app/index.ts'; import { logger } from '../modules/logger.ts'; import { UserV1Proxy } from '../modules/ws-proxy/proxy.ts'; -import { hasBadUser, userIsBanned, appIsBanned } from '@/modules/off/index.ts'; +import { hasBadUser, userIsBanned, appIsBanned, userPathIsBanned } from '@/modules/off/index.ts'; import { robotsTxt } from '@/modules/html/index.ts'; const domain = config?.proxy?.domain; const allowedOrigins = config?.proxy?.allowedOrigin || []; @@ -205,7 +205,11 @@ export const handleRequest = async (req: http.IncomingMessage, res: http.ServerR res.end(robotsTxt); return; } - console.log('urls error', urls, 'originUrl:', url); + if(userPathIsBanned(_user)) { + logger.warn(`Bad user access from IP: ${dns.ip}, Host: ${dns.hostName}, URL: ${req.url}`); + } else { + console.log('urls error', urls, 'originUrl:', url); + } res.writeHead(404, { 'Content-Type': 'text/html' }); res.write('Invalid Proxy URL\n'); if (hasBadUser(_user)) { diff --git a/src/routes/index.ts b/src/routes/index.ts index 5acbbee..1031de7 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -14,4 +14,4 @@ import './config/index.ts'; // import './mark/index.ts'; -import './file-listener/index.ts'; +import './file-listener/index.ts'; \ No newline at end of file diff --git a/src/routes/user/secret-key/list.ts b/src/routes/user/secret-key/list.ts index 4cc1d6a..3c04117 100644 --- a/src/routes/user/secret-key/list.ts +++ b/src/routes/user/secret-key/list.ts @@ -55,7 +55,7 @@ app }) .define(async (ctx) => { const tokenUser = ctx.state.tokenUser; - const { id, updatedAt: _clear, title = 'life', createdAt: _clear2, token, ...rest } = ctx.query.data; + const { id, updatedAt: _clear, title = 'life', createdAt: _clear2, token: _, ...rest } = ctx.query.data; let secret: UserSecret; let isNew = false; @@ -75,8 +75,12 @@ app title, }, }); - } else { - secret = await UserSecret.createSecret(tokenUser); + } + if (!secret) { + secret = await UserSecret.createSecret({ + ...tokenUser, + title, + }); isNew = true; } if (secret) { diff --git a/src/test/nocodb.ts b/src/test/nocodb.ts new file mode 100644 index 0000000..389fa24 --- /dev/null +++ b/src/test/nocodb.ts @@ -0,0 +1,28 @@ +import { SimpleRouter, HttpChain } from "@kevisual/router/simple"; +import http from "http"; +const server = http.createServer(); +const router = new SimpleRouter(); + +router.all('/', async (req, res) => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + res.end('NocoDB Test Server is running'); +}); +router.all("/api/router", async (req, res) => { + res.writeHead(200, { 'Content-Type': 'text/plain' }); + const params = req.url ? new URL(req.url, 'http://localhost').searchParams : null; + console.log('Router API called with params:', params?.toString()); + const body = await router.getBody(req); + console.log('Request body:', body); + res.end('Upload API is ready'); +}); + +const httpChain = new HttpChain({ simpleRouter: router }); +httpChain.setServer(server) +httpChain.parse() + +httpChain.listen({ + port: 4000, + host: '0.0.0.0', +}, () => { + console.log('NocoDB test server is running on http://localhost:4000'); +}); \ No newline at end of file