feat: update to latest release

- pin commits to keep compatibility
- add backup container for database
- patch arcturus permission system
- add default permission groups
- add script for exporting and saving build images
This commit is contained in:
Niklas 2023-10-23 23:58:53 +02:00
parent aec282dd86
commit 5e5bf8b70e
13 changed files with 1334 additions and 16 deletions

2
.gitignore vendored
View File

@ -7,3 +7,5 @@ assets/translation/*.sql
!assets/translation/fix_room_items.sql !assets/translation/fix_room_items.sql
assets/swf assets/swf
assets/usercontent/**/*.png assets/usercontent/**/*.png
~$*.xlsx
export/

View File

@ -59,6 +59,10 @@ https://git.krews.org/morningstar/Arcturus-Community/-/archive/ms4/dev/Arcturus-
- Go to **File** --> **Run SQL file...** and open **4_0_0_pets_EN.sql** - Go to **File** --> **Run SQL file...** and open **4_0_0_pets_EN.sql**
- Go to **File** --> **Run SQL file...** and open **4_0_0_permissions.sql**
- Go to **File** --> **Run SQL file...** and open **perms_groups.sql** Located at: ./arcturus
5. Update emulator settings with HeidiSQL 5. Update emulator settings with HeidiSQL
> This will Disable console mode for Arcturus because we are using docker. > This will Disable console mode for Arcturus because we are using docker.
@ -83,6 +87,7 @@ UPDATE emulator_settings SET `value`='0' WHERE `key`='console.mode';
docker compose up assets -d && \ docker compose up assets -d && \
docker compose up assets-build --build && \ docker compose up assets-build --build && \
docker compose up arcturus --build -d docker compose up arcturus --build -d
docker compose up backup -d
``` ```
7. Update the: `nitro/renderer-config.json` and `nitro/ui-config.json` values to your setup. If the deployment is buggy or throws any errors check the json files for updates. then Build and Start Nitro 7. Update the: `nitro/renderer-config.json` and `nitro/ui-config.json` values to your setup. If the deployment is buggy or throws any errors check the json files for updates. then Build and Start Nitro

View File

@ -4,6 +4,8 @@ RUN yum install -y git
WORKDIR /build/arcturus-community WORKDIR /build/arcturus-community
RUN git clone --branch dev --recurse-submodules https://git.krews.org/morningstar/Arcturus-Community.git . RUN git clone --branch dev --recurse-submodules https://git.krews.org/morningstar/Arcturus-Community.git .
# explicit pin this version
RUN git checkout f051d1d1
RUN mvn package RUN mvn package
RUN mvn install RUN mvn install
@ -18,13 +20,17 @@ RUN cp target/NitroWebsockets-*.jar target/websockets.jar
FROM maven:3-amazoncorretto-19 AS builder-ms4 FROM maven:3-amazoncorretto-19 AS builder-ms4
ARG BRANCH=ms4/dev ARG BRANCH=ms4/dev
ARG COMMIT=3bb8ce16
RUN yum install -y git RUN yum install -y git
WORKDIR /build/arcturus-community WORKDIR /build/arcturus-community
RUN git clone --branch ${BRANCH} --recurse-submodules https://git.krews.org/morningstar/Arcturus-Community.git . RUN git clone --branch ${BRANCH} --recurse-submodules https://git.krews.org/morningstar/Arcturus-Community.git .
RUN git checkout $COMMIT
RUN sed -i 's#Scanner scanner = new Scanner(System.in);##g' src/main/java/com/eu/habbo/Emulator.java RUN sed -i 's#Scanner scanner = new Scanner(System.in);##g' src/main/java/com/eu/habbo/Emulator.java
RUN sed -i 's#scanner.nextLine();##g' src/main/java/com/eu/habbo/Emulator.java RUN sed -i 's#scanner.nextLine();##g' src/main/java/com/eu/habbo/Emulator.java
ADD patches/ /build/arcturus-community/patches/
RUN find "$(readlink -f patches/)" -type f -name "*.patch" | xargs -I {} sh -c 'echo "Applying {}"; git apply {}'
RUN mvn package RUN mvn package
RUN mvn install RUN mvn install
RUN cp target/Morningstar*-with-dependencies.jar target/emulator.jar RUN cp target/Morningstar*-with-dependencies.jar target/emulator.jar

View File

