Updated to latest Protocol Version
This commit is contained in:
@@ -3,7 +3,7 @@
|
|||||||
<modelVersion>4.0.0</modelVersion>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<groupId>org.openautonomousconnection</groupId>
|
<groupId>org.openautonomousconnection</groupId>
|
||||||
<artifactId>WebClient</artifactId>
|
<artifactId>WebClient</artifactId>
|
||||||
<version>1.0.0-BETA.1.0</version>
|
<version>1.0.1-BETA.0.1</version>
|
||||||
<description>The default WebClient</description>
|
<description>The default WebClient</description>
|
||||||
<url>https://open-autonomous-connection.org/</url>
|
<url>https://open-autonomous-connection.org/</url>
|
||||||
<issueManagement>
|
<issueManagement>
|
||||||
@@ -67,6 +67,13 @@
|
|||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.13.0</version>
|
<version>3.13.0</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
|
<annotationProcessorPaths>
|
||||||
|
<path>
|
||||||
|
<groupId>org.projectlombok</groupId>
|
||||||
|
<artifactId>lombok</artifactId>
|
||||||
|
<version>1.18.42</version>
|
||||||
|
</path>
|
||||||
|
</annotationProcessorPaths>
|
||||||
<compilerArgs>
|
<compilerArgs>
|
||||||
<arg>--add-exports</arg>
|
<arg>--add-exports</arg>
|
||||||
<arg>java.base/sun.security.x509=ALL-UNNAMED</arg>
|
<arg>java.base/sun.security.x509=ALL-UNNAMED</arg>
|
||||||
@@ -109,13 +116,13 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
<artifactId>lombok</artifactId>
|
<artifactId>lombok</artifactId>
|
||||||
<version>1.18.38</version>
|
<version>1.18.42</version>
|
||||||
<scope>provided</scope>
|
<scope>provided</scope>
|
||||||
</dependency>
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
<properties>
|
<properties>
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<maven.compiler.target>23</maven.compiler.target>
|
<maven.compiler.target>25</maven.compiler.target>
|
||||||
<maven.compiler.source>23</maven.compiler.source>
|
<maven.compiler.source>25</maven.compiler.source>
|
||||||
</properties>
|
</properties>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
6
pom.xml
6
pom.xml
@@ -6,7 +6,7 @@
|
|||||||
|
|
||||||
<groupId>org.openautonomousconnection</groupId>
|
<groupId>org.openautonomousconnection</groupId>
|
||||||
<artifactId>WebClient</artifactId>
|
<artifactId>WebClient</artifactId>
|
||||||
<version>1.0.0-BETA.1.0</version>
|
<version>1.0.1-BETA.0.2</version>
|
||||||
<organization>
|
<organization>
|
||||||
<name>Open Autonomous Connection</name>
|
<name>Open Autonomous Connection</name>
|
||||||
<url>https://open-autonomous-connection.org/</url>
|
<url>https://open-autonomous-connection.org/</url>
|
||||||
@@ -74,12 +74,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openautonomousconnection</groupId>
|
<groupId>org.openautonomousconnection</groupId>
|
||||||
<artifactId>LuaScript</artifactId>
|
<artifactId>LuaScript</artifactId>
|
||||||
<version>1.0.0-BETA.1.1</version>
|
<version>1.0.0-BETA.1.3</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.openautonomousconnection</groupId>
|
<groupId>org.openautonomousconnection</groupId>
|
||||||
<artifactId>Protocol</artifactId>
|
<artifactId>Protocol</artifactId>
|
||||||
<version>1.0.1-BETA.0.3</version>
|
<version>1.0.1-BETA.0.5</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.projectlombok</groupId>
|
<groupId>org.projectlombok</groupId>
|
||||||
|
|||||||
@@ -1,9 +1,14 @@
|
|||||||
package org.openautonomousconnection.webclient;
|
package org.openautonomousconnection.webclient;
|
||||||
|
|
||||||
import dev.unlegitdqrk.unlegitlibrary.event.Listener;
|
import dev.unlegitdqrk.unlegitlibrary.event.Listener;
|
||||||
|
import dev.unlegitdqrk.unlegitlibrary.network.system.client.events.packets.C_PacketReadEvent;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import org.openautonomousconnection.oacswing.component.OACOptionPane;
|
import org.openautonomousconnection.oacswing.component.OACOptionPane;
|
||||||
|
import org.openautonomousconnection.protocol.packets.v1_0_1.beta.web.WebPacket;
|
||||||
|
import org.openautonomousconnection.protocol.packets.v1_0_1.beta.web.impl.navigate.WebNavigateAckPacket;
|
||||||
|
import org.openautonomousconnection.protocol.packets.v1_0_1.beta.web.impl.resource.WebResourceResponsePacket;
|
||||||
import org.openautonomousconnection.protocol.side.client.ProtocolClient;
|
import org.openautonomousconnection.protocol.side.client.ProtocolClient;
|
||||||
|
import org.openautonomousconnection.protocol.side.client.ProtocolWebClient;
|
||||||
import org.openautonomousconnection.protocol.side.client.events.ConnectedToProtocolINSServerEvent;
|
import org.openautonomousconnection.protocol.side.client.events.ConnectedToProtocolINSServerEvent;
|
||||||
import org.openautonomousconnection.protocol.urlhandler.v1_0_1.beta.LibClientImpl_v1_0_1_B;
|
import org.openautonomousconnection.protocol.urlhandler.v1_0_1.beta.LibClientImpl_v1_0_1_B;
|
||||||
import org.openautonomousconnection.protocol.urlhandler.v1_0_1.beta.web.WebFlagInspector;
|
import org.openautonomousconnection.protocol.urlhandler.v1_0_1.beta.web.WebFlagInspector;
|
||||||
@@ -14,6 +19,7 @@ import org.openautonomousconnection.webclient.ui.BrowserTab;
|
|||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
import java.nio.charset.StandardCharsets;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.concurrent.ConcurrentHashMap;
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
@@ -25,7 +31,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
|||||||
* <p>Implements full stream assembly with strict correlation via:
|
* <p>Implements full stream assembly with strict correlation via:
|
||||||
* requestId + tabId + pageId + frameId.</p>
|
* requestId + tabId + pageId + frameId.</p>
|
||||||
*/
|
*/
|
||||||
public final class ClientImpl extends ProtocolClient {
|
public final class ClientImpl extends ProtocolWebClient {
|
||||||
|
|
||||||
private static final long MAX_STREAM_BYTES = 64L * 1024L * 1024L; // 64MB safety cap
|
private static final long MAX_STREAM_BYTES = 64L * 1024L * 1024L; // 64MB safety cap
|
||||||
private static final int MAX_CONCURRENT_STREAMS = 256;
|
private static final int MAX_CONCURRENT_STREAMS = 256;
|
||||||
@@ -159,7 +165,7 @@ public final class ClientImpl extends ProtocolClient {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void serverConnectionFailed(Exception exception) {
|
public void serverConnectionFailed(Exception exception) {
|
||||||
getProtocolBridge().getLogger().exception("Failed to connect to server", exception);
|
getProtocolBridge().getProtocolValues().logger.exception("Failed to connect to server", exception);
|
||||||
OACOptionPane.showMessageDialog(
|
OACOptionPane.showMessageDialog(
|
||||||
dialogParent,
|
dialogParent,
|
||||||
"Failed to connect to Server:\n" + exception.getMessage(),
|
"Failed to connect to Server:\n" + exception.getMessage(),
|
||||||
|
|||||||
@@ -54,8 +54,11 @@ public class Main {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void main(String[] args) throws IOException, NoSuchFieldException, IllegalAccessException {
|
static void main(String[] args) throws IOException, NoSuchFieldException, IllegalAccessException {
|
||||||
|
File logsFolder = new File("logs");
|
||||||
|
if (!logsFolder.exists()) logsFolder.mkdir();
|
||||||
|
|
||||||
eventManager = new EventManager();
|
eventManager = new EventManager();
|
||||||
logger = new Logger(new File("logs", "client"), false, true);
|
logger = new Logger(logsFolder, false, true);
|
||||||
addonLoader = new AddonLoader(eventManager, logger);
|
addonLoader = new AddonLoader(eventManager, logger);
|
||||||
settings = SettingsManager.load();
|
settings = SettingsManager.load();
|
||||||
|
|
||||||
|
|||||||
@@ -15,26 +15,26 @@ public class WebLogger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void log(String string) {
|
public void log(String string) {
|
||||||
client.getProtocolBridge().getLogger().log(host + ": " + string);
|
client.getProtocolBridge().getProtocolValues().logger.log(host + ": " + string);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void info(String info) {
|
public void info(String info) {
|
||||||
client.getProtocolBridge().getLogger().info(host + ": " + info);
|
client.getProtocolBridge().getProtocolValues().logger.info(host + ": " + info);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void warn(String warn) {
|
public void warn(String warn) {
|
||||||
client.getProtocolBridge().getLogger().warn(host + ": " + warn);
|
client.getProtocolBridge().getProtocolValues().logger.warn(host + ": " + warn);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void error(String error) {
|
public void error(String error) {
|
||||||
client.getProtocolBridge().getLogger().error(host + ": " + error);
|
client.getProtocolBridge().getProtocolValues().logger.error(host + ": " + error);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void exception(String infoLine, Exception exception) {
|
public void exception(String infoLine, Exception exception) {
|
||||||
client.getProtocolBridge().getLogger().exception(host + ": " + infoLine, exception);
|
client.getProtocolBridge().getProtocolValues().logger.exception(host + ": " + infoLine, exception);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void debug(String debug) {
|
public void debug(String debug) {
|
||||||
client.getProtocolBridge().getLogger().debug(host + ": " + debug);
|
client.getProtocolBridge().getProtocolValues().logger.debug(host + ": " + debug);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -231,6 +231,8 @@ public class BrowserUI extends OACFrame {
|
|||||||
readyTab.loadUrl(normalized);
|
readyTab.loadUrl(normalized);
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
connectTabClient(key, client);
|
||||||
|
|
||||||
BrowserTab tab = new BrowserTab(
|
BrowserTab tab = new BrowserTab(
|
||||||
key,
|
key,
|
||||||
normalized,
|
normalized,
|
||||||
@@ -275,42 +277,37 @@ public class BrowserUI extends OACFrame {
|
|||||||
|
|
||||||
cardLayout.show(pageHost, key);
|
cardLayout.show(pageHost, key);
|
||||||
browser.addressField().setText(normalized);
|
browser.addressField().setText(normalized);
|
||||||
|
|
||||||
connectTabClient(key, client);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void connectTabClient(String key, ClientImpl client) {
|
private void connectTabClient(String key, ClientImpl client) {
|
||||||
try {
|
try {
|
||||||
File logsFolder = new File("logs");
|
|
||||||
if (!logsFolder.exists()) logsFolder.mkdir();
|
|
||||||
|
|
||||||
ProtocolValues values = new ProtocolValues();
|
ProtocolValues values = new ProtocolValues();
|
||||||
values.packetHandler = new PacketHandler();
|
values.packetHandler = new PacketHandler();
|
||||||
values.eventManager = new EventManager();
|
values.eventManager = new EventManager();
|
||||||
values.ssl = settings.isSslEnabled();
|
values.ssl = settings.isSslEnabled();
|
||||||
AddonLoader addonLoader = Main.getAddonLoader();
|
values.logger = Main.getLogger();
|
||||||
|
values.addonLoader = Main.getAddonLoader();
|
||||||
|
values.protocolVersion = ProtocolVersion.PV_1_0_1_BETA;
|
||||||
|
AddonLoader addonLoader = values.addonLoader;
|
||||||
|
|
||||||
ProtocolBridge bridge = new ProtocolBridge(
|
ProtocolBridge bridge = new ProtocolBridge(
|
||||||
client,
|
client,
|
||||||
values,
|
client.getLibImpl(),
|
||||||
ProtocolVersion.PV_1_0_1_BETA,
|
values
|
||||||
Main.getLogger(),
|
|
||||||
Main.getAddonLoader(),
|
|
||||||
client.getLibImpl()
|
|
||||||
);
|
);
|
||||||
|
|
||||||
protocolByKey.put(key, bridge);
|
protocolByKey.put(key, bridge);
|
||||||
addonLoaderByKey.put(key, addonLoader);
|
addonLoaderByKey.put(key, addonLoader);
|
||||||
|
|
||||||
|
File addonsFolder = new File("addons");
|
||||||
|
if (!addonsFolder.exists()) addonsFolder.mkdir();
|
||||||
|
addonLoader.loadAddonsFromDirectory(addonsFolder);
|
||||||
|
|
||||||
client.buildINSConnection();
|
client.buildINSConnection();
|
||||||
bridge.getProtocolValues().eventManager.registerListener(client);
|
bridge.getProtocolValues().eventManager.registerListener(client);
|
||||||
|
|
||||||
InsEndpoint ep = Objects.requireNonNull(settings.getSelectedIns(), "selectedIns");
|
InsEndpoint ep = Objects.requireNonNull(settings.getSelectedIns(), "selectedIns");
|
||||||
client.getClientINSConnection().connect(ep.host(), ep.port());
|
client.getClientINSConnection().connect(ep.host(), ep.port());
|
||||||
|
|
||||||
File addonsFolder = new File("addons");
|
|
||||||
if (!addonsFolder.exists()) addonsFolder.mkdir();
|
|
||||||
addonLoader.loadAddonsFromDirectory(addonsFolder);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
OACOptionPane.showMessageDialog(
|
OACOptionPane.showMessageDialog(
|
||||||
this,
|
this,
|
||||||
|
|||||||
Reference in New Issue
Block a user