File tree Expand file tree Collapse file tree 4 files changed +15
-3
lines changed
Sandbox/SearchDependencies/DependencyHit Expand file tree Collapse file tree 4 files changed +15
-3
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,10 @@ const getHost = () => {
1818 return `http://${ process . env . STAGING_BRANCH } .cs.lbogdan.tk` ;
1919 }
2020
21+ if ( 'ROOT_URL' in process . env ) {
22+ return process . env . ROOT_URL ;
23+ }
24+
2125 return 'https://codesandbox.io' ;
2226} ;
2327
Original file line number Diff line number Diff line change @@ -34,7 +34,11 @@ export default class DependencyHit extends React.PureComponent {
3434 }
3535
3636 makeSearchUrl ( hitName : string ) {
37- return `https://codesandbox.io/search?refinementList%5Bnpm_dependencies.dependency%5D%5B0%5D=${ hitName } &page=1` ;
37+ return `${
38+ process . env . CODESANDBOX_HOST
39+ } /search?refinementList%5Bnpm_dependencies.dependency%5D%5B0%5D=${
40+ hitName
41+ } &page=1`;
3842 }
3943
4044 stopPropagation ( e ) {
Original file line number Diff line number Diff line change @@ -23,7 +23,9 @@ import {
2323 ButtonName ,
2424} from './elements' ;
2525
26- const BUTTON_URL = 'https://codesandbox.io/static/img/play-codesandbox.svg' ;
26+ const BUTTON_URL = `${
27+ process . env . CODESANDBOX_HOST
28+ } /static/img/play-codesandbox.svg`;
2729
2830class ShareView extends React . Component {
2931 state = {
Original file line number Diff line number Diff line change @@ -25,7 +25,9 @@ function getId() {
2525 return document . location . host . match ( re ) [ 1 ] ;
2626 }
2727
28- return document . location . host . match ( / ( .* ) \. c o d e s a n d b o x / ) [ 1 ] ;
28+ const hostRegex = host . replace ( / h t t p s ? : \/ \/ / , '' ) . replace ( / \. / g, '\\.' ) ;
29+ const sandboxRegex = new RegExp ( `(.*)\\.${ hostRegex } ` ) ;
30+ return document . location . host . match ( sandboxRegex ) [ 1 ] ;
2931}
3032
3133requirePolyfills ( ) . then ( ( ) => {
You can’t perform that action at this time.
0 commit comments