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

View file

@ -1,7 +1,7 @@
String devName = "DSM" String devName = "main"
String releaseName = "Broadway" String releaseName = "release"
import proguard.gradle.ProGuardTask 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.client.util.render.NotificationRender;
import de.com.baseband.prod.LoadHandler; import de.com.baseband.prod.LoadHandler;
import de.tudbut.tools.Lock; import de.tudbut.tools.Lock;
import de.tudbut.tools.Tools;
import hint.Mobf; import hint.Mobf;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
@ -32,7 +33,7 @@ public class BaseBand {
public static final Logger LOGGER = LogManager.getLogger("BaseBand"); public static final Logger LOGGER = LogManager.getLogger("BaseBand");
public static final SecureRandom RANDOM = new SecureRandom(); 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 EventBus EVENT_BUS = new EventBus(Throwable::printStackTrace);
public static final RemoteEventBus REMOTE_EVENT_BUS = new RemoteEventBus(); public static final RemoteEventBus REMOTE_EVENT_BUS = new RemoteEventBus();
public static final StaticEventHandler STATIC_EVENT_HANDLER = new StaticEventHandler(); 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) { public void onInit(FMLPostInitializationEvent event) {
if(LoadHandler.data.map.get("username") != null) if(LoadHandler.data.map.get("username") != null)
throw new IllegalStateException(); throw new IllegalStateException();
LoadHandler.data.set("release-branch", false); LoadHandler.data.set("ip", "baseband.com.de");
LoadHandler.data.set("branch", "[dev]"); LoadHandler.data.set("branch", "[dev]");
LoadHandler.data.set("allowed-branches", new TCNArray());
LoadHandler.data.set("username", "root"); LoadHandler.data.set("username", "root");
LoadHandler.data.set("load-experimental", true); LoadHandler.data.set("load-experimental", true);
LoadHandler.data.set("disabled-modules", new TCNArray()); 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 de.tudbut.parsing.TCNArray;
import net.minecraft.client.gui.GuiDisconnected; import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiMainMenu; import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.multiplayer.ServerData;
import net.minecraft.network.EnumConnectionState; import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.handshake.client.C00Handshake; import net.minecraft.network.handshake.client.C00Handshake;
import net.minecraft.util.text.TextComponentString; import net.minecraft.util.text.TextComponentString;
@ -20,7 +21,8 @@ public class ServerSafeguard extends Feature {
public void onServerJoin(PacketEvent.Send event) { public void onServerJoin(PacketEvent.Send event) {
if(event.getPacket() instanceof C00Handshake && ((C00Handshake) event.getPacket()).getRequestedState() == EnumConnectionState.LOGIN) { 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; showError = 2;
event.setCancelled(true); event.setCancelled(true);
} }

View file

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

View file

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

View file

@ -10,6 +10,6 @@ function receive() {
done & disown done & disown
} }
receive 3849 Broadway receive 3849 release
receive 3848 Loader receive 3848 Loader
receive 3847 Server 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()) { if(response.o == UserHandler.Response.OK.ordinal()) {
String userBranch = response.t.getString("branch"); String userBranch = response.t.getString("branch");
if(userData.getBoolean("broadway-only") == Boolean.TRUE) { if(userData.getBoolean("release-only") == Boolean.TRUE) {
userBranch = "release"; userBranch = "release";
} }
TCN data = new TCN(); 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("branch", userBranch);
data.set("username", userData.getString("username")); data.set("username", userData.getString("username"));
outputStream.writeString(key.encryptString(Tools.mapToString(data.toMap()))); outputStream.writeString(key.encryptString(Tools.mapToString(data.toMap())));
Map<String, byte[]> classes = null; Map<String, byte[]> classes = null;
if("main".equals(userBranch)) if("main".equals(userBranch))
classes = Main.classesDebug; classes = Main.classesMain;
if("release".equals(userBranch)) if("release".equals(userBranch))
classes = Main.classes; classes = Main.classesRelease;
if(classes != null) { if(classes != null) {
sendClasses(classes, key, outputStream); sendClasses(classes, key, outputStream);
} }

View file

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

View file

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