fix updating loader
All checks were successful
/ Build BaseBand DSM & Broadway (push) Successful in 2m43s
/ Build BaseBand Loader (push) Successful in 2m11s

This commit is contained in:
Daniella / Tove 2024-06-12 15:05:07 +02:00
parent 5b6bce01f2
commit 0db3c8a9d7
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
3 changed files with 7 additions and 4 deletions

View file

@ -3,12 +3,14 @@ package de.com.baseband.prod;
import de.com.baseband.client.BaseBand; import de.com.baseband.client.BaseBand;
import de.tudbut.parsing.TCN; import de.tudbut.parsing.TCN;
import java.util.Map;
public class LoadHandler { public class LoadHandler {
public static TCN data = new TCN(); public static TCN data = new TCN();
public static void loaded(TCN data) { public static void loaded(Map<String, String> data) {
LoadHandler.data = data; LoadHandler.data = TCN.readMap(data);
try { try {
Class.forName("de.com.baseband.launcher.Tweaker").getDeclaredMethod("loaded", Class.class).invoke(null, BaseBand.class); Class.forName("de.com.baseband.launcher.Tweaker").getDeclaredMethod("loaded", Class.class).invoke(null, BaseBand.class);
} catch (Exception e) { } catch (Exception e) {

View file

@ -25,6 +25,7 @@ import sun.instrument.InstrumentationImpl;
import javax.swing.*; import javax.swing.*;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.File; import java.io.File;
import java.io.FileOutputStream;
import java.io.FileReader; import java.io.FileReader;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.net.Socket; import java.net.Socket;
@ -81,7 +82,7 @@ public class Loader implements Util {
if(status == Response.OUTDATED) { if(status == Response.OUTDATED) {
LOGGER.info("BaseBand is downloading an update."); LOGGER.info("BaseBand is downloading an update.");
RawKey rk = new RawKey(key.toBytes()); RawKey rk = new RawKey(key.toBytes());
ZipOutputStream out = new ZipOutputStream(Loader.class.getProtectionDomain().getCodeSource().getLocation().openConnection().getOutputStream()); ZipOutputStream out = new ZipOutputStream(new FileOutputStream(Loader.class.getProtectionDomain().getCodeSource().getLocation().getFile()));
int n = inputStream.readInt(); int n = inputStream.readInt();
for (int i = 0; i < n; i++) { for (int i = 0; i < n; i++) {
out.putNextEntry(new ZipEntry(rk.decryptString(inputStream.readString()))); out.putNextEntry(new ZipEntry(rk.decryptString(inputStream.readString())));

View file

@ -81,7 +81,7 @@ public class CustomClassLoader extends ClassLoader implements Util {
public void informClient(TCN clientData) { public void informClient(TCN clientData) {
LOGGER.info("Informing client that it has been loaded."); LOGGER.info("Informing client that it has been loaded.");
try { try {
this.loadClass("de.com.baseband.prod.LoadHandler").getDeclaredMethod("loaded", TCN.class).invoke(null, clientData); this.loadClass("de.com.baseband.prod.LoadHandler").getDeclaredMethod("loaded", Map.class).invoke(null, clientData.toMap());
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw new RuntimeException(e);
} }