From 7fcda33f1b48b3e5a86e00cbea268ba67184c931 Mon Sep 17 00:00:00 2001 From: niqzart Date: Wed, 24 Dec 2025 00:26:56 +0300 Subject: [PATCH 1/5] devops-fix: allow deployments from unknownproperty --- .github/workflows/production.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/production.yml b/.github/workflows/production.yml index 3c755cb..f705421 100644 --- a/.github/workflows/production.yml +++ b/.github/workflows/production.yml @@ -7,7 +7,7 @@ on: jobs: prepare: - if: github.triggering_actor == 'niqzart' + if: github.triggering_actor == 'niqzart' || github.triggering_actor == 'unknownproperty' uses: ./.github/workflows/common-work.yml with: tag: hocus-main @@ -15,7 +15,7 @@ jobs: secrets: inherit deploy_production: - if: github.triggering_actor == 'niqzart' + if: github.triggering_actor == 'niqzart' || github.triggering_actor == 'unknownproperty' needs: prepare runs-on: ubuntu-latest environment: production From 3112e881103cc26de0745158a8fbf4b59576199f Mon Sep 17 00:00:00 2001 From: niqzart Date: Wed, 24 Dec 2025 01:03:20 +0300 Subject: [PATCH 2/5] fix: rewrite body downloading via array buffer instead of streaming one chunk --- src/hooks/download.ts | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/src/hooks/download.ts b/src/hooks/download.ts index fcdb538..3232909 100644 --- a/src/hooks/download.ts +++ b/src/hooks/download.ts @@ -1,6 +1,6 @@ import { fetchPayload } from "@hocuspocus/server" -import { HocusPocusError, logServerError } from "../common/errors" +import { HocusPocusError } from "../common/errors" import { fetchStorageSafely } from "../common/fetcher" export async function downloadYDocContent({ documentName }: fetchPayload): Promise { @@ -11,24 +11,11 @@ export async function downloadYDocContent({ documentName }: fetchPayload): Promi throw new HocusPocusError() } - if (response.headers.get("content-length") === "0") { + const arrayBuffer = await response.arrayBuffer() + + if (!arrayBuffer || arrayBuffer.byteLength === 0) { return null } - const responseBody = response.body - if (!responseBody) { - logServerError("Download: body is not present") - throw new HocusPocusError() - } - const data = await response.body.getReader().read() - if (!data) { - logServerError("Download: body read failed") - throw new HocusPocusError() - } - const result = data.value - if (!result) { - logServerError("Download: body value is empty") - throw new HocusPocusError() - } - return result + return new Uint8Array(arrayBuffer) } From 684cc98de77e8c97784ca6913f74c33a30c8315f Mon Sep 17 00:00:00 2001 From: niqzart Date: Wed, 24 Dec 2025 01:05:35 +0300 Subject: [PATCH 3/5] fix: allow disabling change logs to prevent spam --- src/index.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/index.ts b/src/index.ts index ed6a187..c7b1336 100644 --- a/src/index.ts +++ b/src/index.ts @@ -15,7 +15,11 @@ const server = Server.configure({ quiet: true, onAuthenticate: verifyYDocAccess, extensions: [ - new Logger(), + new Logger( + { + onChange: process.env.ENABLE_CHANGE_LOGS === "true", + } + ), new Database({ fetch: downloadYDocContent, store: storeYDocContent, From 71dd6707806d1a20d0da2de750e505f43b24f8fd Mon Sep 17 00:00:00 2001 From: niqzart Date: Wed, 24 Dec 2025 01:32:26 +0300 Subject: [PATCH 4/5] refactor: update environment variable names to the new standard --- src/common/fetcher.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/fetcher.ts b/src/common/fetcher.ts index 8230dac..42cf0a7 100644 --- a/src/common/fetcher.ts +++ b/src/common/fetcher.ts @@ -1,8 +1,8 @@ import { logServerError } from "./errors" -const back2BaseUrl = process.env.BACK_2_BASE_URL || "http://localhost:5000" +const back2BaseUrl = process.env.BACK_2__BASE_URL || "http://localhost:5000" const back2BasePath = "/internal/storage-service/v2" -const back2ApiKey = process.env.BACK_2_API_KEY || "local" +const back2ApiKey = process.env.BACK_2__API_KEY || "local" export async function fetchStorage(path: string, init?: RequestInit): Promise { try { From 4396136d7619b7af88ee6aa822d46c0f1a2e88e7 Mon Sep 17 00:00:00 2001 From: niqzart Date: Wed, 24 Dec 2025 02:16:24 +0300 Subject: [PATCH 5/5] devops-fix: band-aid fix for github's horrible breaking change --- .github/workflows/development.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 8b53ad0..250a732 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -56,7 +56,7 @@ jobs: if: contains(github.event.pull_request.labels.*.name, 'ci:deployable') runs-on: ubuntu-latest - environment: ${{ needs.namer.outputs.branch == 'staging' && github.actor == github.triggering_actor && 'staging' || 'manual-staging' }} + environment: manual-staging env: pull_image: ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_USERNAME }}:${{ needs.namer.outputs.tag }}