diff options
| author | Daniel Micay <danielmicay@gmail.com> | 2021-01-05 02:43:55 -0500 |
|---|---|---|
| committer | Daniel Micay <danielmicay@gmail.com> | 2021-01-05 02:43:55 -0500 |
| commit | f9328e24c1b4adf2d6e5f36a471fd504fa8dd8f7 (patch) | |
| tree | 415db24e9f12f1a91bb0ef30d80d47d16aaed51d /static/js/releases.js | |
| parent | e1ddbd94b0a975b4ee08f8936672b6da80e4d113 (diff) | |
move javascript files to js directory
Diffstat (limited to 'static/js/releases.js')
| -rw-r--r-- | static/js/releases.js | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/static/js/releases.js b/static/js/releases.js new file mode 100644 index 00000000..53b782d1 --- /dev/null +++ b/static/js/releases.js @@ -0,0 +1,44 @@ +// @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT + +const baseUrl = "https://releases.grapheneos.org/"; +const versionBaseUrl = "https://github.com/GrapheneOS/platform_manifest/releases/tag/"; +const devices = ["sunfish", "coral", "flame", "bonito", "sargo", "crosshatch", "blueline", "taimen", "walleye"]; +const channels = ["stable", "beta"]; + +for (const channel of channels) { + for (const device of devices) { + fetch(baseUrl + device + "-" + channel).then(response => { + if (!response.ok) { + return Promise.reject(); + } + return response.text(); + }).then(text => { + const metadata = text.trim().split(" "); + + const factoryFilename = device + "-factory-" + metadata[0] + ".zip"; + const factoryUrl = baseUrl + factoryFilename; + + const updateFilename = device + "-ota_update-" + metadata[0] + ".zip"; + const updateUrl = baseUrl + updateFilename; + + const tag = metadata[2] + "." + metadata[0]; + + const release = document.getElementById(device + "-" + channel); + const links = release.getElementsByTagName("a"); + + links[1].innerText = tag; + links[1].setAttribute("href", versionBaseUrl + tag); + + links[2].innerText = factoryFilename; + links[2].setAttribute("href", factoryUrl); + + links[3].innerText = factoryFilename + ".sig"; + links[3].setAttribute("href", factoryUrl + ".sig"); + + links[4].innerText = updateFilename; + links[4].setAttribute("href", updateUrl); + }); + } +} + +// @license-end |
