mirror of
https://github.com/NATroutter/egg-hytale.git
synced 2026-03-01 11:21:13 +03:00
Removed useless variable from entry
Removed unnecessary profile uuid variable Fixed variable compares in if statements Added auth file creation to entry Added version file creation to entry Added VERSION_FILE variable Added override for session and identity tokens
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
"version": "PLCN_v3",
|
||||
"update_url": "https://cdn.nat.gg/egg/egg-hytale.pelican.json"
|
||||
},
|
||||
"exported_at": "2026-01-15T10:29:08+00:00",
|
||||
"exported_at": "2026-01-15T14:20:48+00:00",
|
||||
"name": "Hytale",
|
||||
"author": "contact@natroutter.fi",
|
||||
"uuid": "6594b287-2d7b-4249-bc93-4d40283c57e3",
|
||||
@@ -22,7 +22,8 @@
|
||||
},
|
||||
"file_denylist": [
|
||||
"hytale-downloader-linux-amd64",
|
||||
"hytale-downloader-linux-arm64"
|
||||
"hytale-downloader-linux-arm64",
|
||||
"start.sh"
|
||||
],
|
||||
"startup_commands": {
|
||||
"Default": "./start.sh"
|
||||
@@ -35,7 +36,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"installation": {
|
||||
"script": "#!/bin/bash\nset -e\n\nDOWNLOAD_URL=\"https://downloader.hytale.com/hytale-downloader.zip\"\nDOWNLOAD_FILE=\"hytale-downloader.zip\"\n\nARCH=\"$(uname -m)\"\n\necho \"Platform: ${ARCH}\"\necho \"Installing base dependencies...\"\n\napt update\napt install -y curl unzip jq\n\n# ARM-only setup for running amd64 downloader\nif [ \"${ARCH}\" = \"aarch64\" ]; then\n echo \"ARM64 detected, enabling amd64 emulation with QEMU...\"\n\n apt install -y qemu-user-static\n\n dpkg --add-architecture amd64 || true\n apt update || true\n apt install -y libc6:amd64 || true\nfi\n\ncd /mnt/server\n\necho \"Starting Hytale downloader installation...\"\necho \"Downloading hytale-downloader.zip...\"\n\ncurl -L -o \"${DOWNLOAD_FILE}\" \"${DOWNLOAD_URL}\"\nif [ $? -ne 0 ]; then\n echo \"Error: Failed to download ${DOWNLOAD_URL}\"\n exit 1\nfi\n\necho \"Extracting ${DOWNLOAD_FILE}...\"\nunzip -o \"${DOWNLOAD_FILE}\"\nif [ $? -ne 0 ]; then\n echo \"Error: Failed to extract ${DOWNLOAD_FILE}\"\n exit 1\nfi\n\necho \"Cleaning up...\"\nrm -f \"${DOWNLOAD_FILE}\" QUICKSTART.md hytale-downloader-windows-amd64.exe\n\nchmod +x ./hytale-downloader-linux-amd64\n\n# ARM wrapper setup\nif [ \"${ARCH}\" = \"aarch64\" ]; then\n echo \"Setting up QEMU wrapper for amd64 downloader...\"\n\n cp /usr/bin/qemu-x86_64-static ./qemu-x86_64-static\n\n cat > ./hytale-downloader-linux-arm64 << 'EOF'\n#!/bin/bash\nset -e\n\nREAL_BIN=\"/home/container/hytale-downloader-linux-amd64\"\nQEMU_LOCAL=\"/home/container/qemu-x86_64-static\"\n\nif [ -x \"$QEMU_LOCAL\" ]; then\n exec \"$QEMU_LOCAL\" \"$REAL_BIN\" \"$@\"\nelse\n exec /usr/bin/qemu-x86_64-static \"$REAL_BIN\" \"$@\"\nfi\nEOF\n\n chmod +x ./hytale-downloader-linux-arm64\nfi\n\n# Create version file\nif [ ! -f \"/mnt/server/version.txt\" ]; then\n echo \"Creating version check file...\"\n touch /mnt/server/version.txt\n chmod 666 /mnt/server/version.txt\nfi\n\n# Create auth cache file\nif [ ! -f \"/mnt/server/.hytale-auth-tokens.json\" ]; then\n echo \"Creating auth cache file...\"\n touch /mnt/server/.hytale-auth-tokens.json\n chmod 666 /mnt/server/.hytale-auth-tokens.json\nfi\n\necho \"Installation complete!\"",
|
||||
"script": "#!/bin/bash\nset -e\n\nDOWNLOAD_URL=\"https://downloader.hytale.com/hytale-downloader.zip\"\nDOWNLOAD_FILE=\"hytale-downloader.zip\"\n\nARCH=\"$(uname -m)\"\n\necho \"Platform: ${ARCH}\"\necho \"Installing base dependencies...\"\n\napt update\napt install -y curl unzip jq\n\n# ARM-only setup for running amd64 downloader\nif [ \"${ARCH}\" = \"aarch64\" ]; then\n echo \"ARM64 detected, enabling amd64 emulation with QEMU...\"\n\n apt install -y qemu-user-static\n\n dpkg --add-architecture amd64 || true\n apt update || true\n apt install -y libc6:amd64 || true\nfi\n\ncd /mnt/server\n\necho \"Starting Hytale downloader installation...\"\necho \"Downloading hytale-downloader.zip...\"\n\ncurl -L -o \"${DOWNLOAD_FILE}\" \"${DOWNLOAD_URL}\"\nif [ $? -ne 0 ]; then\n echo \"Error: Failed to download ${DOWNLOAD_URL}\"\n exit 1\nfi\n\necho \"Extracting ${DOWNLOAD_FILE}...\"\nunzip -o \"${DOWNLOAD_FILE}\"\nif [ $? -ne 0 ]; then\n echo \"Error: Failed to extract ${DOWNLOAD_FILE}\"\n exit 1\nfi\n\necho \"Cleaning up...\"\nrm -f \"${DOWNLOAD_FILE}\" QUICKSTART.md hytale-downloader-windows-amd64.exe\n\nchmod +x ./hytale-downloader-linux-amd64\n\n# ARM wrapper setup\nif [ \"${ARCH}\" = \"aarch64\" ]; then\n echo \"Setting up QEMU wrapper for amd64 downloader...\"\n\n cp /usr/bin/qemu-x86_64-static ./qemu-x86_64-static\n\n cat > ./hytale-downloader-linux-arm64 << 'EOF'\n#!/bin/bash\nset -e\n\nREAL_BIN=\"/home/container/hytale-downloader-linux-amd64\"\nQEMU_LOCAL=\"/home/container/qemu-x86_64-static\"\n\nif [ -x \"$QEMU_LOCAL\" ]; then\n exec \"$QEMU_LOCAL\" \"$REAL_BIN\" \"$@\"\nelse\n exec /usr/bin/qemu-x86_64-static \"$REAL_BIN\" \"$@\"\nfi\nEOF\n\n chmod +x ./hytale-downloader-linux-arm64\nfi\n\necho \"Installation complete!\"",
|
||||
"container": "ghcr.io/pelican-eggs/installers:debian",
|
||||
"entrypoint": "bash"
|
||||
}
|
||||
@@ -271,6 +272,32 @@
|
||||
],
|
||||
"sort": 13
|
||||
},
|
||||
{
|
||||
"name": "Override Identity Token",
|
||||
"description": "Optional identity token used to override the default authentication flow. This option only works when both override tokens are provided. If left empty, the server will prompt for authentication as usual. Intended for game server providers.",
|
||||
"env_variable": "OVERRIDE_IDENTITY_TOKEN",
|
||||
"default_value": "",
|
||||
"user_viewable": true,
|
||||
"user_editable": true,
|
||||
"rules": [
|
||||
"nullable",
|
||||
"string"
|
||||
],
|
||||
"sort": 25
|
||||
},
|
||||
{
|
||||
"name": "Override Session Token",
|
||||
"description": "Optional session token used to override the normal server authentication process. This option only takes effect when both override tokens are set. If left empty, the server will request authentication on startup. Intended for game server providers.",
|
||||
"env_variable": "OVERRIDE_SESSION_TOKEN",
|
||||
"default_value": "",
|
||||
"user_viewable": true,
|
||||
"user_editable": true,
|
||||
"rules": [
|
||||
"nullable",
|
||||
"string"
|
||||
],
|
||||
"sort": 24
|
||||
},
|
||||
{
|
||||
"name": "Patchline",
|
||||
"description": "What release channel you want to use",
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
"version": "PTDL_v2",
|
||||
"update_url": "https:\/\/raw.githubusercontent.com\/NATroutter\/egg-hytale\/refs\/heads\/main\/egg-hytale.pterodactyl.json"
|
||||
},
|
||||
"exported_at": "2026-01-15T12:29:34+02:00",
|
||||
"exported_at": "2026-01-15T16:19:47+02:00",
|
||||
"name": "Hytale",
|
||||
"author": "contact@natroutter.fi",
|
||||
"description": "Hytale is a block-based sandbox game that blends creative building with RPG adventure. Explore procedurally generated worlds filled with unique biomes, dungeons, and creatures. Build anything from simple homes to grand castles, craft items, and battle monsters. Create custom content with built-in modding tools, host your own servers, and shape the experience with plugins and mods. Play solo or with friends in a world designed for both creation and exploration.\r\n\r\nCredits:\r\n- Made by NATroutter\r\n- https:\/\/natroutter.fi\r\n- https:\/\/github.com\/NATroutter",
|
||||
@@ -24,7 +24,7 @@
|
||||
},
|
||||
"scripts": {
|
||||
"installation": {
|
||||
"script": "#!\/bin\/bash\r\nset -e\r\n\r\nDOWNLOAD_URL=\"https:\/\/downloader.hytale.com\/hytale-downloader.zip\"\r\nDOWNLOAD_FILE=\"hytale-downloader.zip\"\r\n\r\nARCH=\"$(uname -m)\"\r\n\r\necho \"Platform: ${ARCH}\"\r\necho \"Installing base dependencies...\"\r\n\r\napt update\r\napt install -y curl unzip jq\r\n\r\n# ARM-only setup for running amd64 downloader\r\nif [ \"${ARCH}\" = \"aarch64\" ]; then\r\n echo \"ARM64 detected, enabling amd64 emulation with QEMU...\"\r\n\r\n apt install -y qemu-user-static\r\n\r\n dpkg --add-architecture amd64 || true\r\n apt update || true\r\n apt install -y libc6:amd64 || true\r\nfi\r\n\r\ncd \/mnt\/server\r\n\r\necho \"Starting Hytale downloader installation...\"\r\necho \"Downloading hytale-downloader.zip...\"\r\n\r\ncurl -L -o \"${DOWNLOAD_FILE}\" \"${DOWNLOAD_URL}\"\r\nif [ $? -ne 0 ]; then\r\n echo \"Error: Failed to download ${DOWNLOAD_URL}\"\r\n exit 1\r\nfi\r\n\r\necho \"Extracting ${DOWNLOAD_FILE}...\"\r\nunzip -o \"${DOWNLOAD_FILE}\"\r\nif [ $? -ne 0 ]; then\r\n echo \"Error: Failed to extract ${DOWNLOAD_FILE}\"\r\n exit 1\r\nfi\r\n\r\necho \"Cleaning up...\"\r\nrm -f \"${DOWNLOAD_FILE}\" QUICKSTART.md hytale-downloader-windows-amd64.exe\r\n\r\nchmod +x .\/hytale-downloader-linux-amd64\r\n\r\n# ARM wrapper setup\r\nif [ \"${ARCH}\" = \"aarch64\" ]; then\r\n echo \"Setting up QEMU wrapper for amd64 downloader...\"\r\n\r\n cp \/usr\/bin\/qemu-x86_64-static .\/qemu-x86_64-static\r\n\r\n cat > .\/hytale-downloader-linux-arm64 << 'EOF'\r\n#!\/bin\/bash\r\nset -e\r\n\r\nREAL_BIN=\"\/home\/container\/hytale-downloader-linux-amd64\"\r\nQEMU_LOCAL=\"\/home\/container\/qemu-x86_64-static\"\r\n\r\nif [ -x \"$QEMU_LOCAL\" ]; then\r\n exec \"$QEMU_LOCAL\" \"$REAL_BIN\" \"$@\"\r\nelse\r\n exec \/usr\/bin\/qemu-x86_64-static \"$REAL_BIN\" \"$@\"\r\nfi\r\nEOF\r\n\r\n chmod +x .\/hytale-downloader-linux-arm64\r\nfi\r\n\r\n# Create version file\r\nif [ ! -f \"\/mnt\/server\/version.txt\" ]; then\r\n echo \"Creating version check file...\"\r\n touch \/mnt\/server\/version.txt\r\n chmod 666 \/mnt\/server\/version.txt\r\nfi\r\n\r\n# Create auth cache file\r\nif [ ! -f \"\/mnt\/server\/.hytale-auth-tokens.json\" ]; then\r\n echo \"Creating auth cache file...\"\r\n touch \/mnt\/server\/.hytale-auth-tokens.json\r\n chmod 666 \/mnt\/server\/.hytale-auth-tokens.json\r\nfi\r\n\r\necho \"Installation complete!\"",
|
||||
"script": "#!\/bin\/bash\r\nset -e\r\n\r\nDOWNLOAD_URL=\"https:\/\/downloader.hytale.com\/hytale-downloader.zip\"\r\nDOWNLOAD_FILE=\"hytale-downloader.zip\"\r\n\r\nARCH=\"$(uname -m)\"\r\n\r\necho \"Platform: ${ARCH}\"\r\necho \"Installing base dependencies...\"\r\n\r\napt update\r\napt install -y curl unzip jq\r\n\r\n# ARM-only setup for running amd64 downloader\r\nif [ \"${ARCH}\" = \"aarch64\" ]; then\r\n echo \"ARM64 detected, enabling amd64 emulation with QEMU...\"\r\n\r\n apt install -y qemu-user-static\r\n\r\n dpkg --add-architecture amd64 || true\r\n apt update || true\r\n apt install -y libc6:amd64 || true\r\nfi\r\n\r\ncd \/mnt\/server\r\n\r\necho \"Starting Hytale downloader installation...\"\r\necho \"Downloading hytale-downloader.zip...\"\r\n\r\ncurl -L -o \"${DOWNLOAD_FILE}\" \"${DOWNLOAD_URL}\"\r\nif [ $? -ne 0 ]; then\r\n echo \"Error: Failed to download ${DOWNLOAD_URL}\"\r\n exit 1\r\nfi\r\n\r\necho \"Extracting ${DOWNLOAD_FILE}...\"\r\nunzip -o \"${DOWNLOAD_FILE}\"\r\nif [ $? -ne 0 ]; then\r\n echo \"Error: Failed to extract ${DOWNLOAD_FILE}\"\r\n exit 1\r\nfi\r\n\r\necho \"Cleaning up...\"\r\nrm -f \"${DOWNLOAD_FILE}\" QUICKSTART.md hytale-downloader-windows-amd64.exe\r\n\r\nchmod +x .\/hytale-downloader-linux-amd64\r\n\r\n# ARM wrapper setup\r\nif [ \"${ARCH}\" = \"aarch64\" ]; then\r\n echo \"Setting up QEMU wrapper for amd64 downloader...\"\r\n\r\n cp \/usr\/bin\/qemu-x86_64-static .\/qemu-x86_64-static\r\n\r\n cat > .\/hytale-downloader-linux-arm64 << 'EOF'\r\n#!\/bin\/bash\r\nset -e\r\n\r\nREAL_BIN=\"\/home\/container\/hytale-downloader-linux-amd64\"\r\nQEMU_LOCAL=\"\/home\/container\/qemu-x86_64-static\"\r\n\r\nif [ -x \"$QEMU_LOCAL\" ]; then\r\n exec \"$QEMU_LOCAL\" \"$REAL_BIN\" \"$@\"\r\nelse\r\n exec \/usr\/bin\/qemu-x86_64-static \"$REAL_BIN\" \"$@\"\r\nfi\r\nEOF\r\n\r\n chmod +x .\/hytale-downloader-linux-arm64\r\nfi\r\n\r\necho \"Installation complete!\"",
|
||||
"container": "ghcr.io\/pelican-eggs\/installers:debian",
|
||||
"entrypoint": "bash"
|
||||
}
|
||||
@@ -259,6 +259,26 @@
|
||||
"user_editable": true,
|
||||
"rules": "required|integer|between:1,65535",
|
||||
"field_type": "text"
|
||||
},
|
||||
{
|
||||
"name": "Override Session Token",
|
||||
"description": "Optional session token used to override the normal server authentication process. This option only takes effect when both override tokens are set. If left empty, the server will request authentication on startup. Intended for game server providers.",
|
||||
"env_variable": "OVERRIDE_SESSION_TOKEN",
|
||||
"default_value": "",
|
||||
"user_viewable": true,
|
||||
"user_editable": true,
|
||||
"rules": "nullable|string",
|
||||
"field_type": "text"
|
||||
},
|
||||
{
|
||||
"name": "Override Identity Token",
|
||||
"description": "Optional identity token used to override the default authentication flow. This option only works when both override tokens are provided. If left empty, the server will prompt for authentication as usual. Intended for game server providers.",
|
||||
"env_variable": "OVERRIDE_IDENTITY_TOKEN",
|
||||
"default_value": "",
|
||||
"user_viewable": true,
|
||||
"user_editable": true,
|
||||
"rules": "nullable|string",
|
||||
"field_type": "text"
|
||||
}
|
||||
]
|
||||
}
|
||||
167
entry.sh
167
entry.sh
@@ -16,9 +16,8 @@
|
||||
|
||||
DOWNLOAD_URL="https://downloader.hytale.com/hytale-downloader.zip"
|
||||
DOWNLOAD_FILE="hytale-downloader.zip"
|
||||
VERSION_FILE="version.txt"
|
||||
AUTH_CACHE_FILE=".hytale-auth-tokens.json"
|
||||
DOWNLOADER="./hytale-downloader-linux-amd64"
|
||||
USE_DOWNLOADER=1;
|
||||
|
||||
# Detect architecture and set appropriate downloader binary
|
||||
ARCH=$(uname -m)
|
||||
@@ -163,7 +162,7 @@ create_game_session() {
|
||||
SESSION_RESPONSE=$(curl -s -X POST "https://sessions.hytale.com/game-session/new" \
|
||||
-H "Authorization: Bearer $ACCESS_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"uuid\": \"${PROFILE_UUID}\"}")
|
||||
-d "{\"uuid\": \"$PROFILE_UUID\"}")
|
||||
|
||||
# Validate JSON response
|
||||
if ! echo "$SESSION_RESPONSE" | jq empty 2>/dev/null; then
|
||||
@@ -188,6 +187,13 @@ create_game_session() {
|
||||
|
||||
# Function to save authentication tokens (refresh_token + profile_uuid only)
|
||||
save_auth_tokens() {
|
||||
|
||||
# Create auth cache file (only in standard mode, not GSP mode)
|
||||
if [ ! -f "$AUTH_CACHE_FILE" ]; then
|
||||
echo "Creating auth cache file..."
|
||||
touch $AUTH_CACHE_FILE
|
||||
fi
|
||||
|
||||
cat > "$AUTH_CACHE_FILE" << EOF
|
||||
{
|
||||
"refresh_token": "$REFRESH_TOKEN",
|
||||
@@ -329,70 +335,75 @@ else
|
||||
fi
|
||||
chmod -R 755 /home/container/backup
|
||||
|
||||
# Only proceed with downloader if on x86_64 architecture
|
||||
if [ "$USE_DOWNLOADER" = "1" ]; then
|
||||
# Check if the downloader exists
|
||||
if [ ! -f "$DOWNLOADER" ]; then
|
||||
echo "Error: Hytale downloader not found!"
|
||||
echo "Please run the installation script first."
|
||||
# Check if the downloader exists
|
||||
if [ ! -f "$DOWNLOADER" ]; then
|
||||
echo "Error: Hytale downloader not found!"
|
||||
echo "Please run the installation script first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the downloader is executable
|
||||
if [ ! -x "$DOWNLOADER" ]; then
|
||||
echo "Setting executable permissions..."
|
||||
chmod +x "$DOWNLOADER"
|
||||
fi
|
||||
|
||||
# Create version file
|
||||
if [ ! -f "$VERSION_FILE" ]; then
|
||||
echo "Creating version check file..."
|
||||
touch $VERSION_FILE
|
||||
fi
|
||||
|
||||
INITIAL_SETUP=0
|
||||
|
||||
# Check if credentials file exists, if not run the updater
|
||||
if [ ! -f ".hytale-downloader-credentials.json" ]; then
|
||||
INITIAL_SETUP=1
|
||||
echo "Credentials file not found, running initial setup..."
|
||||
echo "Downloading server files..."
|
||||
|
||||
$DOWNLOADER -check-update
|
||||
|
||||
echo " "
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " NOTE: You must have purchased Hytale on the account you are using to authenticate."
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " "
|
||||
|
||||
if ! $DOWNLOADER -patchline $PATCHLINE -download-path server.zip; then
|
||||
|
||||
echo ""
|
||||
echo "Error: Failed to download Hytale server files."
|
||||
echo "This may indicate:"
|
||||
echo " - You haven't purchased Hytale"
|
||||
echo " - Authentication credentials are invalid or expired"
|
||||
echo ""
|
||||
|
||||
echo "Removing invalid credential file..."
|
||||
rm -f .hytale-downloader-credentials.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Check if the downloader is executable
|
||||
if [ ! -x "$DOWNLOADER" ]; then
|
||||
echo "Setting executable permissions..."
|
||||
chmod +x "$DOWNLOADER"
|
||||
fi
|
||||
extract_server_files
|
||||
|
||||
INITIAL_SETUP=0
|
||||
# Save version info after initial setup
|
||||
DOWNLOADER_VERSION=$($DOWNLOADER -print-version 2>&1)
|
||||
|
||||
# Check if credentials file exists, if not run the updater
|
||||
if [ ! -f ".hytale-downloader-credentials.json" ]; then
|
||||
INITIAL_SETUP=1
|
||||
echo "Credentials file not found, running initial setup..."
|
||||
echo "Downloading server files..."
|
||||
|
||||
$DOWNLOADER -check-update
|
||||
|
||||
echo " "
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " NOTE: You must have purchased Hytale on the account you are using to authenticate."
|
||||
echo "════════════════════════════════════════════════════════════════"
|
||||
echo " "
|
||||
|
||||
if ! $DOWNLOADER -patchline $PATCHLINE -download-path server.zip; then
|
||||
echo ""
|
||||
echo "Error: Failed to download Hytale server files."
|
||||
echo "This may indicate:"
|
||||
echo " - You haven't purchased Hytale"
|
||||
echo " - Authentication credentials are invalid or expired"
|
||||
echo ""
|
||||
echo "Removing invalid credential file..."
|
||||
rm -f .hytale-downloader-credentials.json
|
||||
exit 1
|
||||
fi
|
||||
|
||||
extract_server_files
|
||||
|
||||
# Save version info after initial setup
|
||||
DOWNLOADER_VERSION=$($DOWNLOADER -print-version 2>&1)
|
||||
|
||||
if [ $? -eq 0 ] && [ -n "$DOWNLOADER_VERSION" ]; then
|
||||
echo "$DOWNLOADER_VERSION" > version.txt
|
||||
echo "✓ Saved version info to version.txt!"
|
||||
fi
|
||||
if [ $? -eq 0 ] && [ -n "$DOWNLOADER_VERSION" ]; then
|
||||
echo "$DOWNLOADER_VERSION" > $VERSION_FILE
|
||||
echo "✓ Saved version info!"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Run automatic update if enabled (only on x86_64)
|
||||
if [ "$USE_DOWNLOADER" = "1" ] && [ "${AUTOMATIC_UPDATE}" = "1" ] && [ "${INITIAL_SETUP}" = "0" ]; then
|
||||
# Run automatic update if enabled
|
||||
if [ "$AUTOMATIC_UPDATE" = "1" ] && [ "$INITIAL_SETUP" = "0" ]; then
|
||||
echo "Checking for updates..."
|
||||
|
||||
# Read local version from file
|
||||
if [ -f "version.txt" ]; then
|
||||
LOCAL_VERSION=$(cat version.txt)
|
||||
if [ -f "$VERSION_FILE" ]; then
|
||||
LOCAL_VERSION=$(cat $VERSION_FILE)
|
||||
else
|
||||
echo "version.txt not found, forcing update"
|
||||
echo "version file not found, forcing update"
|
||||
LOCAL_VERSION=""
|
||||
fi
|
||||
|
||||
@@ -416,9 +427,9 @@ if [ "$USE_DOWNLOADER" = "1" ] && [ "${AUTOMATIC_UPDATE}" = "1" ] && [ "${INITIA
|
||||
$DOWNLOADER -patchline $PATCHLINE -download-path server.zip
|
||||
extract_server_files
|
||||
|
||||
# Update version.txt after successful update
|
||||
echo "$DOWNLOADER_VERSION" > version.txt
|
||||
echo "✓ Saved version info to version.txt!"
|
||||
# Update version file after successful update
|
||||
echo "$DOWNLOADER_VERSION" > $VERSION_FILE
|
||||
echo "✓ Saved version info!"
|
||||
else
|
||||
echo "⨯ Versions match, skipping update"
|
||||
fi
|
||||
@@ -433,7 +444,7 @@ if [ ! -f "HytaleServer.jar" ]; then
|
||||
fi
|
||||
|
||||
# Download the latest hytale-sourcequery plugin if enabled
|
||||
if [ "${ENABLE_SOURCE_QUERY_SUPPORT}" = "1" ]; then
|
||||
if [ "$ENABLE_SOURCE_QUERY_SUPPORT" = "1" ]; then
|
||||
echo "Source Query support enabled, checking for plugin..."
|
||||
|
||||
# Create mods directory if it doesn't exist
|
||||
@@ -458,31 +469,37 @@ if [ "${ENABLE_SOURCE_QUERY_SUPPORT}" = "1" ]; then
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for cached authentication tokens
|
||||
if check_cached_tokens && load_cached_tokens; then
|
||||
echo "Using cached authentication..."
|
||||
if refresh_access_token; then
|
||||
# Update cache in case refresh token rotated
|
||||
save_auth_tokens
|
||||
# Create fresh game session
|
||||
if ! create_game_session; then
|
||||
exit 1
|
||||
# Check if GSP mode (tokens provided externally)
|
||||
if [ -n "$OVERRIDE_SESSION_TOKEN" ] && [ -n "$OVERRIDE_IDENTITY_TOKEN" ]; then
|
||||
echo "Using provided session and identity tokens..."
|
||||
SESSION_TOKEN="$OVERRIDE_SESSION_TOKEN"
|
||||
IDENTITY_TOKEN="$OVERRIDE_IDENTITY_TOKEN"
|
||||
else
|
||||
# Standard mode: perform authentication
|
||||
if check_cached_tokens && load_cached_tokens; then
|
||||
echo "Using cached authentication..."
|
||||
if refresh_access_token; then
|
||||
# Update cache in case refresh token rotated
|
||||
save_auth_tokens
|
||||
# Create fresh game session
|
||||
if ! create_game_session; then
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
# Refresh failed, need full re-auth
|
||||
echo "Refresh token expired, re-authenticating..."
|
||||
rm -f "$AUTH_CACHE_FILE"
|
||||
perform_authentication
|
||||
fi
|
||||
else
|
||||
# Refresh failed, need full re-auth
|
||||
echo "Refresh token expired, re-authenticating..."
|
||||
rm -f "$AUTH_CACHE_FILE"
|
||||
# Perform full authentication if no valid cache exists
|
||||
perform_authentication
|
||||
fi
|
||||
else
|
||||
# Perform full authentication if no valid cache exists
|
||||
perform_authentication
|
||||
fi
|
||||
|
||||
# Export the session tokens so they're available to start.sh
|
||||
export SESSION_TOKEN
|
||||
export IDENTITY_TOKEN
|
||||
export PROFILE_UUID
|
||||
|
||||
# Now call the pterodactyl entrypoint which will execute start.sh
|
||||
exec /bin/bash /entrypoint.sh
|
||||
5
start.sh
5
start.sh
@@ -99,11 +99,6 @@ if [ -n "${IDENTITY_TOKEN}" ]; then
|
||||
else
|
||||
echo "Warning: IDENTITY_TOKEN is not set"
|
||||
fi
|
||||
if [ -n "${PROFILE_UUID}" ]; then
|
||||
JAVA_CMD="${JAVA_CMD} --owner-uuid ${PROFILE_UUID}"
|
||||
else
|
||||
echo "Warning: PROFILE_UUID is not set"
|
||||
fi
|
||||
|
||||
# Add bind address
|
||||
JAVA_CMD="${JAVA_CMD} --bind 0.0.0.0:${SERVER_PORT}"
|
||||
|
||||
Reference in New Issue
Block a user