connection: disabled outdated proxy settings (#13323)

This commit is contained in:
Oleg Agafonov 2025-02-09 19:51:10 +04:00
parent 19269b22b0
commit 62ba9f02ba
5 changed files with 40 additions and 19 deletions

View file

@ -949,11 +949,15 @@ public class MageFrame extends javax.swing.JFrame implements MageClient {
} catch (SocketException ex) { } catch (SocketException ex) {
} }
currentConnection.setUserIdStr(System.getProperty("user.name") + ":" + System.getProperty("os.name") + ":" + MagePreferences.getUserNames() + ":" + allMAC); currentConnection.setUserIdStr(System.getProperty("user.name") + ":" + System.getProperty("os.name") + ":" + MagePreferences.getUserNames() + ":" + allMAC);
if (PreferencesDialog.NETWORK_ENABLE_PROXY_SUPPORT) {
currentConnection.setProxyType(proxyType); currentConnection.setProxyType(proxyType);
currentConnection.setProxyHost(proxyServer); currentConnection.setProxyHost(proxyServer);
currentConnection.setProxyPort(proxyPort); currentConnection.setProxyPort(proxyPort);
currentConnection.setProxyUsername(proxyUsername); currentConnection.setProxyUsername(proxyUsername);
currentConnection.setProxyPassword(proxyPassword); currentConnection.setProxyPassword(proxyPassword);
} else {
currentConnection.setProxyType(ProxyType.NONE);
}
setUserPrefsToConnection(currentConnection); setUserPrefsToConnection(currentConnection);
} }

View file

@ -3170,7 +3170,7 @@
<Properties> <Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor"> <Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo"> <Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Proxy for server connection and images download"> <TitledBorder title="Proxy for server connection and images download (DO NOT SUPPORTED)">
<Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo"> <Border PropertyName="innerBorder" info="org.netbeans.modules.form.compat2.border.EtchedBorderInfo">
<EtchetBorder/> <EtchetBorder/>
</Border> </Border>

View file

