Shorten firmware picker selection links and keep original download names
Replace the download-file shortcut approach with compact self-contained picker URLs under /p/. Preserve long-link compatibility, selected install formats, and full published firmware filenames. Cover selection round trips and the redirect in the picker tests.
This commit is contained in:
1 parent
5bd2c1fe4c
commit
7e5eabe81c
16 files changed
+269
-773
No files matched your search
@@ -1,24 +0,0 @@
|
||||
{
|
||||
"schemaVersion": 1,
|
||||
"repository": "mikecarper/MeshCore",
|
||||
"links": [
|
||||
{
|
||||
"filename": "rak4631-1.17.1.10-p2.uf2",
|
||||
"version": "1.17.1.10",
|
||||
"releaseTag": "rak4631-full-companion-v1.17.1.10-preview2",
|
||||
"asset": "RAK_4631_companion_radio_full-v1.17.1.10-halo-keymind-cascade-preview2-015a3e8e.uf2",
|
||||
"sha256": "b74243f9741133b0f0ae858fab02de9aaa999f84c474e0a659efce85fe35ad8c",
|
||||
"size": 1408000,
|
||||
"label": "RAK4631 Full Companion 1.17.1.10 preview2: UF2"
|
||||
},
|
||||
{
|
||||
"filename": "rak4631-1.17.1.10-p2.zip",
|
||||
"version": "1.17.1.10",
|
||||
"releaseTag": "rak4631-full-companion-v1.17.1.10-preview2",
|
||||
"asset": "RAK_4631_companion_radio_full-v1.17.1.10-halo-keymind-cascade-preview2-015a3e8e.zip",
|
||||
"sha256": "11783d291f80c8084bb16f46ad2e35f0b1631da10606723488e2061320a5f6db",
|
||||
"size": 704759,
|
||||
"label": "RAK4631 Full Companion 1.17.1.10 preview2: Serial/Bluetooth DFU ZIP"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -23,6 +23,11 @@
|
||||
]);
|
||||
|
||||
const FACET_FIELDS = Object.freeze(FILTER_FIELDS.concat(["install"]));
|
||||
// Versioned picker selections stay self-contained as release catalogs change.
|
||||
const SHORT_SELECTION_FIELDS = Object.freeze({
|
||||
c: "chipFamily", g: "hardwareFamily", h: "hardware", r: "role",
|
||||
l: "logging", o: "ota", m: "mode", f: "feature", v: "variant", i: "install",
|
||||
});
|
||||
const PROFILE_FIELDS = Object.freeze(["ota", "feature", "variant"]);
|
||||
const CHOICE_FIELDS = Object.freeze([
|
||||
"chipFamily", "hardwareFamily", "hardware", "role", "logging",
|
||||
@@ -1207,6 +1212,7 @@
|
||||
|
||||
function selectionUrl(url, filters, automaticChipFamily) {
|
||||
const result = new URL(url);
|
||||
result.searchParams.delete("s");
|
||||
FACET_FIELDS.forEach(function (field) {
|
||||
result.searchParams.delete(field);
|
||||
if (filters[field]) result.searchParams.set(field, filters[field]);
|
||||
@@ -1218,8 +1224,61 @@
|
||||
return result.href;
|
||||
}
|
||||
|
||||
function shortSelectionUrl(url, filters, automaticChipFamily) {
|
||||
const result = new URL(url);
|
||||
FACET_FIELDS.concat(["chipAuto", "s"]).forEach(function (field) {
|
||||
result.searchParams.delete(field);
|
||||
});
|
||||
const parts = ["1"];
|
||||
Object.keys(SHORT_SELECTION_FIELDS).forEach(function (key) {
|
||||
const field = SHORT_SELECTION_FIELDS[key];
|
||||
const value = filters[field];
|
||||
if (!value || (field === "chipFamily" && automaticChipFamily) ||
|
||||
(field === "hardwareFamily" && value === filters.hardware)) return;
|
||||
// Dots delimit fields; escape them even though encodeURIComponent does not.
|
||||
parts.push(key + encodeURIComponent(value).replace(/\./g, "%2E"));
|
||||
});
|
||||
if ((filters.hardwareFamily || filters.hardware) && !automaticChipFamily) {
|
||||
parts.push("a0");
|
||||
}
|
||||
if (parts.length > 1) result.searchParams.set("s", parts.join("."));
|
||||
return result.href;
|
||||
}
|
||||
|
||||
function shortSelectionParams(params) {
|
||||
const parts = params.get("s").split(".");
|
||||
const result = new URLSearchParams();
|
||||
if (params.getAll("s").length !== 1 || parts.shift() !== "1" || !parts.length) {
|
||||
throw new Error("unsupported or incomplete short picker link");
|
||||
}
|
||||
const seen = new Set();
|
||||
parts.forEach(function (part) {
|
||||
const key = part.charAt(0);
|
||||
if (seen.has(key) || (key !== "a" &&
|
||||
!Object.prototype.hasOwnProperty.call(SHORT_SELECTION_FIELDS, key))) {
|
||||
throw new Error("duplicate or unknown short picker field");
|
||||
}
|
||||
seen.add(key);
|
||||
const value = decodeURIComponent(part.slice(1));
|
||||
if (!value || (key === "a" && value !== "0" && value !== "1")) {
|
||||
throw new Error("invalid short picker field");
|
||||
}
|
||||
result.set(key === "a" ? "chipAuto" : SHORT_SELECTION_FIELDS[key], value);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
function selectionFromUrl(url, profiles) {
|
||||
const params = new URL(url).searchParams;
|
||||
let params = new URL(url).searchParams;
|
||||
if (params.has("s")) {
|
||||
try {
|
||||
// The versioned selection is authoritative over any legacy fields.
|
||||
params = shortSelectionParams(params);
|
||||
} catch (error) {
|
||||
return { filters: {}, automaticChipFamily: false,
|
||||
unavailable: ["short link: " + error.message] };
|
||||
}
|
||||
}
|
||||
const requested = {};
|
||||
const filters = {};
|
||||
const unavailable = [];
|
||||
@@ -1952,7 +2011,7 @@
|
||||
}
|
||||
|
||||
function updateSelectionUrl() {
|
||||
const url = selectionUrl(global.location.href, filters, automaticChipFamily);
|
||||
const url = shortSelectionUrl(global.location.href, filters, automaticChipFamily);
|
||||
if (url !== global.location.href) {
|
||||
try {
|
||||
global.history.replaceState(global.history.state, "", url);
|
||||
@@ -1962,9 +2021,11 @@
|
||||
}
|
||||
}
|
||||
if (shareLink) {
|
||||
const base = global.location.protocol === "file:"
|
||||
? root.getAttribute("data-share-url") : url;
|
||||
shareLink.href = selectionUrl(base || url, filters, automaticChipFamily);
|
||||
const base = new URL(global.location.protocol === "file:"
|
||||
? root.getAttribute("data-share-url") || url : url);
|
||||
base.pathname = base.pathname.replace(/\/firmware_picker\/$/, "/p/");
|
||||
if (global.location.protocol === "file:") base.hash = global.location.hash;
|
||||
shareLink.href = shortSelectionUrl(base.href, filters, automaticChipFamily);
|
||||
shareLink.hidden = false;
|
||||
}
|
||||
if (copyLinkButton) copyLinkButton.disabled = false;
|
||||
@@ -1987,13 +2048,13 @@
|
||||
if (copyLinkButton && shareLink) copyLinkButton.addEventListener("click", function () {
|
||||
const copy = global.navigator.clipboard && global.navigator.clipboard.writeText;
|
||||
if (!copy) {
|
||||
linkStatus.textContent = "Copy the address bar, or copy the 'Link to these settings' link.";
|
||||
linkStatus.textContent = "Copy the address bar, or copy the 'Short link to these settings' link.";
|
||||
return;
|
||||
}
|
||||
global.navigator.clipboard.writeText(shareLink.href).then(function () {
|
||||
linkStatus.textContent = "Link copied.";
|
||||
}).catch(function () {
|
||||
linkStatus.textContent = "Copy the address bar, or copy the 'Link to these settings' link.";
|
||||
linkStatus.textContent = "Copy the address bar, or copy the 'Short link to these settings' link.";
|
||||
});
|
||||
});
|
||||
global.addEventListener("popstate", restoreSelectionUrl);
|
||||
@@ -2513,6 +2574,7 @@
|
||||
choicesUseSameFirmware: choicesUseSameFirmware,
|
||||
selectionRequirements: selectionRequirements,
|
||||
selectionUrl: selectionUrl,
|
||||
shortSelectionUrl: shortSelectionUrl,
|
||||
selectionFromUrl: selectionFromUrl,
|
||||
canonicalAsset: canonicalAsset,
|
||||
resolveProfileAssets: resolveProfileAssets,
|
||||
|
||||
@@ -1,35 +0,0 @@
|
||||
<!-- meshcore-hosted-doc-link:start -->
|
||||
<p class="meshcore-hosted-doc-link"><a href="https://mikecarper.github.io/MeshCore/d/">View this page on MeshCore Docs</a>.</p>
|
||||
<!-- meshcore-hosted-doc-link:end -->
|
||||
|
||||
# Short firmware links
|
||||
|
||||
These links download the same firmware bytes as the original GitHub release,
|
||||
with shorter filenames. Each link is pinned to one version and verified against
|
||||
its SHA-256 checksum when the site is built. Existing links keep their original
|
||||
firmware; a new release gets a new link.
|
||||
|
||||
<!-- firmware-shortlinks:table -->
|
||||
|
||||
For **RAK4631 Full Companion**, use the **UF2** for a bootloader-drive
|
||||
drag-and-drop update. Use the **DFU ZIP** when pasting a custom download URL
|
||||
into the Windows or Linux MeshCore firmware tool. The ZIP is the native
|
||||
application update package, not the release's download bundle. These files do
|
||||
not install a bootloader or SoftDevice.
|
||||
|
||||
The 1.17.1.10 preview2 files are for MeshTalk testing with Keymind Cascade and
|
||||
USA Cascade defaults. The original release includes instructions, qualification
|
||||
reports and checksums. See the [firmware picker](firmware_picker.md) for other
|
||||
board and release choices.
|
||||
|
||||
## Adding links for another release
|
||||
|
||||
Add an entry to `docs/_data/firmware_shortlinks.json` with a unique,
|
||||
version-specific filename, exact release tag and asset name, byte size, label
|
||||
and SHA-256 checksum from the validated release. Keep the original firmware
|
||||
extension. Never change or remove a published filename's version, source or
|
||||
checksum. Labels can be corrected without changing the download.
|
||||
|
||||
The documentation build downloads and verifies the pinned files before
|
||||
publishing them under `d/`. A missing asset, incorrect checksum or changed
|
||||
published link stops deployment instead of publishing a different image.
|
||||
+17
-14
@@ -4,10 +4,6 @@
|
||||
|
||||
# Firmware picker
|
||||
|
||||
For shorter, version-pinned firmware download URLs, use
|
||||
[Short firmware links](d.md). Those links serve the original verified firmware
|
||||
files and include the RAK4631 Full Companion 1.17.1.10 preview2 for MeshTalk testing.
|
||||
|
||||
Each result now includes **Restore your settings after flashing**. Its commands
|
||||
follow the selected logging mode and the exact image's verified role/hardware
|
||||
controls. Click On, Off, or Check to view and copy the commands; Companion
|
||||
@@ -45,7 +41,7 @@ The picker reads public release metadata from GitHub. It does not upload device
|
||||
information. Hardware names, target names, and download links come directly
|
||||
from the published firmware assets.
|
||||
|
||||
<div class="firmware-picker" data-firmware-picker data-release-repo="mikecarper/MeshCore" data-controls-url="../_data/firmware_controls.json?v=1.17.1.9-88c85108" data-bootloaders-url="../_data/bootloader_manifest.json?v=20261002-1" data-share-url="https://mikecarper.github.io/MeshCore/firmware_picker/">
|
||||
<div class="firmware-picker" data-firmware-picker data-release-repo="mikecarper/MeshCore" data-controls-url="../_data/firmware_controls.json?v=1.17.1.9-88c85108" data-bootloaders-url="../_data/bootloader_manifest.json?v=20261002-1" data-share-url="https://mikecarper.github.io/MeshCore/p/">
|
||||
<div class="firmware-picker-intro" role="note">
|
||||
<strong>Current release set</strong>
|
||||
<p data-role="release-set">Loading release information...</p>
|
||||
@@ -74,7 +70,7 @@ from the published firmware assets.
|
||||
<p class="firmware-picker-order-note">
|
||||
Pick in any order. Use <strong>Any</strong> to clear one choice, or clear
|
||||
everything with the button below. The address bar updates with your choices;
|
||||
copy its URL to reopen or share the same selection.
|
||||
use <strong>Copy link to settings</strong> for a shorter link to the same selection.
|
||||
</p>
|
||||
|
||||
<form class="firmware-picker-form" data-role="form">
|
||||
@@ -150,7 +146,7 @@ from the published firmware assets.
|
||||
<div class="firmware-picker-form-actions firmware-picker-wide">
|
||||
<button type="reset" data-action="clear" disabled>Clear all choices</button>
|
||||
<button type="button" data-action="copy-link" disabled>Copy link to settings</button>
|
||||
<a data-role="share-link" hidden>Link to these settings</a>
|
||||
<a data-role="share-link" hidden>Short link to these settings</a>
|
||||
<p data-role="link-status" aria-live="polite"></p>
|
||||
</div>
|
||||
</form>
|
||||
@@ -253,31 +249,38 @@ changing roles or partition layouts.
|
||||
|
||||
## Share a selection
|
||||
|
||||
Select any combination of choices, then copy the address bar or use **Copy link
|
||||
to settings**. Opening the link restores those choices after the release
|
||||
Select any combination of choices, then use **Copy link to settings** for a
|
||||
short URL under `https://mikecarper.github.io/MeshCore/p/`. Opening the link
|
||||
restores those choices after the release
|
||||
catalog loads. Partial selections work too, so you can share a board and role
|
||||
while leaving other choices open. **Clear all choices** removes the picker
|
||||
parameters from the URL. Changes update the current browser-history entry
|
||||
without reloading the page or adding a Back-button entry for every click.
|
||||
|
||||
For example, [RAK3401 unified Full repeater](?hardware=RAK_3401&role=repeater&ota=lora-receiver&feature=full&variant=default)
|
||||
For example, [RAK3401 unified Full repeater](https://mikecarper.github.io/MeshCore/p/?s=1.hRAK_3401.rrepeater.olora-receiver.ffull.vdefault)
|
||||
preselects that board, role, OTA capability, and Full sensor policy. Supported
|
||||
internal or external storage is detected by the unified image.
|
||||
|
||||
The query parameters are `chipFamily`, `hardwareFamily`, `hardware`, `role`,
|
||||
Short links encode only the selected choices in a versioned `s` parameter.
|
||||
Hardware identifiers stay readable, and the link omits redundant hardware-family
|
||||
and automatically selected chip-family values. It keeps profile and install
|
||||
choices explicitly rather than relying on the current catalog's defaults.
|
||||
The address bar also uses the compact selection format; copying it works too.
|
||||
|
||||
Existing long links still work. Their query parameters are `chipFamily`, `hardwareFamily`, `hardware`, `role`,
|
||||
`logging`, `ota`, `mode`, `feature`, `variant`, and `install`. Values use the
|
||||
picker's internal identifiers rather than the displayed labels. One Firmware
|
||||
profile button sets `ota`, `feature`, and `variant` together. Existing links
|
||||
with only some of those choices still work and show their partial selection.
|
||||
The generated
|
||||
link also records `chipAuto` so automatic chip-family selection or an explicit
|
||||
The selection also records when chip-family filtering was chosen manually so
|
||||
automatic chip-family selection or an explicit
|
||||
**Any** choice behaves the same after reopening. Existing section anchors and
|
||||
unrelated query parameters are preserved.
|
||||
|
||||
Links use the current release catalog. If a linked choice is no longer available
|
||||
or conflicts with another choice, the picker identifies it and asks you to
|
||||
review the remaining selections. The downloadable HTML's **Copy link to
|
||||
settings** button creates a public website link that other people can open.
|
||||
settings** button creates a short public website link that other people can open.
|
||||
|
||||
## FULL versus standard
|
||||
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>MeshCore firmware picker</title>
|
||||
<link rel="canonical" href="../firmware_picker/">
|
||||
</head>
|
||||
<body>
|
||||
<p>Opening the firmware picker. <a id="picker-link" href="../firmware_picker/">Continue to the picker</a>.</p>
|
||||
<script>
|
||||
(function () {
|
||||
"use strict";
|
||||
const target = new URL("../firmware_picker/", window.location.href);
|
||||
target.search = window.location.search;
|
||||
target.hash = window.location.hash;
|
||||
document.getElementById("picker-link").href = target.href;
|
||||
window.location.replace(target.href);
|
||||
})();
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user