From 6223db338f2b2478f45511b3a9e0649ee9f023f4 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 03:49:01 +0000 Subject: [PATCH 1/3] Bump puppeteer from 22.14.0 to 23.0.2 Bumps [puppeteer](https://github.com/puppeteer/puppeteer) from 22.14.0 to 23.0.2. - [Release notes](https://github.com/puppeteer/puppeteer/releases) - [Changelog](https://github.com/puppeteer/puppeteer/blob/main/release-please-config.json) - [Commits](https://github.com/puppeteer/puppeteer/compare/puppeteer-v22.14.0...puppeteer-v23.0.2) --- updated-dependencies: - dependency-name: puppeteer dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- package.json | 2 +- pnpm-lock.yaml | 21 +++++++++++---------- 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package.json b/package.json index 194c4cd..87b1ac4 100644 --- a/package.json +++ b/package.json @@ -33,7 +33,7 @@ "mermaid": "^10.3.1", "pako": "^2.1.0", "path-to-regexp": "^7.0.0", - "puppeteer": "^22.4.1" + "puppeteer": "^23.0.2" }, "devDependencies": { "@happy-dom/jest-environment": "^14.3.6", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a116786..c9a53fe 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -33,8 +33,8 @@ dependencies: specifier: ^7.0.0 version: 7.1.0 puppeteer: - specifier: ^22.4.1 - version: 22.14.0 + specifier: ^23.0.2 + version: 23.0.2 devDependencies: '@happy-dom/jest-environment': @@ -1379,8 +1379,8 @@ packages: resolution: {integrity: sha512-shx7oQ0Awen/BRIdkjkvz54PnEEI/EjwXDSIZp86/KKdbafHh1Df/RYGBhn4hbe2+uKC9FnT5UCEdyPz3ai9hQ==} dev: false - /chromium-bidi@0.6.2(devtools-protocol@0.0.1312386): - resolution: {integrity: sha512-4WVBa6ijmUTVr9cZD4eicQD8Mdy/HCX3bzEIYYpmk0glqYLoWH+LqQEvV9RpDRzoQSbY1KJHloYXbDMXMbDPhg==} + /chromium-bidi@0.6.4(devtools-protocol@0.0.1312386): + resolution: {integrity: sha512-8zoq6ogmhQQkAKZVKO2ObFTl4uOkqoX1PlKQX3hZQ5E9cbUotcAb7h4pTNVAGGv8Z36PF3CtdOriEp/Rz82JqQ==} peerDependencies: devtools-protocol: '*' dependencies: @@ -3675,12 +3675,12 @@ packages: once: 1.4.0 dev: false - /puppeteer-core@22.14.0: - resolution: {integrity: sha512-rl4tOY5LcA3e374GAlsGGHc05HL3eGNf5rZ+uxkl6id9zVZKcwcp1Z+Nd6byb6WPiPeecT/dwz8f/iUm+AZQSw==} + /puppeteer-core@23.0.2: + resolution: {integrity: sha512-MvOHn+g1TYkAR2oVd/bf/YWXKqFTJmkhyyurYgxkrjh8rBOL1ZH5VyOsLJi0bLO7/yoipAmk1gFZEx9HUJnaoA==} engines: {node: '>=18'} dependencies: '@puppeteer/browsers': 2.3.0 - chromium-bidi: 0.6.2(devtools-protocol@0.0.1312386) + chromium-bidi: 0.6.4(devtools-protocol@0.0.1312386) debug: 4.3.6 devtools-protocol: 0.0.1312386 ws: 8.18.0 @@ -3690,16 +3690,17 @@ packages: - utf-8-validate dev: false - /puppeteer@22.14.0: - resolution: {integrity: sha512-MGTR6/pM8zmWbTdazb6FKnwIihzsSEXBPH49mFFU96DNZpQOevCAZMnjBZGlZRGRzRK6aADCavR6SQtrbv5dQw==} + /puppeteer@23.0.2: + resolution: {integrity: sha512-I/l1P8s8brcLG+oW9AwF8hUaOSGGJcGKMflXRgULUH0S3ABptlLI9ZKjqWDo8ipY6v789ZKd+bNKtcCwpTh5Ww==} engines: {node: '>=18'} hasBin: true requiresBuild: true dependencies: '@puppeteer/browsers': 2.3.0 + chromium-bidi: 0.6.4(devtools-protocol@0.0.1312386) cosmiconfig: 9.0.0 devtools-protocol: 0.0.1312386 - puppeteer-core: 22.14.0 + puppeteer-core: 23.0.2 transitivePeerDependencies: - bufferutil - supports-color From 6d0682b333dded877c1c8a0b916740624ea2c4ad Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 12 Aug 2024 03:53:30 +0000 Subject: [PATCH 2/3] Bump docker/build-push-action from 6.5.0 to 6.6.1 Bumps [docker/build-push-action](https://github.com/docker/build-push-action) from 6.5.0 to 6.6.1. - [Release notes](https://github.com/docker/build-push-action/releases) - [Commits](https://github.com/docker/build-push-action/compare/5176d81f87c23d6fc96624dfdbcd9f3830bbe445...16ebe778df0e7752d2cfcbd924afdbbd89c1a755) --- updated-dependencies: - dependency-name: docker/build-push-action dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] --- .github/workflows/CI.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/CI.yaml b/.github/workflows/CI.yaml index 8e0af76..0b214e7 100644 --- a/.github/workflows/CI.yaml +++ b/.github/workflows/CI.yaml @@ -53,7 +53,7 @@ jobs: with: images: ghcr.io/${{ github.repository }} - name: Build and push Docker image - uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 + uses: docker/build-push-action@16ebe778df0e7752d2cfcbd924afdbbd89c1a755 with: context: . push: true From 03e6750ae79da20e62335a07b8138cbfaef5a7cc Mon Sep 17 00:00:00 2001 From: jihchi Date: Sat, 17 Aug 2024 12:44:11 +0300 Subject: [PATCH 3/3] Conver UInt8Array to Buffer to avoid being treated as a JSON response --- src/views/img.js | 2 +- src/views/pdf.js | 2 +- test/kitchensink.test.js | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/views/img.js b/src/views/img.js index 926b914..db01892 100644 --- a/src/views/img.js +++ b/src/views/img.js @@ -34,7 +34,7 @@ const img = async (ctx, page, size) => { // dynamically set media type ctx.type = `image/${type}`; - ctx.body = image; + ctx.body = Buffer.from(image); }; module.exports = renderImgOrSvg(img); diff --git a/src/views/pdf.js b/src/views/pdf.js index 5c7531a..a653b92 100644 --- a/src/views/pdf.js +++ b/src/views/pdf.js @@ -63,7 +63,7 @@ const pdf = async (ctx, page, size) => { debug('printed to pdf, file size: %o', pdf.length); ctx.type = 'application/pdf'; - ctx.body = pdf; + ctx.body = Buffer.from(pdf); }; module.exports = renderImgOrSvg(pdf); diff --git a/test/kitchensink.test.js b/test/kitchensink.test.js index 471f0a2..b4f71ba 100644 --- a/test/kitchensink.test.js +++ b/test/kitchensink.test.js @@ -406,7 +406,7 @@ describe('app', () => { ); expect(resp.status).toEqual(200); expect(resp.type).toEqual('application/pdf'); - expect(resp.body.length).toBeGreaterThan(19 * KB); + expect(resp.body.length).toBeGreaterThan(17 * KB); await PDFDocument.load(resp.body.toString('base64')); }); @@ -417,7 +417,7 @@ describe('app', () => { ); expect(resp.status).toEqual(200); expect(resp.type).toEqual('application/pdf'); - expect(resp.body.length).toBeGreaterThan(19 * KB); + expect(resp.body.length).toBeGreaterThan(17 * KB); const pdfDoc = await PDFDocument.load(resp.body.toString('base64')); const pages = pdfDoc.getPages();