feat: 签名 API 异常时提供重启选项

This commit is contained in:
Clansty 2024-01-10 18:26:31 +08:00
parent fe0fc61d2e
commit 7f8345f52e
No known key found for this signature in database
GPG Key ID: 3A6BE8BAF2EDE134
13 changed files with 230 additions and 30 deletions

View File

@ -21,10 +21,10 @@ RUN --mount=type=cache,target=/var/cache/apt,sharing=locked \
COPY package.json pnpm-lock.yaml /app/
FROM build-env AS prod-deps
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --prod --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store,sharing=locked pnpm install --prod --frozen-lockfile
FROM build-env AS build
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile
RUN --mount=type=cache,id=pnpm,target=/pnpm/store,sharing=locked pnpm install --frozen-lockfile
COPY src tsconfig.json /app/
COPY prisma /app/
RUN pnpm exec prisma generate

View File

@ -44,6 +44,7 @@ services:
- sign
volumes:
- q2tg:/app/data
- /var/run/docker.sock:/var/run/docker.sock
environment:
- TG_API_ID=
- TG_API_HASH=

View File

@ -15,11 +15,11 @@
"devDependencies": {
"@types/cli-progress": "^3.11.5",
"@types/date-and-time": "^0.13.0",
"@types/dockerode": "^3.3.23",
"@types/fluent-ffmpeg": "^2.1.24",
"@types/lodash": "^4.14.201",
"@types/node": "^20.10.7",
"@types/prompts": "^2.4.9",
"@types/sharp": "^0.32.0",
"ts-node": "^10.9.2",
"typescript": "^5.3.3"
},
@ -30,6 +30,7 @@
"big-integer": "^1.6.51",
"cli-progress": "^3.11.2",
"date-and-time": "^2.4.1",
"dockerode": "^4.0.2",
"dotenv": "^16.0.1",
"eviltransform": "^0.2.2",
"file-type": "^19.0.0",

View File

