fix load with remix desktop

pull/2323/head
yann300 3 years ago committed by GitHub
parent 6dcc7ae6ec
commit 3bdc23e07e
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