diff --git a/app.js b/app.js index be359d721abbcc7330cc524fbe5fef5e61095157..ca16aee8c139fee790f54fc6ee9f6ed2824852a4 100644 --- a/app.js +++ b/app.js @@ -140,13 +140,47 @@ var firmwarewizard = function() { PREVIEW_PICTURES_DIR = config.preview_pictures; } + function merge_device_list(obj1, obj2) { + // Merge obj2 in obj1 + for (var vendor_name in obj2) { + if (!(vendor_name in obj1)) { + obj1[vendor_name] = obj2[vendor_name]; + continue; + } + + for (var device_name in obj2[vendor_name]) { + if (!(device_name in obj1[vendor_name])) { + obj1[vendor_name][device_name] = obj2[vendor_name][device_name]; + continue; + } + + for (var revision in obj2[vendor_name][device_name]) { + obj1[vendor_name][device_name][revision] = obj2[vendor_name][device_name][revision]; + } + } + } + } + + function buildModelList() { + var device_list = {} + if (!("enabled_device_categories" in config)) { + return config.vendormodels.recommended; + } + + for (var i=0; i<config.enabled_device_categories.length; i++) { + merge_device_list(device_list, config.vendormodels[config.enabled_device_categories[i]]); + } + + return device_list; + } function buildVendorModelsReverse() { var vendormodels_reverse = {}; // create a map of {match : [{vendor, model, default-revision}, ... ], ...} - for (var vendor in config.vendormodels) { - var models = config.vendormodels[vendor]; + var vendormodels = buildModelList() + for (var vendor in vendormodels) { + var models = vendormodels[vendor]; for (var model in models) { var match = models[model]; if (typeof match == 'string') { diff --git a/config_template.js b/config_template.js index 89396b419d34eb983a2aac20735170b386b73acc..c8b8cd0266113d613778b9f1346b7cc21c0206b4 100644 --- a/config_template.js +++ b/config_template.js @@ -18,6 +18,8 @@ var config = { listMissingImages: false, // see devices.js for different vendor model maps vendormodels: vendormodels, + // set enabled categories of devices (see devices.js) + enabled_device_categories: ["recommended"], // community prefix of the firmware images community_prefix: 'gluon-ffda-', // firmware version regex diff --git a/devices.js b/devices.js index 7126566bdba7b1bcc84407beb9d5e39af4826c23..bf074ccc7e44be66ee30d9ce4778b9ac030edc33 100644 --- a/devices.js +++ b/devices.js @@ -1,4 +1,4 @@ -var vendormodels = { +var devices_recommended = { "8devices": { "Carambola Board 2": "8devices-carambola2-board" }, @@ -116,58 +116,23 @@ var vendormodels = { "WBS 210": "tp-link-wbs210", "WBS 510": "tp-link-wbs510", "RE450": "tp-link-re450", - "TL-MR13U": "tp-link-tl-mr13u", - "TL-MR3020": "tp-link-tl-mr3020", - "TL-MR3040": "tp-link-tl-mr3040", - "TL-MR3220": "tp-link-tl-mr3220", - "TL-MR3420": "tp-link-tl-mr3420", - "TL-WA701N/ND": {"tp-link-tl-wa701nd": "", "tp-link-tl-wa701n-nd": ""}, - "TL-WA7210N/ND": "tp-link-tl-wa7210n", - "TL-WA730RE": "tp-link-tl-wa730re", - "TL-WA750RE": "tp-link-tl-wa750re", - "TL-WA7510N": "tp-link-tl-wa7510n", - "TL-WA801N/ND": {"tp-link-tl-wa801n": "", "tp-link-tl-wa801n-nd": ""}, - "TL-WA830RE": "tp-link-tl-wa830re", - "TL-WA850RE": "tp-link-tl-wa850re", - "TL-WA860RE": "tp-link-tl-wa860re", - "TL-WA901N/ND": {"tp-link-tl-wa901nd": "", "tp-link-tl-wa901n-nd": ""}, "TL-WDR3500": "tp-link-tl-wdr3500", "TL-WDR3600": "tp-link-tl-wdr3600", "TL-WDR4300": "tp-link-tl-wdr4300", "TL-WDR4900": "tp-link-tl-wdr4900", - "TL-WR1043N/ND": {"tp-link-tl-wr1043n-nd": "", "tp-link-tl-wr1043n": ""}, + "TL-WR1043N/ND": {"tp-link-tl-wr1043n-nd-v2": "v2", "tp-link-tl-wr1043n-nd-v3": "v3", + "tp-link-tl-wr1043n-nd-v4": "v4", "tp-link-tl-wr1043n-v5": "v5"}, "TL-WR2543N/ND": {"tp-link-tl-wr2543n-nd": ""}, - "TL-WR703N": "tp-link-tl-wr703n", - "TL-WR710N": "tp-link-tl-wr710n", - "TL-WR740N/ND": "tp-link-tl-wr740n-nd", - "TL-WR741N/ND": "tp-link-tl-wr741n-nd", - "TL-WR743N/ND": "tp-link-tl-wr743n-nd", - "TL-WR802N": {"tp-link-tl-wr802n": "v1"}, - "TL-WR810N": {"tp-link-tl-wr810n": "v1"}, - "TL-WR841N/ND": {"tp-link-tl-wr841n-nd": "", "tp-link-tl-wr841nd": ""}, - "TL-WR842N/ND": {"tp-link-tl-wr842n-nd": ""}, - "TL-WR843N/ND": {"tp-link-tl-wr843n-nd": ""}, - "TL-WR940N/ND": {"tp-link-tl-wr940n": "", "tp-link-tl-wr940n-nd": "", "tp-link-tl-wr941nd-v4": "v1", "tp-link-tl-wr941nd-v5": "v2", "tp-link-tl-wr941nd-v6": "v3"}, - "TL-WR941N/ND": {"tp-link-tl-wr941nd": "", "tp-link-tl-wr941n-nd": "", "tp-link-tl-wr941nd-v4": "v4", "tp-link-tl-wr941nd-v5": "v5", "tp-link-tl-wr941nd-v6": "v6"} + "TL-WR842N/ND": {"tp-link-tl-wr842n-nd-v3": "v3"}, }, "Ubiquiti": { "AirGateway": {"ubnt-air-gateway": "", "ubiquiti-airgateway": "", "ubiquiti-airgateway-lr": "LR", "ubiquiti-airgateway-pro": "Pro"}, - "AirRouter": {"ubnt-air-router": "", "ubiquiti-airrouter": ""}, - "Bullet": {"ubiquiti-bullet-m2": "M2", "ubiquiti-bullet-m5": "M5", "bullet-m": "--ignore--"}, "EdgeRouter X": "ubnt-erx", "EdgeRouter X-SFP": "ubnt-erx-sfp", "Litestation SR71": "ubiquiti-ls-sr71", - "NanoStation Loco": {"ubiquiti-loco-m-xw": "--ignore--", - "ubiquiti-nanostation-loco-m2": "M2 XM", "ubiquiti-nanostation-loco-m2-xw": "M2 XW", - "ubiquiti-nanostation-loco-m5": "M5 XM", "ubiquiti-nanostation-loco-m5-xw": "M5 XW"}, - "NanoStation": {"ubiquiti-nanostation-m": "--ignore--", "ubiquiti-nano-m": "--ignore--", "ubiquiti-nanostation-m-xw": "--ignore--", "ubiquiti-nano-m-xw": "--ignore--", - "ubiquiti-nanostation-m2": "M2 XM", "ubiquiti-nano-m2": "M2 XM", "ubiquiti-nanostation-m2-xw": "M2 XW", "ubiquiti-nano-m2-xw": "M2 XW", - "ubiquiti-nanostation-m5": "M5 XM", "ubiquiti-nano-m5": "M5 XM", "ubiquiti-nanostation-m5-xw": "M5 XW", "ubiquiti-nano-m5-xw": "M5 XW"}, "NanoBeam": {"ubiquity-nanobeam-m": "--ignore--", "ubiquiti-nanobeam-m5": "M5"}, - "PicoStation": {"ubiquiti-picostation-m": "M", - "ubiquiti-picostation-m2": "M2"}, "Rocket": {"ubiquiti-rocket-m": "M", "ubiquiti-rocket-m-xw": "M XW", "ubiquiti-rocket-m2": "M2", "ubiquiti-rocket-m2-xw": "M2 XW", "ubiquiti-rocket-m5": "M5", "ubiquiti-rocket-m5-xw": "M5 XW"}, @@ -213,9 +178,63 @@ var vendormodels = { "KVM 32bit": "x86-kvm", "XEN 32bit": "x86-xen", }, - "ZBT": { "WG3526": {"zbt-wg3526-16m": "16M", "zbt-wg3526-32m": "32M", "zbt-wg3526": "16M"}, } +}; + +var devices_4_32 = { + "TP-Link": { + "TL-MR13U": "tp-link-tl-mr13u", + "TL-MR3020": "tp-link-tl-mr3020", + "TL-MR3040": "tp-link-tl-mr3040", + "TL-MR3220": "tp-link-tl-mr3220", + "TL-MR3420": "tp-link-tl-mr3420", + "TL-WA701N/ND": {"tp-link-tl-wa701nd": "", "tp-link-tl-wa701n-nd": ""}, + "TL-WA7210N/ND": "tp-link-tl-wa7210n", + "TL-WA730RE": "tp-link-tl-wa730re", + "TL-WA750RE": "tp-link-tl-wa750re", + "TL-WA7510N": "tp-link-tl-wa7510n", + "TL-WA801N/ND": {"tp-link-tl-wa801n": "", "tp-link-tl-wa801n-nd": ""}, + "TL-WA830RE": "tp-link-tl-wa830re", + "TL-WA850RE": "tp-link-tl-wa850re", + "TL-WA860RE": "tp-link-tl-wa860re", + "TL-WA901N/ND": {"tp-link-tl-wa901nd": "", "tp-link-tl-wa901n-nd": ""}, + "TL-WR703N": "tp-link-tl-wr703n", + "TL-WR710N": "tp-link-tl-wr710n", + "TL-WR740N/ND": "tp-link-tl-wr740n-nd", + "TL-WR741N/ND": "tp-link-tl-wr741n-nd", + "TL-WR743N/ND": "tp-link-tl-wr743n-nd", + "TL-WR802N": {"tp-link-tl-wr802n": "v1"}, + "TL-WR810N": {"tp-link-tl-wr810n": "v1"}, + "TL-WR841N/ND": {"tp-link-tl-wr841n-nd": "", "tp-link-tl-wr841nd": ""}, + "TL-WR843N/ND": {"tp-link-tl-wr843n-nd": ""}, + "TL-WR940N/ND": {"tp-link-tl-wr940n": "", "tp-link-tl-wr940n-nd": "", "tp-link-tl-wr941nd-v4": "v1", "tp-link-tl-wr941nd-v5": "v2", "tp-link-tl-wr941nd-v6": "v3"}, + "TL-WR941N/ND": {"tp-link-tl-wr941nd": "", "tp-link-tl-wr941n-nd": "", "tp-link-tl-wr941nd-v4": "v4", "tp-link-tl-wr941nd-v5": "v5", "tp-link-tl-wr941nd-v6": "v6"} + }, +}; +var devices_8_32 = { + "TP-Link": { + "TL-WR1043N/ND": {"tp-link-tl-wr1043n-nd-v1": "v1"}, + "TL-WR842N/ND": {"tp-link-tl-wr842n-nd-v1": "v1", "tp-link-tl-wr842n-nd-v2": "v2"}, + }, + "Ubiquiti": { + "AirRouter": {"ubnt-air-router": "", "ubiquiti-airrouter": ""}, + "Bullet": {"ubiquiti-bullet-m2": "M2", "ubiquiti-bullet-m5": "M5", "bullet-m": "--ignore--"}, + "NanoStation Loco": {"ubiquiti-loco-m-xw": "--ignore--", + "ubiquiti-nanostation-loco-m2": "M2 XM", "ubiquiti-nanostation-loco-m2-xw": "M2 XW", + "ubiquiti-nanostation-loco-m5": "M5 XM", "ubiquiti-nanostation-loco-m5-xw": "M5 XW"}, + "NanoStation": {"ubiquiti-nanostation-m": "--ignore--", "ubiquiti-nano-m": "--ignore--", "ubiquiti-nanostation-m-xw": "--ignore--", "ubiquiti-nano-m-xw": "--ignore--", + "ubiquiti-nanostation-m2": "M2 XM", "ubiquiti-nano-m2": "M2 XM", "ubiquiti-nanostation-m2-xw": "M2 XW", "ubiquiti-nano-m2-xw": "M2 XW", + "ubiquiti-nanostation-m5": "M5 XM", "ubiquiti-nano-m5": "M5 XM", "ubiquiti-nanostation-m5-xw": "M5 XW", "ubiquiti-nano-m5-xw": "M5 XW"}, + "PicoStation": {"ubiquiti-picostation-m": "M", + "ubiquiti-picostation-m2": "M2"}, + }, }; + +var vendormodels = { + "recommended": devices_recommended, + "4_32": devices_4_32, + "8_32": devices_8_32, +}