Created
February 27, 2024 15:46
-
-
Save dante-nl/5ea074c8b3f298a9d29963d8a2661426 to your computer and use it in GitHub Desktop.
OpenEngine
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html><html lang="en"><head></head><body><script> | |
const oldVersion = "PUT YOUR SHORTCUT VERSION HERE" | |
const newVersion = "PUT THE LATEST VERSION HERE" | |
// π’π½π²π»ππ»π΄πΆπ»π² v1.0 | |
// Β© dante_nl | |
// OpenEngine is an engine to check for your shortcut! You can use this for your updater to check for an update, rollback or latest version. | |
// ππΌπ ππΌ πππ²? | |
// Put in the current version of the shortcut and the most recent version at the top, and check for the output. | |
// The engine will output either "latest", "update" and "rollback". You have to the proper actions with that. | |
// For a full example, please check: <example soon> | |
numbers_oldversion = oldVersion.replace(/[^0-9]/g, "") | |
numbers_newversion = newVersion.replace(/[^0-9]/g, "") | |
if (numbers_oldversion == "" || numbers_newversion == "") { | |
// the version is purely alphabetical | |
if (oldVersion == newVersion) { | |
// latest | |
document.write("latest") | |
} else { | |
document.write("update") | |
} | |
} else { | |
if (parseInt(numbers_oldversion) < parseInt(numbers_newversion)) { | |
// update available | |
document.write("update") | |
} else if (parseInt(numbers_oldversion) > parseInt(numbers_newversion)) { | |
// rollback available | |
document.write("rollback") | |
} else { | |
// latest version | |
document.write("latest") | |
} | |
} | |
</script></body></html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment