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