Compare commits

...

10 Commits

8 changed files with 172 additions and 183 deletions

View File

@ -7,8 +7,9 @@ COPY ./reporter/ ./reporter/
RUN apt update
RUN cd reporter && go build .
# # Base ------------------------------
FROM node:20-alpine AS base
# Base ------------------------------
# The current Chromium version in Alpine 3.20 is causing timeout issues with Puppeteer. Downgrading to Alpine 3.19 fixes the issue. See #11640, #12637, #12189
FROM node:20-alpine3.19 AS base
RUN npm install -g pnpm@9.7.1
RUN apk add --update --no-cache python3 py3-pip g++ make
@ -32,6 +33,20 @@ RUN pnpm build:static
FROM base AS app
WORKDIR /app/tianji
# We don't need the standalone Chromium in alpine.
ENV PUPPETEER_SKIP_DOWNLOAD=true
ENV PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
ENV PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium-browser
RUN apk upgrade --no-cache --available \
&& apk add --no-cache \
chromium-swiftshader \
ttf-freefont \
font-noto-emoji \
&& apk add --no-cache \
--repository=https://dl-cdn.alpinelinux.org/alpine/edge/community \
font-wqy-zenhei
COPY . .
RUN pnpm install --filter @tianji/server... --config.dedupe-peer-dependents=false

View File

@ -2,6 +2,9 @@ version: '3'
services:
tianji:
image: moonrailgun/tianji
build:
context: ./
dockerfile: ./Dockerfile
ports:
- "12345:12345"
environment:

View File

