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 apt update
RUN cd reporter && go build . RUN cd reporter && go build .
# # Base ------------------------------ # Base ------------------------------
FROM node:20-alpine AS 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 npm install -g pnpm@9.7.1
RUN apk add --update --no-cache python3 py3-pip g++ make RUN apk add --update --no-cache python3 py3-pip g++ make
@ -32,6 +33,20 @@ RUN pnpm build:static
FROM base AS app FROM base AS app
WORKDIR /app/tianji 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 . . COPY . .
RUN pnpm install --filter @tianji/server... --config.dedupe-peer-dependents=false RUN pnpm install --filter @tianji/server... --config.dedupe-peer-dependents=false

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,10 @@ export async function screenshotWebsiteDetailImage(
websiteId: string, websiteId: string,
userId: 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(); const page = await browser.newPage();
try { try {
const jwt = jwtSign({ const jwt = jwtSign({