refactor branch names to be central
All checks were successful
/ Build BaseBand Loader (push) Successful in 2m17s
/ Build BaseBand (push) Successful in 2m45s
/ Build BaseBand Installer (push) Successful in 1m13s
/ Build BaseBand Server (push) Successful in 2m2s

This commit is contained in:
Daniella / Tove 2024-10-04 21:01:23 +02:00
parent 920ea1229d
commit 73219e1ad3
Signed by: TudbuT
GPG key ID: B3CF345217F202D3
12 changed files with 51 additions and 34 deletions

View file

@ -9,7 +9,7 @@ on:
jobs:
make:
name: Build BaseBand DSM & Broadway
name: Build BaseBand
runs-on: 'docker'
@ -40,16 +40,16 @@ jobs:
run: |
bash scripts/gen_hash.sh
./gradlew Client:build
- name: Obfuscate DSM
- name: Obfuscate main
if: github.ref == 'refs/heads/main' # !! ONLY MAIN
run: |
./gradlew Client:proguard
MOBFARGS="-p --newjvm" bash scripts/mobf.sh Client/build/proguard/BaseBand-DSM.jar
- name: Obfuscate Broadway
MOBFARGS="-p --newjvm" bash scripts/mobf.sh Client/build/proguard/BaseBand-main.jar
- name: Obfuscate release
if: github.ref == 'refs/heads/release' # !! ONLY RELEASE
run: |
./gradlew Client:proguardRelease
MOBFARGS=-p bash scripts/mobf.sh Client/build/proguard/BaseBand-Broadway.jar
MOBFARGS=-p bash scripts/mobf.sh Client/build/proguard/BaseBand-release.jar
- name: Upload Mappings
continue-on-error: true
@ -57,7 +57,7 @@ jobs:
with:
name: BaseBand-Mapping.zip
path: Client/build/proguard/mapping-*
- name: Push DSM to Prod Server
- name: Push main to Prod Server
if: github.ref == 'refs/heads/main' # !! ONLY MAIN
env:
SSH_PRIVATEKEY: ${{ secrets.SSH_PRIVATEKEY }}
@ -65,8 +65,8 @@ jobs:
BB_HOST: ${{ vars.BB_HOST }}
BB_PORT: ${{ vars.BB_PORT }}
BB_PATH: ${{ vars.BB_PATH }}
run: bash scripts/push_file.sh Client/build/proguard/BaseBand-DSM.jar 3849
- name: Push Broadway to Prod Server
run: bash scripts/push_file.sh Client/build/proguard/BaseBand-Iceland.jar 3849
- name: Push release to Prod Server
if: github.ref == 'refs/heads/release' # !! ONLY RELEASE
env:
SSH_PRIVATEKEY: ${{ secrets.SSH_PRIVATEKEY }}
@ -74,7 +74,7 @@ jobs:
BB_HOST: ${{ vars.BB_HOST }}
BB_PORT: ${{ vars.BB_PORT }}
BB_PATH: ${{ vars.BB_PATH }}
run: bash scripts/push_file.sh Client/build/proguard/BaseBand-Broadway.jar 3849
run: bash scripts/push_file.sh Client/build/proguard/BaseBand-release.jar 3849
- name: Notify Action Completion
if: always()
run: bash scripts/webhook.sh "# New client build\n Build Action Completed <@&1250456258629341284>"

View file

@ -1,7 +1,7 @@
String devName = "DSM"
String releaseName = "Broadway"
String devName = "main"
String releaseName = "release"
import proguard.gradle.ProGuardTask

View file

