Skip to content

Commit 784a8aa

Browse files
committed
fix(webui): fix bug with how index.html was changed
1 parent 90812f9 commit 784a8aa

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

ci-bin/download-web-uis.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ import decompress from "decompress";
4848
writer.close();
4949
console.log("Downloaded", htmlZipAsset.name, "webui successfully. Attempting to unzip");
5050

51-
await decompress(zipfilePath, dstOfWebui);
5251
console.log("Unzipped", zipfilePath);
5352
await fs.rm(zipfilePath);
5453
console.log(`Downloaded`, githubRepo, "successfully");
5554

55+
const extractedDirName = htmlZipAsset.name.replace(".zip", "");
5656
// We're renaming index.html here because we don't somebody to go to unmodified index.html
5757
// they will get an error, but an error is preferable to going to the wrong html
58-
const backupIndexHtml = path.join(dstOfWebui, "index_backup_no_rpc.html");
59-
await fs.rename(path.join(dstOfWebui, "index.html"), backupIndexHtml);
58+
const backupIndexHtml = path.join(dstOfWebui, extractedDirName, "index_backup_no_rpc.html");
59+
await fs.rename(path.join(dstOfWebui, extractedDirName, "index.html"), backupIndexHtml);
6060
}
6161
})();

src/webui/daemon-server.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import express from "express";
77
import type { InputPlebbitOptions } from "@plebbit/plebbit-js/dist/node/types";
88

99
async function _generateModifiedIndexHtmlWithRpcSettings(webuiPath: string, webuiName: string, ipfsGatewayPort: number) {
10-
const indexHtmlString = (await fs.readFile(path.join(webuiPath, "index.html"))).toString();
10+
const indexHtmlString = (await fs.readFile(path.join(webuiPath, "index_backup_no_rpc.html"))).toString();
1111
const defaultRpcOptionString = `[window.location.origin.replace("https://", "wss://").replace("http://", "ws://") + window.location.pathname.split('/' + '${webuiName}')[0]]`;
1212
// Ipfs media only locally because ipfs gateway doesn't allow remote connections
1313
const defaultIpfsMedia = `if (window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "0.0.0.0")window.defaultMediaIpfsGatewayUrl = 'http://' + window.location.hostname + ':' + ${ipfsGatewayPort}`;

0 commit comments

Comments
 (0)