add support for forcibly setting based on routerconsole.browser
Former-commit-id: 0473572933
Former-commit-id: 1b7e63d0a928696dc09049979b3b07cd67284e9d
This commit is contained in:
@ -26,6 +26,7 @@ public class I2PBrowser {
|
||||
private final I2PGenericUnsafeBrowser i2pGeneral = new I2PGenericUnsafeBrowser();
|
||||
public boolean firefox = false;
|
||||
public boolean chromium = false;
|
||||
public boolean generic = false;
|
||||
public boolean chromiumFirst = false;
|
||||
|
||||
private void launchFirefox(boolean privateWindow, String[] url) {
|
||||
@ -49,6 +50,16 @@ public class I2PBrowser {
|
||||
public I2PBrowser() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct an I2PBrowser class which automatically determines which browser to use.
|
||||
*
|
||||
* @since 0.0.18
|
||||
*/
|
||||
public I2PBrowser(String browserPath) {
|
||||
I2PGenericUnsafeBrowser.BROWSER = browserPath;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Return true if there is a Chromium available
|
||||
*
|
||||
@ -92,6 +103,8 @@ public class I2PBrowser {
|
||||
* @since 0.0.17
|
||||
*/
|
||||
public void launch(boolean privateWindow, String[] url){
|
||||
if (generic)
|
||||
this.launchGeneric(privateWindow, url);
|
||||
if ((chromium && firefox) || (!chromium && !firefox)) {
|
||||
if (this.hasFirefox()) {
|
||||
this.launchFirefox(privateWindow, url);
|
||||
|
@ -28,6 +28,7 @@ import java.util.Scanner;
|
||||
|
||||
public class I2PGenericUnsafeBrowser {
|
||||
private final int DEFAULT_TIMEOUT = 200;
|
||||
public static String BROWSER = "";
|
||||
// Ideally, EVERY browser in this list should honor http_proxy, https_proxy, ftp_proxy and no_proxy.
|
||||
// in practice, this is going to be hard to guarantee. For now, we're just assuming. So don't use this until
|
||||
// I understand the situation better, unless you think you know better.
|
||||
@ -169,6 +170,12 @@ public class I2PGenericUnsafeBrowser {
|
||||
* @return
|
||||
*/
|
||||
public static String findUnsafeBrowserAnywhere() {
|
||||
if (BROWSER != ""){
|
||||
File f = new File(BROWSER);
|
||||
if (f.exists())
|
||||
return f.getAbsolutePath();
|
||||
}
|
||||
|
||||
if (getOperatingSystem() == "Windows"){
|
||||
return getDefaultWindowsBrowser();
|
||||
}
|
||||
|
Reference in New Issue
Block a user