Use our own http-service / http-api
Also starts scraping xtea keys :)
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
package net.runelite.http.api;
|
||||
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Properties;
|
||||
@@ -44,12 +45,12 @@ public class RuneLiteAPI
|
||||
public static final String RUNELITE_AUTH = "RUNELITE-AUTH";
|
||||
|
||||
public static final OkHttpClient CLIENT;
|
||||
public static final Gson GSON = new Gson();
|
||||
public static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
|
||||
public static String userAgent;
|
||||
|
||||
private static final String BASE = "https://api.runelite.net";
|
||||
private static final String BASE = "https://api.runelitepl.us";
|
||||
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.runelitepl.us/ws";
|
||||
private static final String STATICBASE = "https://static.runelite.net";
|
||||
private static final Properties properties = new Properties();
|
||||
private static String version;
|
||||
|
||||
@@ -62,6 +62,17 @@ public class XteaClient
|
||||
.url(url)
|
||||
.build();
|
||||
|
||||
try
|
||||
{
|
||||
try (Response response = RuneLiteAPI.CLIENT.newCall(request).execute())
|
||||
{
|
||||
logger.debug("xtea response "+response.code());
|
||||
}
|
||||
}
|
||||
catch (IOException e)
|
||||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
RuneLiteAPI.CLIENT.newCall(request).enqueue(new Callback()
|
||||
{
|
||||
@Override
|
||||
|
||||
@@ -31,6 +31,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import net.runelite.api.Client;
|
||||
import net.runelite.api.GameState;
|
||||
import net.runelite.api.events.GameStateChanged;
|
||||
import net.runelite.api.events.GameTick;
|
||||
import net.runelite.client.eventbus.Subscribe;
|
||||
import net.runelite.client.plugins.Plugin;
|
||||
import net.runelite.client.plugins.PluginDescriptor;
|
||||
@@ -48,17 +49,20 @@ public class XteaPlugin extends Plugin
|
||||
private final XteaClient xteaClient = new XteaClient();
|
||||
|
||||
private final Set<Integer> sentRegions = new HashSet<>();
|
||||
private int[][] xteaKeys;
|
||||
|
||||
@Inject
|
||||
private Client client;
|
||||
|
||||
@Subscribe
|
||||
public void onGameStateChanged(GameStateChanged gameStateChanged)
|
||||
public void onGameTick(GameTick gameTick)
|
||||
{
|
||||
if (gameStateChanged.getGameState() != GameState.LOGGED_IN)
|
||||
// Only send when keys are updated
|
||||
if (xteaKeys == client.getXteaKeys())
|
||||
{
|
||||
return;
|
||||
}
|
||||
xteaKeys = client.getXteaKeys();
|
||||
|
||||
int revision = client.getRevision();
|
||||
int[] regions = client.getMapRegions();
|
||||
|
||||
Reference in New Issue
Block a user