@ -55,6 +55,8 @@ public class PreferencesDialog extends javax.swing.JDialog {
private static PreferencesDialog instance; // shared dialog instance private static PreferencesDialog instance; // shared dialog instance
public static final boolean NETWORK_ENABLE_PROXY_SUPPORT = false; // TODO: delete proxy at all after few releases, 2025-02-09
// WARNING, do not change const values - it must be same for compatibility with user's saved settings // WARNING, do not change const values - it must be same for compatibility with user's saved settings
public static final String KEY_SHOW_TOOLTIPS_DELAY = "showTooltipsDelay"; public static final String KEY_SHOW_TOOLTIPS_DELAY = "showTooltipsDelay";
public static final String KEY_SHOW_CARD_NAMES = "showCardNames"; public static final String KEY_SHOW_CARD_NAMES = "showCardNames";
@ -2795,7 +2797,7 @@ public class PreferencesDialog extends javax.swing.JDialog {
tabsPanel.addTab("Sounds", tabSounds); tabsPanel.addTab("Sounds", tabSounds);
connection_Proxy.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Proxy for server connection and images download")); connection_Proxy.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createEtchedBorder(), "Proxy for server connection and images download (DO NOT SUPPORTED)"));
cbProxyType.addActionListener(new java.awt.event.ActionListener() { cbProxyType.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) { public void actionPerformed(java.awt.event.ActionEvent evt) {
@ -3317,6 +3319,11 @@ public class PreferencesDialog extends javax.swing.JDialog {
return; return;
} }
if (!NETWORK_ENABLE_PROXY_SUPPORT) {
connection.setProxyType(ProxyType.NONE);
return;
}
connection.setProxyType(configProxyType); connection.setProxyType(configProxyType);
if (configProxyType != ProxyType.NONE) { if (configProxyType != ProxyType.NONE) {
String host = getCachedValue(KEY_PROXY_ADDRESS, ""); String host = getCachedValue(KEY_PROXY_ADDRESS, "");

View file

@ -365,6 +365,8 @@ public class ConnectDialog extends JDialog {
connection.setPort(Integer.parseInt(this.txtPort.getText())); connection.setPort(Integer.parseInt(this.txtPort.getText()));
connection.setAdminPassword(new String(txtPassword.getPassword())); connection.setAdminPassword(new String(txtPassword.getPassword()));
connection.setUsername(SessionImpl.ADMIN_NAME); connection.setUsername(SessionImpl.ADMIN_NAME);
if (false) { // TODO: delete proxy at all after few releases, 2025-02-09
connection.setProxyType((ProxyType) this.cbProxyType.getSelectedItem()); connection.setProxyType((ProxyType) this.cbProxyType.getSelectedItem());
if (!this.cbProxyType.getSelectedItem().equals(ProxyType.NONE)) { if (!this.cbProxyType.getSelectedItem().equals(ProxyType.NONE)) {
connection.setProxyHost(this.txtProxyServer.getText()); connection.setProxyHost(this.txtProxyServer.getText());
@ -372,6 +374,9 @@ public class ConnectDialog extends JDialog {
connection.setProxyUsername(this.txtProxyUserName.getText()); connection.setProxyUsername(this.txtProxyUserName.getText());
connection.setProxyPassword(new String(this.txtPasswordField.getPassword())); connection.setProxyPassword(new String(this.txtPasswordField.getPassword()));
} }
} else {
connection.setProxyType(ProxyType.NONE);
}
logger.debug("connecting: " + connection.getProxyType() + ' ' + connection.getProxyHost() + ' ' + connection.getProxyPort()); logger.debug("connecting: " + connection.getProxyType() + ' ' + connection.getProxyHost() + ' ' + connection.getProxyPort());
task = new ConnectTask(); task = new ConnectTask();

View file

@ -101,6 +101,7 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
newConnection.setPort(ConsoleFrame.getPreferences().getInt("serverPort", 17171)); newConnection.setPort(ConsoleFrame.getPreferences().getInt("serverPort", 17171));
newConnection.setUsername(SessionImpl.ADMIN_NAME); newConnection.setUsername(SessionImpl.ADMIN_NAME);
newConnection.setAdminPassword(ConsoleFrame.getPreferences().get("password", "")); newConnection.setAdminPassword(ConsoleFrame.getPreferences().get("password", ""));
if (false) { // TODO: delete proxy at all after few releases, 2025-02-09
newConnection.setProxyType(Connection.ProxyType.valueOf(ConsoleFrame.getPreferences().get("proxyType", "NONE").toUpperCase(Locale.ENGLISH))); newConnection.setProxyType(Connection.ProxyType.valueOf(ConsoleFrame.getPreferences().get("proxyType", "NONE").toUpperCase(Locale.ENGLISH)));
if (!newConnection.getProxyType().equals(Connection.ProxyType.NONE)) { if (!newConnection.getProxyType().equals(Connection.ProxyType.NONE)) {
newConnection.setProxyHost(ConsoleFrame.getPreferences().get("proxyAddress", "")); newConnection.setProxyHost(ConsoleFrame.getPreferences().get("proxyAddress", ""));
@ -108,6 +109,10 @@ public class ConsoleFrame extends javax.swing.JFrame implements MageClient {
newConnection.setProxyUsername(ConsoleFrame.getPreferences().get("proxyUsername", "")); newConnection.setProxyUsername(ConsoleFrame.getPreferences().get("proxyUsername", ""));
newConnection.setProxyPassword(ConsoleFrame.getPreferences().get("proxyPassword", "")); newConnection.setProxyPassword(ConsoleFrame.getPreferences().get("proxyPassword", ""));
} }
} else {
newConnection.setProxyType(Connection.ProxyType.NONE);
}
status = connect(newConnection); status = connect(newConnection);
} }
return status; return status;