add generic to browser.config

Former-commit-id: 7b300ac9b2
Former-commit-id: c6419d208eeadee126defe2a844bb499310ce03d
This commit is contained in:
idk
2022-10-22 21:59:44 -04:00
parent 2a66154f6c
commit c6c98f97a5
3 changed files with 116 additions and 66 deletions

View File

@ -1,15 +1,19 @@
#Firefox Configuration Section
#Sat Oct 22 20:54:51 EDT 2022
# Chromium configuration section
chromium.bins.linux=ungoogled-chromium,chromium,brave,edge,ungoogled-chromium,chrome
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
generic.bins.unix=sensible-browser,xdg-open,x-www-browser,gnome-www-browser,defaultbrowser,dillo,seamonkey,konqueror,galeon,surf,www-browser,links,lynx
chromium.paths.osx=/Applications/Chromium.app/Contents/MacOS,/Applications/Chrome.app/Contents/MacOS,/Applications/Brave.app/Contents/MacOS
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 configuration section
firefox.bins.linux=firefox,firefox-bin,firefox-esr,waterfox,waterfox-bin,librewolf
firefox.bins.osx=firefox,firefox-bin,firefox-esr,waterfox,waterfox-bin,librewolf
firefox.bins.windows=firefox.exe,firefox-bin.exe,firefox-esr.exe,waterfox.exe,waterfox-bin.exe,librewolf.exe
firefox.paths.linux=/usr/bin,/usr/local/bin,/opt/firefox/bin,/snap/bin
firefox.paths.osx=/Applications/Tor Browser.app/Contents/MacOS,/Applications/Firefox.app/Contents/MacOS,/Applications/Waterfox.app/Contents/MacOS,/Applications/Librewolf.app/Contents/MacOS
firefox.paths.windows=/home/idk/OneDrive/Desktop/Tor Browser/Browser,/home/idk/Desktop/Tor Browser/Browser,Mozilla Firefox,Mozilla Firefox,Waterfox,Waterfox,Librewolf
# Generic configuration section
generic.bins.unix=sensible-browser,xdg-open,x-www-browser,gnome-www-browser,defaultbrowser,dillo,seamonkey,konqueror,galeon,surf,www-browser,links,lynx

View File

