Merge pull request #339 from runelite-extended/switchtooursession
Switch to our session endpoint
This commit is contained in:
@@ -48,6 +48,7 @@ public class RuneLiteAPI
|
|||||||
public static String userAgent;
|
public static String userAgent;
|
||||||
|
|
||||||
private static final String BASE = "https://api.runelite.net";
|
private static final String BASE = "https://api.runelite.net";
|
||||||
|
private static final String RLPLUS = "https://session.runelitepl.us";
|
||||||
private static final String WSBASE = "https://api.runelite.net/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();
|
||||||
@@ -100,6 +101,11 @@ public class RuneLiteAPI
|
|||||||
return HttpUrl.parse(BASE);
|
return HttpUrl.parse(BASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static HttpUrl getSessionBase()
|
||||||
|
{
|
||||||
|
return HttpUrl.parse(RLPLUS);
|
||||||
|
}
|
||||||
|
|
||||||
public static HttpUrl getApiBase()
|
public static HttpUrl getApiBase()
|
||||||
{
|
{
|
||||||
return HttpUrl.parse(BASE + "/runelite-" + getVersion());
|
return HttpUrl.parse(BASE + "/runelite-" + getVersion());
|
||||||
|
|||||||
@@ -39,13 +39,12 @@ class SessionClient
|
|||||||
{
|
{
|
||||||
UUID open() throws IOException
|
UUID open() throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneLiteAPI.getApiRoot().newBuilder()
|
HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder()
|
||||||
.addPathSegment("session")
|
.build();
|
||||||
.build();
|
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
@@ -62,15 +61,14 @@ class SessionClient
|
|||||||
|
|
||||||
void ping(UUID uuid) throws IOException
|
void ping(UUID uuid) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneLiteAPI.getApiRoot().newBuilder()
|
HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder()
|
||||||
.addPathSegment("session")
|
.addPathSegment("ping")
|
||||||
.addPathSegment("ping")
|
.addQueryParameter("session", uuid.toString())
|
||||||
.addQueryParameter("session", uuid.toString())
|
.build();
|
||||||
.build();
|
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||||
{
|
{
|
||||||
@@ -83,15 +81,14 @@ class SessionClient
|
|||||||
|
|
||||||
void delete(UUID uuid) throws IOException
|
void delete(UUID uuid) throws IOException
|
||||||
{
|
{
|
||||||
HttpUrl url = RuneLiteAPI.getApiRoot().newBuilder()
|
HttpUrl url = RuneLiteAPI.getSessionBase().newBuilder()
|
||||||
.addPathSegment("session")
|
.addQueryParameter("session", uuid.toString())
|
||||||
.addQueryParameter("session", uuid.toString())
|
.build();
|
||||||
.build();
|
|
||||||
|
|
||||||
Request request = new Request.Builder()
|
Request request = new Request.Builder()
|
||||||
.delete()
|
.delete()
|
||||||
.url(url)
|
.url(url)
|
||||||
.build();
|
.build();
|
||||||
|
|
||||||
RuneLiteAPI.CLIENT.newCall(request).execute().close();
|
RuneLiteAPI.CLIENT.newCall(request).execute().close();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user