File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
apps/remix-ide/src/assets/js Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -25,7 +25,28 @@ createScriptTag = function (url, type) {
2525 script . type = type ;
2626 document . getElementsByTagName ( 'head' ) [ 0 ] . appendChild ( script ) ;
2727} ;
28- fetch ( 'assets/version.json' , { cache : "no-store" } ) . then ( response => {
28+
29+ function isElectron ( ) {
30+ // Renderer process
31+ if ( typeof window !== 'undefined' && typeof window . process === 'object' && window . process . type === 'renderer' ) {
32+ return true
33+ }
34+
35+ // Main process
36+ if ( typeof process !== 'undefined' && typeof process . versions === 'object' && ! ! process . versions . electron ) {
37+ return true
38+ }
39+
40+ // Detect the user agent when the `nodeIntegration` option is set to false
41+ if ( typeof navigator === 'object' && typeof navigator . userAgent === 'string' && navigator . userAgent . indexOf ( 'Electron' ) >= 0 ) {
42+ return true
43+ }
44+
45+ return false
46+ }
47+
48+ const versionUrl = isElectron ( ) ? 'https://remix.ethereum.org/assets/version.json' : 'assets/version.json'
49+ fetch ( versionUrl , { cache : "no-store" } ) . then ( response => {
2950 response . text ( ) . then ( function ( data ) {
3051 const version = JSON . parse ( data ) ;
3152 console . log ( `Loading Remix ${ version . version } ` ) ;
You can’t perform that action at this time.
0 commit comments