diff options
author | Matěj Cepl <mcepl@redhat.com> | 2010-06-27 15:23:12 +0200 |
---|---|---|
committer | Matěj Cepl <mcepl@redhat.com> | 2010-06-27 15:23:12 +0200 |
commit | 890dd7f9adcbe1ef7c4218edc89ee7075a12e211 (patch) | |
tree | 855893c690ebfbe5502b8151e3d3009501957091 /lib/main.js | |
parent | 955f77978ea6f3f5730571698de07cc77d1fc5a4 (diff) | |
download | bugzilla-triage-890dd7f9adcbe1ef7c4218edc89ee7075a12e211.tar.gz |
Move all constant data out of the main JSON
Diffstat (limited to 'lib/main.js')
-rw-r--r-- | lib/main.js | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/lib/main.js b/lib/main.js index f40dcd1..3d59d6e 100644 --- a/lib/main.js +++ b/lib/main.js @@ -16,6 +16,7 @@ var logger = require("logger"); var myStorage = require("simple-storage").storage; var browser = require("tab-browser"); var urlMod = require("url"); +var selfMod = require("self"); var preferences = require("preferences-service"); var BSTPrefNS = require("bzpage").BSTPrefNS; // Use my JSON for now before it is fixed for general public @@ -26,21 +27,12 @@ var NumberOfFrames = 7; var XMLRPCurl = "https://bugzilla.redhat.com/xmlrpc.cgi"; var config = {}; -config.matches = [ - "https://bugzilla.redhat.com/show_bug.cgi", - "https://bz-web2-test.devel.redhat.com/show_bug.cgi", - "https://bugs.freedesktop.org/show_bug.cgi", - "https://bugzilla.mozilla.org/show_bug.cgi" -]; - -config.skipMatches = [ - "https://bugzilla.redhat.com/(process|post)_bug.cgi", - "https://bz-web2-test.devel.redhat.com/(process|post)_bug.cgi", - "https://bugzilla.mozilla.org/post_bug.cgi", - "https://bugzilla.mozilla.org/process_bug.cgi", - "https://bugzilla.(redhat.com|mozilla.org)/attachment.cgi$" -]; - +(function (){ + var matchesAll = JSON.parse(selfMod.data.load("matches.json")); + config.matches = matchesAll.matches; + config.skipMatches = matchesAll.skipMatches; +})(); +console.log("config.matches = " + config.matches.toSource()); // ============================================================== // https://wiki.mozilla.org/Labs/Jetpack/JEP/24 var WillBemanifest = { @@ -114,11 +106,17 @@ function initialize(callback) { console.log("loaded JSON object keys: " + keys); // Get card translation table - if ("PCIIDsURL" in config.gJSONData.configData) { - util.loadJSON(config.gJSONData.configData.PCIIDsURL, function(response) { - config.PCI_ID_Array = response; - }); - } + if ("downloadJSON" in config.gJSONData.configData) { + var URLsList = config.gJSONData.configData.downloadJSON; + for (var dwnldObj in URLsList) { + console.log("Downloading " + + dwnldObj + " from URL " + + URLsList[dwnldObj] + "."); + util.loadJSON(URLsList[dwnldObj],function(response){ + config[dwnldObj] = response; + }); + } + }; if (!myStorage.logs) { console.log("myStorage.logs empty!"); @@ -127,7 +125,7 @@ function initialize(callback) { var logConstructor = logger.Logger; config.logger = new logConstructor(myStorage.logs, - config.gJSONData.constantData.bugzillalabelAbbreviations); + JSON.parse(selfMod.data.load("bugzillalabelAbbreviations.json"))); callback(config); }, this); |