From 05b4e04fdd3537e55de421f10cb49e486b4c21e4 Mon Sep 17 00:00:00 2001
From: codedust <codedust@users.noreply.github.com>
Date: Tue, 13 Dec 2016 01:11:39 +0100
Subject: [PATCH] Add config.js

---
 .gitignore         |  2 ++
 README.md          |  9 +--------
 app.js             | 20 +++++---------------
 config_template.js | 23 +++++++++++++++++++++++
 index.html         |  1 +
 5 files changed, 32 insertions(+), 23 deletions(-)
 create mode 100644 .gitignore
 create mode 100644 config_template.js

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..c321e79
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,2 @@
+config.js
+images/*
diff --git a/README.md b/README.md
index 9a019b7..b45abd0 100644
--- a/README.md
+++ b/README.md
@@ -3,12 +3,6 @@ OpenWrt/LEDE Firmware Wizard
 
 This Firmware Wizard lets a user select the correct firmware for his device. Directory listings are used to parse the list of available images.
 
-This a fork of the [gluon-firmware-wizard](https://github.com/freifunk-darmstadt/gluon-firmware-wizard) containing these changes:
-- jQuery and bootstrap.js were removed
-- support for other images name formats
-- simpler configuration
-- no static branch names
-
 Some [Screenshots](docs/screenshots.md).
 
 ### Configuration
@@ -47,11 +41,10 @@ If no hardware revision is given or is it is empty, the revision is extracted fr
 If two matches overlap, the longest match will be assigned the matching files. On the other hand, the same match can be used by multiple models without problems.
 
 ### Configuration
-Image paths and available branches can be set in file app.js.
+Image paths and available branches can be set in file `config_template.js` which has to be renamed to `config.js`
 
 ### TODO
 - support rootfs/kernel image combinations
-- server side site generation (maybe using python?)
 
 ### License
 This program is free software: you can redistribute it and/or modify
diff --git a/app.js b/app.js
index d8ddbce..1de673e 100644
--- a/app.js
+++ b/app.js
@@ -13,20 +13,6 @@
  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
-
-var config = {
-  typeNames: {
-    'factory': 'Erstinstallation',
-    'sysupgrade': 'Upgrade'
-  },
-  // relative image paths and branch
-  directories: {
-    // some demo sources
-    './images/gluon-factory.html': 'stable',
-    './images/gluon-sysupgrade.html': 'stable'
-  }
-};
-
 function $(s) {
   return document.getElementById(s.substring(1));
 }
@@ -388,7 +374,11 @@ var firmwarewizard = function() {
       var types = getImageTypes();
       for (var i in types) {
         var type = types[i];
-        var displayType = config.typeNames[type] || type;
+        var typeNames = {
+          'factory': 'Erstinstallation',
+          'sysupgrade': 'Upgrade'
+        };
+        var displayType = typeNames[type] || type;
           content += '<input type="radio" id="radiogroup-typeselect-'
           + type + '" ' + ((type == wizard.imageType) ? 'checked ' : '')
           + 'name="firmwareType" onclick="firmwarewizard.setImageType(\'' + type + '\');">'
diff --git a/config_template.js b/config_template.js
new file mode 100644
index 0000000..8b4cb38
--- /dev/null
+++ b/config_template.js
@@ -0,0 +1,23 @@
+/*
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+
+var config = {
+  // relative image paths and branch
+  directories: {
+    // some demo sources
+    './images/gluon-factory.html': 'stable',
+    './images/gluon-sysupgrade.html': 'stable'
+  }
+};
diff --git a/index.html b/index.html
index 4dad4d4..e355e51 100644
--- a/index.html
+++ b/index.html
@@ -82,6 +82,7 @@
     </div>
 
     <script src="devices.js"></script>
+    <script src="config.js"></script>
     <script src="app.js"></script>
   </body>
 </html>
-- 
GitLab