Merge pull request #2323 from ethereum/yann300-patch-41

fix load with remix desktop
pull/2327/head
yann300 3 years ago committed by GitHub
commit b444717061
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 23
      apps/remix-ide/src/assets/js/loader.js

@ -25,7 +25,28 @@ createScriptTag = function (url, type) {
script.type = type;
document.getElementsByTagName('head')[0].appendChild(script);
};
fetch('assets/version.json', { cache: "no-store" }).then(response => {
function isElectron() {
// Renderer process
if (typeof window !== 'undefined' && typeof window.process === 'object' && window.process.type === 'renderer') {
return true
}
// Main process
if (typeof process !== 'undefined' && typeof process.versions === 'object' && !!process.versions.electron) {
return true
}
// Detect the user agent when the `nodeIntegration` option is set to false
if (typeof navigator === 'object' && typeof navigator.userAgent === 'string' && navigator.userAgent.indexOf('Electron') >= 0) {
return true
}
return false
}
const versionUrl = isElectron() ? 'https://remix.ethereum.org/assets/version.json' : 'assets/version.json'
fetch(versionUrl, { cache: "no-store" }).then(response => {
response.text().then(function (data) {
const version = JSON.parse(data);
console.log(`Loading Remix ${version.version}`);

Loading…
Cancel
Save