File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react'
2
2
3
+ let isLocalhost = ( window . location . hostname . indexOf ( 'localhost' ) >= 0 || window . location . hostname . indexOf ( '127.0.0.1' ) >= 0 ) && window . location . port !== '' ;
3
4
export const getServedBy = ( ) => {
4
- return ( window . location . hostname . indexOf ( 'localhost' ) >= 0 && window . location . port !== '' )
5
+ return isLocalhost
5
6
? 'flask'
6
7
: 'nginx'
7
8
}
8
9
9
10
export const getUrl = ( ) => {
10
11
const portWithColon = window . location . port ? `:${ window . location . port } ` : ''
11
- return ( window . location . hostname . indexOf ( 'localhost' ) >= 0 && window . location . port !== '' )
12
- ? `http://localhost :${ process . env . REACT_APP_SERVER_PORT || window . location . port } `
12
+ return isLocalhost
13
+ ? `http://${ window . location . hostname } :${ process . env . REACT_APP_SERVER_PORT || window . location . port } `
13
14
: `${ window . location . protocol } //${ window . location . hostname } ${ portWithColon } `
14
15
}
15
16
@@ -19,8 +20,8 @@ export const getPublicWatchUrl = () => {
19
20
return `${ shareableLinkDomain } /w/`
20
21
}
21
22
const portWithColon = window . location . port ? `:${ window . location . port } ` : ''
22
- return ( window . location . hostname . indexOf ( 'localhost' ) >= 0 && window . location . port !== '' )
23
- ? `http://localhost :${ process . env . REACT_APP_SERVER_PORT || window . location . port } /#/w/`
23
+ return isLocalhost
24
+ ? `http://${ window . location . hostname } :${ process . env . REACT_APP_SERVER_PORT || window . location . port } /#/w/`
24
25
: `${ window . location . protocol } //${ window . location . hostname } ${ portWithColon } /w/`
25
26
}
26
27
You can’t perform that action at this time.
0 commit comments