remove butter.apk; support net.osmand.plus as well as net.osmand

This commit is contained in:
John Hess 2025-03-05 11:06:53 -06:00
parent 295cadc50b
commit 4334cbff4d
2 changed files with 17 additions and 12 deletions

Binary file not shown.

View file

@ -1,7 +1,9 @@
// Checks to see what map files exist at /usb-butter/osm-map-files/ and displays them // Checks to see what map files exist at /usb-butter/osm-map-files/ and displays them
// using the template hidden in the page // using the template hidden in the page
OSM_PACKAGE = "net.osmand"; // APKs which would be acceptable to link to in the instructions
// for installing maps/OSMAnd. The first one found will be used.
OSM_PACKAGES = ["net.osmand", "net.osmand.plus"];
const getMaps = async (folder_href) => { const getMaps = async (folder_href) => {
async function populateSpan(response) { async function populateSpan(response) {
@ -53,18 +55,21 @@ const getOsm = async () => {
json_url = repoRoot + 'index-v1.json'; json_url = repoRoot + 'index-v1.json';
const response = fetch(json_url).then(async (response) => { const response = fetch(json_url).then(async (response) => {
const ix = await response.json(); const ix = await response.json();
if (ix.packages && ix.packages[OSM_PACKAGE] && ix.packages[OSM_PACKAGE].length > 0) { for (let package of OSM_PACKAGES) {
const button = document.getElementById('osm-dl-button'); if (ix.packages && ix.packages[package] && ix.packages[package].length > 0) {
const links = button.querySelectorAll('a'); const button = document.getElementById('osm-dl-button');
const apkName = ix.packages[OSM_PACKAGE][0]['apkName']; const links = button.querySelectorAll('a');
const size = ix.packages[OSM_PACKAGE][0]['size']; const apkName = ix.packages[package][0]['apkName'];
const sizeInMB = Math.floor(size / 1024 / 1024); const size = ix.packages[package][0]['size'];
for (let link of links) { const sizeInMB = Math.floor(size / 1024 / 1024);
link.href = repoRoot + apkName; for (let link of links) {
link.href = repoRoot + apkName;
}
const cta = button.querySelector('.button-sub-text');
cta.textContent = `${sizeInMB} MB`;
button.classList.remove('hidden');
break;
} }
const cta = button.querySelector('.button-sub-text');
cta.textContent = `${sizeInMB} MB`;
button.classList.remove('hidden');
} }
}); });
} }