From 82b53fc4f5ed3365ae2fb9573716db0fc1ccdf4f Mon Sep 17 00:00:00 2001 From: Tommaso Casaburi Date: Sat, 30 May 2026 12:13:21 +0700 Subject: [PATCH] fix(webui): strip 5chan root hash redirect --- src/webui/daemon-server.ts | 5 ++++- test/cli/daemon.test.ts | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/webui/daemon-server.ts b/src/webui/daemon-server.ts index 56e3511..6c50431 100644 --- a/src/webui/daemon-server.ts +++ b/src/webui/daemon-server.ts @@ -9,10 +9,13 @@ import { randomBytes } from "crypto"; import express from "express"; import { loadChallengesIntoPKC } from "../challenge-packages/challenge-utils.js"; +const rootHashRedirectScriptPattern = + /]*>(?:(?!<\/script>)[\s\S])*?window\.location\.replace\(["']\/#["']\s*\+\s*window\.location\.pathname\s*\+\s*window\.location\.search\);(?:(?!<\/script>)[\s\S])*?<\/script>/; + async function _generateModifiedIndexHtmlWithRpcSettings(webuiPath: string, webuiName: string, ipfsGatewayPort: number) { const indexHtmlString = (await fs.readFile(path.join(webuiPath, "index_backup_no_rpc.html"))) .toString() - .replace(/