generalize code avoiding links to snapshot tags

This commit is contained in:
Daniel Micay 2019-05-07 06:50:52 -04:00
parent 0f12afe050
commit 4ec9e0a0d8

View File

@ -3,6 +3,7 @@
const baseUrl = "https://seamlessupdate.app/";
const versionBaseUrl = "https://github.com/GrapheneOS/platform_manifest/releases/tag/";
const devices = ["crosshatch", "blueline", "taimen", "walleye", "marlin", "sailfish"];
const snapshot = ["marlin", "sailfish"];
const channels = ["stable", "beta"];
function createLink(href, text) {
@ -61,11 +62,11 @@ for (const channel of channels) {
const tag = metadata[2] + "." + metadata[0];
const version = document.createElement("p");
if (device !== "marlin" && device !== "sailfish") {
if (snapshot.includes(device)) {
version.appendChild(document.createTextNode("Version: " + tag));
} else {
version.appendChild(document.createTextNode("Version: "));
version.appendChild(createLink(versionBaseUrl + tag, tag));
} else {
version.appendChild(document.createTextNode("Version: " + tag));
}
release.appendChild(version);