misc fixes

This commit is contained in:
LAX1DUDE 2022-08-27 15:20:27 -07:00
parent 9d85ac9a68
commit 7a732a3657
23 changed files with 47673 additions and 66863 deletions

View File

@ -290,12 +290,15 @@ public class BungeeCord extends ProxyServer {
for (final ListenerInfo info : this.config.getListeners()) {
InetSocketAddress sock = info.getHost();
if(info.isWebsocket()) {
try {
ServerSocket s = new ServerSocket(0, 0, InetAddress.getByName("127.11.0.1"));
sock = new InetSocketAddress("127.11.0.1", s.getLocalPort());
s.close();
} catch(IOException e) {
sock = new InetSocketAddress("127.11.0.1",(int) (System.nanoTime() % 64000L + 1025L));
sock = info.getJavaHost();
if(sock == null) {
try {
ServerSocket s = new ServerSocket(0, 0, InetAddress.getByName("127.11.0.1"));
sock = new InetSocketAddress("127.11.0.1", s.getLocalPort());
s.close();
} catch(IOException e) {
sock = new InetSocketAddress("127.11.0.1",(int) (System.nanoTime() % 64000L + 1025L));
}
}
try {
this.wsListeners.add(new WebSocketListener(info, sock, this));

View File

@ -15,6 +15,7 @@ import net.md_5.bungee.eaglercraft.WebSocketRateLimiter;
public class ListenerInfo {
private final String hostString;
private final InetSocketAddress host;
private final InetSocketAddress javaHost;
private final String motd;
private final int maxPlayers;
private final int tabListSize;
@ -23,6 +24,7 @@ public class ListenerInfo {
private final boolean forceDefault;
private final boolean websocket;
private final boolean forwardIp;
private final String forwardIpHeader;
private final Map<String, String> forcedHosts;
private final TexturePackInfo texturePack;
private final Class<? extends TabListHandler> tabList;
@ -39,11 +41,17 @@ public class ListenerInfo {
private final WebSocketRateLimiter rateLimitQuery;
public ListenerInfo(final String hostString, final InetSocketAddress host, final String motd, final int maxPlayers, final int tabListSize, final String defaultServer, final String fallbackServer, final boolean forceDefault, final boolean websocket,
final boolean forwardIp, final Map<String, String> forcedHosts, final TexturePackInfo texturePack, final Class<? extends TabListHandler> tabList, final String serverIcon, final MOTDCacheConfiguration cacheConfig,
final boolean allowMOTD, final boolean allowQuery, final WebSocketRateLimiter rateLimitIP, final WebSocketRateLimiter rateLimitLogin, final WebSocketRateLimiter rateLimitMOTD, final WebSocketRateLimiter rateLimitQuery) {
public ListenerInfo(final String hostString, final InetSocketAddress host, final InetSocketAddress javaHost,
final String forwardIpHeader, final String motd, final int maxPlayers, final int tabListSize,
final String defaultServer, final String fallbackServer, final boolean forceDefault,
final boolean websocket, final boolean forwardIp, final Map<String, String> forcedHosts,
final TexturePackInfo texturePack, final Class<? extends TabListHandler> tabList, final String serverIcon,
final MOTDCacheConfiguration cacheConfig, final boolean allowMOTD, final boolean allowQuery,
final WebSocketRateLimiter rateLimitIP, final WebSocketRateLimiter rateLimitLogin,
final WebSocketRateLimiter rateLimitMOTD, final WebSocketRateLimiter rateLimitQuery) {
this.hostString = hostString;
this.host = host;
this.javaHost = javaHost;
this.motd = motd;
this.maxPlayers = maxPlayers;
this.tabListSize = tabListSize;
@ -52,6 +60,7 @@ public class ListenerInfo {
this.forceDefault = forceDefault;
this.websocket = websocket;
this.forwardIp = forwardIp;
this.forwardIpHeader = forwardIpHeader;
this.forcedHosts = forcedHosts;
this.texturePack = texturePack;
this.tabList = tabList;
@ -76,6 +85,10 @@ public class ListenerInfo {
return this.host;
}
public InetSocketAddress getJavaHost() {
return this.javaHost;
}
public String getMotd() {
return this.motd;
}
@ -273,6 +286,10 @@ public class ListenerInfo {
return forwardIp;
}
public String getForwardedIPHeader() {
return forwardIpHeader;
}
public String getServerIcon() {
return serverIcon;
}

View File

@ -173,9 +173,12 @@ public class YamlConfig implements ConfigurationAdapter {
final boolean forceDefault = this.get("force_default_server", true, val);
final boolean websocket = this.get("websocket", true, val);
final boolean forwardIp = this.get("forward_ip", false, val);
final String forwardIpHeader = this.get("forward_ip_header", "X-Real-IP", val);
final String host = this.get("host", "0.0.0.0:25565", val);
final String javaHost = this.get("java_host", "null", val);
final int tabListSize = this.get("tab_size", 60, val);
final InetSocketAddress address = Util.getAddr(host);
final InetSocketAddress javaAddress = (javaHost.equalsIgnoreCase("null") || javaHost == null) ? null : Util.getAddr(javaHost);
final Map<String, String> forced = (Map<String, String>) new CaseInsensitiveMap(this.get("forced_hosts", forcedDef, val));
final String textureURL = this.get("texture_url", (String) null, val);
final int textureSize = this.get("texture_size", 16, val);
@ -238,8 +241,9 @@ public class YamlConfig implements ConfigurationAdapter {
if (value == null) {
value = DefaultTabList.GLOBAL_PING;
}
ret.add(new ListenerInfo(host, address, motd, maxPlayers, tabListSize, defaultServer, fallbackServer, forceDefault, websocket, forwardIp,
forced, texture, value.clazz, serverIcon, cacheConfig, allowMOTD, allowQuery, ratelimitIP, ratelimitLogin, ratelimitMOTD, ratelimitQuery));
ret.add(new ListenerInfo(host, address, javaAddress, forwardIpHeader, motd, maxPlayers, tabListSize, defaultServer,
fallbackServer, forceDefault, websocket, forwardIp, forced, texture, value.clazz, serverIcon, cacheConfig,
allowMOTD, allowQuery, ratelimitIP, ratelimitLogin, ratelimitMOTD, ratelimitQuery));
}
return ret;
}

View File

@ -244,12 +244,12 @@ public class WebSocketListener extends WebSocketServer {
}
InetAddress addr;
if(info.hasForwardedHeaders()) {
String s = arg1.getFieldValue("X-Real-IP");
String s = arg1.getFieldValue(info.getForwardedIPHeader());
if(s != null) {
try {
addr = InetAddress.getByName(s);
}catch(UnknownHostException e) {
System.out.println("invalid 'X-Real-IP' header - " + e.toString());
System.out.println("invalid '" + info.getForwardedIPHeader() + "' header - " + e.toString());
arg0.close();
return;
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -12,11 +12,18 @@ alert("You're not supposed to 'open' this file in your browser. Please upload th
window.addEventListener("load", function(){
window.eaglercraftOpts = {
container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: "worker_bootstrap.js", worldsFolder: "TEST",
servers: [ { serverName: "Local Test Server", serverAddress: "localhost:25565", hideAddress: false } ],
servers: [
{ serverName: "Local Test Server", serverAddress: "localhost:25565", hideAddress: false }
],
relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: true },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2" },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1" }
],
mainMenu: { splashes: [
"Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee",
"EEEEEEEEE!", "You Darvig!", "You Vigg!", ":>", "|>", "You Yumpster!"
]}};
], eaglerLogo: false }};
(function(){
var q = window.location.search;
if(typeof q === 'string' && q.startsWith("?")) {

Binary file not shown.

Binary file not shown.

View File

@ -6,7 +6,7 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w35a";
public static final String version = "22w34a";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/lax1dude/eaglercraft";

View File

@ -1,11 +1,10 @@
package net.lax1dude.eaglercraft;
public class License {
public class GuiScreenChangeWorldTimeout {
/*
* This is the text on the 'License Agreement' screen
* It is encoded to stop people from easily modifying it
* in classes.js via find/replace in a text editor
* 'license' screen text, this is encoded to stop skids from
* easily modifying it via find/replace in a text editor
*/
static final byte[] line00 = new byte[] {

View File

@ -19,8 +19,8 @@ public class GuiScreenLicense extends GuiScreen {
if(beginOffset < 5) {
beginOffset = 5;
}
this.buttonList.add(new GuiButton(1, this.width / 2 - 120, beginOffset + 180, 115, 20, new String(License.line61)));
this.buttonList.add(acceptButton = new GuiButton(2, this.width / 2 + 5, beginOffset + 180, 115, 20, new String(License.line60)));
this.buttonList.add(new GuiButton(1, this.width / 2 - 120, beginOffset + 180, 115, 20, new String(GuiScreenChangeWorldTimeout.line61)));
this.buttonList.add(acceptButton = new GuiButton(2, this.width / 2 + 5, beginOffset + 180, 115, 20, new String(GuiScreenChangeWorldTimeout.line60)));
acceptButton.enabled = false;
}
@ -43,24 +43,24 @@ public class GuiScreenLicense extends GuiScreen {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glScalef(1.33f, 1.33f, 1.33f);
drawCenteredString(fontRenderer, new String(License.line00), width * 3 / 8, beginOffset * 3 / 4, 0xDDDD55);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line00), width * 3 / 8, beginOffset * 3 / 4, 0xDDDD55);
EaglerAdapter.glPopMatrix();
drawCenteredString(fontRenderer, new String(License.line10), width / 2, beginOffset + 22, 0xFF7777);
drawCenteredString(fontRenderer, new String(License.line11), width / 2, beginOffset + 33, 0xFF7777);
drawCenteredString(fontRenderer, new String(License.line12), width / 2, beginOffset + 44, 0xFF7777);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line10), width / 2, beginOffset + 22, 0xFF7777);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line11), width / 2, beginOffset + 33, 0xFF7777);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line12), width / 2, beginOffset + 44, 0xFF7777);
drawCenteredString(fontRenderer, new String(License.line20), width / 2, beginOffset + 62, 0x448844);
drawCenteredString(fontRenderer, new String(License.line21), width / 2, beginOffset + 71, 0x448844);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line20), width / 2, beginOffset + 62, 0x448844);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line21), width / 2, beginOffset + 71, 0x448844);
EaglerAdapter.glPushMatrix();
EaglerAdapter.glScalef(0.75f, 0.75f, 0.75f);
drawCenteredString(fontRenderer, new String(License.line30), width * 4 / 6, (beginOffset + 89) * 4 / 3, 0x666666);
drawCenteredString(fontRenderer, new String(License.line31), width * 4 / 6, (beginOffset + 97) * 4 / 3, 0x999999);
drawCenteredString(fontRenderer, new String(License.line32), width * 4 / 6, (beginOffset + 105) * 4 / 3, 0x999999);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line30), width * 4 / 6, (beginOffset + 89) * 4 / 3, 0x666666);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line31), width * 4 / 6, (beginOffset + 97) * 4 / 3, 0x999999);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line32), width * 4 / 6, (beginOffset + 105) * 4 / 3, 0x999999);
EaglerAdapter.glPopMatrix();
drawCenteredString(fontRenderer, new String(License.line40), width / 2, beginOffset + 120, 0xFF7777);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line40), width / 2, beginOffset + 120, 0xFF7777);
boolean mouseOverCheck = width / 2 - 100 < mx && width / 2 - 83 > mx && beginOffset + 142 < my && beginOffset + 159 > my;
@ -87,7 +87,7 @@ public class GuiScreenLicense extends GuiScreen {
EaglerAdapter.glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
drawString(fontRenderer, new String(License.line50), width / 2 - 75, beginOffset + 147, 0xEEEEEE);
drawString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line50), width / 2 - 75, beginOffset + 147, 0xEEEEEE);
}
protected void mouseClicked(int par1, int par2, int par3) {

View File

@ -6,8 +6,8 @@ public class GuiScreenLicenseDeclined extends GuiScreen {
public void drawScreen(int mx, int my, float par3) {
this.drawDefaultBackground();
drawCenteredString(fontRenderer, new String(License.line70), width / 2, height / 3 - 10, 0xFFFFFF);
drawCenteredString(fontRenderer, new String(License.line71), width / 2, height / 3 + 18, 0xFF7777);
drawCenteredString(fontRenderer, new String(License.line72), width / 2, height / 3 + 35, 0x666666);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line70), width / 2, height / 3 - 10, 0xFFFFFF);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line71), width / 2, height / 3 + 18, 0xFF7777);
drawCenteredString(fontRenderer, new String(GuiScreenChangeWorldTimeout.line72), width / 2, height / 3 + 35, 0x666666);
}
}

