Append -beta to the version number, define compression on window
Some checks failed
Make Latest Folder On EmulatorJS CDN / run (push) Has been cancelled

This commit is contained in:
Ethan O'Brien 2024-08-03 22:12:43 -05:00
parent e8c9d0d28b
commit 735c20b3be
3 changed files with 17 additions and 9 deletions

View file

@ -100,3 +100,5 @@ class EJS_COMPRESSION {
}); });
} }
} }
window.EJS_COMPRESSION = EJS_COMPRESSION;

View file

@ -202,20 +202,29 @@ class EmulatorJS {
}) })
} }
checkForUpdates() { checkForUpdates() {
if (this.ejs_version.endsWith("-beta")) {
console.warn("Using EmulatorJS beta. Not checking for updates. This instance may be out of date. Using stable is highly recommended unless you build and ship your own cores.");
return;
}
fetch('https://cdn.emulatorjs.org/stable/data/version.json').then(response => { fetch('https://cdn.emulatorjs.org/stable/data/version.json').then(response => {
if (response.ok) { if (response.ok) {
response.text().then(body => { response.text().then(body => {
let version = JSON.parse(body); let version = JSON.parse(body);
if (this.ejs_num_version < version.current_version) { if (this.versionAsInt(this.ejs_version) < this.versionAsInt(version.current_version)) {
console.log('Using EmulatorJS version ' + this.ejs_num_version + ' but the newest version is ' + version.current_version + '\nopen https://github.com/EmulatorJS/EmulatorJS to update'); console.log('Using EmulatorJS version ' + this.versionAsInt(this.ejs_version) + ' but the newest version is ' + this.versionAsInt(version.current_version) + '\nopen https://github.com/EmulatorJS/EmulatorJS to update');
} }
}) })
} }
}) })
} }
versionAsInt(ver) {
if (ver.endsWith("-beta")) {
return 99999999;
}
return parseInt(ver.split(".").join(""));
}
constructor(element, config) { constructor(element, config) {
this.ejs_version = "4.0.12"; this.ejs_version = "4.0.13-beta";
this.ejs_num_version = 401.2;
this.debug = (window.EJS_DEBUG_XX === true); this.debug = (window.EJS_DEBUG_XX === true);
if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates(); if (this.debug || (window.location && ['localhost', '127.0.0.1'].includes(location.hostname))) this.checkForUpdates();
this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true); this.netplayEnabled = (window.EJS_DEBUG_XX === true) && (window.EJS_EXPERIMENTAL_NETPLAY === true);
@ -477,7 +486,7 @@ class EmulatorJS {
} }
checkCompression(data, msg, fileCbFunc) { checkCompression(data, msg, fileCbFunc) {
if (!this.compression) { if (!this.compression) {
this.compression = new EJS_COMPRESSION(this); this.compression = new window.EJS_COMPRESSION(this);
} }
if (msg) { if (msg) {
this.textElem.innerText = msg; this.textElem.innerText = msg;
@ -486,9 +495,6 @@ class EmulatorJS {
this.textElem.innerText = appendMsg ? (msg + m) : m; this.textElem.innerText = appendMsg ? (msg + m) : m;
}, fileCbFunc); }, fileCbFunc);
} }
versionAsInt(ver) {
return parseInt(ver.split(".").join(""));
}
checkCoreCompatibility(version) { checkCoreCompatibility(version) {
// Leave commented until next release - this is ready to go. // Leave commented until next release - this is ready to go.
if (this.versionAsInt(version.minimumEJSVersion) > this.versionAsInt(this.ejs_version)) { if (this.versionAsInt(version.minimumEJSVersion) > this.versionAsInt(this.ejs_version)) {

View file

@ -1 +1 @@
{ "current_version": 401.2 } { "current_version": "4.0.12" }