host detection fixed in prod mode

This commit is contained in:
Daniel Shleifman
2021-06-03 20:08:07 +03:00
parent aec2ecbb20
commit 7b2e1443f5
2 changed files with 4 additions and 4 deletions

View File

@@ -17,9 +17,7 @@ export default function SettingsDialog() {
const [open, setOpen] = useState(false) const [open, setOpen] = useState(false)
const [settings, setSets] = useState({}) const [settings, setSets] = useState({})
const [show, setShow] = useState(false) const [show, setShow] = useState(false)
const [tsHost, setTSHost] = useState(getTorrServerHost())
const { protocol, hostname, port } = window.location
const [tsHost, setTSHost] = useState(getTorrServerHost() || `${protocol}//${hostname}${port ? `:${port}` : ''}`)
const handleClickOpen = () => setOpen(true) const handleClickOpen = () => setOpen(true)
const handleClose = () => setOpen(false) const handleClose = () => setOpen(false)

View File

@@ -1,4 +1,6 @@
let torrserverHost = process.env.REACT_APP_SERVER_HOST || '' const { protocol, hostname, port } = window.location
let torrserverHost = process.env.REACT_APP_SERVER_HOST || `${protocol}//${hostname}${port ? `:${port}` : ''}`
export const torrentsHost = () => `${torrserverHost}/torrents` export const torrentsHost = () => `${torrserverHost}/torrents`
export const viewedHost = () => `${torrserverHost}/viewed` export const viewedHost = () => `${torrserverHost}/viewed`