@ -123,8 +123,10 @@ public class I2PBrowser extends I2PCommonBrowser {
*/
public void launch(int privateWindow, String[] url) {
validateUserDir();
if (generic)
if (generic) {
this.launchGeneric(privateWindow, url);
return;
}
if ((chromium && firefox) || (!chromium && !firefox)) {
if (this.hasFirefox()) {
this.launchFirefox(privateWindow, url);

View File

@ -244,63 +244,105 @@ public class I2PFirefox extends I2PCommonBrowser {
for (File userFile2 : userFiles2) {
if (userFile2.isDirectory())
continue;
if (userFile2.getName().equals("firefox") ||
userFile2.getName().equals("firefox-bin") ||
userFile2.getName().equals("firefox-esr") ||
userFile2.getName().equals("waterfox") ||
userFile2.getName().equals("waterfox-bin") ||
userFile2.getName().equals("librewolf")) {
logger.info("FOUND NEARBY" + userFile2.getAbsolutePath());
return new String[] {userFile2.getAbsolutePath()};
if (!isWindows()) {
if (userFile2.getName().equals("firefox") ||
userFile2.getName().equals("firefox-bin") ||
userFile2.getName().equals("firefox-esr") ||
userFile2.getName().equals("waterfox") ||
userFile2.getName().equals("waterfox-bin") ||
userFile2.getName().equals("librewolf")) {
return new String[] {userFile2.getAbsolutePath()};
}
} else {
if (userFile2.getName().equals("firefox.exe") ||
userFile2.getName().equals("firefox-bin.exe") ||
userFile2.getName().equals("firefox-esr.exe") ||
userFile2.getName().equals("waterfox.exe") ||
userFile2.getName().equals("waterfox-bin.exe") ||
userFile2.getName().equals("librewolf.exe")) {
return new String[] {userFile2.getAbsolutePath()};
}
}
}
if (!isWindows()) {
if (userFile.getName().equals("firefox") ||
userFile.getName().equals("firefox-bin") ||
userFile.getName().equals("firefox-esr") ||
userFile.getName().equals("waterfox") ||
userFile.getName().equals("waterfox-bin") ||
userFile.getName().equals("librewolf")) {
return new String[] {userFile.getAbsolutePath()};
}
} else {
if (userFile.getName().equals("firefox.exe") ||
userFile.getName().equals("firefox-bin.exe") ||
userFile.getName().equals("firefox-esr.exe") ||
userFile.getName().equals("waterfox.exe") ||
userFile.getName().equals("waterfox-bin.exe") ||
userFile.getName().equals("librewolf.exe")) {
return new String[] {userFile.getAbsolutePath()};
}
}
}
if (userFile.getName().equals("firefox") ||
userFile.getName().equals("firefox-bin") ||
userFile.getName().equals("firefox-esr") ||
userFile.getName().equals("waterfox") ||
userFile.getName().equals("waterfox-bin") ||
userFile.getName().equals("librewolf")) {
return new String[] {userFile.getAbsolutePath()};
}
}
}
}
}
}
// now, do the same thing, but with user.dir instead of plugin
// list the directories in the user.dir directory
File userDir = new File(System.getProperty("user.dir"));
if (userDir.exists()) {
File[] userDirs = userDir.listFiles();
// list the files in the user.dir directory
for (File userDir1 : userDirs) {
File[] userFiles = userDir1.listFiles();
if (userFiles != null) {
for (File userFile : userFiles) {
if (userFile.isDirectory()) {
File[] userFiles2 = userFile.listFiles();
for (File userFile2 : userFiles2) {
if (userFile2.isDirectory())
continue;
if (userFile2.getName().equals("firefox") ||
userFile2.getName().equals("firefox-bin") ||
userFile2.getName().equals("firefox-esr") ||
userFile2.getName().equals("waterfox") ||
userFile2.getName().equals("waterfox-bin") ||
userFile2.getName().equals("librewolf")) {
logger.info("FOUND NEARBY" + userFile2.getAbsolutePath());
return new String[] {userFile2.getAbsolutePath()};
// now, do the same thing, but with user.dir instead of plugin
// list the directories in the user.dir directory
userDir = new File(System.getProperty("user.dir"));
if (userDir.exists()) {
File[] userDirs = userDir.listFiles();
// list the files in the user.dir directory
for (File userDir1 : userDirs) {
File[] userFiles = userDir1.listFiles();
if (userFiles != null) {
for (File userFile : userFiles) {
if (userFile.isDirectory()) {
File[] userFiles2 = userFile.listFiles();
for (File userFile2 : userFiles2) {
if (userFile2.isDirectory())
continue;
if (isWindows()) {
if (userFile2.getName().equals("firefox") ||
userFile2.getName().equals("firefox-bin") ||
userFile2.getName().equals("firefox-esr") ||
userFile2.getName().equals("waterfox") ||
userFile2.getName().equals("waterfox-bin") ||
userFile2.getName().equals("librewolf")) {
return new String[] {userFile2.getAbsolutePath()};
}
} else {
if (userFile.getName().equals("firefox.exe") ||
userFile.getName().equals("firefox-bin.exe") ||
userFile.getName().equals("firefox-esr.exe") ||
userFile.getName().equals("waterfox.exe") ||
userFile.getName().equals("waterfox-bin.exe") ||
userFile.getName().equals("librewolf.exe")) {
return new String[] {userFile.getAbsolutePath()};
}
}
}
}
if (!isWindows()) {
if (userFile.getName().equals("firefox") ||
userFile.getName().equals("firefox-bin") ||
userFile.getName().equals("firefox-esr") ||
userFile.getName().equals("waterfox") ||
userFile.getName().equals("waterfox-bin") ||
userFile.getName().equals("librewolf")) {
return new String[] {userFile.getAbsolutePath()};
}
} else {
if (userFile.getName().equals("firefox.exe") ||
userFile.getName().equals("firefox-bin.exe") ||
userFile.getName().equals("firefox-esr.exe") ||
userFile.getName().equals("waterfox.exe") ||
userFile.getName().equals("waterfox-bin.exe") ||
userFile.getName().equals("librewolf.exe")) {
return new String[] {userFile.getAbsolutePath()};
}
}
}
if (userFile.getName().equals("firefox") ||
userFile.getName().equals("firefox-bin") ||
userFile.getName().equals("firefox-esr") ||
userFile.getName().equals("waterfox") ||
userFile.getName().equals("waterfox-bin") ||
userFile.getName().equals("librewolf")) {
return new String[] {userFile.getAbsolutePath()};
}
}
}
@ -346,7 +388,8 @@ public class I2PFirefox extends I2PCommonBrowser {
/**
* Return the best available Firefox from the list of Firefoxes we have.
*
* @return the path to the best available Firefox, or null if none are found.
* @return the path to the best available Firefox, or null if none are
* found.
* @since 0.0.1
*/
public String topFirefox() {
@ -375,7 +418,8 @@ public class I2PFirefox extends I2PCommonBrowser {
* be used.
*
* @param override the path to a valid Firefox binary to use.
* @return the path to the best available Firefox, or null if none are found.
* @return the path to the best available Firefox, or null if none are
* found.
* @since 0.0.1
*/
public String topFirefox(String overrideFirefox) {
@ -677,8 +721,8 @@ public class I2PFirefox extends I2PCommonBrowser {
* Waits for an HTTP proxy on the port 4444 to be ready.
* Launches Firefox with the profile directory.
*
* @param bool if true, the profile will be ephemeral(i.e. a --private-window
* profile).
* @param bool if true, the profile will be ephemeral(i.e. a
* --private-window profile).
* @param String[] a list of URL's to pass to the browser window
* @since 0.0.17
*/
@ -708,8 +752,8 @@ public class I2PFirefox extends I2PCommonBrowser {
* Waits for an HTTP proxy on the port 4444 to be ready.
* Launches Firefox with the profile directory.
*
* @param bool if true, the profile will be ephemeral(i.e. a --private-window
* profile).
* @param bool if true, the profile will be ephemeral(i.e. a
* --private-window profile).
* @since 0.0.1
*/
public void launch(boolean privateWindow) { launch(privateWindow, null); }