add default config file
Former-commit-id: ee3532b83d
Former-commit-id: d493f375d5dee58483f0af95a050480598f1b043
This commit is contained in:
14
browser.config
Normal file
14
browser.config
Normal file
@ -0,0 +1,14 @@
|
||||
#Chromium Configuration Section
|
||||
#Sat Oct 22 20:12:30 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
|
||||
firefox.bins.linux=firefox,firefox-bin,firefox-esr,waterfox,waterfox-bin,librewolf
|
||||
chromium.paths.windows=/Google/Chrome/Application,/Google/Chrome/Application,/Google/Chrome/Application,/Chromium/Application,/Chromium/Application,/Chromium/Application,/BraveSoftware/Brave Browser/Application,/BraveSoftware/Brave Browser/Application,/BraveSoftware/Brave Browser/Application,/Microsoft/Edge/Application,/Microsoft/Edge/Application
|
||||
firefox.paths.windows=/home/idk/OneDrive/Desktop/Tor Browser/Browser,/home/idk/Desktop/Tor Browser/Browser,Mozilla Firefox,Mozilla Firefox,Waterfox,Waterfox,Librewolf
|
||||
firefox.paths.osx=/Applications/Tor Browser.app/Contents/MacOS,/Applications/Firefox.app/Contents/MacOS,/Applications/Waterfox.app/Contents/MacOS,/Applications/Librewolf.app/Contents/MacOS
|
||||
chromium.bins.linux=ungoogled-chromium,chromium,brave,edge,ungoogled-chromium,chrome
|
||||
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
|
||||
firefox.paths.linux=/usr/bin,/usr/local/bin,/opt/firefox/bin,/snap/bin
|
@ -30,15 +30,20 @@ public class I2PBrowser extends I2PCommonBrowser {
|
||||
public boolean generic = false;
|
||||
public boolean chromiumFirst = false;
|
||||
public boolean usability = false;
|
||||
static private boolean outputConfig = true;
|
||||
|
||||
private void launchFirefox(int privateWindow, String[] url) {
|
||||
logger.info("I2PFirefox" + privateWindow);
|
||||
I2PFirefox.usability = usability;
|
||||
if (outputConfig)
|
||||
i2pFirefox.storeFirefoxDefaults();
|
||||
i2pFirefox.launch(privateWindow, url);
|
||||
}
|
||||
private void launchChromium(int privateWindow, String[] url) {
|
||||
logger.info("I2PChromium" + privateWindow);
|
||||
I2PChromiumProfileBuilder.usability = usability;
|
||||
if (outputConfig)
|
||||
i2pChromium.storeChromiumDefaults();
|
||||
i2pChromium.launch(privateWindow, url);
|
||||
}
|
||||
private void launchGeneric(int privateWindowInt, String[] url) {
|
||||
@ -208,6 +213,9 @@ public class I2PBrowser extends I2PCommonBrowser {
|
||||
i2pBrowser.usability = true;
|
||||
privateBrowsing = 2;
|
||||
}
|
||||
if (arg.equals("-outputconfig")) {
|
||||
outputConfig = true;
|
||||
}
|
||||
if (arg.equals("-noproxycheck")) {
|
||||
logger.info("zeroing out proxy check");
|
||||
i2pBrowser.setProxyTimeoutTime(0);
|
||||
|
@ -1,11 +1,15 @@
|
||||
package net.i2p.i2pfirefox;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
@ -53,6 +57,35 @@ public class I2PChromium extends I2PCommonBrowser {
|
||||
I2PChromiumProfileBuilder.usability = true;
|
||||
}
|
||||
|
||||
public static void storeChromiumDefaults() {
|
||||
List<String> list = new ArrayList<String>();
|
||||
list = Arrays.asList(chromiumPathsWindows());
|
||||
prop.setProperty("chromium.paths.windows",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
list = Arrays.asList(chromiumPathsUnix());
|
||||
prop.setProperty("chromium.paths.linux",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
list = Arrays.asList(chromiumPathsOSX());
|
||||
prop.setProperty("chromium.paths.osx",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
|
||||
list = Arrays.asList(chromiumBinsWindows());
|
||||
prop.setProperty("chromium.bins.windows",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
list = Arrays.asList(chromiumBinsUnix());
|
||||
prop.setProperty("chromium.bins.linux",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
list = Arrays.asList(chromiumBinsUnix());
|
||||
prop.setProperty("chromium.bins.osx",
|
||||
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());
|
||||
}
|
||||
}
|
||||
|
||||
private static String[] chromiumPathsUnix() {
|
||||
String chromiumPathsProp = prop.getProperty("chromium.paths.unix");
|
||||
if (chromiumPathsProp != null)
|
||||
@ -63,16 +96,17 @@ public class I2PChromium extends I2PCommonBrowser {
|
||||
}
|
||||
|
||||
private static String[] chromiumBinsUnix() {
|
||||
String chromiumPathsProp = prop.getProperty("chromium.bins.unix");
|
||||
if (chromiumPathsProp != null)
|
||||
if (!chromiumPathsProp.equals(""))
|
||||
return chromiumPathsProp.split(",");
|
||||
String chromiumPathsProp;
|
||||
if (isOSX()) {
|
||||
chromiumPathsProp = prop.getProperty("chromium.bins.osx");
|
||||
if (chromiumPathsProp != null)
|
||||
if (!chromiumPathsProp.equals(""))
|
||||
return chromiumPathsProp.split(",");
|
||||
}
|
||||
chromiumPathsProp = prop.getProperty("chromium.bins.unix");
|
||||
if (chromiumPathsProp != null)
|
||||
if (!chromiumPathsProp.equals(""))
|
||||
return chromiumPathsProp.split(",");
|
||||
return new String[] {"ungoogled-chromium", "chromium", "brave", "edge",
|
||||
"ungoogled-chromium", "chrome"};
|
||||
}
|
||||
|
@ -52,6 +52,7 @@ public class I2PCommonBrowser {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
loadPropertiesFile(new File(runtimeDirectory(""), "browser.config"));
|
||||
}
|
||||
|
||||
public static void loadPropertiesFile(File props) {
|
||||
|
@ -1,12 +1,16 @@
|
||||
package net.i2p.i2pfirefox;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.FileWriter;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.io.PrintWriter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
@ -45,6 +49,35 @@ public class I2PFirefox extends I2PCommonBrowser {
|
||||
}
|
||||
}
|
||||
|
||||
public static void storeFirefoxDefaults() {
|
||||
List<String> list = new ArrayList<String>();
|
||||
list = Arrays.asList(firefoxPathsWindows());
|
||||
prop.setProperty("firefox.paths.windows",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
list = Arrays.asList(firefoxPathsUnix());
|
||||
prop.setProperty("firefox.paths.linux",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
list = Arrays.asList(firefoxPathsOSX());
|
||||
prop.setProperty("firefox.paths.osx",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
|
||||
list = Arrays.asList(firefoxBinsWindows());
|
||||
prop.setProperty("firefox.bins.windows",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
list = Arrays.asList(firefoxBinsUnix());
|
||||
prop.setProperty("firefox.bins.linux",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
list = Arrays.asList(firefoxBinsUnix());
|
||||
prop.setProperty("firefox.bins.osx",
|
||||
list.stream().collect(Collectors.joining(",")));
|
||||
try (OutputStream fos = new FileOutputStream(
|
||||
new File(runtimeDirectory(""), "browser.config"))) {
|
||||
prop.store(fos, "Firefox Configuration Section");
|
||||
} catch (IOException ioe) {
|
||||
logger.warning(ioe.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public static String[] firefoxPathsUnix() {
|
||||
String firefoxPathsProp = prop.getProperty("firefox.paths.unix");
|
||||
if (firefoxPathsProp != null)
|
||||
@ -55,16 +88,18 @@ public class I2PFirefox extends I2PCommonBrowser {
|
||||
}
|
||||
|
||||
public static String[] firefoxBinsUnix() {
|
||||
String firefoxPathsProp = prop.getProperty("firefox.bins.unix");
|
||||
if (firefoxPathsProp != null)
|
||||
if (!firefoxPathsProp.equals(""))
|
||||
return firefoxPathsProp.split(",");
|
||||
String firefoxPathsProp;
|
||||
if (isOSX()) {
|
||||
firefoxPathsProp = prop.getProperty("firefox.bins.osx");
|
||||
if (firefoxPathsProp != null)
|
||||
if (!firefoxPathsProp.equals(""))
|
||||
return firefoxPathsProp.split(",");
|
||||
}
|
||||
firefoxPathsProp = prop.getProperty("firefox.bins.unix");
|
||||
if (firefoxPathsProp != null)
|
||||
if (!firefoxPathsProp.equals(""))
|
||||
return firefoxPathsProp.split(",");
|
||||
|
||||
return new String[] {"firefox", "firefox-bin", "firefox-esr",
|
||||
"waterfox", "waterfox-bin", "librewolf"};
|
||||
}
|
||||
|
Reference in New Issue
Block a user