|
|
@ -174,10 +174,13 @@ class CompilerContainer { |
|
|
|
|
|
|
|
|
|
|
|
render () { |
|
|
|
render () { |
|
|
|
this.compileTabLogic.compiler.event.register('compilerLoaded', (version) => this.setVersionText(version)) |
|
|
|
this.compileTabLogic.compiler.event.register('compilerLoaded', (version) => this.setVersionText(version)) |
|
|
|
this.fetchAllVersion((allversions, selectedVersion) => { |
|
|
|
this.fetchAllVersion((allversions, selectedVersion, isURL) => { |
|
|
|
this.data.allversions = allversions |
|
|
|
this.data.allversions = allversions |
|
|
|
this.data.selectedVersion = selectedVersion |
|
|
|
if(isURL) this._updateVersionSelector(selectedVersion) |
|
|
|
if (this._view.versionSelector) this._updateVersionSelector() |
|
|
|
else { |
|
|
|
|
|
|
|
this.data.selectedVersion = selectedVersion |
|
|
|
|
|
|
|
if (this._view.versionSelector) this._updateVersionSelector() |
|
|
|
|
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
this._view.warnCompilationSlow = yo`<i title="Compilation Slow" style="visibility:hidden" class="${css.warnCompilationSlow} fas fa-exclamation-triangle" aria-hidden="true"></i>` |
|
|
|
this._view.warnCompilationSlow = yo`<i title="Compilation Slow" style="visibility:hidden" class="${css.warnCompilationSlow} fas fa-exclamation-triangle" aria-hidden="true"></i>` |
|
|
@ -407,6 +410,7 @@ class CompilerContainer { |
|
|
|
this.data.selectedVersion = customUrl |
|
|
|
this.data.selectedVersion = customUrl |
|
|
|
this._view.versionSelector.appendChild(yo`<option value="${customUrl}" selected>custom</option>`) |
|
|
|
this._view.versionSelector.appendChild(yo`<option value="${customUrl}" selected>custom</option>`) |
|
|
|
url = customUrl |
|
|
|
url = customUrl |
|
|
|
|
|
|
|
this.queryParams.update({ version: this.data.selectedVersion }) |
|
|
|
} else if (this.data.selectedVersion === 'builtin') { |
|
|
|
} else if (this.data.selectedVersion === 'builtin') { |
|
|
|
let location = window.document.location |
|
|
|
let location = window.document.location |
|
|
|
location = `${location.protocol}//${location.host}/${location.pathname}` |
|
|
|
location = `${location.protocol}//${location.host}/${location.pathname}` |
|
|
@ -449,7 +453,7 @@ class CompilerContainer { |
|
|
|
|
|
|
|
|
|
|
|
// fetching both normal and wasm builds and creating a [version, baseUrl] map
|
|
|
|
// fetching both normal and wasm builds and creating a [version, baseUrl] map
|
|
|
|
async fetchAllVersion (callback) { |
|
|
|
async fetchAllVersion (callback) { |
|
|
|
let allVersions, selectedVersion, allVersionsWasm |
|
|
|
let allVersions, selectedVersion, allVersionsWasm, isURL |
|
|
|
// fetch normal builds
|
|
|
|
// fetch normal builds
|
|
|
|
const binRes = await promisedMiniXhr(`${baseURLBin}/list.json`) |
|
|
|
const binRes = await promisedMiniXhr(`${baseURLBin}/list.json`) |
|
|
|
// fetch wasm builds
|
|
|
|
// fetch wasm builds
|
|
|
@ -463,6 +467,11 @@ class CompilerContainer { |
|
|
|
allVersions = JSON.parse(binRes.json).builds.slice().reverse() |
|
|
|
allVersions = JSON.parse(binRes.json).builds.slice().reverse() |
|
|
|
selectedVersion = this.data.defaultVersion |
|
|
|
selectedVersion = this.data.defaultVersion |
|
|
|
if (this.queryParams.get().version) selectedVersion = this.queryParams.get().version |
|
|
|
if (this.queryParams.get().version) selectedVersion = this.queryParams.get().version |
|
|
|
|
|
|
|
// Check if version is a URL and corresponding filename starts with 'soljson'
|
|
|
|
|
|
|
|
if (selectedVersion.startsWith('https://')) { |
|
|
|
|
|
|
|
const urlArr = selectedVersion.split('/') |
|
|
|
|
|
|
|
if(urlArr[urlArr.length - 1].startsWith('soljson')) isURL = true |
|
|
|
|
|
|
|
}
|
|
|
|
if (wasmRes.event.type !== 'error') { |
|
|
|
if (wasmRes.event.type !== 'error') { |
|
|
|
allVersionsWasm = JSON.parse(wasmRes.json).builds.slice().reverse() |
|
|
|
allVersionsWasm = JSON.parse(wasmRes.json).builds.slice().reverse() |
|
|
|
} |
|
|
|
} |
|
|
@ -481,7 +490,7 @@ class CompilerContainer { |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
} |
|
|
|
} |
|
|
|
callback(allVersions, selectedVersion) |
|
|
|
callback(allVersions, selectedVersion, isURL) |
|
|
|
} |
|
|
|
} |
|
|
|
scheduleCompilation () { |
|
|
|
scheduleCompilation () { |
|
|
|
if (!this.config.get('autoCompile')) return |
|
|
|
if (!this.config.get('autoCompile')) return |
|
|
|