Skip to content

Commit

Permalink
fix(routing): [for #168] set router basename
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremyckahn committed Sep 29, 2023
1 parent 3fe80f5 commit f7e8748
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 5 additions & 1 deletion src/Bootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down Expand Up @@ -99,7 +103,7 @@ function Bootstrap({
}

return (
<Router>
<Router basename={homepageUrl.pathname}>
<StorageContext.Provider value={storageContextValue}>
<SettingsContext.Provider value={settingsContextValue}>
{hasLoadedSettings ? (
Expand Down

0 comments on commit f7e8748

Please sign in to comment.