@ -23,6 +23,9 @@ dependencies:
date-and-time:
specifier: ^2.4.1
version: 2.4.3
dockerode:
specifier: ^4.0.2
version: 4.0.2
dotenv:
specifier: ^16.0.1
version: 16.3.1
@ -85,6 +88,9 @@ devDependencies:
'@types/date-and-time':
specifier: ^0.13.0
version: 0.13.0
'@types/dockerode':
specifier: ^3.3.23
version: 3.3.23
'@types/fluent-ffmpeg':
specifier: ^2.1.24
version: 2.1.24
@ -97,9 +103,6 @@ devDependencies:
'@types/prompts':
specifier: ^2.4.9
version: 2.4.9
'@types/sharp':
specifier: ^0.32.0
version: 0.32.0
ts-node:
specifier: ^10.9.2
version: 10.9.2(@types/node@20.10.7)(typescript@5.3.3)
@ -109,6 +112,10 @@ devDependencies:
packages:
/@balena/dockerignore@1.0.2:
resolution: {integrity: sha512-wMue2Sy4GAVTk6Ic4tJVcnfdau+gx2EnG7S+uAEe+TWJFqE4YoWN4/H8MSLj4eYJKxGg26lZwboEniNiNwZQ6Q==}
dev: false
/@cryptography/aes@0.1.1:
resolution: {integrity: sha512-PcYz4FDGblO6tM2kSC+VzhhK62vml6k6/YAkiWtyPvrgJVfnDRoHGDtKn5UiaRRUrvUTTocBpvc2rRgTCqxjsg==}
dev: false
@ -125,6 +132,7 @@ packages:
requiresBuild: true
dependencies:
tslib: 2.6.2
dev: false
optional: true
/@fastify/busboy@2.0.0:
@ -140,6 +148,7 @@ packages:
requiresBuild: true
optionalDependencies:
'@img/sharp-libvips-darwin-arm64': 1.0.0
dev: false
optional: true
/@img/sharp-darwin-x64@0.33.1:
@ -150,6 +159,7 @@ packages:
requiresBuild: true
optionalDependencies:
'@img/sharp-libvips-darwin-x64': 1.0.0
dev: false
optional: true
/@img/sharp-libvips-darwin-arm64@1.0.0:
@ -158,6 +168,7 @@ packages:
cpu: [arm64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@img/sharp-libvips-darwin-x64@1.0.0:
@ -166,6 +177,7 @@ packages:
cpu: [x64]
os: [darwin]
requiresBuild: true
dev: false
optional: true
/@img/sharp-libvips-linux-arm64@1.0.0:
@ -174,6 +186,7 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@img/sharp-libvips-linux-arm@1.0.0:
@ -182,6 +195,7 @@ packages:
cpu: [arm]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@img/sharp-libvips-linux-s390x@1.0.0:
@ -190,6 +204,7 @@ packages:
cpu: [s390x]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@img/sharp-libvips-linux-x64@1.0.0:
@ -198,6 +213,7 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@img/sharp-libvips-linuxmusl-arm64@1.0.0:
@ -206,6 +222,7 @@ packages:
cpu: [arm64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@img/sharp-libvips-linuxmusl-x64@1.0.0:
@ -214,6 +231,7 @@ packages:
cpu: [x64]
os: [linux]
requiresBuild: true
dev: false
optional: true
/@img/sharp-linux-arm64@0.33.1:
@ -224,6 +242,7 @@ packages:
requiresBuild: true
optionalDependencies:
'@img/sharp-libvips-linux-arm64': 1.0.0
dev: false
optional: true
/@img/sharp-linux-arm@0.33.1:
@ -234,6 +253,7 @@ packages:
requiresBuild: true
optionalDependencies:
'@img/sharp-libvips-linux-arm': 1.0.0
dev: false
optional: true
/@img/sharp-linux-s390x@0.33.1:
@ -244,6 +264,7 @@ packages:
requiresBuild: true
optionalDependencies:
'@img/sharp-libvips-linux-s390x': 1.0.0
dev: false
optional: true
/@img/sharp-linux-x64@0.33.1:
@ -254,6 +275,7 @@ packages:
requiresBuild: true
optionalDependencies:
'@img/sharp-libvips-linux-x64': 1.0.0
dev: false
optional: true
/@img/sharp-linuxmusl-arm64@0.33.1:
@ -264,6 +286,7 @@ packages:
requiresBuild: true
optionalDependencies:
'@img/sharp-libvips-linuxmusl-arm64': 1.0.0
dev: false
optional: true
/@img/sharp-linuxmusl-x64@0.33.1:
@ -274,6 +297,7 @@ packages:
requiresBuild: true
optionalDependencies:
'@img/sharp-libvips-linuxmusl-x64': 1.0.0
dev: false
optional: true
/@img/sharp-wasm32@0.33.1:
@ -283,6 +307,7 @@ packages:
requiresBuild: true
dependencies:
'@emnapi/runtime': 0.44.0
dev: false
optional: true
/@img/sharp-win32-ia32@0.33.1:
@ -291,6 +316,7 @@ packages:
cpu: [ia32]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@img/sharp-win32-x64@0.33.1:
@ -299,6 +325,7 @@ packages:
cpu: [x64]
os: [win32]
requiresBuild: true
dev: false
optional: true
/@jimp/bmp@0.22.10(@jimp/custom@0.22.10):
@ -761,6 +788,20 @@ packages:
resolution: {integrity: sha512-kHEncapIgrqaY8r2tyb19EvdKyhNjwheLl5cYTorsWJtURoI+oGm5ehW8CLAaq4dvu8x9z56FcXqAT4Mm5Nvzw==}
dev: true
/@types/docker-modem@3.0.6:
resolution: {integrity: sha512-yKpAGEuKRSS8wwx0joknWxsmLha78wNMe9R2S3UNsVOkZded8UqOrV8KoeDXoXsjndxwyF3eIhyClGbO1SEhEg==}
dependencies:
'@types/node': 20.10.7
'@types/ssh2': 1.11.18
dev: true
/@types/dockerode@3.3.23:
resolution: {integrity: sha512-Lz5J+NFgZS4cEVhquwjIGH4oQwlVn2h7LXD3boitujBnzOE5o7s9H8hchEjoDK2SlRsJTogdKnQeiJgPPKLIEw==}
dependencies:
'@types/docker-modem': 3.0.6
'@types/node': 20.10.7
dev: true
/@types/fluent-ffmpeg@2.1.24:
resolution: {integrity: sha512-g5oQO8Jgi2kFS3tTub7wLvfLztr1s8tdXmRd8PiL/hLMLzTIAyMR2sANkTggM/rdEDAg3d63nYRRVepwBiCw5A==}
dependencies:
@ -794,11 +835,10 @@ packages:
kleur: 3.0.3
dev: true
/@types/sharp@0.32.0:
resolution: {integrity: sha512-OOi3kL+FZDnPhVzsfD37J88FNeZh6gQsGcLc95NbeURRGvmSjeXiDcyWzF2o3yh/gQAUn2uhh/e+CPCa5nwAxw==}
deprecated: This is a stub types definition. sharp provides its own type definitions, so you do not need this installed.
/@types/ssh2@1.11.18:
resolution: {integrity: sha512-7eH4ppQMFlzvn//zhwD54MWaITR1aSc1oFBye9vb76GZ2Y9PSFYdwVIwOlxRXWs5+1hifntXyt+8a6SUbOD7Hg==}
dependencies:
sharp: 0.33.1
'@types/node': 18.18.8
dev: true
/abab@2.0.6:
@ -992,6 +1032,14 @@ packages:
file-uri-to-path: 1.0.0
dev: false
/bl@4.1.0:
resolution: {integrity: sha512-1W07cM9gS6DcLperZfFSj+bWLtaPGSOHWhPiGzXmvVJbRLdG82sH/Kn8EtW1VqWVA54AKf2h5k5BbnIbwF3h6w==}
dependencies:
buffer: 5.7.1
inherits: 2.0.4
readable-stream: 3.6.2
dev: false
/bmp-js@0.1.0:
resolution: {integrity: sha512-vHdS19CnY3hwiNdkaqk93DvjVLfbEcI8mys4UjuWrlX1haDmroo8o4xCzh4wD6DGV6HxRCyauwhHRqMTfERtjw==}
dev: false
@ -1041,6 +1089,13 @@ packages:
node-gyp-build: 4.6.1
dev: false
/buildcheck@0.0.6:
resolution: {integrity: sha512-8f9ZJCUXyT1M35Jx7MkBgmBMo3oHTTBIPLiY9xyL0pl3T5RwcPEY8cUHr5LBNfu/fk6c2T4DJZuVM/8ZZT2D2A==}
engines: {node: '>=10.0.0'}
requiresBuild: true
dev: false
optional: true
/bytes@3.1.2:
resolution: {integrity: sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg==}
engines: {node: '>= 0.8'}
@ -1093,6 +1148,10 @@ packages:
supports-color: 5.5.0
dev: false
/chownr@1.1.4:
resolution: {integrity: sha512-jJ0bqzaylmJtVnNgzTeSOs8DPavpbYgEr/b0YL8/2GO3xJEhInFmhKMUnEJQjZumK7KXGFhUy89PrsJWlakBVg==}
dev: false
/chownr@2.0.0:
resolution: {integrity: sha512-bIomtDF5KGpdogkLd9VspvFzk9KfpyyGlS8YFVZl7TGPBHL5snIOnxeshwVgPteQ9b4Eydl+pVbIyE1DcvCWgQ==}
engines: {node: '>=10'}
@ -1130,6 +1189,7 @@ packages:
engines: {node: '>=7.0.0'}
dependencies:
color-name: 1.1.4
dev: false
/color-name@1.1.3:
resolution: {integrity: sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==}
@ -1137,12 +1197,14 @@ packages:
/color-name@1.1.4:
resolution: {integrity: sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==}
dev: false
/color-string@1.9.1:
resolution: {integrity: sha512-shrVawQFojnZv6xM40anx4CkoDP+fZsw/ZerEMsW/pyzsRbElpsL/DBVW7q3ExxwusdNXI3lXpuhEZkzs8p5Eg==}
dependencies:
color-name: 1.1.4
simple-swizzle: 0.2.2
dev: false
/color-support@1.1.3:
resolution: {integrity: sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==}
@ -1155,6 +1217,7 @@ packages:
dependencies:
color-convert: 2.0.1
color-string: 1.9.1
dev: false
/combined-stream@1.0.8:
resolution: {integrity: sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==}
@ -1206,6 +1269,16 @@ packages:
resolution: {integrity: sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==}
dev: false
/cpu-features@0.0.9:
resolution: {integrity: sha512-AKjgn2rP2yJyfbepsmLfiYcmtNn/2eUvocUyM/09yB0YDiz39HteK/5/T4Onf0pmdYDMgkBoGvRLvEguzyL7wQ==}
engines: {node: '>=10.0.0'}
requiresBuild: true
dependencies:
buildcheck: 0.0.6
nan: 2.18.0
dev: false
optional: true
/create-require@1.1.1:
resolution: {integrity: sha512-dcKFX3jn0MpIaXjisoRvexIJVEKzaq7z2rZKxf+MSr9TkdmHmsU4m2lcLojrj/FHl8mk5VxMmYA+ftRkP/3oKQ==}
dev: true
@ -1356,6 +1429,7 @@ packages:
/detect-libc@2.0.2:
resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==}
engines: {node: '>=8'}
dev: false
/diff@3.3.1:
resolution: {integrity: sha512-MKPHZDMB0o6yHyDryUOScqZibp914ksXwAMYMTHj6KO8UeKsRYNJD3oNCKjTqZon+V488P7N/HzXF8t7ZR95ww==}
@ -1369,6 +1443,29 @@ packages:
engines: {node: '>=0.3.1'}
dev: true
/docker-modem@5.0.3:
resolution: {integrity: sha512-89zhop5YVhcPEt5FpUFGr3cDyceGhq/F9J+ZndQ4KfqNvfbJpPMfgeixFgUj5OjCYAboElqODxY5Z1EBsSa6sg==}
engines: {node: '>= 8.0'}
dependencies:
debug: 4.3.4
readable-stream: 3.6.2
split-ca: 1.0.1
ssh2: 1.15.0
transitivePeerDependencies:
- supports-color
dev: false
/dockerode@4.0.2:
resolution: {integrity: sha512-9wM1BVpVMFr2Pw3eJNXrYYt6DT9k0xMcsSCjtPvyQ+xa1iPg/Mo3T/gUcwI0B2cczqCeCYRPF8yFYDwtFXT0+w==}
engines: {node: '>= 8.0'}
dependencies:
'@balena/dockerignore': 1.0.2
docker-modem: 5.0.3
tar-fs: 2.0.1
transitivePeerDependencies:
- supports-color
dev: false
/dom-serializer@1.4.1:
resolution: {integrity: sha512-VHwB3KfrcOOkelEG2ZOfxqLZdfkil8PtJi4P8N2MMXucZq2yLp75ClViUlOVwyoHEDjYU433Aq+5zWP61+RGag==}
dependencies:
@ -1442,6 +1539,12 @@ packages:
engines: {node: '>= 0.8'}
dev: false
/end-of-stream@1.4.4:
resolution: {integrity: sha512-+uw1inIHVPQoaVuHzRyXd21icM+cnt4CzD5rW+NC1wjOUSTOs+Te7FOv7AhN7vS9x/oIyhLP5PR1H+phQAHu5Q==}
dependencies:
once: 1.4.0
dev: false
/entities@2.2.0:
resolution: {integrity: sha512-p92if5Nz619I0w+akJrLZH0MX0Pb5DX39XOwQTtXSdQQOaYH03S1uIQp4mhOZtAXrxq4ViO67YTiLBo2638o9A==}
dev: false
@ -1619,6 +1722,10 @@ packages:
engines: {node: '>= 0.6'}
dev: false
/fs-constants@1.0.0:
resolution: {integrity: sha512-y6OAwoSIf7FyjMIv94u+b5rdheZEjzR63GTyZJm5qh4Bi+2YgwLCcI/fPFZkL5PSixOt6ZNKm+w+Hfp/Bciwow==}
dev: false
/fs-extra@8.1.0:
resolution: {integrity: sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==}
engines: {node: '>=6 <7 || >=8'}
@ -1942,6 +2049,7 @@ packages:
/is-arrayish@0.3.2:
resolution: {integrity: sha512-eVRqCvVlZbuw3GrM63ovNSNAeA1K16kaR/LRY/92w0zxQ5/1YzwblUX652i4Xs9RwAGjW9d9y6X88t8OaAJfWQ==}
dev: false
/is-fullwidth-code-point@3.0.0:
resolution: {integrity: sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==}
@ -2258,6 +2366,7 @@ packages:
engines: {node: '>=10'}
dependencies:
yallist: 4.0.0
dev: false
/make-dir@3.1.0:
resolution: {integrity: sha512-g3FeP20LNwhALb/6Cz6Dd4F2ngze0jz7tbzrD2wAV+o9FeNHe4rL+yK2md0J/fiSf1sa1ADhXqi5+oVwOM/eGw==}
@ -2351,6 +2460,10 @@ packages:
yallist: 4.0.0
dev: false
/mkdirp-classic@0.5.3:
resolution: {integrity: sha512-gKLcREMhtuZRwRAfqP3RFW+TK4JqApVBtOIftVgjuABpAtpxhPGaDcfvbhNvD0B8iD1oUr/txX35NjcaY6Ns/A==}
dev: false
/mkdirp@0.5.1:
resolution: {integrity: sha512-SknJC52obPfGQPnjIkXbmA6+5H15E+fR+E4iR2oQ3zzCLbd7/ONua69R/Gw7AgkTLsRG+r5fzksYwWe1AgTyWA==}
deprecated: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
@ -2647,6 +2760,13 @@ packages:
resolution: {integrity: sha512-E/ZsdU4HLs/68gYzgGTkMicWTLPdAftJLfJFlLUAAKZGkStNU72sZjT66SnMDVOfOWY/YAoiD7Jxa9iHvngcag==}
dev: false
/pump@3.0.0:
resolution: {integrity: sha512-LwZy+p3SFs1Pytd/jYct4wpv49HiYCqd9Rlc5ZVdk0V+8Yzv6jR5Blk3TRmPL1ft69TxP0IMZGJ+WPFU2BFhww==}
dependencies:
end-of-stream: 1.4.4
once: 1.4.0
dev: false
/punycode@2.3.1:
resolution: {integrity: sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==}
engines: {node: '>=6'}
@ -2794,6 +2914,7 @@ packages:
hasBin: true
dependencies:
lru-cache: 6.0.0
dev: false
/set-blocking@2.0.0:
resolution: {integrity: sha512-KiKBS8AnWGEyLzofFfmvKwpdPzqiy16LvQfK3yv/fVH7Bj13/wl3JSR1J+rfgRE9q7xUJK4qvgS8raSOeLUehw==}
@ -2841,6 +2962,7 @@ packages:
'@img/sharp-wasm32': 0.33.1
'@img/sharp-win32-ia32': 0.33.1
'@img/sharp-win32-x64': 0.33.1
dev: false
/should-equal@2.0.0:
resolution: {integrity: sha512-ZP36TMrK9euEuWQYBig9W55WPC7uo37qzAEmbjHz4gfyuXrEUgF8cUvQVO+w+d3OMfPvSRQJ22lSm8MQJ43LTA==}
@ -2929,6 +3051,7 @@ packages:
resolution: {integrity: sha512-JA//kQgZtbuY83m+xT+tXJkmJncGMTFT+C+g2h2R9uxkYIrE2yy9sgmcLhCnw57/WSD+Eh3J97FPEDFnbXnDUg==}
dependencies:
is-arrayish: 0.3.2
dev: false
/sisteransi@1.0.5:
resolution: {integrity: sha512-bLGGlR1QxBcynn2d5YmDX4MGjlZvy2MRBDRNHLJ8VI6l6+9FUiyTFNJ0IveOSP0bcXgVDPRcfGqA0pjaqUpfVg==}
@ -2971,6 +3094,22 @@ packages:
dev: false
optional: true
/split-ca@1.0.1:
resolution: {integrity: sha512-Q5thBSxp5t8WPTTJQS59LrGqOZqOsrhDGDVm8azCqIBjSBd7nd9o2PM+mDulQQkh8h//4U6hFZnc/mul8t5pWQ==}
dev: false
/ssh2@1.15.0:
resolution: {integrity: sha512-C0PHgX4h6lBxYx7hcXwu3QWdh4tg6tZZsTfXcdvc5caW/EMxaB4H9dWsl7qk+F7LAW762hp8VbXOX7x4xUYvEw==}
engines: {node: '>=10.16.0'}
requiresBuild: true
dependencies:
asn1: 0.2.6
bcrypt-pbkdf: 1.0.2
optionalDependencies:
cpu-features: 0.0.9
nan: 2.18.0
dev: false
/sshpk@1.18.0:
resolution: {integrity: sha512-2p2KJZTSqQ/I3+HX42EpYOa2l3f8Erv8MWKsy2I9uf4wA7yFIkXRffYdsx86y6z4vHtV8u7g+pPlr8/4ouAxsQ==}
engines: {node: '>=0.10.0'}
@ -3078,6 +3217,26 @@ packages:
resolution: {integrity: sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==}
dev: false
/tar-fs@2.0.1:
resolution: {integrity: sha512-6tzWDMeroL87uF/+lin46k+Q+46rAJ0SyPGz7OW7wTgblI273hsBqk2C1j0/xNadNLKDTUL9BukSjB7cwgmlPA==}
dependencies:
chownr: 1.1.4
mkdirp-classic: 0.5.3
pump: 3.0.0
tar-stream: 2.2.0
dev: false
/tar-stream@2.2.0:
resolution: {integrity: sha512-ujeqbceABgwMZxEJnk2HDY2DlnUZ+9oEcb1KzTVfYHio0UE6dG71n60d8D2I4qNvleWrrXpmjpt7vZeF1LnMZQ==}
engines: {node: '>=6'}
dependencies:
bl: 4.1.0
end-of-stream: 1.4.4
fs-constants: 1.0.0
inherits: 2.0.4
readable-stream: 3.6.2
dev: false
/tar@6.2.0:
resolution: {integrity: sha512-/Wo7DcT0u5HUV486xg675HtjNd3BXZ6xDbzsCUZPt5iw8bTQ63bP0Raut3mvro9u+CUyq7YQd8Cx55fsZXxqLQ==}
engines: {node: '>=10'}
@ -3243,6 +3402,7 @@ packages:
/tslib@2.6.2:
resolution: {integrity: sha512-AEYxH93jGFPn/a2iVAwW87VuUIkR1FVUKB77NwMF7nBTDkDrrT/Hpt/IrCJ0QXhW27jTBDcf5ZY7w6RiqTMw2Q==}
dev: false
/tsscmp@1.0.6:
resolution: {integrity: sha512-LxhtAkPDTkVCMQjt2h6eBVY28KCjikZqZfMcC15YBeNjkgUpdCfBu5HoiOTDu86v6smE8yOjyEktJ8hlbANHQA==}
@ -3547,6 +3707,7 @@ packages:
/yallist@4.0.0:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
dev: false
/ylru@1.3.2:
resolution: {integrity: sha512-RXRJzMiK6U2ye0BlGGZnmpwJDPgakn6aNQ0A7gHRbD4I0uvK4TW6UqkK1V0pp9jskjJBAXd3dRrbzWkqJ+6cxA==}

View File

@ -48,13 +48,14 @@ model Instance {
}
model QqBot {
id Int @id @default(autoincrement())
uin BigInt @default(0)
password String @default("")
platform Int @default(0)
Instance Instance[]
signApi String?
signVer String?
id Int @id @default(autoincrement())
uin BigInt @default(0)
password String @default("")
platform Int @default(0)
Instance Instance[]
signApi String?
signVer String?
signDockerId String?
}
model Message {

View File

@ -36,13 +36,15 @@ interface CreateOicqParams {
onVerifyDevice: (phone: string) => Promise<string>;
// 当滑块时调用此方法,返回 ticker也可以返回假值改用扫码登录
onVerifySlider: (url: string) => Promise<string>;
signDockerId?: string;
}
// OicqExtended??
export default class OicqClient extends Client {
private readonly onMessageHandlers: Array<MessageHandler> = [];
private constructor(uin: number, public readonly id: number, conf?: Config) {
private constructor(uin: number, public readonly id: number, conf?: Config,
public readonly signDockerId?: string) {
super(conf);
}
@ -125,7 +127,7 @@ export default class OicqClient extends Client {
ffprobe_path: process.env.FFPROBE_PATH,
sign_api_addr: params.signApi || process.env.SIGN_API,
ver: params.signVer || process.env.SIGN_VER,
});
}, params.signDockerId);
client.on('system.login.device', loginDeviceHandler);
client.on('system.login.slider', loginSliderHandler);
client.on('system.login.error', loginErrorHandler);

View File

@ -6,13 +6,13 @@ import { DeletedMessage, DeletedMessageEvent } from 'telegram/events/DeletedMess
import { EntityLike } from 'telegram/define';
import WaitForMessageHelper from '../helpers/WaitForMessageHelper';
import CallbackQueryHelper from '../helpers/CallbackQueryHelper';
import { CallbackQuery } from 'telegram/events/CallbackQuery';
import { CallbackQuery, CallbackQueryEvent } from 'telegram/events/CallbackQuery';
import os from 'os';
import TelegramChat from './TelegramChat';
import TelegramSession from '../models/TelegramSession';
import { LogLevel } from 'telegram/extensions/Logger';
import { BigInteger } from 'big-integer';
import { IterMessagesParams } from 'telegram/client/messages';
import { EditMessageParams, IterMessagesParams } from 'telegram/client/messages';
import { PromisedNetSockets, PromisedWebSockets } from 'telegram/extensions';
import { ConnectionTCPFull, ConnectionTCPObfuscated } from 'telegram/network';
@ -174,7 +174,7 @@ export default class Telegram {
);
}
public registerCallback(cb: () => any) {
public registerCallback(cb: (event: CallbackQueryEvent) => any) {
return this.callbackQueryHelper.registerCallback(cb);
}

View File

@ -290,6 +290,7 @@ export default class {
const qqMessage = await pair.qq.sendMsg({
type: 'image',
file: image,
asface: true
});
await db.message.create({
data: {

View File

@ -80,6 +80,7 @@ export default class SetupController {
platform: this.instance.qq.platform,
signApi: this.instance.qq.signApi,
signVer: this.instance.qq.signVer,
signDockerId: this.instance.qq.signDockerId,
onVerifyDevice: async (phone) => {
return await this.setupService.waitForOwnerInput(`请输入手机 ${phone} 收到的验证码`);
},
@ -147,7 +148,7 @@ export default class SetupController {
await this.setupService.informOwner('正在登录,请稍候…');
this.tgUser = await this.setupService.createUserBot(phoneNumber);
this.instance.userSessionId = this.tgUser.sessionId;
await this.setupService.informOwner(`登录成功`);
await this.setupService.informOwner(`登录成功\n请使用下面的菜单开始创建转发`);
}
catch (e) {
this.log.error('创建 UserBot 失败', e);

View File

@ -1,9 +1,9 @@
import { CallbackQueryEvent } from 'telegram/events/CallbackQuery';
export default class CallbackQueryHelper {
private readonly queries: Array<() => any> = [];
private readonly queries: Array<(event: CallbackQueryEvent) => any> = [];
public registerCallback(cb: () => any) {
public registerCallback(cb: (event: CallbackQueryEvent) => any) {
const id = this.queries.push(cb) - 1;
const buf = Buffer.alloc(2);
buf.writeUInt16LE(id);
@ -13,8 +13,12 @@ export default class CallbackQueryHelper {
public onCallbackQuery = async (event: CallbackQueryEvent) => {
const id = event.query.data.readUint16LE();
if (this.queries[id]) {
this.queries[id]();
this.queries[id](event);
}
try {
await event.answer();
}
catch {
}
await event.answer();
};
}

View File

@ -28,9 +28,12 @@ import db from './models/db';
}
setTimeout(async () => {
log.info('开始加载 MapInstance');
for (const instance of instances.filter(it => it.workMode === 'group')) {
await instance.forwardPairs.initMapInstance(instances.filter(it => it.workMode === 'personal'));
try {
await instance.forwardPairs.initMapInstance(instances.filter(it => it.workMode === 'personal'));
}
catch {
}
}
}, 15 * 1000);
})();

View File

@ -123,6 +123,7 @@ export default class Instance {
platform: this.qq.platform,
signApi: this.qq.signApi,
signVer: this.qq.signVer,
signDockerId: this.qq.signDockerId,
onVerifyDevice: async (phone) => {
return await this.waitForOwnerInput(`请输入手机 ${phone} 收到的验证码`);
},

View File

@ -39,6 +39,8 @@ import ZincSearch from 'zincsearch-node';
import { speech as AipSpeechClient } from 'baidu-aip-sdk';
import random from '../utils/random';
import { escapeXml } from 'icqq/lib/common';
import Docker from 'dockerode';
import ReplyKeyboardHide = Api.ReplyKeyboardHide;
const NOT_CHAINABLE_ELEMENTS = ['flash', 'record', 'video', 'location', 'share', 'json', 'xml', 'poke'];
@ -47,6 +49,7 @@ export default class ForwardService {
private readonly log: Logger;
private readonly zincSearch: ZincSearch;
private readonly speechClient: AipSpeechClient;
private readonly restartSignCallbackHandle?: Buffer;
constructor(private readonly instance: Instance,
private readonly tgBot: Telegram,
@ -66,6 +69,24 @@ export default class ForwardService {
process.env.BAIDU_SECRET_KEY,
);
}
if (oicq.signDockerId) {
const socket = new Docker({ socketPath: '/var/run/docker.sock' });
const container = socket.getContainer(oicq.signDockerId);
this.restartSignCallbackHandle = tgBot.registerCallback(async (event) => {
const message = await event.edit({
message: event.messageId,
text: '正在重启签名服务...',
buttons: new ReplyKeyboardHide({}),
});
await container.restart();
await event.answer({
message: '已发送重启指令',
});
await message.reply({
message: '已发送重启指令\n你需要稍后重新发送一下消息',
});
});
}
}
public async forwardFromQq(event: PrivateMessageEvent | GroupMessageEvent, pair: Pair) {
@ -672,7 +693,10 @@ export default class ForwardService {
this.log.error('从 TG 到 QQ 的消息转发失败', e);
try {
await message.reply({
message: `<i>转发失败:${e.message}</i>\n${e}`,
message: `<i>转发失败:${e.message}</i>`,
buttons: (e.message === '签名api异常' && this.restartSignCallbackHandle) ?
Button.inline('重启签名服务', this.restartSignCallbackHandle) :
undefined,
});
}
catch {