@ -17,6 +17,7 @@ import de.com.baseband.client.util.net.WebServiceClient;
import de.com.baseband.client.util.render.NotificationRender;
import de.com.baseband.prod.LoadHandler;
import de.tudbut.tools.Lock;
import de.tudbut.tools.Tools;
import hint.Mobf;
import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge;
@ -32,7 +33,7 @@ public class BaseBand {
public static final Logger LOGGER = LogManager.getLogger("BaseBand");
public static final SecureRandom RANDOM = new SecureRandom();
public static String buildString = LoadHandler.data.getBoolean("release-branch") ? "Broadway" : "Dark Side of the Moon";
public static String buildString = Tools.firstNonNull(LoadHandler.data.getString("build-name"), "Greenland");
public static final EventBus EVENT_BUS = new EventBus(Throwable::printStackTrace);
public static final RemoteEventBus REMOTE_EVENT_BUS = new RemoteEventBus();
public static final StaticEventHandler STATIC_EVENT_HANDLER = new StaticEventHandler();

View file

@ -30,8 +30,9 @@ public class DevStub implements IFMLLoadingPlugin {
public void onInit(FMLPostInitializationEvent event) {
if(LoadHandler.data.map.get("username") != null)
throw new IllegalStateException();
LoadHandler.data.set("release-branch", false);
LoadHandler.data.set("ip", "baseband.com.de");
LoadHandler.data.set("branch", "[dev]");
LoadHandler.data.set("allowed-branches", new TCNArray());
LoadHandler.data.set("username", "root");
LoadHandler.data.set("load-experimental", true);
LoadHandler.data.set("disabled-modules", new TCNArray());

View file

@ -7,6 +7,7 @@ import de.com.baseband.prod.LoadHandler;
import de.tudbut.parsing.TCNArray;
import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.handshake.client.C00Handshake;
import net.minecraft.util.text.TextComponentString;
@ -20,7 +21,8 @@ public class ServerSafeguard extends Feature {
public void onServerJoin(PacketEvent.Send event) {
if(event.getPacket() instanceof C00Handshake && ((C00Handshake) event.getPacket()).getRequestedState() == EnumConnectionState.LOGIN) {
if(LoadHandler.data.getArray("do-not-join").contains(mc.getCurrentServerData().serverIP.split(":")[0])) {
ServerData currentServerData = mc.getCurrentServerData();
if(currentServerData != null && LoadHandler.data.getArray("do-not-join").contains(currentServerData.serverIP.split(":")[0])) {
showError = 2;
event.setCancelled(true);
}

View file

@ -22,7 +22,7 @@ public class WebServiceClient {
return;
new Thread(() -> {
try {
try (Socket client = new Socket("baseband.com.de", 40000)) {
try (Socket client = new Socket(LoadHandler.data.getString("ip"), 40000)) {
client.setSoTimeout(7000);
client.getOutputStream().write(1); // client mode
inputStream = new TypedInputStream(client.getInputStream()).stopOnEOF();

View file

@ -80,7 +80,7 @@ public class Loader implements Util {
try {
preOptions = JSON.read(new StreamReader(new FileInputStream("baseband_launch.json")).readAllAsString());
preOptions.set("ip", null);
preOptions.set("broadway-only", false);
preOptions.set("release-only", false);
} catch (Exception e) {
preOptions = new TCN();
}
@ -94,7 +94,7 @@ public class Loader implements Util {
x.finish();
})
.option("Run BaseBand (custom)", x -> x.newScreen()
.option("Broadway-Only mode", x1 -> x.data.set("broadway-only", true))
.option("Broadway-Only mode", x1 -> x.data.set("release-only", true))
.option("Run BaseBand normally", ClientBoot::finish)
.option("Run in recovery mode", x1 -> {
x.data.set("config-file", "baseband.db.tmp");
@ -355,7 +355,7 @@ public class Loader implements Util {
tcn.set("password", key.decryptString(reader.readLine()));
tcn.set("hardware-id", getToken());
tcn.set("commit", options.getBoolean("redownload") == Boolean.TRUE ? "REDOWNLOAD!" : GitHash.GIT_HASH);
tcn.set("broadway-only", options.getBoolean("broadway-only") == Boolean.TRUE);
tcn.set("release-only", options.getBoolean("release-only") == Boolean.TRUE);
TCN antiDump = new TCN();

View file

@ -10,6 +10,6 @@ function receive() {
done & disown
}
receive 3849 Broadway
receive 3849 release
receive 3848 Loader
receive 3847 Server

View file

@ -0,0 +1,13 @@
package de.com.baseband.server;
import java.util.HashMap;
public class BuildNames {
public static final HashMap<String, String> buildNames = new HashMap<>();
static {
buildNames.put("release", "Broadway");
buildNames.put("main", "Iceland");
}
}

View file

@ -30,21 +30,21 @@ public class LoaderHandler {
}
if(response.o == UserHandler.Response.OK.ordinal()) {
String userBranch = response.t.getString("branch");
if(userData.getBoolean("broadway-only") == Boolean.TRUE) {
if(userData.getBoolean("release-only") == Boolean.TRUE) {
userBranch = "release";
}
TCN data = new TCN();
data.set("release-branch", "release".equals(userBranch));
data.set("build-name", BuildNames.buildNames.get(userBranch));
data.set("branch", userBranch);
data.set("username", userData.getString("username"));
outputStream.writeString(key.encryptString(Tools.mapToString(data.toMap())));
Map<String, byte[]> classes = null;
if("main".equals(userBranch))
classes = Main.classesDebug;
classes = Main.classesMain;
if("release".equals(userBranch))
classes = Main.classes;
classes = Main.classesRelease;
if(classes != null) {
sendClasses(classes, key, outputStream);
}

View file

@ -37,8 +37,8 @@ public class Main {
public static boolean denyAll = false;
public static String clientHash, clientDebugHash, loaderHash;
public static Map<String, byte[]> classes = new HashMap<>();
public static Map<String, byte[]> classesDebug = new HashMap<>();
public static Map<String, byte[]> classesMain = new HashMap<>();
public static Map<String, byte[]> classesRelease = new HashMap<>();
public static Map<String, byte[]> classesLoader = new HashMap<>();
public static void save() {
@ -86,7 +86,7 @@ public class Main {
tcn.set("hardware-id-reset", true);
tcn.set("disabled", true);
tcn.set("discord-id", 0);
tcn.set("branch", "release");
tcn.set("branch", "main");
UserHandler.users.add(tcn);
}
@ -96,17 +96,17 @@ public class Main {
System.out.println("Indexing Jar...");
indexJar(classes, "Broadway");
indexJar(classesDebug, "DSM");
indexJar(classesMain, "main");
indexJar(classesRelease, "release");
indexJar(classesLoader, "Loader");
clientHash = new String(classes.get("commit"), StandardCharsets.ISO_8859_1);
clientHash = new String(classesRelease.get("commit"), StandardCharsets.ISO_8859_1);
loaderHash = new String(classesLoader.getOrDefault("commit", "[dev]".getBytes(StandardCharsets.ISO_8859_1)), StandardCharsets.ISO_8859_1);
clientDebugHash = new String(classesDebug.getOrDefault("commit", "[dev]".getBytes(StandardCharsets.ISO_8859_1)), StandardCharsets.ISO_8859_1);
clientDebugHash = new String(classesMain.getOrDefault("commit", "[dev]".getBytes(StandardCharsets.ISO_8859_1)), StandardCharsets.ISO_8859_1);
for (String s : classesDebug.keySet().toArray(new String[0])) {
for (String s : classesMain.keySet().toArray(new String[0])) {
if(s.startsWith("org/spongepowered"))
classesDebug.remove(s);
classesMain.remove(s);
}
System.out.println("Enabling Service Handler for Remote Actioning...");

View file

@ -10,5 +10,5 @@ if [ "$BB_PATH" = '' ] ; then
fi
bash scripts/push_file.sh Server/build/libs/BaseBand-Server.jar
bash scripts/push_file.sh Client/build/proguard/BaseBand-Broadway.jar
bash scripts/push_file.sh Loader/build/proguard/BaseBand-Loader.jar
bash scripts/push_file.sh Client/build/proguard/BaseBand-release.jar
bash scripts/push_file.sh Loader/build/proguard/BaseBand-main.jar