Skip to content

Commit

Permalink
Add back valid OS and TYPE lists that got lost
Browse files Browse the repository at this point in the history
  • Loading branch information
confused-Techie committed Feb 3, 2024
1 parent 4ae8954 commit 214adb2
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions microservices/download/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
const https = require("node:https");
const bins = require("./bins.js");
let TOKEN = process.env.GH_TOKEN_DOWNLOAD_MICROSERVICE;
const VALID_OS = [ "linux", "arm_linux", "silicon_mac", "intel_mac", "windows" ];
const VALID_TYPE = [
"linux_appimage",
"linux_tar",
"linux_rpm",
"linux_deb",
"windows_setup",
"windows_portable",
"windows_blockmap",
"mac_zip",
"mac_zip_blockmap",
"mac_dmg",
"mac_dmg_blockmap"
];

// Environment Variables Check

Expand Down Expand Up @@ -60,14 +74,13 @@ function query_os(queryString) {
}

const allParams = queryString.split("&");
const valid = [ "linux", "arm_linux", "silicon_mac", "intel_mac", "windows" ];

for (const param of allParams) {
if (param.startsWith("os=")) {
// Returning a result based on the first "os=" param we encounter.
// Users should not provide the same param twice, that would be invalid.
const prov = param.split("=")[1];
return valid.includes(prov) ? prov : false;
return VALID_OS.includes(prov) ? prov : false;
}
}

Expand All @@ -81,26 +94,13 @@ function query_type(queryString) {
}

const allParams = queryString.split("&");
const valid = [
"linux_appimage",
"linux_tar",
"linux_rpm",
"linux_deb",
"windows_setup",
"windows_portable",
"windows_blockmap",
"mac_zip",
"mac_zip_blockmap",
"mac_dmg",
"mac_dmg_blockmap"
];

for (const param of allParams) {
if (param.startsWith("type=")) {
// Returning a result based on the first "type=" param we encounter.
// Users should not provide the same param twice, that would be invalid.
const prov = param.split("=")[1];
return valid.includes(prov) ? prov : false;
return VALID_TYPE.includes(prov) ? prov : false;
}
}

Expand Down

0 comments on commit 214adb2

Please sign in to comment.