remove -attach-console as it probably does nothing and breaks something
This commit is contained in:
@ -392,16 +392,15 @@ public class I2PFirefox extends I2PCommonBrowser {
|
|||||||
int arglength = 0;
|
int arglength = 0;
|
||||||
if (args != null)
|
if (args != null)
|
||||||
arglength = args.length;
|
arglength = args.length;
|
||||||
String[] newArgs = new String[arglength + 5];
|
String[] newArgs = new String[arglength + 4];
|
||||||
newArgs[0] = firefox;
|
newArgs[0] = firefox;
|
||||||
newArgs[1] = "-attach-console";
|
newArgs[1] = "--new-instance";
|
||||||
newArgs[2] = "--new-instance";
|
newArgs[2] = "--profile";
|
||||||
newArgs[3] = "--profile";
|
newArgs[3] = I2PFirefoxProfileBuilder.profileDirectory();
|
||||||
newArgs[4] = I2PFirefoxProfileBuilder.profileDirectory();
|
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
if (arglength > 0) {
|
if (arglength > 0) {
|
||||||
for (int i = 0; i < arglength; i++) {
|
for (int i = 0; i < arglength; i++) {
|
||||||
newArgs[i + 5] = args[i];
|
newArgs[i + 4] = args[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2,9 +2,11 @@ package net.i2p.i2pfirefox;
|
|||||||
|
|
||||||
import java.io.BufferedReader;
|
import java.io.BufferedReader;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileReader;
|
import java.io.FileReader;
|
||||||
import java.io.FileWriter;
|
import java.io.FileWriter;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.util.Scanner;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* I2PFirefoxProfileChecker.java
|
* I2PFirefoxProfileChecker.java
|
||||||
@ -78,24 +80,27 @@ public class I2PFirefoxProfileChecker extends I2PCommonBrowser {
|
|||||||
println("extensions directory is invalid");
|
println("extensions directory is invalid");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return deRestrictHTTPS(profileDir.toString());
|
return deRestrictHTTPSAndSetupHomepage(profileDir.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
private static boolean deRestrictHTTPS(String profile) {
|
private static boolean deRestrictHTTPSAndSetupHomepage(String profile) {
|
||||||
// String profile = profileDirectory();
|
// String profile = profileDirectory();
|
||||||
File profileDir = new File(profile);
|
File profileDir = new File(profile);
|
||||||
if (profileDir.exists()) {
|
if (profileDir.exists()) {
|
||||||
File prefOverrides = new File(profile, "prefs.js");
|
File prefOverrides = new File(profile, "prefs.js");
|
||||||
if (prefOverrides.exists()) {
|
if (prefOverrides.exists()) {
|
||||||
undoHttpsOnlyMode(prefOverrides);
|
undoHttpsOnlyMode(prefOverrides);
|
||||||
|
undoHomepage(prefOverrides);
|
||||||
}
|
}
|
||||||
File userSettings = new File(profile, "user.js");
|
File userSettings = new File(profile, "user.js");
|
||||||
if (userSettings.exists()) {
|
if (userSettings.exists()) {
|
||||||
undoHttpsOnlyMode(userSettings);
|
undoHttpsOnlyMode(userSettings);
|
||||||
|
undoHomepage(userSettings);
|
||||||
}
|
}
|
||||||
File userOverrides = new File(profile, "user-overrides.js");
|
File userOverrides = new File(profile, "user-overrides.js");
|
||||||
if (userOverrides.exists()) {
|
if (userOverrides.exists()) {
|
||||||
undoHttpsOnlyMode(userOverrides);
|
undoHttpsOnlyMode(userOverrides);
|
||||||
|
undoHomepage(userOverrides);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -104,6 +109,31 @@ public class I2PFirefoxProfileChecker extends I2PCommonBrowser {
|
|||||||
private static boolean undoHttpsOnlyMode(File fileToBeModified) {
|
private static boolean undoHttpsOnlyMode(File fileToBeModified) {
|
||||||
String oldString = "\"dom.security.https_only_mode\", true";
|
String oldString = "\"dom.security.https_only_mode\", true";
|
||||||
String newString = "\"dom.security.https_only_mode\", false";
|
String newString = "\"dom.security.https_only_mode\", false";
|
||||||
|
return undoValue(oldString, newString, fileToBeModified);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean undoHomepage(File fileToBeModified) {
|
||||||
|
String oldString = "\"browser.startup.homepage\", true";
|
||||||
|
File file = new File("Student.txt");
|
||||||
|
String newString = "\"browser.startup.homepage\", \"http://127.0.0.1:7657\"";
|
||||||
|
try {
|
||||||
|
Scanner scanner = new Scanner(file);
|
||||||
|
// now read the file line by line...
|
||||||
|
while (scanner.hasNextLine()) {
|
||||||
|
String line = scanner.nextLine();
|
||||||
|
if(line.contains("browser.startup.homepage")) {
|
||||||
|
oldString = line.toString();
|
||||||
|
return undoValue(oldString, newString, fileToBeModified);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
// handle this
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private static boolean undoValue(String oldString, String newString,
|
||||||
|
File fileToBeModified) {
|
||||||
String oldContent = "";
|
String oldContent = "";
|
||||||
BufferedReader reader = null;
|
BufferedReader reader = null;
|
||||||
FileWriter writer = null;
|
FileWriter writer = null;
|
||||||
|
Reference in New Issue
Block a user