client: accept custom javconfig url
This commit is contained in:
@@ -139,6 +139,9 @@ public class RuneLite
|
||||
parser.accepts("debug", "Show extra debugging output");
|
||||
parser.accepts("safe-mode", "Disables external plugins and the GPU plugin");
|
||||
parser.accepts("insecure-skip-tls-verification", "Disables TLS verification");
|
||||
parser.accepts("jav_config", "jav_config url")
|
||||
.withRequiredArg()
|
||||
.defaultsTo(RuneLiteProperties.getJavConfig());
|
||||
|
||||
final ArgumentAcceptingOptionSpec<File> sessionfile = parser.accepts("sessionfile", "Use a specified session file")
|
||||
.withRequiredArg()
|
||||
@@ -204,7 +207,7 @@ public class RuneLite
|
||||
|
||||
try
|
||||
{
|
||||
final ClientLoader clientLoader = new ClientLoader(okHttpClient, options.valueOf(updateMode));
|
||||
final ClientLoader clientLoader = new ClientLoader(okHttpClient, options.valueOf(updateMode), (String) options.valueOf("jav_config"));
|
||||
|
||||
new Thread(() ->
|
||||
{
|
||||
|
||||
@@ -87,15 +87,17 @@ public class ClientLoader implements Supplier<Applet>
|
||||
private final ClientConfigLoader clientConfigLoader;
|
||||
private ClientUpdateCheckMode updateCheckMode;
|
||||
private final WorldSupplier worldSupplier;
|
||||
private final String javConfigUrl;
|
||||
|
||||
private Object client;
|
||||
|
||||
public ClientLoader(OkHttpClient okHttpClient, ClientUpdateCheckMode updateCheckMode)
|
||||
public ClientLoader(OkHttpClient okHttpClient, ClientUpdateCheckMode updateCheckMode, String javConfigUrl)
|
||||
{
|
||||
this.okHttpClient = okHttpClient;
|
||||
this.clientConfigLoader = new ClientConfigLoader(okHttpClient);
|
||||
this.updateCheckMode = updateCheckMode;
|
||||
this.worldSupplier = new WorldSupplier(okHttpClient);
|
||||
this.javConfigUrl = javConfigUrl;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -186,7 +188,7 @@ public class ClientLoader implements Supplier<Applet>
|
||||
|
||||
private RSConfig downloadConfig() throws IOException
|
||||
{
|
||||
HttpUrl url = HttpUrl.parse(RuneLiteProperties.getJavConfig());
|
||||
HttpUrl url = HttpUrl.parse(javConfigUrl);
|
||||
IOException err = null;
|
||||
for (int attempt = 0; attempt < NUM_ATTEMPTS; attempt++)
|
||||
{
|
||||
@@ -204,6 +206,12 @@ public class ClientLoader implements Supplier<Applet>
|
||||
catch (IOException e)
|
||||
{
|
||||
log.info("Failed to get jav_config from host \"{}\" ({})", url.host(), e.getMessage());
|
||||
|
||||
if (!javConfigUrl.equals(RuneLiteProperties.getJavConfig()))
|
||||
{
|
||||
throw e;
|
||||
}
|
||||
|
||||
String host = worldSupplier.get().getAddress();
|
||||
url = url.newBuilder().host(host).build();
|
||||
err = e;
|
||||
|
||||
Reference in New Issue
Block a user