@ -0,0 +1,26 @@
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/ChangeNameCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/ChangeNameCommand.java
index 3952b300..4e9a5c5f 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/list/ChangeNameCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/ChangeNameCommand.java
@@ -7,7 +7,7 @@ import com.eu.habbo.messages.outgoing.users.UserObjectComposer;
public class ChangeNameCommand extends Command {
public ChangeNameCommand() {
- super("cmd_change_name");
+ super("cmd_changename");
}
@Override
diff --git a/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java b/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java
index 39cb7f8f..bd4f45e1 100644
--- a/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java
+++ b/src/main/java/com/eu/habbo/habbohotel/commands/list/UserInfoCommand.java
@@ -16,7 +16,7 @@ import java.util.*;
public class UserInfoCommand extends Command {
public UserInfoCommand() {
- super("cmd_userinfo");
+ super("cmd_user_info");
}
@Override

View File

@ -0,0 +1,38 @@
diff --git a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
index 8c38c442..b1fa237a 100644
--- a/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
+++ b/src/main/java/com/eu/habbo/habbohotel/GameEnvironment.java
@@ -62,6 +62,8 @@ public class GameEnvironment {
log.info("GameEnvironment -> Loading...");
this.permissionsManager = new PermissionsManager();
+ this.permissionsManager.reload();
+
this.habboManager = new HabboManager();
this.hotelViewManager = new HotelViewManager();
this.itemManager = new ItemManager();
diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionGroup.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionGroup.java
index 60d31f09..232a0314 100644
--- a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionGroup.java
+++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionGroup.java
@@ -76,7 +76,7 @@ public class PermissionGroup {
statement.setInt(1, this.id);
try(ResultSet set = statement.executeQuery()) {
while (set.next()) {
- PermissionRight right = Emulator.getGameEnvironment().getPermissionsManager().getRight(set.getString("name"));
+ PermissionRight right = Emulator.getGameEnvironment().getPermissionsManager().getRight(set.getString("right_name"));
this.rights.put(right, PermissionSetting.fromString(set.getString("setting_type")));
}
}
diff --git a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
index e8fca734..73243918 100644
--- a/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
+++ b/src/main/java/com/eu/habbo/habbohotel/permissions/PermissionsManager.java
@@ -28,7 +28,6 @@ public class PermissionsManager {
this.fixedCommands = new HashMap<>();
this.permissionRights = new HashMap<>();
this.specialEnables = new TIntIntHashMap();
- this.reload();
log.info("Permissions Manager -> Loaded! (" + (System.currentTimeMillis() - millis) + " MS)");
}

BIN
arcturus/perms.xlsx Normal file

Binary file not shown.

1128
arcturus/perms_groups.sql Normal file

File diff suppressed because it is too large Load Diff

70
arcturus/perms_sql.py Normal file
View File

@ -0,0 +1,70 @@
import pandas as pd
# Load the Excel file
excel_file = 'perms.xlsx'
df = pd.read_excel(excel_file)
headers = list(df)[1:]
column_names = df.iloc[:, 0]
groups = []
for hi, rank in enumerate(headers):
group = {}
for index, row in df.iterrows():
if str(row["col"]) == "nan":
continue
val = row[rank]
if str(val) == "nan":
val = ""
try:
val = int(val)
except:
pass
group[row["col"]] = val
groups.append(group)
def generate_insert_sql(table_name, data):
"""
Generate an SQL INSERT INTO statement.
Parameters:
- table_name (str): The name of the table.
- data (dict): A dictionary representing the column names and values.
Returns:
- str: The generated SQL statement.
"""
columns = ', '.join(data.keys())
values = ', '.join([f"'{value}'" for value in data.values()])
sql_statement = f"INSERT INTO {table_name} ({columns}) VALUES ({values});"
return sql_statement
with open("perms_groups.sql", 'w', encoding="utf-8") as file:
file.write(f"-- auto generated by mc8051.de\n")
for group in groups:
file.write(f"-- permission group {group['name']}\n")
group_id = group["id"]
sql = generate_insert_sql("permission_groups", {"id": group_id, "name": group["name"], "description": group["description"], "level": group["level"], "prefix": group["prefix"], "prefix_color": group["prefix_color"], "badge": group["badge"], "room_effect": group["room_effect"], "log_enabled": group["log_enabled"]})
file.write(sql + "\n")
for key in group.keys():
if not str(key).startswith("cmd_"):
continue
sql = generate_insert_sql("permission_group_commands", {"group_id": group_id, "command_name": key, "setting_type": group[key]})
file.write(sql + "\n")
for key in group.keys():
if not str(key).startswith("acc_"):
continue
sql = generate_insert_sql("permission_group_rights", {"group_id": group_id, "right_name": key, "setting_type": group[key]})
file.write(sql + "\n")
file.write("\n\n")

View File

@ -1,10 +1,12 @@
FROM node:lts-alpine as builder FROM node:lts-alpine as builder
ARG COMMIT=bd86e1f
WORKDIR /app WORKDIR /app
RUN apk add --no-cache git RUN apk add --no-cache git
RUN git clone --recurse-submodules https://github.com/billsonnn/nitro-converter.git . RUN git clone --recurse-submodules https://github.com/billsonnn/nitro-converter.git .
RUN git checkout -b habbo-room-content RUN git switch -c habbo-room-content $COMMIT
RUN yarn install RUN yarn install
RUN yarn build RUN yarn build

View File

@ -56,6 +56,30 @@ services:
restart: unless-stopped restart: unless-stopped
networks: [nitro] networks: [nitro]
backup:
image: tiredofit/db-backup
depends_on:
- db
volumes:
- ./db/backup:/backup
environment:
- TIMEZONE=UTC
- DB_TYPE=mariadb
- DB_HOST=db
- DB_USER=$MYSQL_USER
- DB_PASS=$MYSQL_PASSWORD
- DB_NAME=$MYSQL_DATABASE
- COMPRESSION=GZ
- ENABLE_CHECKSUM=TRUE
- CHECKSUM=SHA1
- DB_DUMP_BEGIN=0315
- DB_DUMP_FREQ=1440
- DB_CLEANUP_TIME=10080
- CREATE_LATEST_SYMLINK=FALSE
- CONTAINER_ENABLE_MONITORING=FALSE
restart: unless-stopped
networks: [nitro]
assets: assets:
image: nginx:alpine image: nginx:alpine
restart: unless-stopped restart: unless-stopped

21
export_containers.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/bash
# Get a list of all service names defined in the Docker Compose file
SERVICES=$(docker compose config --services)
mkdir -p export/
# Loop through each service and export it as a tar archive
for SERVICE in $SERVICES; do
# Get the container ID of the running service
CONTAINER_ID=$(docker compose ps -q $SERVICE)
echo "$SERVICE: $CONTAINER_ID"
if [ -n "$CONTAINER_ID" ]; then
# Export the container as a tar archive
docker export $CONTAINER_ID > export/${SERVICE}_exported.tar
echo "Container $SERVICE exported successfully."
else
echo "Container $SERVICE is not running or does not exist."
fi
done

View File

@ -1,11 +1,13 @@
FROM node:lts-alpine as builder FROM node:lts-alpine as builder
ARG BRANCH=main ARG BRANCH=main
ARG COMMIT=16475d5
WORKDIR /build WORKDIR /build
RUN apk add --no-cache git RUN apk add --no-cache git
RUN git clone --branch ${BRANCH} --recurse-submodules https://github.com/Gurkengewuerz/nitro.git . RUN git clone --branch ${BRANCH} --recurse-submodules https://github.com/Gurkengewuerz/nitro.git .
RUN git checkout $COMMIT
RUN npm install --force RUN npm install --force
RUN npm install --save-dev nx RUN npm install --save-dev nx
RUN npx nx build frontend RUN npx nx build frontend

View File

@ -61,24 +61,18 @@
"hotelview": { "hotelview": {
"show.avatar": true, "show.avatar": true,
"widgets": { "widgets": {
"slot.1.widget": "promoarticle", "slot.1.widget": "",
"slot.1.conf": {}, "slot.1.conf": {},
"slot.2.widget": "widgetcontainer", "slot.2.widget": "",
"slot.2.conf": { "slot.2.conf": {},
"image": "${image.library.url}web_promo_small/spromo_Canal_Bundle.png", "slot.3.widget": "",
"texts": "2021NitroPromo",
"btnLink": "https://google.com"
},
"slot.3.widget": "promoarticle",
"slot.3.conf": {}, "slot.3.conf": {},
"slot.4.widget": "", "slot.4.widget": "",
"slot.4.conf": {}, "slot.4.conf": {},
"slot.5.widget": "", "slot.5.widget": "",
"slot.5.conf": {}, "slot.5.conf": {},
"slot.6.widget": "achievementcompetition_hall_of_fame", "slot.6.widget": "",
"slot.6.conf": { "slot.6.conf": {},
"campaign": "habboFameComp"
},
"slot.7.widget": "", "slot.7.widget": "",
"slot.7.conf": {} "slot.7.conf": {}
}, },
@ -104,8 +98,8 @@
5 5
], ],
"catalog.links": { "catalog.links": {
"hc.buy_hc": "habbo_club", "hc.buy_hc": "hc_membership",
"hc.hc_gifts": "club_gifts", "hc.hc_gifts": "hcpayday",
"pets.buy_food": "pet_food", "pets.buy_food": "pet_food",
"pets.buy_saddle": "saddles" "pets.buy_saddle": "saddles"
}, },
@ -113,7 +107,7 @@
"benefits.info": true, "benefits.info": true,
"payday.info": true, "payday.info": true,
"gift.info": true, "gift.info": true,
"benefits.habbopage": "habboclub", "benefits.habbopage": "hc_membership",
"payday.habbopage": "hcpayday" "payday.habbopage": "hcpayday"
}, },
"respect.options": { "respect.options": {