View File

@ -67,7 +67,14 @@ public class ServerList {
tag.setBoolean("default", true);
forcedServers.add(ServerData.getServerDataFromNBTCompound(tag));
}
// NOTE: Change these asap if one goes down or is replaced, they are used by replits
ConfigConstants.relays = new ArrayList();
ConfigConstants.relays.add(new RelayEntry("wss://relay.deev.is/", "lax1dude relay #1", true));
ConfigConstants.relays.add(new RelayEntry("wss://relay.lax1dude.net/", "lax1dude relay #2", false));
ConfigConstants.relays.add(new RelayEntry("wss://relay.shhnowisnottheti.me/", "ayunami relay #1", false));
} catch (IOException e) {
e.printStackTrace();
}

View File

@ -366,9 +366,11 @@ public class EaglerAdapterImpl2 {
voiceClient = startVoiceClient();
rtcLANClient = startRTCLANClient();
if(integratedServerScript != null) {
//todo: safely skip startRTCLANServer() if the integrated server is disabled:
//if(integratedServerScript != null) {
rtcLANServer = startRTCLANServer();
}
//}
downloadAssetPack(assetPackageURI);

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -22,7 +22,14 @@ alert("You cannot 'open' this file in your browser, the code doesn't work. Uploa
window.addEventListener("load", function(){
window.eaglercraftOpts = {
container: "game_frame", assetsURI: "assets.epk", serverWorkerURI: "worker_bootstrap.js", worldsFolder: "MAIN",
servers: [ { serverName: "placeholder", serverAddress: "address here", hideAddress: false } ],
servers: [
{ serverName: "placeholder", serverAddress: "address here", hideAddress: false }
],
relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: true },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2" },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1" }
],
mainMenu: { splashes: [
"Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee",
"EEEEEEEEE!", "You Darvig!", "You Vigg!", ":>", "|>", "You Yumpster!"

View File

@ -113,7 +113,10 @@ window.addEventListener("load", function() {
"Darviglet!", "eaglerenophile!", "You Eagler!", "Yeeeeeee!", "yeee",
"EEEEEEEEE!", "You Darvig!", "You Vigg!", ":>", "|>", "You Yumpster!"
]}, worldsFolder: "OFFLINE", serverListTitle: "Ayonull hosts a list of servers:",
serverListLink: "https://eagler.nully.tech/servers"
serverListLink: "https://eagler.nully.tech/servers", relays: [
{ addr: "wss://relay.deev.is/", name: "lax1dude relay #1", primary: true },
{ addr: "wss://relay.lax1dude.net/", name: "lax1dude relay #2" },
{ addr: "wss://relay.shhnowisnottheti.me/", name: "ayunami relay #1" } ]
};
main();
}, 6000);