Fix API
yeah yeah yeah
This commit is contained in:
@@ -45,12 +45,14 @@ public class RuneLiteAPI
|
|||||||
public static final String RUNELITE_AUTH = "RUNELITE-AUTH";
|
public static final String RUNELITE_AUTH = "RUNELITE-AUTH";
|
||||||
|
|
||||||
public static final OkHttpClient CLIENT;
|
public static final OkHttpClient CLIENT;
|
||||||
|
public static final OkHttpClient RLP_CLIENT;
|
||||||
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||||
public static String userAgent;
|
public static String userAgent;
|
||||||
|
|
||||||
private static final String BASE = "https://api.runelitepl.us";
|
private static final String BASE = "https://api.runelite.net";
|
||||||
|
private static final String PLUS_BASE = "https://api.runelitepl.us";
|
||||||
private static final String RLPLUS = "https://session.runelitepl.us";
|
private static final String RLPLUS = "https://session.runelitepl.us";
|
||||||
private static final String WSBASE = "https://api.runelitepl.us/ws";
|
private static final String WSBASE = "https://api.runelite.net/ws";
|
||||||
private static final String STATICBASE = "https://static.runelite.net";
|
private static final String STATICBASE = "https://static.runelite.net";
|
||||||
private static final Properties properties = new Properties();
|
private static final Properties properties = new Properties();
|
||||||
private static String version;
|
private static String version;
|
||||||
@@ -95,6 +97,24 @@ public class RuneLiteAPI
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
|
|
||||||
|
RLP_CLIENT= new OkHttpClient.Builder()
|
||||||
|
.pingInterval(30, TimeUnit.SECONDS)
|
||||||
|
.addNetworkInterceptor(new Interceptor()
|
||||||
|
{
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Response intercept(Chain chain) throws IOException
|
||||||
|
{
|
||||||
|
Request userAgentRequest = chain.request()
|
||||||
|
.newBuilder()
|
||||||
|
.header("User-Agent", userAgent)
|
||||||
|
.build();
|
||||||
|
return chain.proceed(userAgentRequest);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static HttpUrl getSessionBase()
|
public static HttpUrl getSessionBase()
|
||||||
@@ -126,6 +146,11 @@ public class RuneLiteAPI
|
|||||||
return HttpUrl.parse(BASE + "/runelite-" + getVersion());
|
return HttpUrl.parse(BASE + "/runelite-" + getVersion());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HttpUrl getPlusApiBase()
|
||||||
|
{
|
||||||
|
return HttpUrl.parse(PLUS_BASE + "/runelite-" + getVersion());
|
||||||
|
}
|
||||||
|
|
||||||
public static HttpUrl getStaticBase()
|
public static HttpUrl getStaticBase()
|
||||||
{
|
{
|
||||||
final String prop = System.getProperty("runelite.static.url");
|
final String prop = System.getProperty("runelite.static.url");
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ public class XteaClient
|
|||||||
{
|
{
|
||||||
String json = RuneLiteAPI.GSON.toJson(xteaRequest);
|
String json = RuneLiteAPI.GSON.toJson(xteaRequest);
|
||||||
|
|
||||||
HttpUrl url = RuneLiteAPI.getApiBase().newBuilder()
|
HttpUrl url = RuneLiteAPI.getPlusApiBase().newBuilder()
|
||||||
.addPathSegment("xtea")
|
.addPathSegment("xtea")
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
@@ -64,9 +64,9 @@ public class XteaClient
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.RLP_CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
logger.debug("xtea response " + response.code());
|
logger.info("xtea response " + response.code());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (IOException e)
|
catch (IOException e)
|
||||||
@@ -74,7 +74,7 @@ public class XteaClient
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback()
|
RuneLiteAPI.RLP_CLIENT.newCall(request).enqueue(new Callback()
|
||||||
{
|
{
|
||||||
@Override
|
@Override
|
||||||
public void onFailure(Call call, IOException e)
|
public void onFailure(Call call, IOException e)
|
||||||
|
|||||||
Reference in New Issue
Block a user