remove -attach-console as it probably does nothing and breaks something

This commit is contained in:
idk
2022-09-07 03:16:13 -04:00
parent 4e19c36817
commit 24a08cf7c5
2 changed files with 37 additions and 8 deletions

View File

@ -392,16 +392,15 @@ public class I2PFirefox extends I2PCommonBrowser {
int arglength = 0;
if (args != null)
arglength = args.length;
String[] newArgs = new String[arglength + 5];
String[] newArgs = new String[arglength + 4];
newArgs[0] = firefox;
newArgs[1] = "-attach-console";
newArgs[2] = "--new-instance";
newArgs[3] = "--profile";
newArgs[4] = I2PFirefoxProfileBuilder.profileDirectory();
newArgs[1] = "--new-instance";
newArgs[2] = "--profile";
newArgs[3] = I2PFirefoxProfileBuilder.profileDirectory();
if (args != null) {
if (arglength > 0) {
for (int i = 0; i < arglength; i++) {
newArgs[i + 5] = args[i];
newArgs[i + 4] = args[i];
}
}
}

View File

@ -2,9 +2,11 @@ package net.i2p.i2pfirefox;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.Scanner;
/**
* I2PFirefoxProfileChecker.java
@ -78,24 +80,27 @@ public class I2PFirefoxProfileChecker extends I2PCommonBrowser {
println("extensions directory is invalid");
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();
File profileDir = new File(profile);
if (profileDir.exists()) {
File prefOverrides = new File(profile, "prefs.js");
if (prefOverrides.exists()) {
undoHttpsOnlyMode(prefOverrides);
undoHomepage(prefOverrides);
}
File userSettings = new File(profile, "user.js");
if (userSettings.exists()) {
undoHttpsOnlyMode(userSettings);
undoHomepage(userSettings);
}
File userOverrides = new File(profile, "user-overrides.js");
if (userOverrides.exists()) {
undoHttpsOnlyMode(userOverrides);
undoHomepage(userOverrides);
}
}
return false;
@ -104,6 +109,31 @@ public class I2PFirefoxProfileChecker extends I2PCommonBrowser {
private static boolean undoHttpsOnlyMode(File fileToBeModified) {
String oldString = "\"dom.security.https_only_mode\", true";
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 = "";
BufferedReader reader = null;
FileWriter writer = null;