mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2025-11-05 11:56:37 +00:00
remove vpn, node and wallet from settings
This commit is contained in:
parent
79a597cfa0
commit
3cc97d11f3
2 changed files with 1 additions and 143 deletions
|
|
@ -11,65 +11,14 @@ import javafx.scene.control.PasswordField;
|
||||||
|
|
||||||
public class SettingsController extends JoinstrFormController {
|
public class SettingsController extends JoinstrFormController {
|
||||||
|
|
||||||
@FXML
|
|
||||||
Label urlLabel;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
Label selectedWalletLabel;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TextField usernameTextField;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
PasswordField passwordTextField;
|
|
||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
TextField nostrRelayTextField;
|
TextField nostrRelayTextField;
|
||||||
|
|
||||||
@FXML
|
|
||||||
TextField hostTextField;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TextField locationTextField;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TextField ipAddressTextField;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TextField portTextField;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
TextField protocolTextField;
|
|
||||||
|
|
||||||
private VpnGateway vpnGateway;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void initializeView() {
|
public void initializeView() {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
// Node settings
|
|
||||||
urlLabel.setText(Config.get().getServer().getUrl());
|
|
||||||
selectedWalletLabel.setText(this.getJoinstrForm().getWallet().getName());
|
|
||||||
|
|
||||||
usernameTextField.setText(Config.get().getNodeUsername());
|
|
||||||
usernameTextField.textProperty().addListener(new ChangeListener<String>() {
|
|
||||||
@Override
|
|
||||||
public void changed(ObservableValue<? extends String> observable,
|
|
||||||
String oldValue, String newValue) {
|
|
||||||
Config.get().setNodeUsername(usernameTextField.getText());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
passwordTextField.setText(Config.get().getNodePassword());
|
|
||||||
passwordTextField.textProperty().addListener(new ChangeListener<String>() {
|
|
||||||
@Override
|
|
||||||
public void changed(ObservableValue<? extends String> observable,
|
|
||||||
String oldValue, String newValue) {
|
|
||||||
Config.get().setNodePassword(passwordTextField.getText());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
nostrRelayTextField.setText(Config.get().getNostrRelay());
|
nostrRelayTextField.setText(Config.get().getNostrRelay());
|
||||||
nostrRelayTextField.textProperty().addListener(new ChangeListener<String>() {
|
nostrRelayTextField.textProperty().addListener(new ChangeListener<String>() {
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -82,69 +31,8 @@ public class SettingsController extends JoinstrFormController {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// VPN Gateway settings
|
|
||||||
vpnGateway = Config.get().getVpnGateway();
|
|
||||||
if(vpnGateway == null)
|
|
||||||
vpnGateway = new VpnGateway();
|
|
||||||
|
|
||||||
hostTextField.setText(vpnGateway.getHost());
|
|
||||||
hostTextField.textProperty().addListener(new ChangeListener<String>() {
|
|
||||||
@Override
|
|
||||||
public void changed(ObservableValue<? extends String> observable,
|
|
||||||
String oldValue, String newValue) {
|
|
||||||
vpnGateway.setHost(hostTextField.getText());
|
|
||||||
Config.get().setVpnGateway(vpnGateway);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
locationTextField.setText(vpnGateway.getLocation());
|
|
||||||
locationTextField.textProperty().addListener(new ChangeListener<String>() {
|
|
||||||
@Override
|
|
||||||
public void changed(ObservableValue<? extends String> observable,
|
|
||||||
String oldValue, String newValue) {
|
|
||||||
vpnGateway.setLocation(locationTextField.getText());
|
|
||||||
Config.get().setVpnGateway(vpnGateway);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ipAddressTextField.setText(vpnGateway.getIpAddress());
|
|
||||||
ipAddressTextField.textProperty().addListener(new ChangeListener<String>() {
|
|
||||||
@Override
|
|
||||||
public void changed(ObservableValue<? extends String> observable,
|
|
||||||
String oldValue, String newValue) {
|
|
||||||
vpnGateway.setIpAddress(ipAddressTextField.getText());
|
|
||||||
Config.get().setVpnGateway(vpnGateway);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
portTextField.setText(String.valueOf(vpnGateway.getPort()));
|
|
||||||
portTextField.textProperty().addListener(new ChangeListener<String>() {
|
|
||||||
@Override
|
|
||||||
public void changed(ObservableValue<? extends String> observable,
|
|
||||||
String oldValue, String newValue) {
|
|
||||||
if (!newValue.matches("\\d{0,4}")) {
|
|
||||||
portTextField.setText(newValue.replaceAll("[^\\d]", ""));
|
|
||||||
}
|
|
||||||
if (newValue.length() > 4) {
|
|
||||||
portTextField.setText(newValue.substring(0, 4));
|
|
||||||
}
|
|
||||||
vpnGateway.setPort(Integer.getInteger(portTextField.getText()));
|
|
||||||
Config.get().setVpnGateway(vpnGateway);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
protocolTextField.setText(vpnGateway.getProtocol());
|
|
||||||
protocolTextField.textProperty().addListener(new ChangeListener<String>() {
|
|
||||||
@Override
|
|
||||||
public void changed(ObservableValue<? extends String> observable,
|
|
||||||
String oldValue, String newValue) {
|
|
||||||
vpnGateway.setProtocol(protocolTextField.getText());
|
|
||||||
Config.get().setVpnGateway(vpnGateway);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
} catch(Exception e) {
|
} catch(Exception e) {
|
||||||
if(e != null) {}
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -21,39 +21,9 @@
|
||||||
</columnConstraints>
|
</columnConstraints>
|
||||||
<children>
|
<children>
|
||||||
|
|
||||||
<Label GridPane.rowIndex="0" GridPane.columnIndex="0">Node URL:</Label>
|
|
||||||
<Label GridPane.rowIndex="0" GridPane.columnIndex="1" fx:id="urlLabel" />
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="1" GridPane.columnIndex="0">Selected Wallet:</Label>
|
|
||||||
<Label GridPane.rowIndex="1" GridPane.columnIndex="1" fx:id="selectedWalletLabel" />
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="2" GridPane.columnIndex="0">Username:</Label>
|
|
||||||
<TextField prefWidth="50" maxWidth="100" GridPane.rowIndex="2" GridPane.columnIndex="1" fx:id="usernameTextField" />
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="3" GridPane.columnIndex="0">Password:</Label>
|
|
||||||
<PasswordField prefWidth="50" maxWidth="100" GridPane.rowIndex="3" GridPane.columnIndex="1" fx:id="passwordTextField" />
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="4" GridPane.columnIndex="0">Nostr Relay:</Label>
|
<Label GridPane.rowIndex="4" GridPane.columnIndex="0">Nostr Relay:</Label>
|
||||||
<TextField prefWidth="100" maxWidth="150" GridPane.rowIndex="4" GridPane.columnIndex="1" fx:id="nostrRelayTextField">wss://nostr.fmt.wiz.biz</TextField>
|
<TextField prefWidth="100" maxWidth="150" GridPane.rowIndex="4" GridPane.columnIndex="1" fx:id="nostrRelayTextField">wss://nostr.fmt.wiz.biz</TextField>
|
||||||
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="6" GridPane.columnIndex="0" styleClass="sub-title">VPN Gateway</Label>
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="7" GridPane.columnIndex="0">Host:</Label>
|
|
||||||
<TextField prefWidth="100" maxWidth="150" GridPane.rowIndex="7" GridPane.columnIndex="1" fx:id="hostTextField" />
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="8" GridPane.columnIndex="0">Location:</Label>
|
|
||||||
<TextField prefWidth="100" maxWidth="150" GridPane.rowIndex="8" GridPane.columnIndex="1" fx:id="locationTextField" />
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="11" GridPane.columnIndex="0">Protocol:</Label>
|
|
||||||
<TextField prefWidth="100" maxWidth="150" GridPane.rowIndex="11" GridPane.columnIndex="1" fx:id="protocolTextField" />
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="9" GridPane.columnIndex="0">IP Address:</Label>
|
|
||||||
<TextField prefWidth="100" maxWidth="150" GridPane.rowIndex="9" GridPane.columnIndex="1" fx:id="ipAddressTextField" />
|
|
||||||
|
|
||||||
<Label GridPane.rowIndex="10" GridPane.columnIndex="0">Port:</Label>
|
|
||||||
<TextField prefWidth="25" maxWidth="50" GridPane.rowIndex="10" GridPane.columnIndex="1" fx:id="portTextField" />
|
|
||||||
|
|
||||||
</children>
|
</children>
|
||||||
</GridPane>
|
</GridPane>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue