mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-09 09:57:35 +01:00
Show any valid address if webserver is enabled (even game servers)
Affects issues: - Fixed #3251
This commit is contained in:
parent
d6065f497b
commit
549a26bcc8
@ -105,7 +105,7 @@ public class Addresses {
|
||||
}
|
||||
|
||||
public Optional<String> getProxyServerAddress() {
|
||||
return dbSystem.getDatabase().query(ServerQueries.fetchProxyServers())
|
||||
return dbSystem.getDatabase().query(ServerQueries.fetchPlanServerInformationCollection())
|
||||
.stream()
|
||||
.map(Server::getWebAddress)
|
||||
.filter(this::isValidAddress)
|
||||
@ -113,7 +113,12 @@ public class Addresses {
|
||||
}
|
||||
|
||||
private boolean isValidAddress(String address) {
|
||||
return address != null && !address.isEmpty() && !"0.0.0.0".equals(address);
|
||||
return address != null
|
||||
&& !address.isEmpty()
|
||||
&& !"0.0.0.0".equals(address)
|
||||
&& !"https://www.example.address".equals(address)
|
||||
&& !"http://www.example.address".equals(address)
|
||||
&& !"http://localhost:0".equals(address);
|
||||
}
|
||||
|
||||
public Optional<String> getServerPropertyIP() {
|
||||
|
@ -90,7 +90,7 @@ public class ServerServerInfo extends ServerInfo {
|
||||
}
|
||||
|
||||
private void updateStorage() {
|
||||
String address = addresses.getAccessAddress().orElseGet(addresses::getFallbackLocalhostAddress);
|
||||
String address = getAddress();
|
||||
String name = config.get(PluginSettings.SERVER_NAME);
|
||||
|
||||
server.setName(name);
|
||||
@ -101,6 +101,11 @@ public class ServerServerInfo extends ServerInfo {
|
||||
fromFile.save(server);
|
||||
}
|
||||
|
||||
private String getAddress() {
|
||||
return addresses.getAccessAddress()
|
||||
.orElse(addresses.isWebserverEnabled() ? addresses.getFallbackLocalhostAddress() : null);
|
||||
}
|
||||
|
||||
private Server registerNew() {
|
||||
return registerNew(generateNewUUID());
|
||||
}
|
||||
@ -117,7 +122,7 @@ public class ServerServerInfo extends ServerInfo {
|
||||
}
|
||||
|
||||
private Server createServerObject(ServerUUID serverUUID) {
|
||||
String webAddress = addresses.getAccessAddress().orElseGet(addresses::getFallbackLocalhostAddress);
|
||||
String webAddress = getAddress();
|
||||
String name = config.get(PluginSettings.SERVER_NAME);
|
||||
return new Server(serverUUID, name, webAddress, currentVersion);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user