@ -230,8 +230,8 @@ importers:
specifier: ^3.0.1
version: 3.0.1
axios:
specifier: ^1.5.0
version: 1.5.0
specifier: 1.7.7
version: 1.7.7
bytemd:
specifier: ^1.21.0
version: 1.21.0
@ -450,8 +450,8 @@ importers:
specifier: ^1.5.0
version: 1.5.0
axios:
specifier: ^1.5.0
version: 1.5.0
specifier: 1.7.7
version: 1.7.7
badge-maker:
specifier: ^3.3.1
version: 3.3.1
@ -540,8 +540,8 @@ importers:
specifier: ^0.4.4
version: 0.4.4
puppeteer:
specifier: ^21.7.0
version: 21.7.0(typescript@5.5.4)
specifier: 23.4.1
version: 23.4.1(typescript@5.5.4)
request-ip:
specifier: ^3.3.0
version: 3.3.0
@ -2717,11 +2717,6 @@ packages:
'@probe.gl/stats@3.6.0':
resolution: {integrity: sha512-JdALQXB44OP4kUBN/UrQgzbJe4qokbVF4Y8lkIA8iVCFnjVowWIgkD/z/0QO65yELT54tTrtepw1jScjKB+rhQ==}
'@puppeteer/browsers@1.9.1':
resolution: {integrity: sha512-PuvK6xZzGhKPvlx3fpfdM2kYY3P/hB1URtK8wA7XUJ6prn6pp22zvJHu48th0SGcHL9SutbPHrFuQgfXTFobWA==}
engines: {node: '>=16.3.0'}
hasBin: true
'@puppeteer/browsers@2.4.0':
resolution: {integrity: sha512-x8J1csfIygOwf6D6qUAZ0ASk3z63zPb7wkNeHRerCMh82qWKUrOgkuP005AJC8lDL6/evtXETGEJVcwykKT4/g==}
engines: {node: '>=18'}
@ -4914,11 +4909,8 @@ packages:
resolution: {integrity: sha512-Mr2ZakwQ7XUAjp7pAwQWRhhK8mQQ6JAaNWSjmjxil0R8BPioMtQsTLOolGYkji1rcL++3dCqZA3zWqpT+9Ew6g==}
engines: {node: '>=4'}
axios@1.5.0:
resolution: {integrity: sha512-D4DdjDo5CY50Qms0qGQTTw6Q44jl7zRwY7bthds06pUGfChBCTcQs+N743eFWGEd6pRTMd6A+I87aWyFV5wiZQ==}
b4a@1.6.4:
resolution: {integrity: sha512-fpWrvyVHEKyeEvbKZTVOeZF3VSKKWtJxFIxX/jaVPf+cLbGUSitjb49pHLqPV2BUNNZ0LcoeEGfE/YCpyDYHIw==}
axios@1.7.7:
resolution: {integrity: sha512-S4kL7XrjgBmvdGut0sN3yJxqYzrDOnivkBiN0OFs6hLiUam3UPvswUo0kqGyhqUZGEOytHyumEdXsAkgCOUf3Q==}
b4a@1.6.6:
resolution: {integrity: sha512-5Tk1HLk6b6ctmjIkAcU/Ujv/1WqiDl0F0JdRCR80VsOcUlHcu7pWeWRlOqQLHfDEsVx9YH/aif5AG4ehoCtTmg==}
@ -5290,11 +5282,6 @@ packages:
resolution: {integrity: sha512-p3KULyQg4S7NIHixdwbGX+nFHkoBiA4YQmyWtjb8XngSKV124nJmRysgAeujbUVb15vh+RvFUfCPqU7rXk+hZg==}
engines: {node: '>=6.0'}
chromium-bidi@0.5.2:
resolution: {integrity: sha512-PbVOSddxgKyj+JByqavWMNqWPCoCaT6XK5Z1EFe168sxnB/BM51LnZEPXSbFcFAJv/+u2B4XNTs9uXxy4GW3cQ==}
peerDependencies:
devtools-protocol: '*'
chromium-bidi@0.6.5:
resolution: {integrity: sha512-RuLrmzYrxSb0s9SgpB+QN5jJucPduZQ/9SIe76MDxYJuecPW5mxMdacJ1f4EtgiV+R0p3sCkznTMvH0MPGFqjA==}
peerDependencies:
@ -6035,6 +6022,15 @@ packages:
supports-color:
optional: true
debug@4.3.7:
resolution: {integrity: sha512-Er2nc/H7RrMXZBFCEim6TCmMk02Z8vLC2Rbi1KEBggpo0fS6l0S1nnapwmIi3yW/+GOJap1Krg4w0Hg80oCqgQ==}
engines: {node: '>=6.0'}
peerDependencies:
supports-color: '*'
peerDependenciesMeta:
supports-color:
optional: true
decamelize@1.2.0:
resolution: {integrity: sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA==}
engines: {node: '>=0.10.0'}
@ -6175,15 +6171,15 @@ packages:
devlop@1.1.0:
resolution: {integrity: sha512-RWmIqhcFf1lRYBvNmr7qTNuyCt/7/ns2jbpp1+PalgE/rDQcBT0fioSMUpJ93irlUhC5hrg4cYqe6U+0ImW0rA==}
devtools-protocol@0.0.1203626:
resolution: {integrity: sha512-nEzHZteIUZfGCZtTiS1fRpC8UZmsfD1SiyPvaUNvS13dvKf666OAm8YTi0+Ca3n1nLEyu49Cy4+dPWpaHFJk9g==}
devtools-protocol@0.0.1312386:
resolution: {integrity: sha512-DPnhUXvmvKT2dFA/j7B+riVLUt9Q6RKJlcppojL5CoRywJJKLDYnRlw0gTFKfgDPHP5E04UoB71SxoJlVZy8FA==}
devtools-protocol@0.0.1330662:
resolution: {integrity: sha512-pzh6YQ8zZfz3iKlCvgzVCu22NdpZ8hNmwU6WnQjNVquh0A9iVosPtNLWDwaWVGyrntQlltPFztTMK5Cg6lfCuw==}
devtools-protocol@0.0.1342118:
resolution: {integrity: sha512-75fMas7PkYNDTmDyb6PRJCH7ILmHLp+BhrZGeMsa4bCh40DTxgCz2NRy5UDzII4C5KuD0oBMZ9vXKhEl6UD/3w==}
dezalgo@1.0.4:
resolution: {integrity: sha512-rXSP0bf+5n0Qonsb+SVVfNfIsimO4HEtmnIpPHY8Q1UCzKlQrDMfdobr8nJOOsRgWCyMRqeSBQzmWUMq7zvVig==}
@ -6764,6 +6760,15 @@ packages:
debug:
optional: true
follow-redirects@1.15.9:
resolution: {integrity: sha512-gew4GsXizNgdoRyqmyfMHyAmXsZDk6mHkSxZFCzW9gwlbtOW44CDtYavM+y+72qD/Vq2l550kMF52DT8fOLJqQ==}
engines: {node: '>=4.0'}
peerDependencies:
debug: '*'
peerDependenciesMeta:
debug:
optional: true
for-each@0.3.3:
resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==}
@ -8258,10 +8263,6 @@ packages:
resolution: {integrity: sha512-ozCC6gdQ+glXOQsveKD0YsDy8DSQFjDTz4zyzEHNV5+JP5D62LmfDZ6o1cycFx9ouG940M5dE8C8CTewdj2YWQ==}
engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0}
lru-cache@10.1.0:
resolution: {integrity: sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==}
engines: {node: 14 || >=16.14}
lru-cache@10.4.3:
resolution: {integrity: sha512-JNAzZcXrCt42VGLuYz0zfAzDfAvJWW6AfYlDBQyDV5DClI2m5sAmK+OIO7s59XfsRsWHp02jAJrRadPRGTt6SQ==}
@ -10114,18 +10115,17 @@ packages:
resolution: {integrity: sha512-FLpr4flz5xZTSJxSeaheeMKN/EDzMdK7b8PTOC6a5PYFKTucWbdqjgqaEyH0shFiSJrVB1+Qqi4Tk19ccU6Aug==}
engines: {node: '>=12.20'}
puppeteer-core@21.7.0:
resolution: {integrity: sha512-elPYPozrgiM3phSy7VDUJCVWQ07SPnOm78fpSaaSNFoQx5sur/MqhTSro9Wz8lOEjqCykGC6WRkwxDgmqcy1dQ==}
engines: {node: '>=16.13.2'}
puppeteer-core@23.3.0:
resolution: {integrity: sha512-sB2SsVMFs4gKad5OCdv6w5vocvtEUrRl0zQqSyRPbo/cj1Ktbarmhxy02Zyb9R9HrssBcJDZbkrvBnbaesPyYg==}
engines: {node: '>=18'}
puppeteer@21.7.0:
resolution: {integrity: sha512-Yy+UUy0b9siJezbhHO/heYUoZQUwyqDK1yOQgblTt0l97tspvDVFkcW9toBlnSvSfkDmMI3Dx9cZL6R8bDArHA==}
engines: {node: '>=16.13.2'}
deprecated: < 22.8.2 is no longer supported
puppeteer-core@23.4.1:
resolution: {integrity: sha512-uCxGtn8VE9PlKhdFJX/zZySi9K3Ufr3qUZe28jxJoZUqiMJOi+SFh2zhiFDSjWqZIDkc0FtnaCC+rewW3MYXmg==}
engines: {node: '>=18'}
puppeteer@23.4.1:
resolution: {integrity: sha512-+wWfWTkQ8L9IB/3OVGSUp37c0eQ5za/85KdX+LAq2wTZkMdocgYGMCs+/91e2f/RXIYzve4x/uGxN8zG2sj8+w==}
engines: {node: '>=18'}
hasBin: true
qrcode.react@3.1.0:
@ -11607,9 +11607,6 @@ packages:
resolution: {integrity: sha512-Mcc5wHehp9aXz1ax6bZUyY5afg9u2rv5cqQI3mRrYkGC8rW2hM02jWuwjtL++LS5qinSyhj2QfLyNsuc+VsExg==}
engines: {node: '>=10.0.0'}
streamx@2.16.1:
resolution: {integrity: sha512-m9QYj6WygWyWa3H1YY69amr4nVgy61xfjys7xO7kviL5rfIEc2naf+ewFiOA+aEJD7y0JO3h2GoiUv4TDwEGzQ==}
streamx@2.20.1:
resolution: {integrity: sha512-uTa0mU6WUC65iUvzKH4X9hEdvSW7rbPxPtwfWiLMSj3qTdQbAiUboZTxauKfpFuGIGa1C2BYijZ7wgdUXICJhA==}
@ -11832,9 +11829,6 @@ packages:
tar-fs@2.1.1:
resolution: {integrity: sha512-V0r2Y9scmbDRLCNex/+hYzvp/zyYjvFbHPNgVTKfQvVrb6guiE/fxP+XblDNR011utopbkex2nM4dHNV6GDsng==}
tar-fs@3.0.4:
resolution: {integrity: sha512-5AFQU8b9qLfZCX9zp2duONhPmZv0hGYiBPJsyUdqMjzq/mqVpy/rEUSeHk1+YitmxugaptgBh5oDGU3VsAJq4w==}
tar-fs@3.0.6:
resolution: {integrity: sha512-iokBDQQkUyeXhgPYaZxmczGPhnhXZ0CmrqI+MOb/WFGS9DW5wnfrLgtjUJBvz50vQ3qfRwJ62QVoCFu8mPVu5w==}
@ -12396,9 +12390,6 @@ packages:
urlpattern-polyfill@10.0.0:
resolution: {integrity: sha512-H/A06tKD7sS1O1X2SshBVeA5FLycRpjqiBeqGKmBwBDBy28EnRjORxTNe269KSSr5un5qyWi1iL61wLxpd+ZOg==}
urlpattern-polyfill@9.0.0:
resolution: {integrity: sha512-WHN8KDQblxd32odxeIgo83rdVDE2bvdkb86it7bMhYZwWKJz0+O0RK/eZiHYnM+zgt/U7hAHOlCQGfjjvSkw2g==}
use-callback-ref@1.3.1:
resolution: {integrity: sha512-Lg4Vx1XZQauB42Hw3kK7JM6yjVjgFmFC5/Ab797s79aARomD2nEErc4mCgM8EZrARLmmbWpi5DGCadmK50DcAQ==}
engines: {node: '>=10'}
@ -12827,18 +12818,6 @@ packages:
utf-8-validate:
optional: true
ws@8.16.0:
resolution: {integrity: sha512-HS0c//TP7Ina87TfiPUz1rQzMhHrl/SG2guqRcTOIUYD2q8uhUdNHZYJUaQ8aTGPzCh+c6oawMKW35nFl1dxyQ==}
engines: {node: '>=10.0.0'}
peerDependencies:
bufferutil: ^4.0.1
utf-8-validate: '>=5.0.2'
peerDependenciesMeta:
bufferutil:
optional: true
utf-8-validate:
optional: true
ws@8.18.0:
resolution: {integrity: sha512-8VbfWfHLbbwu3+N6OKsOMpBdT4kXPDDB9cJk2bJ6mh9ucxdlnNvH1e+roYkKmN9Nxw2yjz7VzeO9oOz2zJ04Pw==}
engines: {node: '>=10.0.0'}
@ -13904,7 +13883,7 @@ snapshots:
'@babel/traverse': 7.23.7
'@babel/types': 7.23.6
convert-source-map: 2.0.0
debug: 4.3.4
debug: 4.3.6
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@ -13924,7 +13903,7 @@ snapshots:
'@babel/traverse': 7.24.0
'@babel/types': 7.24.0
convert-source-map: 2.0.0
debug: 4.3.4
debug: 4.3.6
gensync: 1.0.0-beta.2
json5: 2.2.3
semver: 6.3.1
@ -14725,7 +14704,7 @@ snapshots:
'@babel/helper-split-export-declaration': 7.22.6
'@babel/parser': 7.24.0
'@babel/types': 7.24.0
debug: 4.3.4
debug: 4.3.6
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@ -14740,7 +14719,7 @@ snapshots:
'@babel/helper-split-export-declaration': 7.22.6
'@babel/parser': 7.24.0
'@babel/types': 7.24.0
debug: 4.3.4
debug: 4.3.6
globals: 11.12.0
transitivePeerDependencies:
- supports-color
@ -16248,18 +16227,6 @@ snapshots:
dependencies:
'@babel/runtime': 7.24.0
'@puppeteer/browsers@1.9.1':
dependencies:
debug: 4.3.4
extract-zip: 2.0.1
progress: 2.0.3
proxy-agent: 6.3.1
tar-fs: 3.0.4
unbzip2-stream: 1.4.3
yargs: 17.7.2
transitivePeerDependencies:
- supports-color
'@puppeteer/browsers@2.4.0':
dependencies:
debug: 4.3.6
@ -17305,7 +17272,7 @@ snapshots:
'@tanstack/router-generator@1.20.5':
dependencies:
prettier: 3.2.5
zod: 3.22.4
zod: 3.23.8
'@tanstack/router-vite-plugin@1.20.5':
dependencies:
@ -18825,7 +18792,7 @@ snapshots:
agent-base@7.1.0:
dependencies:
debug: 4.3.4
debug: 4.3.6
transitivePeerDependencies:
- supports-color
@ -19236,16 +19203,14 @@ snapshots:
axe-core@4.10.0: {}
axios@1.5.0:
axios@1.7.7:
dependencies:
follow-redirects: 1.15.2
follow-redirects: 1.15.9
form-data: 4.0.0
proxy-from-env: 1.1.0
transitivePeerDependencies:
- debug
b4a@1.6.4: {}
b4a@1.6.6: {}
babel-loader@9.1.3(@babel/core@7.24.0)(webpack@5.90.3):
@ -19730,12 +19695,6 @@ snapshots:
chrome-trace-event@1.0.3: {}
chromium-bidi@0.5.2(devtools-protocol@0.0.1203626):
dependencies:
devtools-protocol: 0.0.1203626
mitt: 3.0.1
urlpattern-polyfill: 9.0.0
chromium-bidi@0.6.5(devtools-protocol@0.0.1330662):
dependencies:
devtools-protocol: 0.0.1330662
@ -19743,6 +19702,13 @@ snapshots:
urlpattern-polyfill: 10.0.0
zod: 3.23.8
chromium-bidi@0.6.5(devtools-protocol@0.0.1342118):
dependencies:
devtools-protocol: 0.0.1342118
mitt: 3.0.1
urlpattern-polyfill: 10.0.0
zod: 3.23.8
ci-info@3.8.0: {}
citty@0.1.6:
@ -20086,7 +20052,7 @@ snapshots:
handlebars: 4.7.8
json-stringify-safe: 5.0.1
meow: 12.1.1
semver: 7.6.0
semver: 7.6.3
split2: 4.2.0
conventional-changelog@5.1.0:
@ -20272,7 +20238,7 @@ snapshots:
postcss-modules-scope: 3.1.1(postcss@8.4.35)
postcss-modules-values: 4.0.0(postcss@8.4.35)
postcss-value-parser: 4.2.0
semver: 7.6.0
semver: 7.6.3
optionalDependencies:
webpack: 5.90.3
@ -20528,6 +20494,10 @@ snapshots:
dependencies:
ms: 2.1.2
debug@4.3.7:
dependencies:
ms: 2.1.3
decamelize@1.2.0: {}
decode-named-character-reference@1.0.2:
@ -20657,7 +20627,7 @@ snapshots:
detect-port@1.5.1:
dependencies:
address: 1.2.2
debug: 4.3.4
debug: 4.3.6
transitivePeerDependencies:
- supports-color
@ -20665,12 +20635,12 @@ snapshots:
dependencies:
dequal: 2.0.3
devtools-protocol@0.0.1203626: {}
devtools-protocol@0.0.1312386: {}
devtools-protocol@0.0.1330662: {}
devtools-protocol@0.0.1342118: {}
dezalgo@1.0.4:
dependencies:
asap: 2.0.6
@ -20948,7 +20918,7 @@ snapshots:
engine.io-client@6.5.2:
dependencies:
'@socket.io/component-emitter': 3.1.0
debug: 4.3.4
debug: 4.3.6
engine.io-parser: 5.2.1
ws: 8.11.0
xmlhttprequest-ssl: 2.0.0
@ -20968,7 +20938,7 @@ snapshots:
base64id: 2.0.0
cookie: 0.4.2
cors: 2.8.5
debug: 4.3.4
debug: 4.3.6
engine.io-parser: 5.2.1
ws: 8.11.0
transitivePeerDependencies:
@ -21309,7 +21279,7 @@ snapshots:
extract-zip@2.0.1:
dependencies:
debug: 4.3.4
debug: 4.3.6
get-stream: 5.2.0
yauzl: 2.10.0
optionalDependencies:
@ -21474,6 +21444,8 @@ snapshots:
follow-redirects@1.15.2: {}
follow-redirects@1.15.9: {}
for-each@0.3.3:
dependencies:
is-callable: 1.2.7
@ -21496,7 +21468,7 @@ snapshots:
memfs: 3.5.3
minimatch: 3.1.2
schema-utils: 2.7.0
semver: 7.6.0
semver: 7.6.3
tapable: 1.1.3
typescript: 5.5.4
webpack: 5.90.3
@ -21691,7 +21663,7 @@ snapshots:
git-semver-tags@7.0.1:
dependencies:
meow: 12.1.1
semver: 7.6.0
semver: 7.6.3
git-up@7.0.0:
dependencies:
@ -22160,7 +22132,7 @@ snapshots:
hosted-git-info@7.0.1:
dependencies:
lru-cache: 10.1.0
lru-cache: 10.4.3
hpack.js@2.1.6:
dependencies:
@ -22262,7 +22234,7 @@ snapshots:
http-proxy-agent@7.0.0:
dependencies:
agent-base: 7.1.0
debug: 4.3.4
debug: 4.3.6
transitivePeerDependencies:
- supports-color
@ -22317,7 +22289,7 @@ snapshots:
https-proxy-agent@6.2.1:
dependencies:
agent-base: 7.1.0
debug: 4.3.4
debug: 4.3.6
transitivePeerDependencies:
- supports-color
@ -22331,7 +22303,7 @@ snapshots:
https-proxy-agent@7.0.2:
dependencies:
agent-base: 7.1.0
debug: 4.3.4
debug: 4.3.6
transitivePeerDependencies:
- supports-color
@ -23205,8 +23177,6 @@ snapshots:
lowercase-keys@3.0.0: {}
lru-cache@10.1.0: {}
lru-cache@10.4.3: {}
lru-cache@11.0.0: {}
@ -24428,7 +24398,7 @@ snapshots:
node-abi@3.52.0:
dependencies:
semver: 7.6.0
semver: 7.6.3
node-domexception@1.0.0: {}
@ -24491,7 +24461,7 @@ snapshots:
dependencies:
hosted-git-info: 7.0.1
is-core-module: 2.13.0
semver: 7.6.0
semver: 7.6.3
validate-npm-package-license: 3.0.4
normalize-path@2.1.1:
@ -24796,10 +24766,10 @@ snapshots:
dependencies:
'@tootallnate/quickjs-emscripten': 0.23.0
agent-base: 7.1.0
debug: 4.3.4
debug: 4.3.6
get-uri: 6.0.2
http-proxy-agent: 7.0.0
https-proxy-agent: 7.0.2
http-proxy-agent: 7.0.2
https-proxy-agent: 7.0.5
pac-resolver: 7.0.0
socks-proxy-agent: 8.0.2
transitivePeerDependencies:
@ -24818,7 +24788,7 @@ snapshots:
got: 12.6.1
registry-auth-token: 5.0.2
registry-url: 6.0.1
semver: 7.6.0
semver: 7.6.3
param-case@3.0.4:
dependencies:
@ -25172,7 +25142,7 @@ snapshots:
cosmiconfig: 8.3.6(typescript@5.5.4)
jiti: 1.21.0
postcss: 8.4.35
semver: 7.6.0
semver: 7.6.3
webpack: 5.90.3
transitivePeerDependencies:
- typescript
@ -25708,7 +25678,7 @@ snapshots:
proxy-agent@6.3.1:
dependencies:
agent-base: 7.1.0
debug: 4.3.4
debug: 4.3.6
http-proxy-agent: 7.0.0
https-proxy-agent: 7.0.2
lru-cache: 7.18.3
@ -25760,20 +25730,6 @@ snapshots:
dependencies:
escape-goat: 4.0.0
puppeteer-core@21.7.0:
dependencies:
'@puppeteer/browsers': 1.9.1
chromium-bidi: 0.5.2(devtools-protocol@0.0.1203626)
cross-fetch: 4.0.0
debug: 4.3.4
devtools-protocol: 0.0.1203626
ws: 8.16.0
transitivePeerDependencies:
- bufferutil
- encoding
- supports-color
- utf-8-validate
puppeteer-core@23.3.0:
dependencies:
'@puppeteer/browsers': 2.4.0
@ -25787,14 +25743,29 @@ snapshots:
- supports-color
- utf-8-validate
puppeteer@21.7.0(typescript@5.5.4):
puppeteer-core@23.4.1:
dependencies:
'@puppeteer/browsers': 1.9.1
cosmiconfig: 8.3.6(typescript@5.5.4)
puppeteer-core: 21.7.0
'@puppeteer/browsers': 2.4.0
chromium-bidi: 0.6.5(devtools-protocol@0.0.1342118)
debug: 4.3.7
devtools-protocol: 0.0.1342118
typed-query-selector: 2.12.0
ws: 8.18.0
transitivePeerDependencies:
- bufferutil
- supports-color
- utf-8-validate
puppeteer@23.4.1(typescript@5.5.4):
dependencies:
'@puppeteer/browsers': 2.4.0
chromium-bidi: 0.6.5(devtools-protocol@0.0.1342118)
cosmiconfig: 9.0.0(typescript@5.5.4)
devtools-protocol: 0.0.1342118
puppeteer-core: 23.4.1
typed-query-selector: 2.12.0
transitivePeerDependencies:
- bufferutil
- encoding
- supports-color
- typescript
- utf-8-validate
@ -27515,7 +27486,7 @@ snapshots:
semver-diff@4.0.0:
dependencies:
semver: 7.6.0
semver: 7.6.3
semver@5.7.2: {}
@ -27758,7 +27729,7 @@ snapshots:
socket.io-parser@4.2.4:
dependencies:
'@socket.io/component-emitter': 3.1.0
debug: 4.3.4
debug: 4.3.6
transitivePeerDependencies:
- supports-color
@ -27785,7 +27756,7 @@ snapshots:
socks-proxy-agent@8.0.2:
dependencies:
agent-base: 7.1.0
debug: 4.3.4
debug: 4.3.6
socks: 2.7.1
transitivePeerDependencies:
- supports-color
@ -27877,7 +27848,7 @@ snapshots:
spdy@4.0.2:
dependencies:
debug: 4.3.4
debug: 4.3.6
handle-thing: 2.0.1
http-deceiver: 1.2.7
select-hose: 2.0.0
@ -27955,13 +27926,6 @@ snapshots:
streamsearch@1.1.0: {}
streamx@2.16.1:
dependencies:
fast-fifo: 1.3.2
queue-tick: 1.0.1
optionalDependencies:
bare-events: 2.2.1
streamx@2.20.1:
dependencies:
fast-fifo: 1.3.2
@ -28132,14 +28096,14 @@ snapshots:
dependencies:
component-emitter: 1.3.1
cookiejar: 2.1.4
debug: 4.3.4
debug: 4.3.6
fast-safe-stringify: 2.1.1
form-data: 4.0.0
formidable: 2.1.2
methods: 1.1.2
mime: 2.6.0
qs: 6.11.2
semver: 7.6.0
semver: 7.6.3
transitivePeerDependencies:
- supports-color
@ -28317,12 +28281,6 @@ snapshots:
pump: 3.0.0
tar-stream: 2.2.0
tar-fs@3.0.4:
dependencies:
mkdirp-classic: 0.5.3
pump: 3.0.0
tar-stream: 3.1.6
tar-fs@3.0.6:
dependencies:
pump: 3.0.0
@ -28341,9 +28299,9 @@ snapshots:
tar-stream@3.1.6:
dependencies:
b4a: 1.6.4
b4a: 1.6.6
fast-fifo: 1.3.2
streamx: 2.16.1
streamx: 2.20.1
tar@6.1.15:
dependencies:
@ -28917,7 +28875,7 @@ snapshots:
is-yarn-global: 0.4.1
latest-version: 7.0.0
pupa: 3.1.0
semver: 7.6.0
semver: 7.6.3
semver-diff: 4.0.0
xdg-basedir: 5.1.0
@ -28932,7 +28890,7 @@ snapshots:
is-npm: 6.0.0
latest-version: 7.0.0
pupa: 3.1.0
semver: 7.6.0
semver: 7.6.3
semver-diff: 4.0.0
xdg-basedir: 5.1.0
@ -28958,8 +28916,6 @@ snapshots:
urlpattern-polyfill@10.0.0: {}
urlpattern-polyfill@9.0.0: {}
use-callback-ref@1.3.1(@types/react@18.2.78)(react@18.2.0):
dependencies:
react: 18.2.0
@ -29022,7 +28978,7 @@ snapshots:
validate-peer-dependencies@2.2.0:
dependencies:
resolve-package-path: 4.0.3
semver: 7.6.0
semver: 7.6.3
validator@13.11.0: {}
@ -29166,7 +29122,7 @@ snapshots:
vite-node@1.2.1(@types/node@18.17.12)(less@4.2.0)(terser@5.28.1):
dependencies:
cac: 6.7.14
debug: 4.3.4
debug: 4.3.6
pathe: 1.1.2
picocolors: 1.0.0
vite: 5.0.12(@types/node@18.17.12)(less@4.2.0)(terser@5.28.1)
@ -29183,7 +29139,7 @@ snapshots:
vite-node@1.2.1(@types/node@20.12.7)(less@4.2.0)(terser@5.28.1):
dependencies:
cac: 6.7.14
debug: 4.3.4
debug: 4.3.6
pathe: 1.1.2
picocolors: 1.0.0
vite: 5.0.12(@types/node@20.12.7)(less@4.2.0)(terser@5.28.1)
@ -29383,7 +29339,7 @@ snapshots:
sockjs: 0.3.24
spdy: 4.0.2
webpack-dev-middleware: 5.3.3(webpack@5.90.3)
ws: 8.16.0
ws: 8.18.0
optionalDependencies:
webpack: 5.90.3
transitivePeerDependencies:
@ -29562,8 +29518,6 @@ snapshots:
ws@8.11.0: {}
ws@8.16.0: {}
ws@8.18.0: {}
xdg-basedir@4.0.0: {}

View File

@ -55,7 +55,7 @@
"ahooks": "^3.7.10",
"antd": "^5.13.1",
"array-move": "^3.0.1",
"axios": "^1.5.0",
"axios": "1.7.7",
"bytemd": "^1.21.0",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",

View File

@ -30,7 +30,7 @@
"@tianji/shared": "workspace:^",
"@trpc/server": "^10.45.2",
"accept-language-parser": "^1.5.0",
"axios": "^1.5.0",
"axios": "1.7.7",
"badge-maker": "^3.3.1",
"bcryptjs": "^2.4.3",
"cache-manager": "^5.7.2",
@ -60,7 +60,7 @@
"passport": "^0.7.0",
"passport-jwt": "^4.0.1",
"ping": "^0.4.4",
"puppeteer": "^21.7.0",
"puppeteer": "23.4.1",
"request-ip": "^3.3.0",
"socket.io": "^4.7.4",
"swagger-ui-express": "^5.0.0",

View File

@ -52,6 +52,7 @@ export const env = {
sandboxMemoryLimit: process.env.SANDBOX_MEMORY_LIMIT
? Number(process.env.SANDBOX_MEMORY_LIMIT)
: 16, // unit: MB
puppeteerExecutablePath: process.env.PUPPETEER_EXECUTABLE_PATH,
dbDebug: checkEnvTrusty(process.env.DB_DEBUG),
amapToken: process.env.AMAP_TOKEN,
mapboxToken: process.env.MAPBOX_TOKEN,

View File

@ -1,37 +1,50 @@
import puppeteer from 'puppeteer';
import lighthouse, { Result, generateReport } from 'lighthouse';
import { logger } from '../logger.js';
import { env } from '../env.js';
export async function generateLighthouse(url: string): Promise<Result> {
logger.info('[Lighthouse] Generating Lighthouse report...', { url });
// Use Puppeteer to launch headless Chrome
// - Omit `--enable-automation` (See https://github.com/GoogleChrome/lighthouse/issues/12988)
// - Don't use 800x600 default viewport
const browser = await puppeteer.launch({
// Set to false if you want to see the script in action.
headless: 'new',
executablePath: env.puppeteerExecutablePath,
headless: true,
args: ['--no-sandbox', '--disable-dev-shm-usage'],
defaultViewport: null,
ignoreDefaultArgs: ['--enable-automation'],
});
const page = await browser.newPage();
// Wait for Lighthouse to open url, then inject our stylesheet.
browser.on('targetchanged', async (target) => {
if (page && page.url() === url) {
await page.addStyleTag({ content: '* {color: red}' });
try {
const page = await browser.newPage();
// Wait for Lighthouse to open url, then inject our stylesheet.
browser.on('targetchanged', async (target) => {
if (page && page.url() === url) {
await page.addStyleTag({ content: '* {color: red}' });
}
});
// Lighthouse will open the URL.
// Puppeteer will observe `targetchanged` and inject our stylesheet.
const res = await lighthouse(url, undefined, undefined, page);
if (!res) {
throw new Error('Lighthouse failed to generate report');
}
});
// Lighthouse will open the URL.
// Puppeteer will observe `targetchanged` and inject our stylesheet.
const res = await lighthouse(url, undefined, undefined, page);
if (!res) {
throw new Error('Lighthouse failed to generate report');
await page.close({ runBeforeUnload: false });
const { lhr } = res;
return lhr;
} catch (err) {
throw err;
} finally {
await browser.close();
}
const { lhr } = res;
await browser.close();
return lhr;
}
export function getLighthouseReport(lhr: Result): string {

View File

@ -10,7 +10,10 @@ export async function screenshotWebsiteDetailImage(
websiteId: string,
userId: string
) {
const browser = await puppeteer.launch({ headless: 'new' });
const browser = await puppeteer.launch({
executablePath: env.puppeteerExecutablePath,
headless: true,
});
const page = await browser.newPage();
try {
const jwt = jwtSign({