From f1509151702eb076115579eec4f2f8ab6e0b64ec Mon Sep 17 00:00:00 2001 From: Jeremy Kahn Date: Thu, 28 Sep 2023 20:57:49 -0500 Subject: [PATCH] fix(routing): [for #168] set router basename (#169) --- package.json | 4 ++-- src/Bootstrap.tsx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/package.json b/package.json index 8c05e6f..f1e163b 100644 --- a/package.json +++ b/package.json @@ -50,11 +50,11 @@ "webrtc-adapter": "^8.2.2" }, "scripts": { - "start": "react-scripts start", + "start": "cross-env REACT_APP_HOMEPAGE=$(npm pkg get homepage) react-scripts start", "start:tracker": "bittorrent-tracker", "start:streamsaver": "serve -p 3015 node_modules/streamsaver", "dev": "mprocs \"npx cross-env REACT_APP_TRACKER_URL=\"ws://localhost:8000\" REACT_APP_STREAMSAVER_URL=\"http://localhost:3015/mitm.html\" npm run start\" \"npm run start:tracker\" \"npm run start:streamsaver\"", - "build": "react-scripts build", + "build": "cross-env REACT_APP_HOMEPAGE=$(npm pkg get homepage) react-scripts build", "test": "react-scripts test", "prepare": "husky install", "prettier": "prettier 'src/**/*.js' --write", diff --git a/src/Bootstrap.tsx b/src/Bootstrap.tsx index cecd21e..3d629f9 100644 --- a/src/Bootstrap.tsx +++ b/src/Bootstrap.tsx @@ -27,6 +27,10 @@ export interface BootstrapProps { getUuid?: typeof uuid } +const homepageUrl = new URL( + process.env.REACT_APP_HOMEPAGE ?? 'https://chitchatter.im/' +) + function Bootstrap({ persistedStorage: persistedStorageProp = localforage.createInstance({ name: 'chitchatter', @@ -99,7 +103,7 @@ function Bootstrap({ } return ( - + {hasLoadedSettings ? (