add private-windows support
Former-commit-id: 20fd681f46
Former-commit-id: 323a42b2f42b80e50651ebeeba3cc03a6714391b
This commit is contained in:
@ -265,6 +265,19 @@ public class I2PChromium {
|
|||||||
return processBuilder(new String[]{});
|
return processBuilder(new String[]{});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Build a ProcessBuilder for the top Chromium binary and
|
||||||
|
* the default profile.
|
||||||
|
*
|
||||||
|
* @param args the arguments to pass to the Chromium binary.
|
||||||
|
* @return a ProcessBuilder for the top Chromium binary and
|
||||||
|
* the default profile. Always passes the --incognito flag.
|
||||||
|
* @since 0.0.1
|
||||||
|
*/
|
||||||
|
public ProcessBuilder privateProcessBuilder() {
|
||||||
|
return processBuilder(new String[]{"--incognito"});
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
1 --user-data-dir="$CHROMIUM_I2P" \
|
1 --user-data-dir="$CHROMIUM_I2P" \
|
||||||
2 --proxy-server="http://127.0.0.1:4444" \
|
2 --proxy-server="http://127.0.0.1:4444" \
|
||||||
@ -403,9 +416,10 @@ public class I2PChromium {
|
|||||||
* Waits for an HTTP proxy on the port 4444 to be ready.
|
* Waits for an HTTP proxy on the port 4444 to be ready.
|
||||||
* Launches Chromium with the profile directory.
|
* Launches Chromium with the profile directory.
|
||||||
*
|
*
|
||||||
|
* @param bool if true, the profile will be ephemeral(i.e. a --private-window profile).
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
public void launch(){
|
public void launch(boolean privateWindow){
|
||||||
String profileDirectory = I2PChromiumProfileBuilder.profileDirectory();
|
String profileDirectory = I2PChromiumProfileBuilder.profileDirectory();
|
||||||
if (I2PChromiumProfileChecker.validateProfileDirectory(profileDirectory)) {
|
if (I2PChromiumProfileChecker.validateProfileDirectory(profileDirectory)) {
|
||||||
System.out.println("Valid profile directory: "+profileDirectory);
|
System.out.println("Valid profile directory: "+profileDirectory);
|
||||||
@ -419,7 +433,13 @@ public class I2PChromium {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (waitForProxy()){
|
if (waitForProxy()){
|
||||||
ProcessBuilder pb = this.defaultProcessBuilder();
|
ProcessBuilder pb = null;
|
||||||
|
if (privateWindow) {
|
||||||
|
pb = this.privateProcessBuilder();
|
||||||
|
} else {
|
||||||
|
pb = this.defaultProcessBuilder();
|
||||||
|
}
|
||||||
|
|
||||||
Process p = null;
|
Process p = null;
|
||||||
try{
|
try{
|
||||||
System.out.println(pb.command());
|
System.out.println(pb.command());
|
||||||
@ -437,6 +457,16 @@ public class I2PChromium {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/*
|
||||||
|
* Populates a profile directory with a proxy configuration.
|
||||||
|
* Waits for an HTTP proxy on the port 4444 to be ready.
|
||||||
|
* Launches Chromium with the profile directory.
|
||||||
|
*
|
||||||
|
* @since 0.0.1
|
||||||
|
*/
|
||||||
|
public void launch(){
|
||||||
|
launch(false);
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
System.out.println("I2PChromium");
|
System.out.println("I2PChromium");
|
||||||
|
@ -419,7 +419,8 @@ public class I2PFirefox {
|
|||||||
/*
|
/*
|
||||||
* Populates a profile directory with a proxy configuration.
|
* Populates a profile directory with a proxy configuration.
|
||||||
* Waits for an HTTP proxy on the port 4444 to be ready.
|
* Waits for an HTTP proxy on the port 4444 to be ready.
|
||||||
* Launches Firefox with the profile directory.
|
* Launches Firefox with the profile directory. Uses a semi-permanent
|
||||||
|
* profile.
|
||||||
*
|
*
|
||||||
* @since 0.0.1
|
* @since 0.0.1
|
||||||
*/
|
*/
|
||||||
|
Reference in New Issue
Block a user