Merge branch 'master' of https://github.com/mikalv/i2pbutton
This commit is contained in:
@ -12,8 +12,8 @@ function IBI2PCheckService() {
|
||||
this._logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
|
||||
this._logger.info("I2pbutton I2P Check Service initialized")
|
||||
|
||||
this._statusOfI2PCheck = this.kCheckNotInitiated;
|
||||
this.wrappedJSObject = this;
|
||||
this._statusOfI2PCheck = this.kCheckNotInitiated
|
||||
this.wrappedJSObject = this
|
||||
}
|
||||
|
||||
IBI2PCheckService.prototype =
|
||||
@ -88,25 +88,27 @@ IBI2PCheckService.prototype =
|
||||
},
|
||||
|
||||
_createRequest: function(url, aAsync, mimetype) {
|
||||
Cu.importGlobalProperties(["XMLHttpRequest"]);
|
||||
let req = new XMLHttpRequest();
|
||||
req.open('GET', url, aAsync);
|
||||
req.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE;
|
||||
req.overrideMimeType(mimetype);
|
||||
req.timeout = 120000; // Wait at most two minutes for a response.
|
||||
return req;
|
||||
Cu.importGlobalProperties(["XMLHttpRequest"])
|
||||
let req = new XMLHttpRequest()
|
||||
req.open('GET', url, aAsync)
|
||||
req.channel.loadFlags |= Ci.nsIRequest.LOAD_BYPASS_CACHE
|
||||
req.overrideMimeType(mimetype)
|
||||
req.timeout = 120000 // Wait at most two minutes for a response.
|
||||
return req
|
||||
},
|
||||
|
||||
createCheckConsoleRequest: function(aAsync)
|
||||
{
|
||||
let url = 'http://localhost:7657/netdb?r=.';
|
||||
return this._createRequest(url, aAsync, "text/html");
|
||||
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch)
|
||||
let port = prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 17657)
|
||||
let url = `http://localhost:${port}/netdb?r=.`
|
||||
return this._createRequest(url, aAsync, "text/html")
|
||||
},
|
||||
|
||||
createCheckProxyRequest: function(aAsync) {
|
||||
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch);
|
||||
let url = prefs.getCharPref("extensions.i2pbutton.test_url");
|
||||
return this._createRequest(url, aAsync, "application/json");
|
||||
let prefs = Cc["@mozilla.org/preferences-service;1"].getService(Ci.nsIPrefBranch)
|
||||
let url = prefs.getCharPref("extensions.i2pbutton.test_url")
|
||||
return this._createRequest(url, aAsync, "application/json")
|
||||
},
|
||||
|
||||
parseCheckConsoleResponse: function(aReq)
|
||||
@ -181,5 +183,5 @@ IBI2PCheckService.prototype =
|
||||
}
|
||||
};
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
var NSGetFactory = XPCOMUtils.generateNSGetFactory([IBI2PCheckService]);
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
|
||||
var NSGetFactory = XPCOMUtils.generateNSGetFactory([IBI2PCheckService])
|
||||
|
@ -10,13 +10,13 @@ try { Cu.import("resource://gre/modules/ctypes.jsm") } catch(e) {}
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/modules/launcher-util.jsm")
|
||||
//XPCOMUtils.defineLazyModuleGetter(this, "I2PLauncherLogger", "resource://i2pbutton/modules/tl-logger.jsm")
|
||||
|
||||
//let observerService = Cc["@mozilla.org/observer-service;1"].getService(Ci.nsIObserverService)
|
||||
|
||||
function I2PProcessService()
|
||||
{
|
||||
this._logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
|
||||
this._config_checker = Cc["@geti2p.net/i2pbutton-router-config-mgr;1"].getService(Ci.nsISupports).wrappedJSObject
|
||||
this._logger.log(3, "I2pbutton I2P Router Process Service initialized")
|
||||
this.wrappedJSObject = this
|
||||
}
|
||||
@ -34,7 +34,7 @@ I2PProcessService.prototype =
|
||||
|
||||
kInitialControlConnDelayMS: 25,
|
||||
kMaxControlConnRetryMS: 2000, // Retry at least every 2 seconds.
|
||||
kControlConnTimeoutMS: 5*60*1000, // Wait at most 5 minutes for tor to start.
|
||||
kControlConnTimeoutMS: 5*60*1000, // Wait at most 5 minutes for i2p to start.
|
||||
|
||||
kStatusUnknown: 0, // I2P process status.
|
||||
kStatusStarting: 1,
|
||||
@ -98,8 +98,11 @@ I2PProcessService.prototype =
|
||||
this._isConsoleRunning(function(res) {
|
||||
if (res!=4) {
|
||||
// Yes, 4 is success
|
||||
self._logger.log(3, 'Starting the router')
|
||||
self.I2PStartAndControlI2P(true)
|
||||
let canStartPromise = this._config_checker.ensure_config()
|
||||
canStartPromise.then(() => {
|
||||
self._logger.log(3, 'Starting the router')
|
||||
self.I2PStartAndControlI2P(true)
|
||||
})
|
||||
} else {
|
||||
self._logger.log(3, 'Already found a router, won\'t launch.')
|
||||
}
|
||||
@ -321,21 +324,25 @@ I2PProcessService.prototype =
|
||||
for (var i = 0; i < args.length; ++i)
|
||||
this._logger.log(2, " " + args[i])
|
||||
|
||||
// Possible fix for Windows and cmd.exe window spawn.
|
||||
p.startHidden = true
|
||||
p.noShell = true
|
||||
|
||||
p.runwAsync(args, args.length, this, false)
|
||||
this.mI2PProcess = p
|
||||
this.mI2PProcessStartTime = Date.now()
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
this.mI2PProcessStatus = this.kStatusExited;
|
||||
this.mI2PProcessStatus = this.kStatusExited
|
||||
//var s = LauncherUtil.getLocalizedString("i2p_failed_to_start");
|
||||
//this._notifyUserOfError(s, null, this.kI2PProcessDidNotStartTopic);
|
||||
this._logger.log(4, "_startI2P error: ", e);
|
||||
this._logger.log(4, "_startI2P error: ", e)
|
||||
}
|
||||
}, // _startI2P()
|
||||
|
||||
_isConsoleRunning: function(callback) {
|
||||
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject;
|
||||
let checkSvc = Cc["@geti2p.net/i2pbutton-i2pCheckService;1"].getService(Ci.nsISupports).wrappedJSObject
|
||||
let req = checkSvc.createCheckConsoleRequest(true);
|
||||
req.onreadystatechange = function(event) {
|
||||
if (req.readyState === 4) {
|
||||
|
@ -1,26 +1,18 @@
|
||||
// Bug 1506 P1: This is just a handy logger. If you have a better one, toss
|
||||
// this in the trash.
|
||||
|
||||
/*************************************************************************
|
||||
* TBLogger (JavaScript XPCOM component)
|
||||
*
|
||||
* Allows loglevel-based logging to different logging mechanisms.
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
// TODO: Slowly migrate to firefox's Log module "resource://gre/modules/Log.jsm"
|
||||
// Module specific constants
|
||||
const kMODULE_NAME = "I2pbutton Logger";
|
||||
const kMODULE_CONTRACTID = "@geti2p.net/i2pbutton-logger;1";
|
||||
const kMODULE_CID = Components.ID("f36d72c9-9718-4134-b550-e109638331d7");
|
||||
const kMODULE_NAME = "I2pbutton Logger"
|
||||
const kMODULE_CONTRACTID = "@geti2p.net/i2pbutton-logger;1"
|
||||
const kMODULE_CID = Components.ID("f36d72c9-9718-4134-b550-e109638331d7")
|
||||
|
||||
const Cr = Components.results;
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const Cr = Components.results
|
||||
const Cc = Components.classes
|
||||
const Ci = Components.interfaces
|
||||
const Cu = Components.utils
|
||||
|
||||
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs();
|
||||
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs()
|
||||
Cu.import("resource://gre/modules/Services.jsm")
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
let console = (Cu.import("resource://gre/modules/Console.jsm", {})).console
|
||||
|
||||
function I2pbuttonLogger() {
|
||||
// Register observer
|
||||
|
@ -16,18 +16,19 @@ const nsFile = Components.Constructor(
|
||||
"initWithPath"
|
||||
)
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
|
||||
|
||||
//XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/modules/launcher-util.jsm")
|
||||
Cu.import("resource://i2pbutton/modules/launcher-util.jsm")
|
||||
//ChromeUtils.defineModuleGetter(this, "ZipUtils", "resource://gre/modules/ZipUtils.jsm")
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm")
|
||||
Cu.import('resource://gre/modules/osfile.jsm')
|
||||
Cu.import('resource://gre/modules/FileUtils.jsm')
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "LauncherUtil", "resource://i2pbutton/modules/launcher-util.jsm")
|
||||
|
||||
let consolePort = Services.prefs.getIntPref("extensions.i2pbutton.console_port_i2pj", 17657)
|
||||
let httpProxyPort = Services.prefs.getIntPref("network.proxy.http_port", 14444)
|
||||
|
||||
const defaultProxyTunnels = `# Autogenerated by I2P Browser
|
||||
tunnel.0.description=HTTP proxy for browsing eepsites and the web
|
||||
tunnel.0.interface=127.0.0.1
|
||||
tunnel.0.listenPort=4444
|
||||
tunnel.0.listenPort=${httpProxyPort}
|
||||
tunnel.0.name=I2P HTTP Proxy
|
||||
tunnel.0.option.i2cp.closeIdleTime=1800000
|
||||
tunnel.0.option.i2cp.closeOnIdle=false
|
||||
@ -67,7 +68,7 @@ tunnel.0.type=httpclient
|
||||
`
|
||||
|
||||
const defaultClientsConfig = `# Autogenerated by I2P Browser
|
||||
clientApp.0.args=7657 ::1,127.0.0.1 ./webapps/
|
||||
clientApp.0.args=${consolePort} ::1,127.0.0.1 ./webapps/
|
||||
clientApp.0.main=net.i2p.router.web.RouterConsoleRunner
|
||||
clientApp.0.name=I2P Router Console
|
||||
clientApp.0.onBoot=true
|
||||
@ -129,7 +130,6 @@ router.sharePercentage=50
|
||||
|
||||
function RouterConfigManager() {
|
||||
this.version = '0.1'
|
||||
this.routerCertsZipFile = LauncherUtil.getI2PFile("certszip", false)
|
||||
this._logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
|
||||
this._logger.log(3, "I2pbutton I2P RouterConfigManager Service initialized")
|
||||
this.wrappedJSObject = this
|
||||
@ -145,9 +145,20 @@ RouterConfigManager.prototype = {
|
||||
_logger: null,
|
||||
state: {},
|
||||
|
||||
// State
|
||||
mDoesRouterConfigExists: false,
|
||||
mDoesClientsConfigExists: false,
|
||||
mDoesTunnelConfigExists: false,
|
||||
mHasChecksStarted: false,
|
||||
mIsChecksDone: false,
|
||||
|
||||
|
||||
// nsISupports implementation.
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsISupports]),
|
||||
|
||||
canRouterStart: function() {
|
||||
return (this.mDoesRouterConfigExists && this.mDoesClientsConfigExists && this.mDoesTunnelConfigExists)
|
||||
},
|
||||
|
||||
|
||||
_write_router_config: function(configfile,onComplete) {
|
||||
@ -170,31 +181,78 @@ RouterConfigManager.prototype = {
|
||||
},
|
||||
|
||||
|
||||
ensure_config: function(onCompleteCallback) {
|
||||
ensure_config: async function(onCompleteCallback) {
|
||||
this.mHasChecksStarted = true
|
||||
|
||||
let configDirectory = LauncherUtil.getI2PConfigPath(true)
|
||||
let routerConfigFile = configDirectory.clone()
|
||||
routerConfigFile.append('router.config')
|
||||
let tunnelConfigFIle = configDirectory.clone()
|
||||
tunnelConfigFIle.append('i2ptunnel.config')
|
||||
let clientsConfigFIle = configDirectory.clone()
|
||||
clientsConfigFIle.append('clients.config')
|
||||
let tunnelConfigFile = configDirectory.clone()
|
||||
tunnelConfigFile.append('i2ptunnel.config')
|
||||
let clientsConfigFile = configDirectory.clone()
|
||||
clientsConfigFile.append('clients.config')
|
||||
|
||||
// Ensure they exists
|
||||
if (!routerConfigFile.exists) {
|
||||
this._write_router_config(routerConfigFile, file => {
|
||||
if (typeof onCompleteCallback === 'function') onCompleteCallback(file)
|
||||
const self = this
|
||||
|
||||
this.ensureRouterConfigPromise = () => {
|
||||
return new Promise(resolve => {
|
||||
if (!routerConfigFile.exists()) {
|
||||
self._write_router_config(routerConfigFile, file => {
|
||||
self.mDoesRouterConfigExists = true
|
||||
self._logger.log(3, 'Wrote router.config')
|
||||
if (typeof onCompleteCallback === 'function') onCompleteCallback(file)
|
||||
resolve(routerConfigFile)
|
||||
})
|
||||
} else {
|
||||
self._logger.log(3, 'Found router.config from earlier')
|
||||
self.mDoesRouterConfigExists = true
|
||||
resolve(null)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!tunnelConfigFIle.exits) {
|
||||
this._write_tunnel_config(tunnelConfigFIle, tfile => {
|
||||
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
|
||||
|
||||
this.ensureTunnelConfigPromise = () => {
|
||||
return new Promise(resolve => {
|
||||
if (!tunnelConfigFile.exists()) {
|
||||
self._write_tunnel_config(tunnelConfigFile, tfile => {
|
||||
self._logger.log(3, 'Wrote i2ptunnel.config')
|
||||
self.mDoesTunnelConfigExists = true
|
||||
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
|
||||
resolve(tunnelConfigFile)
|
||||
})
|
||||
} else {
|
||||
self._logger.log(3, 'Found i2ptunnel.config from earlier')
|
||||
self.mDoesTunnelConfigExists = true
|
||||
resolve(null)
|
||||
}
|
||||
})
|
||||
}
|
||||
if (!clientsConfigFIle.exits) {
|
||||
this._write_tunnel_config(tunnelConfigFIle, tfile => {
|
||||
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
|
||||
|
||||
this.ensureClientsConfigPromise = () => {
|
||||
return new Promise(resolve => {
|
||||
if (!clientsConfigFile.exists()) {
|
||||
self._write_tunnel_config(tunnelConfigFile, tfile => {
|
||||
self._logger.log(3, 'Wrote clients.config')
|
||||
self.mDoesClientsConfigExists = true
|
||||
if (typeof onCompleteCallback === 'function') onCompleteCallback(tfile)
|
||||
resolve(clientsConfigFile)
|
||||
})
|
||||
} else {
|
||||
self._logger.log(3, 'Found clients.config from earlier')
|
||||
self.mDoesClientsConfigExists = true
|
||||
resolve(null)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
// Promises are not done but at least done here.
|
||||
this.mIsChecksDone = true
|
||||
return Promise.all([
|
||||
this.ensureRouterConfigPromise(),
|
||||
this.ensureTunnelConfigPromise(),
|
||||
this.ensureClientsConfigPromise(),
|
||||
])
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -8,34 +8,34 @@
|
||||
*
|
||||
*************************************************************************/
|
||||
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cr = Components.results;
|
||||
const Cu = Components.utils;
|
||||
const Cc = Components.classes
|
||||
const Ci = Components.interfaces
|
||||
const Cr = Components.results
|
||||
const Cu = Components.utils
|
||||
|
||||
Cu.import("resource://gre/modules/Services.jsm")
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm")
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm");
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "FileUtils", "resource://gre/modules/FileUtils.jsm")
|
||||
|
||||
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs();
|
||||
//let NoScriptControl = Cu.import("resource://torbutton/modules/noscript-control.js", {});
|
||||
Cu.import("resource://i2pbutton/modules/default-prefs.js", {}).ensureDefaultPrefs()
|
||||
let NoScriptControl = Cu.import("resource://i2pbutton/modules/noscript-control.js", {})
|
||||
|
||||
// Module specific constants
|
||||
const kMODULE_NAME = "Startup";
|
||||
const kMODULE_CONTRACTID = "@geti2p.net/startup-observer;1";
|
||||
const kMODULE_CID = Components.ID("06322def-6fde-4c06-aef6-47ae8e799629");
|
||||
const kMODULE_NAME = "Startup"
|
||||
const kMODULE_CONTRACTID = "@geti2p.net/startup-observer;1"
|
||||
const kMODULE_CID = Components.ID("06322def-6fde-4c06-aef6-47ae8e799629")
|
||||
|
||||
function StartupObserver() {
|
||||
this.logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject;
|
||||
this._prefs = Services.prefs;
|
||||
this.logger.log(3, "Startup Observer created");
|
||||
this.logger = Cc["@geti2p.net/i2pbutton-logger;1"].getService(Ci.nsISupports).wrappedJSObject
|
||||
this._prefs = Services.prefs
|
||||
this.logger.log(3, "Startup Observer created")
|
||||
|
||||
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment);
|
||||
var prefName = "browser.startup.homepage";
|
||||
var env = Cc["@mozilla.org/process/environment;1"].getService(Ci.nsIEnvironment)
|
||||
var prefName = "browser.startup.homepage"
|
||||
if (env.exists("I2P_DEFAULT_HOMEPAGE")) {
|
||||
// if the user has set this value in a previous installation, don't override it
|
||||
if (!this._prefs.prefHasUserValue(prefName)) {
|
||||
this._prefs.setCharPref(prefName, env.get("I2P_DEFAULT_HOMEPAGE"));
|
||||
this._prefs.setCharPref(prefName, env.get("I2P_DEFAULT_HOMEPAGE"))
|
||||
}
|
||||
}
|
||||
|
||||
@ -48,20 +48,16 @@ function StartupObserver() {
|
||||
}
|
||||
|
||||
try {
|
||||
// XXX: We're in a race with HTTPS-Everywhere to update our proxy settings
|
||||
// before the initial SSL-Observatory test... If we lose the race, Firefox
|
||||
// caches the old proxy settings for check.tp.o somehwere, and it never loads :(
|
||||
this.setProxySettings();
|
||||
} catch(e) {
|
||||
this.logger.log(4, "Early proxy change failed. Will try again at profile load. Error: "+e);
|
||||
}
|
||||
|
||||
// Arrange for our about:tor handler to be loaded in the default (chrome)
|
||||
// Arrange for our about:i2p handler to be loaded in the default (chrome)
|
||||
// process as well as in each content process.
|
||||
let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"]
|
||||
.getService(Ci.nsIProcessScriptLoader);
|
||||
ppmm.loadProcessScript("resource://i2pbutton/components/aboutI2p.js",
|
||||
true);
|
||||
ppmm.loadProcessScript("resource://i2pbutton/components/aboutI2p.js", true)
|
||||
}
|
||||
|
||||
StartupObserver.prototype = {
|
||||
@ -77,12 +73,13 @@ StartupObserver.prototype = {
|
||||
this._prefs.setIntPref("network.proxy.type", 1);
|
||||
this._prefs.setIntPref("network.proxy.socks_port", 0);
|
||||
this._prefs.setCharPref("network.proxy.socks", "");
|
||||
this._prefs.setIntPref("extensions.i2pbutton.console_port_i2pj", 17657);
|
||||
this._prefs.setCharPref("network.proxy.http", "127.0.0.1");
|
||||
this._prefs.setIntPref("network.proxy.http_port", 4444);
|
||||
this._prefs.setIntPref("network.proxy.http_port", 14444);
|
||||
this._prefs.setCharPref("network.proxy.ssl", "127.0.0.1");
|
||||
this._prefs.setIntPref("network.proxy.ssl_port", 4445);
|
||||
this._prefs.setIntPref("network.proxy.ssl_port", 14444);
|
||||
this._prefs.setCharPref("network.proxy.ftp", "127.0.0.1");
|
||||
this._prefs.setIntPref("network.proxy.ftp_port", 4444);
|
||||
this._prefs.setIntPref("network.proxy.ftp_port", 14444);
|
||||
this._prefs.setCharPref("network.proxy.no_proxies_on", "localhost, 127.0.0.1");
|
||||
|
||||
// Force prefs to be synced to disk
|
||||
@ -97,8 +94,8 @@ StartupObserver.prototype = {
|
||||
// but only for hackish reasons.
|
||||
this._prefs.setBoolPref("extensions.i2pbutton.startup", true);
|
||||
|
||||
// We need to listen for NoScript before it starts.
|
||||
//NoScriptControl.initialize();
|
||||
// We need to listen for NoScript before it starts.
|
||||
NoScriptControl.initialize();
|
||||
|
||||
this.setProxySettings();
|
||||
}
|
||||
|
@ -16,6 +16,10 @@ pref("extensions.i2pbutton.local_i2p_check",true);
|
||||
// https://developer.mozilla.org/en/Addons/Working_with_AMO
|
||||
pref("extensions.i2pbutton@geti2p.net.getAddons.cache.enabled", false);
|
||||
|
||||
// I2P router control prefs:
|
||||
pref("extensions.i2pbutton.start_i2p", true);
|
||||
pref("extensions.i2pbutton.kill_router_on_exit", true);
|
||||
|
||||
// State prefs:
|
||||
pref("extensions.i2pbutton.startup",false);
|
||||
pref("extensions.i2pbutton.inserted_button",false);
|
||||
@ -27,9 +31,9 @@ pref("extensions.i2pbutton.cookie_auto_protect",false);
|
||||
pref("extensions.i2pbutton.clear_http_auth",true);
|
||||
pref("extensions.i2pbutton.close_newnym",true);
|
||||
pref("extensions.i2pbutton.resize_new_windows",true);
|
||||
pref("extensions.i2pbutton.startup_state", 2); // 0=non-tor, 1=tor, 2=last
|
||||
pref("extensions.i2pbutton.startup_state", 2); // 0=non-i2p, 1=i2p, 2=last
|
||||
pref("extensions.i2pbutton.i2p_memory_jar",false);
|
||||
pref("extensions.i2pbutton.nontor_memory_jar",false);
|
||||
pref("extensions.i2pbutton.noni2p_memory_jar",false);
|
||||
pref("extensions.i2pbutton.launch_warning",true);
|
||||
|
||||
// Security Slider
|
||||
@ -52,20 +56,9 @@ pref("browser.startup.homepage", "chrome://i2pbutton/content/locale/non-localize
|
||||
pref("extensions.i2pbutton.start_i2p", true);
|
||||
pref("extensions.i2pbutton.kill_router_on_exit", true);
|
||||
pref("extensions.i2pbutton.console_host", "127.0.0.1");
|
||||
pref("extensions.i2pbutton.console_port_i2pj", 7657);
|
||||
pref("extensions.i2pbutton.console_port_i2pd", 7070);
|
||||
pref("extensions.i2pbutton.console_port_i2pj", 17657);
|
||||
pref("extensions.i2pbutton.console_port_i2pd", 17070);
|
||||
|
||||
// I2P Implementation
|
||||
pref("extensions.i2pbutton.i2pimpl_driver", "i2pj");
|
||||
|
||||
// The i2p_path is relative to the application directory. On Linux and
|
||||
// Windows this is the Browser/ directory that contains the firefox
|
||||
// executables, and on Mac OS it is the I2PBrowser.app directory.
|
||||
pref("extensions.i2pbutton.i2p_path", "");
|
||||
|
||||
// The i2pdatadir_path are relative to the data directory,
|
||||
// which is I2PBrowser-Data/ if it exists as a sibling of the application
|
||||
// directory. If I2PBrowser-Data/ does not exist, these paths are relative
|
||||
// to the I2PBrowser/ directory within the application directory.
|
||||
pref("extensions.i2pbutton.i2pdatadir_path", "");
|
||||
|
||||
|
@ -258,13 +258,13 @@ const LauncherUtil = {
|
||||
|
||||
getI2PFile: function(aI2PFileType, aCreate) {
|
||||
if (!aI2PFileType) {
|
||||
return false
|
||||
aI2PFileType = 'i2p'
|
||||
}
|
||||
let i2pFile
|
||||
let path = ''
|
||||
let useAppDir = false
|
||||
let isRelativePath = true
|
||||
let isUserData = (aI2PFileType != 'i2p')
|
||||
let isUserData = false
|
||||
let appBaseDir = this.appDirectoryObject.clone()
|
||||
|
||||
logger.log(2, `appBaseDir => ${appBaseDir.path}`)
|
||||
@ -276,15 +276,10 @@ const LauncherUtil = {
|
||||
appBaseDir.append('bin')
|
||||
appBaseDir.append('java.exe')
|
||||
return appBaseDir
|
||||
} else if ("i2pdatadir" == aI2PFileType) {
|
||||
path = "I2P"
|
||||
}
|
||||
} else if (this.isMac) {
|
||||
//
|
||||
if ("i2p" == aI2PFileType) {
|
||||
path = "Contents/Resources/I2PBrowser/I2P/bin/java"
|
||||
} else if ("i2pdatadir" == aI2PFileType) {
|
||||
path = "I2P"
|
||||
}
|
||||
} else {
|
||||
if ("i2p" == aI2PFileType) {
|
||||
@ -292,42 +287,23 @@ const LauncherUtil = {
|
||||
appBaseDir.append('bin')
|
||||
appBaseDir.append('java')
|
||||
return appBaseDir
|
||||
} else if ("i2pdatadir" == aI2PFileType) {
|
||||
path = "I2P"
|
||||
}
|
||||
}
|
||||
|
||||
logger.log(2, `getI2PFile - Gonna try path ${path}`)
|
||||
i2pFile = LauncherUtilInternal._appDir.clone()
|
||||
try {
|
||||
if (path == '' && !useAppDir) {
|
||||
throw Error('Fatal error: Can\'t resolve directories!')
|
||||
}
|
||||
if (useAppDir)
|
||||
{
|
||||
i2pFile = LauncherUtilInternal._appDir.clone()
|
||||
}
|
||||
|
||||
// Turn 'path' into an absolute path.
|
||||
if (LauncherUtilInternal._isUserDataOutsideOfAppDir)
|
||||
{
|
||||
let baseDir = isUserData ? LauncherUtilInternal._dataDir : LauncherUtilInternal._appDir
|
||||
i2pFile = baseDir.clone()
|
||||
i2pFile = LauncherUtilInternal._appDir.clone()
|
||||
if (this.isMac) {
|
||||
i2pFile.append("I2PBrowser")
|
||||
} else {
|
||||
i2pFile = LauncherUtilInternal._appDir.clone()
|
||||
if (this.isMac) {
|
||||
i2pFile.append("I2PBrowser")
|
||||
} else {
|
||||
let lnxpath = i2pFile.clone()
|
||||
lnxpath.append(path)
|
||||
return lnxpath
|
||||
}
|
||||
let lnxpath = i2pFile.clone()
|
||||
lnxpath.append(path)
|
||||
return lnxpath
|
||||
}
|
||||
i2pFile.appendRelativePath(path)
|
||||
|
||||
if (!i2pFile.exists() && aCreate === true) {
|
||||
logger.log(3, `Requested datadir ${i2pFile.path}, but it wasn't created so we create it now.`)
|
||||
i2pFile.create(i2pFile.DIRECTORY_TYPE, 0o700)
|
||||
}
|
||||
logger.log(2, `getI2PFile - Gonna try path ${i2pFile.path}`)
|
||||
|
||||
if (i2pFile.exists()) {
|
||||
try { i2pFile.normalize() } catch(e) {}
|
||||
|
@ -78,7 +78,7 @@ let noscriptSettings = safetyLevel => (
|
||||
"enforced": true,
|
||||
"autoAllowTop": false
|
||||
},
|
||||
"isTorBrowser": true,
|
||||
"isI2PBrowser": true,
|
||||
"tabId": -1
|
||||
});
|
||||
|
||||
|
Reference in New Issue
Block a user