fixes part1

This commit is contained in:
sirjonasxx 2020-05-06 04:52:31 +02:00
parent 48458de3c7
commit e129f1ce8a
3 changed files with 17 additions and 16 deletions

View File

@ -224,6 +224,9 @@ public class RawIpProxyProvider extends ProxyProvider {
}
private void saveCurrentConnectionsCache(JSONObject connections) {
if (!Cacher.getCacheContents().has(proxy.getActual_domain())) {
Cacher.put(RAWIP_CONNECTIONS, new JSONObject());
}
JSONObject gearthConnections = Cacher.getCacheContents().getJSONObject(RAWIP_CONNECTIONS);
gearthConnections.put(proxy.getActual_domain(), connections);
Cacher.put(RAWIP_CONNECTIONS, gearthConnections);
@ -231,18 +234,16 @@ public class RawIpProxyProvider extends ProxyProvider {
static private JSONObject getCurrentConnectionsCache(String actual_host) {
if (!Cacher.getCacheContents().has(actual_host)) {
Cacher.put(RAWIP_CONNECTIONS, new JSONObject());
}
JSONObject gearthConnections = Cacher.getCacheContents().getJSONObject(RAWIP_CONNECTIONS);
if (gearthConnections == null) {
gearthConnections = new JSONObject();
if (!gearthConnections.has(actual_host)) {
gearthConnections.put(actual_host, new JSONObject());
Cacher.put(RAWIP_CONNECTIONS, gearthConnections);
}
JSONObject connections = gearthConnections.getJSONObject(actual_host);
if (connections == null) {
connections = new JSONObject();
gearthConnections.put(actual_host, connections);
Cacher.put(RAWIP_CONNECTIONS, gearthConnections);
}
return connections;
return gearthConnections.getJSONObject(actual_host);
}
static boolean isNoneConnected(String actual_host) {

View File

@ -52,8 +52,8 @@ public class ExtraController extends SubForm implements SocksConfiguration {
txtarea_notepad.setText(notepadInitValue);
}
JSONObject socksInitValue = Cacher.getCacheContents().getJSONObject(SOCKS_CACHE_KEY);
if (socksInitValue != null) {
if (Cacher.getCacheContents().has(SOCKS_CACHE_KEY)) {
JSONObject socksInitValue = Cacher.getCacheContents().getJSONObject(SOCKS_CACHE_KEY);
txt_socksIp.setText(socksInitValue.getString(SOCKS_IP));
txt_socksPort.setText(socksInitValue.getString(SOCKS_PORT));
cbx_ignoreSocksOnce.setSelected(socksInitValue.getBoolean(IGNORE_ONCE));

View File

@ -36,8 +36,8 @@
</columnConstraints>
<rowConstraints>
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="119.0" minHeight="72.0" prefHeight="83.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="119.0" minHeight="6.0" prefHeight="20.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="119.0" minHeight="58.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="119.0" minHeight="6.0" prefHeight="15.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
@ -48,7 +48,7 @@
<Insets bottom="4.0" left="7.0" top="7.0" />
</padding>
<children>
<CheckBox fx:id="cbx_useSocks" mnemonicParsing="false" prefHeight="17.0" prefWidth="208.0" text="Use SOCKS proxy" />
<CheckBox fx:id="cbx_useSocks" mnemonicParsing="false" text="Use SOCKS proxy" />
<CheckBox fx:id="cbx_disableDecryption" mnemonicParsing="false" text="Disable decryption" GridPane.rowIndex="3" />
<CheckBox fx:id="cbx_debug" mnemonicParsing="false" text="Debug to stdout" GridPane.rowIndex="4" />
<GridPane fx:id="grd_socksInfo" disable="true" prefHeight="54.0" prefWidth="81.0" GridPane.rowIndex="1">
@ -56,7 +56,7 @@
<ColumnConstraints hgrow="SOMETIMES" minWidth="10.0" prefWidth="100.0" />
</columnConstraints>
<rowConstraints>
<RowConstraints minHeight="10.0" prefHeight="30.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="60.0" minHeight="60.0" prefHeight="60.0" vgrow="SOMETIMES" />
<RowConstraints maxHeight="30.0" minHeight="30.0" prefHeight="30.0" vgrow="SOMETIMES" />
</rowConstraints>
<GridPane.margin>
@ -66,7 +66,7 @@
<Insets left="5.0" />
</padding>
<children>
<CheckBox fx:id="cbx_ignoreSocksOnce" mnemonicParsing="false" prefHeight="17.0" prefWidth="196.0" selected="true" text="Ignore for first connection" GridPane.rowIndex="1" />
<CheckBox fx:id="cbx_ignoreSocksOnce" mnemonicParsing="false" selected="true" text="Ignore for first connection" GridPane.rowIndex="1" />
<GridPane prefHeight="119.0" prefWidth="259.0">
<columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" maxWidth="159.0" minWidth="10.0" prefWidth="68.0" />