add generic to browser.config

Former-commit-id: 7d90b9000d
Former-commit-id: fba873898c9c82b04ba5b985d9fe2ac37c541ad4
This commit is contained in:
idk
2022-10-22 20:55:41 -04:00
parent ee5ead4440
commit 2a66154f6c
5 changed files with 34 additions and 8 deletions

View File

@ -1,5 +1,5 @@
#Chromium Configuration Section
#Sat Oct 22 20:12:30 EDT 2022
#Firefox Configuration Section
#Sat Oct 22 20:54:51 EDT 2022
chromium.bins.osx=ungoogled-chromium,chromium,brave,edge,ungoogled-chromium,chrome
chromium.bins.windows=ungoogled-chromium.exe,chromium.exe,brave.exe,edge.exe,ungoogled-chromium.exe,chrome.exe
firefox.bins.windows=firefox.exe,firefox-bin.exe,firefox-esr.exe,waterfox.exe,waterfox-bin.exe,librewolf.exe
@ -11,4 +11,5 @@ chromium.bins.linux=ungoogled-chromium,chromium,brave,edge,ungoogled-chromium,ch
firefox.bins.osx=firefox,firefox-bin,firefox-esr,waterfox,waterfox-bin,librewolf
chromium.paths.osx=/Applications/Chromium.app/Contents/MacOS,/Applications/Chrome.app/Contents/MacOS,/Applications/Brave.app/Contents/MacOS
chromium.paths.linux=/usr/bin,/usr/local/bin,/opt/chromium/bin,/snap/bin
generic.bins.unix=sensible-browser,xdg-open,x-www-browser,gnome-www-browser,defaultbrowser,dillo,seamonkey,konqueror,galeon,surf,www-browser,links,lynx
firefox.paths.linux=/usr/bin,/usr/local/bin,/opt/firefox/bin,/snap/bin

View File

@ -30,7 +30,7 @@ public class I2PBrowser extends I2PCommonBrowser {
public boolean generic = false;
public boolean chromiumFirst = false;
public boolean usability = false;
static private boolean outputConfig = false;
static private boolean outputConfig = true;
private void launchFirefox(int privateWindow, String[] url) {
logger.info("I2PFirefox" + privateWindow);
@ -50,6 +50,8 @@ public class I2PBrowser extends I2PCommonBrowser {
boolean privateWindow = false;
if (privateWindowInt == 1)
privateWindow = true;
if (outputConfig)
i2pGeneral.storeGenericDefaults();
logger.info("I2PGeneric" + privateWindowInt);
i2pGeneral.launch(privateWindow, url);
}
@ -209,6 +211,9 @@ public class I2PBrowser extends I2PCommonBrowser {
if (arg.equals("-usability")) {
i2pBrowser.usability = true;
}
if (arg.equals("-generic")) {
i2pBrowser.generic = true;
}
if (arg.equals("-app")) {
i2pBrowser.usability = true;
privateBrowsing = 2;

View File

@ -9,6 +9,7 @@ import java.io.OutputStream;
import java.net.Socket;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.util.Arrays;
import java.util.Properties;
import java.util.logging.FileHandler;
import java.util.logging.Logger;

View File

@ -1,10 +1,15 @@
package net.i2p.i2pfirefox;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.net.Socket;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Scanner;
import java.util.stream.Collectors;
/**
* I2PChromiumProfileChecker.java
@ -57,6 +62,20 @@ public class I2PGenericUnsafeBrowser extends I2PCommonBrowser {
"www-browser", "links", "lynx"};
}
public static void storeGenericDefaults() {
List<String> list = new ArrayList<String>();
list = Arrays.asList(browsers());
prop.setProperty("generic.bins.unix",
list.stream().collect(Collectors.joining(",")));
try (OutputStream fos = new FileOutputStream(
new File(runtimeDirectory(""), "browser.config"))) {
prop.store(fos, "Chromium Configuration Section");
} catch (IOException ioe) {
logger.warning(ioe.toString());
}
}
/**
* Obtains the default browser for the Windows platform, which by now should
* be Edgium in the worst-case scenario but in case it isn't, we can use this

10
test.sh
View File

@ -82,15 +82,15 @@ sleep 2s
rm -rf i2p.chromium.base.profile i2p.chromium.profile i2p.firefox.base.profile i2p.firefox.profile
echo "Testing UNSAFE auto-selector with no private and no URL parameters."
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PGenericUnsafeBrowser 2> gen.0.err 1> gen.0.log
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PBrowser -generic 2> gen.0.err 1> gen.0.log
echo "Testing UNSAFE auto-selector with local URL parameter."
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PGenericUnsafeBrowser "http://127.0.0.1:7657" 2> gen.1.err 1> gen.1.log
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PBrowser -generic "http://127.0.0.1:7657" 2> gen.1.err 1> gen.1.log
echo "Testing UNSAFE auto-selector with remote URL parameter."
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PGenericUnsafeBrowser "http://idk.i2p" 2> gen.2.err 1> gen.2.log
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PBrowser -generic "http://idk.i2p" 2> gen.2.err 1> gen.2.log
echo "Testing UNSAFE auto-selector with remote AND local URL parameter."
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PGenericUnsafeBrowser "http://127.0.0.1:7657" "http://idk.i2p" 2> gen.3.err 1> gen.3.log
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PBrowser -generic "http://127.0.0.1:7657" "http://idk.i2p" 2> gen.3.err 1> gen.3.log
echo "Testing UNSAFE auto-selector with private browsing parameter"
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PGenericUnsafeBrowser -private "http://127.0.0.1:7657" 2> gen.4.err 1> gen.4.log
java -cp ./src/build/i2pfirefox.jar net.i2p.i2pfirefox.I2PBrowser -generic -private "http://127.0.0.1:7657" 2> gen.4.err 1> gen.4.log
echo "UNSAFE browser tests complete"