Rendering und Lua working, need to work on request method via custom URL implementation
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
package org.openautonomousconnection.webclient;
|
||||
|
||||
import dev.unlegitdqrk.unlegitlibrary.event.Listener;
|
||||
import org.openautonomousconnection.infonamelib.OacWebUrlInstaller;
|
||||
import org.openautonomousconnection.infonamelib.ProtocolHandlerPackages;
|
||||
import org.openautonomousconnection.oacswing.component.OACOptionPane;
|
||||
import org.openautonomousconnection.protocol.side.client.ProtocolClient;
|
||||
import org.openautonomousconnection.protocol.side.client.events.ConnectedToProtocolINSServerEvent;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class ClientImpl extends ProtocolClient {
|
||||
@Override
|
||||
public boolean trustINS(String caFingerprint) {
|
||||
Object[] options = {"Continue", "Cancel"};
|
||||
int result = OACOptionPane.showOptionDialog(
|
||||
Main.getUi(),
|
||||
"You never connected to this INS before!\n" +
|
||||
"Fingerprint: " + caFingerprint + "\nDo you want to connect?",
|
||||
"INS Connection",
|
||||
OACOptionPane.YES_NO_OPTION,
|
||||
OACOptionPane.INFORMATION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[0] // default button: Continue
|
||||
);
|
||||
|
||||
return result == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean trustNewINSFingerprint(String oldCAFingerprint, String newCAFingerprint) {
|
||||
Object[] options = {"Continue", "Cancel"};
|
||||
|
||||
String table = String.format("""
|
||||
Saved Fingerprint\tNew Fingerprint
|
||||
%s\t%s
|
||||
""", oldCAFingerprint, newCAFingerprint);
|
||||
|
||||
int result = OACOptionPane.showOptionDialog(
|
||||
Main.getUi(),
|
||||
"The fingerprint does not match with the saved fingerprint!\n" +
|
||||
"Saved Fingerprint: " + oldCAFingerprint + "\n" +
|
||||
"New Fingerprint: " + newCAFingerprint + "\n" +
|
||||
"Do you want to connect?",
|
||||
"INS Connection",
|
||||
OACOptionPane.YES_NO_OPTION,
|
||||
OACOptionPane.INFORMATION_MESSAGE,
|
||||
null,
|
||||
options,
|
||||
options[0] // default button: Continue
|
||||
);
|
||||
|
||||
return result == 0;
|
||||
}
|
||||
|
||||
@Listener
|
||||
public void onConnected(ConnectedToProtocolINSServerEvent event) {
|
||||
try {
|
||||
buildServerConnection(null, getProtocolBridge().getProtocolValues().ssl);
|
||||
ProtocolHandlerPackages.installPackage("org.openautonomousconnection.infonamelib");
|
||||
OacWebUrlInstaller.installOnce(getProtocolBridge().getProtocolValues().eventManager, this);
|
||||
SwingUtilities.invokeLater(() -> Main.getUi().openNewTab("web://info.oac/"));
|
||||
} catch (Exception e) {
|
||||
Main.getClient().getProtocolBridge().getLogger().exception("Failed to build Server connection", e);
|
||||
OACOptionPane.showMessageDialog(Main.getUi(), "Failed to connect to build Server connection:\n" + e.getMessage(),
|
||||
"Server Connection", OACOptionPane.ERROR_MESSAGE);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user