Skip to content

Commit

Permalink
Merge pull request #39 from XDanielPaul/main
Browse files Browse the repository at this point in the history
feat: Add the option to filter an example name in the url parameters
  • Loading branch information
igrr authored Sep 15, 2023
2 parents 205866b + a3485de commit db36a32
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,17 @@ async function buildQuickTryUI() {
xhr.onload = function () {
if (xhr.readyState === 4 && xhr.status === 200) {
config = toml.parse(xhr.responseText);

var requestedApp = urlParams.get("app");
if (requestedApp) {
// Filter the supported_apps that start with the app name
const filtered_apps = config.supported_apps.filter(app => app.startsWith(`${requestedApp}-`));

if (filtered_apps.length > 0) {
config["supported_apps"] = filtered_apps;
} else {
alert(`No applications found for ${requestedApp}`);
}
}
if(!isDefault) {
$("#qtLabel").html("Choose from the firmware images listed below. <Br> You have chosen to try the firmware images from an <b><u>external source</u> - "
+ tomlFileURL + "</b>");
Expand All @@ -107,7 +117,6 @@ async function buildQuickTryUI() {
catch (err){
alert ("Unsupported config version used -" + err.message);
}

return config;
}
}
Expand Down Expand Up @@ -695,4 +704,4 @@ flashCustom.onclick = async () => {
$( window ).resize(function() {
clearTimeout(resizeTimeout);
resizeTimeout = setTimeout(() => utilities.resizeTerminal(fitAddon), 300);
});
});

0 comments on commit db36a32

Please sign in to comment.