improvements to TBB compatibility
This commit is contained in:
28
VERSION.md
28
VERSION.md
@ -6,23 +6,23 @@ Extension Versions
|
|||||||
|
|
||||||
```md
|
```md
|
||||||
i2p-in-private-browsing
|
i2p-in-private-browsing
|
||||||
2.6.0
|
2.7.0
|
||||||
https://addons.mozilla.org/firefox/downloads/file/4339795/i2p_in_private_browsing-2.6.0.xpi
|
https://addons.mozilla.org/firefox/downloads/file/4364373/i2p_in_private_browsing-2.7.0.xpi
|
||||||
noscript
|
noscript
|
||||||
11.4.34
|
11.4.40
|
||||||
https://addons.mozilla.org/firefox/downloads/file/4333280/noscript-11.4.34.xpi
|
https://addons.mozilla.org/firefox/downloads/file/4357325/noscript-11.4.40.xpi
|
||||||
localcdn-fork-of-decentraleyes
|
localcdn-fork-of-decentraleyes
|
||||||
2.6.72
|
2.6.73
|
||||||
https://addons.mozilla.org/firefox/downloads/file/4336546/localcdn_fork_of_decentraleyes-2.6.72.xpi
|
https://addons.mozilla.org/firefox/downloads/file/4349721/localcdn_fork_of_decentraleyes-2.6.73.xpi
|
||||||
onion-in-container-browsing
|
onion-in-container-browsing
|
||||||
0.82
|
0.82
|
||||||
https://addons.mozilla.org/firefox/downloads/file/3904685/onion_in_container_browsing-0.82.xpi
|
https://addons.mozilla.org/firefox/downloads/file/3904685/onion_in_container_browsing-0.82.xpi
|
||||||
javascript-restrictor
|
javascript-restrictor
|
||||||
0.19
|
0.19.1
|
||||||
https://addons.mozilla.org/firefox/downloads/file/4339678/javascript_restrictor-0.19.xpi
|
https://addons.mozilla.org/firefox/downloads/file/4352350/javascript_restrictor-0.19.1.xpi
|
||||||
ublock-origin
|
ublock-origin
|
||||||
1.59.0
|
1.60.0
|
||||||
https://addons.mozilla.org/firefox/downloads/file/4328681/ublock_origin-1.59.0.xpi
|
https://addons.mozilla.org/firefox/downloads/file/4359936/ublock_origin-1.60.0.xpi
|
||||||
```
|
```
|
||||||
|
|
||||||
## Chromium
|
## Chromium
|
||||||
@ -32,15 +32,15 @@ __MSG_extensionName__
|
|||||||
1.29
|
1.29
|
||||||
https://clients2.google.com/service/update2/crx
|
https://clients2.google.com/service/update2/crx
|
||||||
NoScript
|
NoScript
|
||||||
11.4.33
|
11.4.42
|
||||||
https://clients2.google.com/service/update2/crx
|
https://clients2.google.com/service/update2/crx
|
||||||
LocalCDN
|
LocalCDN
|
||||||
2.6.72
|
2.6.73
|
||||||
https://clients2.google.com/service/update2/crx
|
https://clients2.google.com/service/update2/crx
|
||||||
uBlock Origin
|
uBlock Origin
|
||||||
1.59.0
|
1.60.0
|
||||||
https://clients2.google.com/service/update2/crx
|
https://clients2.google.com/service/update2/crx
|
||||||
__MSG_extensionName__
|
__MSG_extensionName__
|
||||||
0.19
|
0.19.1
|
||||||
https://clients2.google.com/service/update2/crx
|
https://clients2.google.com/service/update2/crx
|
||||||
```
|
```
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
#Build Number for ANT. Do not edit!
|
#Build Number for ANT. Do not edit!
|
||||||
#Tue Aug 20 23:41:03 EDT 2024
|
#Mon Oct 07 14:09:22 EDT 2024
|
||||||
build.number=746
|
build.number=769
|
||||||
|
@ -391,6 +391,12 @@ public class I2PCommonBrowser {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected void makeDirectory(File destDir) {
|
||||||
|
logger.info("creating directory");
|
||||||
|
if (!destDir.exists())
|
||||||
|
destDir.mkdir();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy a directory in compatibility mode.
|
* Copy a directory in compatibility mode.
|
||||||
*
|
*
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package net.i2p.i2pfirefox;
|
package net.i2p.i2pfirefox;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
@ -124,6 +126,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
}
|
}
|
||||||
return exePath;
|
return exePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] firefoxPathsOSX() {
|
public String[] firefoxPathsOSX() {
|
||||||
String firefoxPathsProp = getProperties().getProperty("firefox.paths.osx");
|
String firefoxPathsProp = getProperties().getProperty("firefox.paths.osx");
|
||||||
if (firefoxPathsProp != null)
|
if (firefoxPathsProp != null)
|
||||||
@ -134,6 +137,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
"/Applications/Waterfox.app/Contents/MacOS",
|
"/Applications/Waterfox.app/Contents/MacOS",
|
||||||
"/Applications/Librewolf.app/Contents/MacOS"};
|
"/Applications/Librewolf.app/Contents/MacOS"};
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] FIND_FIREFOX_SEARCH_PATHS_OSX() {
|
private String[] FIND_FIREFOX_SEARCH_PATHS_OSX() {
|
||||||
String[] path = firefoxPathsOSX();
|
String[] path = firefoxPathsOSX();
|
||||||
String[] exes = firefoxBinsUnix();
|
String[] exes = firefoxBinsUnix();
|
||||||
@ -147,6 +151,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
}
|
}
|
||||||
return exePath;
|
return exePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String[] firefoxPathsWindows() {
|
public String[] firefoxPathsWindows() {
|
||||||
String firefoxPathsProp =
|
String firefoxPathsProp =
|
||||||
getProperties().getProperty("firefox.paths.windows");
|
getProperties().getProperty("firefox.paths.windows");
|
||||||
@ -181,6 +186,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
new File(programFiles, "Librewolf/").toString(),
|
new File(programFiles, "Librewolf/").toString(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] firefoxBinsWindows() {
|
private String[] firefoxBinsWindows() {
|
||||||
String firefoxPathsProp =
|
String firefoxPathsProp =
|
||||||
getProperties().getProperty("firefox.bins.windows");
|
getProperties().getProperty("firefox.bins.windows");
|
||||||
@ -192,6 +198,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
"waterfox.exe", "waterfox-bin.exe", "librewolf.exe",
|
"waterfox.exe", "waterfox-bin.exe", "librewolf.exe",
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] FIND_FIREFOX_SEARCH_PATHS_WINDOWS() {
|
private String[] FIND_FIREFOX_SEARCH_PATHS_WINDOWS() {
|
||||||
String[] path = firefoxPathsWindows();
|
String[] path = firefoxPathsWindows();
|
||||||
String[] exes = firefoxBinsWindows();
|
String[] exes = firefoxBinsWindows();
|
||||||
@ -226,6 +233,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
}
|
}
|
||||||
return exePath;
|
return exePath;
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] FIND_FIREFOX_SEARCH_PATHS() {
|
private String[] FIND_FIREFOX_SEARCH_PATHS() {
|
||||||
switch (getOperatingSystem()) {
|
switch (getOperatingSystem()) {
|
||||||
case "Windows":
|
case "Windows":
|
||||||
@ -337,6 +345,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
|
|
||||||
return new String[] {};
|
return new String[] {};
|
||||||
}
|
}
|
||||||
|
|
||||||
private String[] FIREFOX_FINDER() {
|
private String[] FIREFOX_FINDER() {
|
||||||
String[] nearby = NEARBY_FIREFOX_SEARCH_PATHS();
|
String[] nearby = NEARBY_FIREFOX_SEARCH_PATHS();
|
||||||
String[] all = FIND_FIREFOX_SEARCH_PATHS();
|
String[] all = FIND_FIREFOX_SEARCH_PATHS();
|
||||||
@ -366,8 +375,9 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
if (firefoxFile.exists()) {
|
if (firefoxFile.exists()) {
|
||||||
logger.info("Found valid firefox at " + firefox);
|
logger.info("Found valid firefox at " + firefox);
|
||||||
validFirefoxes.add(firefox);
|
validFirefoxes.add(firefox);
|
||||||
|
}else{
|
||||||
|
logger.info("firefox at " + firefox + "does not exist");
|
||||||
}
|
}
|
||||||
logger.info("firefox at " + firefox + "does not exist");
|
|
||||||
}
|
}
|
||||||
return validFirefoxes.toArray(new String[validFirefoxes.size()]);
|
return validFirefoxes.toArray(new String[validFirefoxes.size()]);
|
||||||
}
|
}
|
||||||
@ -376,7 +386,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
* Return the best available Firefox from the list of Firefoxes we have.
|
* Return the best available Firefox from the list of Firefoxes we have.
|
||||||
*
|
*
|
||||||
* @return the path to the best available Firefox, or null if none are
|
* @return the path to the best available Firefox, or null if none are
|
||||||
* found.
|
* found.
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public String topFirefox() {
|
public String topFirefox() {
|
||||||
@ -411,7 +421,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
*
|
*
|
||||||
* @param override the path to a valid Firefox binary to use.
|
* @param override the path to a valid Firefox binary to use.
|
||||||
* @return the path to the best available Firefox, or null if none are
|
* @return the path to the best available Firefox, or null if none are
|
||||||
* found.
|
* found.
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public String topFirefox(String overrideFirefox) {
|
public String topFirefox(String overrideFirefox) {
|
||||||
@ -429,7 +439,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
* the default profile.
|
* the default profile.
|
||||||
*
|
*
|
||||||
* @return a ProcessBuilder for the top Firefox binary and
|
* @return a ProcessBuilder for the top Firefox binary and
|
||||||
* the default profile.
|
* the default profile.
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public ProcessBuilder defaultProcessBuilder() {
|
public ProcessBuilder defaultProcessBuilder() {
|
||||||
@ -442,7 +452,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
*
|
*
|
||||||
* @param args the args to pass to the Firefox binary
|
* @param args the args to pass to the Firefox binary
|
||||||
* @return a ProcessBuilder for the top Firefox binary and
|
* @return a ProcessBuilder for the top Firefox binary and
|
||||||
* the default profile.
|
* the default profile.
|
||||||
*/
|
*/
|
||||||
public ProcessBuilder defaultProcessBuilder(String[] args) {
|
public ProcessBuilder defaultProcessBuilder(String[] args) {
|
||||||
return processBuilder(args, false);
|
return processBuilder(args, false);
|
||||||
@ -455,7 +465,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
*
|
*
|
||||||
* @param args the arguments to pass to the Firefox binary.
|
* @param args the arguments to pass to the Firefox binary.
|
||||||
* @return a ProcessBuilder for the top Firefox binary and
|
* @return a ProcessBuilder for the top Firefox binary and
|
||||||
* the default profile.
|
* the default profile.
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public ProcessBuilder privateProcessBuilder() {
|
public ProcessBuilder privateProcessBuilder() {
|
||||||
@ -469,7 +479,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
*
|
*
|
||||||
* @param args the arguments to pass to the Firefox binary
|
* @param args the arguments to pass to the Firefox binary
|
||||||
* @return a ProcessBuilder for the top Firefox binary and
|
* @return a ProcessBuilder for the top Firefox binary and
|
||||||
* the default profile.
|
* the default profile.
|
||||||
*/
|
*/
|
||||||
public ProcessBuilder privateProcessBuilder(String[] args) {
|
public ProcessBuilder privateProcessBuilder(String[] args) {
|
||||||
ArrayList<String> argList = new ArrayList<String>();
|
ArrayList<String> argList = new ArrayList<String>();
|
||||||
@ -491,7 +501,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
*
|
*
|
||||||
* @param args the arguments to pass to the Firefox binary.
|
* @param args the arguments to pass to the Firefox binary.
|
||||||
* @return a ProcessBuilder for the top Firefox binary and
|
* @return a ProcessBuilder for the top Firefox binary and
|
||||||
* the default profile.
|
* the default profile.
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public ProcessBuilder appProcessBuilder() {
|
public ProcessBuilder appProcessBuilder() {
|
||||||
@ -505,7 +515,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
*
|
*
|
||||||
* @param args the arguments to pass to the Firefox binary
|
* @param args the arguments to pass to the Firefox binary
|
||||||
* @return a ProcessBuilder for the top Firefox binary and
|
* @return a ProcessBuilder for the top Firefox binary and
|
||||||
* the default profile.
|
* the default profile.
|
||||||
*/
|
*/
|
||||||
public ProcessBuilder appProcessBuilder(String[] args) {
|
public ProcessBuilder appProcessBuilder(String[] args) {
|
||||||
ArrayList<String> argList = new ArrayList<String>();
|
ArrayList<String> argList = new ArrayList<String>();
|
||||||
@ -526,7 +536,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
*
|
*
|
||||||
* @param args the arguments to pass to the Firefox binary
|
* @param args the arguments to pass to the Firefox binary
|
||||||
* @return a ProcessBuilder for the top Firefox binary and
|
* @return a ProcessBuilder for the top Firefox binary and
|
||||||
* the default profile.
|
* the default profile.
|
||||||
*/
|
*/
|
||||||
public ProcessBuilder headlessProcessBuilder(String[] args) {
|
public ProcessBuilder headlessProcessBuilder(String[] args) {
|
||||||
ArrayList<String> argList = new ArrayList<String>();
|
ArrayList<String> argList = new ArrayList<String>();
|
||||||
@ -548,14 +558,14 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
*
|
*
|
||||||
* @param args the extended arguments to pass to the Firefox binary.
|
* @param args the extended arguments to pass to the Firefox binary.
|
||||||
* @return a ProcessBuilder for the top Firefox binary and
|
* @return a ProcessBuilder for the top Firefox binary and
|
||||||
* default profile, with a specific set of extended arguments.
|
* default profile, with a specific set of extended arguments.
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
public ProcessBuilder processBuilder(String[] args ) {
|
* public ProcessBuilder processBuilder(String[] args ) {
|
||||||
return processBuilder(args, false);
|
* return processBuilder(args, false);
|
||||||
}
|
* }
|
||||||
*/
|
*/
|
||||||
public ProcessBuilder processBuilder(String[] args, boolean app) {
|
public ProcessBuilder processBuilder(String[] args, boolean app) {
|
||||||
String firefox = topFirefox();
|
String firefox = topFirefox();
|
||||||
if (!firefox.isEmpty()) {
|
if (!firefox.isEmpty()) {
|
||||||
@ -683,7 +693,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
pb.environment().put("TOR_SKIP_CONTROLPORTTEST", "1");
|
pb.environment().put("TOR_SKIP_CONTROLPORTTEST", "1");
|
||||||
pb.environment().put("TOR_NONTOR_PROXY", "1");
|
pb.environment().put("TOR_NONTOR_PROXY", "1");
|
||||||
return pb;
|
return pb;
|
||||||
//}
|
// }
|
||||||
// return null;
|
// return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -693,12 +703,14 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
}
|
}
|
||||||
return "base";
|
return "base";
|
||||||
}
|
}
|
||||||
|
|
||||||
public Process launchAndDetatch(boolean privateWindow, String[] url) {
|
public Process launchAndDetatch(boolean privateWindow, String[] url) {
|
||||||
int privateWindowInt = 0;
|
int privateWindowInt = 0;
|
||||||
if (privateWindow)
|
if (privateWindow)
|
||||||
privateWindowInt = 1;
|
privateWindowInt = 1;
|
||||||
return launchAndDetatch(privateWindowInt, url);
|
return launchAndDetatch(privateWindowInt, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Process launchAndDetatch(int privateWindow, String[] url) {
|
public Process launchAndDetatch(int privateWindow, String[] url) {
|
||||||
validateUserDirectory();
|
validateUserDirectory();
|
||||||
boolean app = false;
|
boolean app = false;
|
||||||
@ -706,12 +718,13 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
app = true;
|
app = true;
|
||||||
if (waitForProxy()) {
|
if (waitForProxy()) {
|
||||||
String profileDirectory = this.profileDirectory(app, baseMode());
|
String profileDirectory = this.profileDirectory(app, baseMode());
|
||||||
if (this.validateProfileDirectory(profileDirectory)) {
|
if (this.validateProfileDirectory(profileDirectory) && !isTorBrowser()) {
|
||||||
logger.info("Valid profile directory: " + profileDirectory);
|
logger.info("Valid profile directory: " + profileDirectory);
|
||||||
} else {
|
} else {
|
||||||
logger.info("Invalid profile directory: " + profileDirectory +
|
logger.info("Invalid profile directory: " + profileDirectory +
|
||||||
" rebuilding...");
|
" rebuilding...");
|
||||||
if (!this.copyBaseProfiletoProfile(usabilityMode(), app)) {
|
if (!this.copyBaseProfiletoProfile(usabilityMode(), app,
|
||||||
|
isTorBrowser())) {
|
||||||
logger.info("Failed to rebuild profile directory: " +
|
logger.info("Failed to rebuild profile directory: " +
|
||||||
profileDirectory);
|
profileDirectory);
|
||||||
return null;
|
return null;
|
||||||
@ -720,7 +733,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (validateProfileFirstRun(profileDirectory)) {
|
if (validateProfileFirstRun(profileDirectory)) {
|
||||||
if (isWindows()) {
|
if (isWindows() && !isTorBrowser()) {
|
||||||
ProcessBuilder hpb = headlessProcessBuilder(url);
|
ProcessBuilder hpb = headlessProcessBuilder(url);
|
||||||
try {
|
try {
|
||||||
Process hp = hpb.start();
|
Process hp = hpb.start();
|
||||||
@ -786,8 +799,8 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
* Waits for an HTTP proxy on the port 4444 to be ready.
|
* Waits for an HTTP proxy on the port 4444 to be ready.
|
||||||
* Launches Firefox with the profile directory.
|
* Launches Firefox with the profile directory.
|
||||||
*
|
*
|
||||||
* @param bool if true, the profile will be ephemeral(i.e. a
|
* @param bool if true, the profile will be ephemeral(i.e. a
|
||||||
* --private-window profile).
|
* --private-window profile).
|
||||||
* @param String[] a list of URL's to pass to the browser window
|
* @param String[] a list of URL's to pass to the browser window
|
||||||
* @since 0.0.17
|
* @since 0.0.17
|
||||||
*/
|
*/
|
||||||
@ -797,6 +810,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
priv = 1;
|
priv = 1;
|
||||||
launch(priv, url);
|
launch(priv, url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void launch(int privateWindow, String[] url) {
|
public void launch(int privateWindow, String[] url) {
|
||||||
if (waitForProxy()) {
|
if (waitForProxy()) {
|
||||||
process = launchAndDetatch(privateWindow, url);
|
process = launchAndDetatch(privateWindow, url);
|
||||||
@ -820,7 +834,7 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
* Launches Firefox with the profile directory.
|
* Launches Firefox with the profile directory.
|
||||||
*
|
*
|
||||||
* @param bool if true, the profile will be ephemeral(i.e. a
|
* @param bool if true, the profile will be ephemeral(i.e. a
|
||||||
* --private-window profile).
|
* --private-window profile).
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public void launch(boolean privateWindow) { launch(privateWindow, null); }
|
public void launch(boolean privateWindow) { launch(privateWindow, null); }
|
||||||
@ -902,12 +916,40 @@ public class I2PFirefox extends I2PFirefoxProfileBuilder {
|
|||||||
visitURL.toArray(new String[visitURL.size()]));
|
visitURL.toArray(new String[visitURL.size()]));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*private void sleep(int millis) {
|
public boolean isTorBrowser() {
|
||||||
|
String[] args = {"--version"};
|
||||||
|
ProcessBuilder tpb = defaultProcessBuilder(args);
|
||||||
try {
|
try {
|
||||||
Thread.sleep(millis);
|
Process tp = tpb.start();
|
||||||
} catch (InterruptedException bad) {
|
BufferedReader reader =
|
||||||
bad.printStackTrace();
|
new BufferedReader(new InputStreamReader(tp.getInputStream()));
|
||||||
throw new RuntimeException(bad);
|
StringBuilder builder = new StringBuilder();
|
||||||
|
String line = null;
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
builder.append(line);
|
||||||
|
builder.append(System.getProperty("line.separator"));
|
||||||
|
}
|
||||||
|
String result = builder.toString().toLowerCase();
|
||||||
|
if (result.contains("tor ")) {
|
||||||
|
logger.info("running in Tor Browser, modifying only required config");
|
||||||
|
return true;
|
||||||
|
} else {
|
||||||
|
logger.info("running in regular Firefox, using extended config");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* private void sleep(int millis) {s
|
||||||
|
* try {
|
||||||
|
* Thread.sleep(millis);
|
||||||
|
* } catch (InterruptedException bad) {
|
||||||
|
* bad.printStackTrace();
|
||||||
|
* throw new RuntimeException(bad);
|
||||||
|
* }
|
||||||
|
* }
|
||||||
|
*/
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,7 @@ import java.nio.file.StandardCopyOption;
|
|||||||
*/
|
*/
|
||||||
public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
||||||
private boolean strict;
|
private boolean strict;
|
||||||
|
|
||||||
private String userChromeCSS() {
|
private String userChromeCSS() {
|
||||||
String ret =
|
String ret =
|
||||||
"@namespace url(\"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\")\n";
|
"@namespace url(\"http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul\")\n";
|
||||||
@ -99,18 +100,22 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
|||||||
* @return the profile directory, or null if it could not be created
|
* @return the profile directory, or null if it could not be created
|
||||||
*/
|
*/
|
||||||
// public String profileDirectory() {
|
// public String profileDirectory() {
|
||||||
// return profileDirectory("I2P_FIREFOX_PROFILE", "firefox", false);
|
// return profileDirectory("I2P_FIREFOX_PROFILE", "firefox", false);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
private String baseProfileDir(String file, String base) {
|
private String baseProfileDir(String file, String base,
|
||||||
|
boolean isTorBrowser) {
|
||||||
File profileDir = new File(file, "i2p.firefox." + base + ".profile");
|
File profileDir = new File(file, "i2p.firefox." + base + ".profile");
|
||||||
// make sure the directory exists
|
// make sure the directory exists
|
||||||
if (profileDir.exists()) {
|
if (profileDir.exists()) {
|
||||||
return profileDir.getAbsolutePath();
|
return profileDir.getAbsolutePath();
|
||||||
} else {
|
} else {
|
||||||
// create the directory
|
// create the directory
|
||||||
if (!this.unpackProfile(profileDir.getAbsolutePath(), "firefox", base)) {
|
if (!isTorBrowser) {
|
||||||
return null;
|
if (!this.unpackProfile(profileDir.getAbsolutePath(), "firefox",
|
||||||
|
base)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return profileDir.getAbsolutePath();
|
return profileDir.getAbsolutePath();
|
||||||
}
|
}
|
||||||
@ -121,7 +126,7 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
|||||||
*
|
*
|
||||||
* @return the base profile directory, or null if it could not be created
|
* @return the base profile directory, or null if it could not be created
|
||||||
*/
|
*/
|
||||||
public String baseProfileDirectory(String base) {
|
public String baseProfileDirectory(String base, boolean isTorBrowser) {
|
||||||
String pd = System.getenv("I2P_FIREFOX_BASE_PROFILE");
|
String pd = System.getenv("I2P_FIREFOX_BASE_PROFILE");
|
||||||
if (pd != null && !pd.isEmpty()) {
|
if (pd != null && !pd.isEmpty()) {
|
||||||
File pdf = new File(pd);
|
File pdf = new File(pd);
|
||||||
@ -134,7 +139,7 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
String rtd = runtimeDirectory();
|
String rtd = runtimeDirectory();
|
||||||
return baseProfileDir(rtd, base);
|
return baseProfileDir(rtd, base, isTorBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -175,11 +180,10 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
|||||||
*
|
*
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public boolean copyBaseProfiletoProfile(String base, boolean app) {
|
public boolean copyBaseProfiletoProfile(String base, boolean app,
|
||||||
String baseProfile = baseProfileDirectory(base);
|
boolean isTorBrowser) {
|
||||||
|
String baseProfile = baseProfileDirectory(base, isTorBrowser);
|
||||||
String profile = profileDirectory(app, base);
|
String profile = profileDirectory(app, base);
|
||||||
logger.info("Copying base profile to profile directory: " + baseProfile +
|
|
||||||
" -> " + profile);
|
|
||||||
if (baseProfile.isEmpty() || profile.isEmpty()) {
|
if (baseProfile.isEmpty() || profile.isEmpty()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -188,24 +192,31 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
|||||||
|
|
||||||
if (!profileDir.exists()) {
|
if (!profileDir.exists()) {
|
||||||
try {
|
try {
|
||||||
logger.info("Copying base profile to profile directory");
|
if (!isTorBrowser) {
|
||||||
copyDirectory(baseProfileDir, profileDir, "firefox", base);
|
logger.info("Copying base profile to profile directory: " +
|
||||||
|
baseProfile + " -> " + profile);
|
||||||
|
copyDirectory(baseProfileDir, profileDir, "firefox", base);
|
||||||
|
} else {
|
||||||
|
logger.info("Creating base directory for use with Tor Browser");
|
||||||
|
makeDirectory(profileDir);
|
||||||
|
}
|
||||||
|
logger.info("Copied base profile to profile directory");
|
||||||
|
return true;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.info("Error copying base profile to profile" + e);
|
logger.info("Error copying base profile to profile" + e);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
logger.info("Copied base profile to profile directory");
|
|
||||||
}
|
}
|
||||||
// if user.js does not exist yet, make an empty one.
|
// if user.js does not exist yet, make an empty one.
|
||||||
// if (!touch(profileDir.toString(), "user.js")) {
|
// if (!touch(profileDir.toString(), "user.js")) {
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
// }
|
||||||
// if extensions does not exist yet, make an empty one.
|
// if extensions does not exist yet, make an empty one.
|
||||||
// if (!mkExtensionsDir(profileDir.toString())){
|
// if (!mkExtensionsDir(profileDir.toString())){
|
||||||
// return false;
|
// return false;
|
||||||
//}
|
// }
|
||||||
|
|
||||||
return copyStrictOptions(base, app);
|
return copyStrictOptions(base, app, isTorBrowser);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean writeAppChrome(String profile) {
|
protected boolean writeAppChrome(String profile) {
|
||||||
@ -221,6 +232,7 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected boolean deleteAppChrome(String profile) {
|
protected boolean deleteAppChrome(String profile) {
|
||||||
File dir = new File(profile, "chrome");
|
File dir = new File(profile, "chrome");
|
||||||
if (!dir.exists())
|
if (!dir.exists())
|
||||||
@ -230,15 +242,17 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
|||||||
f.delete();
|
f.delete();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Copy the strict options from the base profile to the profile
|
* Copy the strict options from the base profile to the profile
|
||||||
*
|
*
|
||||||
* @return true if successful, false otherwise
|
* @return true if successful, false otherwise
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public boolean copyStrictOptions(String base, boolean app) {
|
public boolean copyStrictOptions(String base, boolean app,
|
||||||
|
boolean isTorBrowser) {
|
||||||
logger.info("Checking strict options");
|
logger.info("Checking strict options");
|
||||||
String baseProfile = baseProfileDirectory(base);
|
String baseProfile = baseProfileDirectory(base, isTorBrowser);
|
||||||
String profile = profileDirectory(app, base);
|
String profile = profileDirectory(app, base);
|
||||||
if (baseProfile.isEmpty() || profile.isEmpty()) {
|
if (baseProfile.isEmpty() || profile.isEmpty()) {
|
||||||
logger.info("Empty paths");
|
logger.info("Empty paths");
|
||||||
@ -324,6 +338,7 @@ public class I2PFirefoxProfileBuilder extends I2PFirefoxProfileChecker {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct a new Profile Builder
|
* Construct a new Profile Builder
|
||||||
|
*
|
||||||
* @param strict if true, the strict overrides will be copied to the profile
|
* @param strict if true, the strict overrides will be copied to the profile
|
||||||
*
|
*
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
|
@ -190,8 +190,8 @@ public class I2PBrowserPlugin extends I2PBrowser implements ClientApp {
|
|||||||
// Ubuntu GNOME does not work, SystemTray.isSupported() returns false
|
// Ubuntu GNOME does not work, SystemTray.isSupported() returns false
|
||||||
String xdg = System.getenv("XDG_CURRENT_DESKTOP");
|
String xdg = System.getenv("XDG_CURRENT_DESKTOP");
|
||||||
boolean dflt = SystemVersion.isWindows() || SystemVersion.isMac() ||
|
boolean dflt = SystemVersion.isWindows() || SystemVersion.isMac() ||
|
||||||
"XFCE".equals(xdg) ||
|
"XFCE".equals(xdg) || "KDE".equals(xdg) ||
|
||||||
"KDE".equals(xdg) || "LXDE".equals(xdg);
|
"LXDE".equals(xdg);
|
||||||
return _context.getProperty(PROP_DTG_ENABLED, dflt);
|
return _context.getProperty(PROP_DTG_ENABLED, dflt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
19
src/prefs.js
19
src/prefs.js
@ -19,11 +19,6 @@ user_pref("extensions.torlauncher.start_tor", false);
|
|||||||
//user_pref("extensions.torlauncher.default_bridge_type", "");
|
//user_pref("extensions.torlauncher.default_bridge_type", "");
|
||||||
user_pref("extensions.torlauncher.prompt_at_startup", false);
|
user_pref("extensions.torlauncher.prompt_at_startup", false);
|
||||||
|
|
||||||
// Resist-fingerprinting and first-party isolation enable
|
|
||||||
|
|
||||||
user_pref("privacy.resistFingerprinting", true);
|
|
||||||
user_pref("privacy.firstparty.isolate", true);
|
|
||||||
|
|
||||||
// Use i2p http proxy for all connections and set homepage to safe local form.
|
// Use i2p http proxy for all connections and set homepage to safe local form.
|
||||||
|
|
||||||
// DON'T allow access to the admin panel from the profile we browse i2p with.
|
// DON'T allow access to the admin panel from the profile we browse i2p with.
|
||||||
@ -39,7 +34,6 @@ user_pref("network.proxy.socks", "127.0.0.1");
|
|||||||
user_pref("network.proxy.socks_port", 4444);
|
user_pref("network.proxy.socks_port", 4444);
|
||||||
user_pref("network.proxy.share_proxy_settings", true);
|
user_pref("network.proxy.share_proxy_settings", true);
|
||||||
user_pref("browser.startup.homepage", "about:blank");
|
user_pref("browser.startup.homepage", "about:blank");
|
||||||
user_pref("dom.security.https_only_mode", false);
|
|
||||||
user_pref("keyword.enabled", false);
|
user_pref("keyword.enabled", false);
|
||||||
user_pref("extensions.allowPrivateBrowsingByDefault", true);
|
user_pref("extensions.allowPrivateBrowsingByDefault", true);
|
||||||
user_pref("extensions.PrivateBrowsing.notification", false);
|
user_pref("extensions.PrivateBrowsing.notification", false);
|
||||||
@ -51,17 +45,4 @@ user_pref("browser.newtabpage.activity-stream.feeds.section.highlights", false);
|
|||||||
user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
|
user_pref("browser.newtabpage.activity-stream.feeds.section.topstories", false);
|
||||||
user_pref("browser.newtabpage.activity-stream.default.sites", "http://planet.i2p/,http://legwork.i2p/,http://i2pwiki.i2p/,http://i2pforums.i2p/,http://zzz.i2p/");
|
user_pref("browser.newtabpage.activity-stream.default.sites", "http://planet.i2p/,http://legwork.i2p/,http://i2pwiki.i2p/,http://i2pforums.i2p/,http://zzz.i2p/");
|
||||||
user_pref("browser.newtabpage.activity-stream.feeds.topsites", true);
|
user_pref("browser.newtabpage.activity-stream.feeds.topsites", true);
|
||||||
user_pref("ui.use_standins_for_native_colors", true);
|
|
||||||
user_pref("webgl.disable-extensions", true);
|
|
||||||
user_pref("webgl.min_capability_mode", true);
|
|
||||||
user_pref("webgl.disable-fail-if-major-performance-caveat", true);
|
|
||||||
user_pref("webgl.enable-webgl2", false);
|
|
||||||
user_pref("media.navigator.enabled", false);
|
|
||||||
user_pref("dom.w3c_touch_events.enabled", false);
|
|
||||||
user_pref("browser.privatebrowsing.autostart", false);
|
|
||||||
user_pref("browser.display.use_system_colors", false);
|
|
||||||
user_pref("dom.image-lazy-loading.enabled", false);
|
|
||||||
user_pref("extensions.autoDisableScopes", 0);
|
|
||||||
user_pref("extensions.enabledScopes", 1);
|
|
||||||
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", false);
|
|
||||||
user_pref("browser.fixup.domainsuffixwhitelist.i2p", true);
|
user_pref("browser.fixup.domainsuffixwhitelist.i2p", true);
|
@ -228,4 +228,24 @@ user_pref("dom.w3c_touch_events.enabled", false);
|
|||||||
user_pref("browser.privatebrowsing.autostart", false);
|
user_pref("browser.privatebrowsing.autostart", false);
|
||||||
user_pref("browser.display.use_system_colors", false);
|
user_pref("browser.display.use_system_colors", false);
|
||||||
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", false);
|
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", false);
|
||||||
user_pref("browser.fixup.domainsuffixwhitelist.i2p", true);
|
user_pref("browser.fixup.domainsuffixwhitelist.i2p", true);
|
||||||
|
|
||||||
|
user_pref("ui.use_standins_for_native_colors", true);
|
||||||
|
user_pref("webgl.disable-extensions", true);
|
||||||
|
user_pref("webgl.min_capability_mode", true);
|
||||||
|
user_pref("webgl.disable-fail-if-major-performance-caveat", true);
|
||||||
|
user_pref("webgl.enable-webgl2", false);
|
||||||
|
user_pref("media.navigator.enabled", false);
|
||||||
|
user_pref("dom.w3c_touch_events.enabled", false);
|
||||||
|
user_pref("browser.privatebrowsing.autostart", false);
|
||||||
|
user_pref("browser.display.use_system_colors", false);
|
||||||
|
user_pref("dom.image-lazy-loading.enabled", false);
|
||||||
|
user_pref("extensions.autoDisableScopes", 0);
|
||||||
|
user_pref("extensions.enabledScopes", 1);
|
||||||
|
user_pref("toolkit.legacyUserProfileCustomizations.stylesheets", false);
|
||||||
|
user_pref("dom.security.https_only_mode", false);
|
||||||
|
|
||||||
|
// Resist-fingerprinting and first-party isolation enable
|
||||||
|
|
||||||
|
user_pref("privacy.resistFingerprinting", true);
|
||||||
|
user_pref("privacy.firstparty.isolate", true);
|
Reference in New Issue
Block a user