summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Xu <alex_y_xu@yahoo.ca>2014-12-08 10:06:29 -0500
committerAlex Xu <alex_y_xu@yahoo.ca>2014-12-08 10:06:29 -0500
commit3a93c00d336cc9e9201e41a9bacfcd2e916368b7 (patch)
treeca6d7439177692413cd2595721c45de591eca2fb
parentb8b74f38babd5186cc538b4aeae7c0dba7c7c8b6 (diff)
downloadeib-3a93c00d336cc9e9201e41a9bacfcd2e916368b7.tar.xz
eib-3a93c00d336cc9e9201e41a9bacfcd2e916368b7.zip
Add features and whatnot.
-rw-r--r--README.rst16
-rw-r--r--src/bootstrap.js13
2 files changed, 20 insertions, 9 deletions
diff --git a/README.rst b/README.rst
index ba142e1..1de2369 100644
--- a/README.rst
+++ b/README.rst
@@ -5,6 +5,20 @@ How to use
2. Add your trusted sites to the extensions.eib.trusted preference as follows:
a. Open about:addons.
b. Select Preferences for EVE-IGB Bridge.
- c. Input ["http://site1", "http://site2"], etc. JSON array of strings, matched at the start of the URL.
+ c. Input ``["^http://site1.com/", "^http://site2.com/.*\.php$"]``, etc. JSON array of regular expressions as strings. Note that there is no automatic ^$ token insertion.
3. Open "http://127.0.0.1:26001/" in the EVE in-game browser. We recommend that you set this page as your home page since there's nothing else the IGB is useful for.
4. Open one of your trusted sites and start clicking. A recommended starter is http://wiki.eveuniversity.com/ for their ship fittings.
+
+Usage notes
+-----------
+
+This is alpha-level software.
+It may not work.
+It may crash Firefox.
+It may format your hard drive.
+It is recommended that you do not run this in your primary browser for the time being, as it may be insecure (i.e. allowing bad sites).
+
+You must refresh all affected sites when upgrading EIB or changing the trusted sites.
+
+Avoid excessively complex regular expressions, as they must be checked against each site that is visited.
+If such expressions are required, put them at the end of the list as early exit is implemented in the trusted checker.
diff --git a/src/bootstrap.js b/src/bootstrap.js
index 7d4bf8f..162c857 100644
--- a/src/bootstrap.js
+++ b/src/bootstrap.js
@@ -1,5 +1,3 @@
-const PORT = 26001;
-
if (typeof EIB === "undefined")
var EIB = {
headers: {},
@@ -17,7 +15,7 @@ function uninstall() {}
EIB.listen = function () {
this.serverSocket = Cc["@mozilla.org/network/server-socket;1"]
.createInstance(Ci.nsIServerSocket);
- this.serverSocket.init(PORT, true, -1);
+ this.serverSocket.init(26001, true, -1);
const tm = Cc["@mozilla.org/thread-manager;1"].getService();
this.serverSocket.asyncListen({
onSocketAccepted: function (socket, transport) {
@@ -110,7 +108,7 @@ var WindowListener = {
var TrustedReparser = {
observe: function () {
EIB.trusted = EIB.prefs.prefHasUserValue("trusted") ?
- JSON.parse(EIB.prefs.getCharPref("trusted")) :
+ JSON.parse(EIB.prefs.getCharPref("trusted").map(function (v) { return new RegExp(v); }) :
[];
}
};
@@ -145,10 +143,9 @@ function shutdown(data, reason) {
}
function checkTrusted(href) {
- for (var i = 0; i < EIB.trusted.length; i++)
- if (href.indexOf(EIB.trusted[i]) === 0)
- return true;
- return false;
+ return EIB.trusted.some(function (v) {
+ return v.test(href);
+ });
}
function injectCCPEVE(e) {