Skip to content

Commit ec44a00

Browse files
committed
Merge branch '1.21.4' into 1.21.11
2 parents b11a2c2 + 97066e6 commit ec44a00

File tree

21 files changed

+253
-175
lines changed

21 files changed

+253
-175
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,4 +36,5 @@ buildSrc/.gradle
3636
buildSrc/.kotlin
3737
buildSrc/build
3838
.python-version
39-
uv.lock
39+
src/launcher/uv.lock
40+
src/launcher/pyproject.toml

docs/wiki/Commands.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ Debug settings for features in testing or for use in development.
479479

480480
```debug uploadDebugLog```
481481

482+
```debug uploadLauncherLog```
483+
482484
```debug passthroughResourcePacks on/off```
483485

484486

docs/wiki/Setup.md

Lines changed: 23 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
* `java` release channel (Any OS and CPU):
1111
* ~600MB RAM
1212

13-
??? tip "Don't have enough RAM on your Linux VPS?"
13+
???+ tip "Don't have enough RAM on your Linux VPS?"
1414

15-
Use your hard drive as RAM: https://linuxize.com/post/create-a-linux-swap-file/
15+
Use your hard drive as (slow) RAM: [https://linuxize.com/post/create-a-linux-swap-file/](https://linuxize.com/post/create-a-linux-swap-file/)
1616

1717
### Setup Guides
1818

@@ -21,7 +21,16 @@
2121

2222
### Downloads
2323

24-
1. Download [the launcher zip](https://github.com/rfresh2/ZenithProxy/releases/launcher-v3) for your OS and CPU
24+
* [Windows x64](https://github.com/rfresh2/ZenithProxy/releases/download/launcher-v3/ZenithProxy-launcher-windows-python-amd64.zip)
25+
* Linux: [x64](https://github.com/rfresh2/ZenithProxy/releases/download/launcher-v3/ZenithProxy-launcher-linux-amd64.zip) or [aarch64 (ARM)](https://github.com/rfresh2/ZenithProxy/releases/download/launcher-v3/ZenithProxy-launcher-linux-aarch64.zip)
26+
* Mac: [M-series CPU](https://github.com/rfresh2/ZenithProxy/releases/download/launcher-v3/ZenithProxy-launcher-macos-aarch64.zip) or [x64 (Intel)](https://github.com/rfresh2/ZenithProxy/releases/download/launcher-v3/ZenithProxy-launcher-macos-amd64.zip)
27+
* Other: [Python (Universal)](https://github.com/rfresh2/ZenithProxy/releases/download/launcher-v3/ZenithProxy-launcher-python.zip)
28+
29+
Source: https://github.com/rfresh2/ZenithProxy/releases/tag/launcher-v3
30+
31+
#### Instructions
32+
33+
1. Download the above launcher release for your OS and CPU
2534
2. Unzip the file.
2635
3. Run the launcher in a terminal:
2736
* Linux/Mac: `./launch`
@@ -48,10 +57,6 @@
4857

4958
The launcher will ask for required configuration on first launch
5059

51-
??? note "How to Rerun Launcher Setup"
52-
53-
Run the launcher with the `--setup` flag. e.g. `./launch --setup`
54-
5560
Use the `connect` command to link an MC account and log in once launched
5661

5762
Command Prefixes:
@@ -60,6 +65,16 @@ Command Prefixes:
6065
* In-game: `/` OR `!` -> (e.g. `/help`)
6166
* Terminal: N/A -> (e.g. `help`)
6267

68+
???+ tip "How to Rerun Launcher Setup"
69+
70+
Run the launcher with the `--setup` flag. e.g. `./launch --setup`
71+
72+
???+ tip "How to exit a running instance"
73+
74+
Press the keybind: `control + c`
75+
76+
Some terminals have alternate keybinds. If all else fails, just close the window
77+
6378
[Full Commands Documentation](Commands.md){ .md-button .md-button--primary }
6479

6580
[Frequently Asked Questions](FAQ.md){ .md-button .md-button--primary }
@@ -71,7 +86,7 @@ ZenithProxy releases for multiple MC versions and OS/hardware platforms, known a
7186
**Platforms**
7287

7388
* (Default) `java` - Works on all systems. Supports [Plugins](Plugins.md).
74-
* (Recommended) `linux` - Linux native x86_64 executable. ~50% reduced memory usage and instant startup
89+
* (Recommended) `linux` - Linux native x64 executable. ~50% reduced memory usage and instant startup
7590

7691
**MC Versions**
7792

docs/zensical.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ features = [
243243
# automatically updated with the active anchor as highlighted in the table
244244
# of contents.
245245
# https://zensical.org/docs/setup/navigation/#anchor-tracking
246-
"navigation.tracking",
246+
# "navigation.tracking",
247247

248248
# When search highlighting is enabled and a user clicks on a search result,
249249
# Zensical will highlight all occurrences after following the link.

gradle/wrapper/gradle-wrapper.jar

542 Bytes
Binary file not shown.

gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-9.2.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.0-bin.zip
44
networkTimeout=10000
55
validateDistributionUrl=true
66
zipStoreBase=GRADLE_USER_HOME

src/launcher/__main__.py

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,24 +3,34 @@
33
import sys
44
import time
55

6-
import certifi
6+
if sys.version_info[0] < 3 or sys.version_info[1] < 6:
7+
# f strings added in 3.6
8+
# it's possible other things will break pre 3.10, not sure tho
9+
print("CRITICAL: Python 3.10 or higher is required. Current version: " + str(sys.version_info[0]) + "." + str(sys.version_info[1]))
10+
sys.exit(1)
11+
12+
if sys.version_info[1] < 10:
13+
print("WARNING: Python 3.10 or higher is required. Current version: " + str(sys.version_info[0]) + "." + str(sys.version_info[1]))
14+
15+
from log import info, critical_error
716

17+
info("ZenithProxy Launcher Initializing...")
18+
info(f"Python Version: {sys.version_info[0]}.{sys.version_info[1]}.{sys.version_info[2]}")
19+
20+
import certifi
821
import github_api
922
import launch_platform
1023
from launch_config import LaunchConfig, read_launch_config_file
1124
from launcher import launcher_exec
1225
from setup import setup_execute, rescue_invalid_system, setup_unattended
1326
from update_launcher import update_launcher_exec
1427
from update_zenith import update_zenith_exec
15-
from utils import critical_error
1628

1729
ssl._create_default_https_context = lambda: ssl.create_default_context(cafile=certifi.where())
1830

1931
config = LaunchConfig()
2032
api = github_api.GitHubAPI(config)
2133

22-
print("ZenithProxy Launcher Initializing...")
23-
2434
# Certain platforms like mac seem to not have the correct cwd set correctly when double clicking the executable
2535
if launch_platform.is_pyinstaller_bundle():
2636
current_cwd = os.getcwd()
@@ -56,17 +66,17 @@
5666
if json_data is None:
5767
if unattended:
5868
critical_error("launch_config.json not found and unattended setup is enabled")
59-
print("Running setup...")
69+
info("Running setup...")
6070
setup_execute(config)
6171
continue
6272
config.load_launch_config_data(json_data)
6373
if not config.validate_launch_config():
6474
if unattended:
6575
critical_error("launch_config.json has invalid values and unattended setup is enabled")
66-
print("launch_config.json has invalid values, running setup...")
76+
info("launch_config.json has invalid values, running setup...")
6777
setup_execute(config)
6878
continue
69-
print("Loaded launch_config.json successfully")
79+
info("Loaded launch_config.json successfully")
7080
if not launch_platform.validate_system_with_config(config):
7181
if unattended:
7282
critical_error("System validation failed and unattended setup is enabled")
@@ -78,7 +88,7 @@
7888
update_launcher_exec(config, api)
7989
update_zenith_exec(config, api)
8090
launcher_exec(config)
81-
print("Restarting in 3 seconds...")
91+
info("Restarting in 3 seconds...")
8292
time.sleep(3)
8393
except KeyboardInterrupt:
8494
sys.exit(0)

src/launcher/github_api.py

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
from requests.adapters import HTTPAdapter
55
from urllib3 import Retry
66

7+
from log import info, error
8+
79

810
class GitHubAPI:
911
launch_config = None
@@ -62,7 +64,7 @@ def get_latest_release_and_ver(self, channel):
6264
)
6365
return (latest_release["id"], latest_release["tag_name"]) if latest_release else None
6466
except Exception as e:
65-
print("Failed to get releases:", e)
67+
error("Failed to get releases: %s", e)
6668
return None
6769

6870
def get_release_for_ver(self, tag_name):
@@ -72,7 +74,7 @@ def get_release_for_ver(self, tag_name):
7274
release = response.json()
7375
return release["id"], release["tag_name"]
7476
except Exception as e:
75-
print("Failed to get release for version:", e)
77+
error("Failed to get release for version: %s", e)
7678
return None
7779

7880
def get_asset_id(self, release_id, asset_name, tag=False):
@@ -81,7 +83,7 @@ def get_asset_id(self, release_id, asset_name, tag=False):
8183
response = self._send_request(url, self.get_headers())
8284
return next((asset["id"] for asset in response.json()["assets"] if asset["name"] == asset_name), None)
8385
except Exception as e:
84-
print("Failed to get release asset ID:", e)
86+
error("Failed to get release asset ID: %s", e)
8587
return None
8688

8789
def get_release_asset_id(self, release_id, asset_name):
@@ -103,6 +105,8 @@ def download_asset(self, asset_id, verbose=False):
103105
data = bytearray()
104106
# start timer when streaming begins
105107
start_time = time.time()
108+
if verbose:
109+
info(f"Downloading {url}:")
106110

107111
for chunk in response.iter_content(chunk_size=chunk_size):
108112
if not chunk:
@@ -121,14 +125,14 @@ def download_asset(self, asset_id, verbose=False):
121125
percent = downloaded * 100 / total
122126
total_kb = total / 1024
123127
if verbose:
124-
print(f"\rDownloading {url}: {percent:.1f}% ({downloaded_kb:.1f}/{total_kb:.1f} KB) {elapsed_str}", end="", flush=True)
128+
print(f"\r{percent:.1f}% ({downloaded_kb:.1f}/{total_kb:.1f} KB) {elapsed_str}", end="", flush=True)
125129
else:
126130
if verbose:
127-
print(f"\rDownloading {url}: {asset_id}: {downloaded_kb:.1f} KB {elapsed_str}", end="", flush=True)
131+
print(f"\r{downloaded_kb:.1f} KB {elapsed_str}", end="", flush=True)
128132
if verbose:
129133
print()
130134

131135
return bytes(data)
132136
except Exception as e:
133-
print("Failed to download asset:", e)
137+
error("Failed to download asset: %s", e)
134138
return None

src/launcher/jdk_install.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import jdk
77

88
import launch_platform
9-
from utils import critical_error
9+
from log import info, error, warn, critical_error
1010

1111
_USER_DIR = os.path.expanduser("~")
1212
_JDK_DIR = os.path.join(_USER_DIR, ".jdk")
@@ -32,7 +32,7 @@ def get_java_executable(min_version=21, install_type=JavaInstallType.AUTO_INSTAL
3232
elif install_type == JavaInstallType.NO_INSTALL:
3333
critical_error("Java not found and both auto install and user prompt disabled.")
3434
if not java_path:
35-
print("Failed to install Java.")
35+
warn("Failed to install Java.")
3636
return None
3737
return java_path
3838

@@ -73,9 +73,9 @@ def _locate_java_from_env(env_var, min_version):
7373

7474

7575
def _install_java():
76-
print("Installing Java to:", _JDK_DIR)
76+
info(f"Installing Java to: {_JDK_DIR}")
7777
install_dir = jdk.install("25", path=_JDK_DIR)
78-
print("Java installed successfully to:", install_dir)
78+
info(f"Java installed successfully to: {install_dir}")
7979

8080

8181
def _java_exe_extension():
@@ -131,13 +131,13 @@ def _locate_java(min_version):
131131

132132
def _java_install_prompt():
133133
while True:
134-
print("Automatically install Java? (y/n)")
134+
info("Automatically install Java? (y/n)")
135135
i1 = input("> ")
136136
if i1 == "y":
137137
_install_java()
138138
break
139139
elif i1 == "n":
140-
print("Please install Java 21+ and try again.")
140+
error("Please install Java 21+ and try again.")
141141
break
142142
else:
143-
print("Invalid input. Enter y or n")
143+
error("Invalid input. Enter y or n")

src/launcher/launch_config.py

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import os
33
import re
44

5-
from utils import critical_error
5+
from log import info, error, critical_error
66

77

88
def version_looks_valid(ver):
@@ -19,10 +19,10 @@ def read_launch_config_file():
1919
data = json.load(f)
2020
return data
2121
except FileNotFoundError:
22-
print("launch_config.json not found")
22+
info("launch_config.json not found")
2323
return None
2424
except json.decoder.JSONDecodeError:
25-
print("launch_config.json is invalid")
25+
error("launch_config.json is invalid")
2626
return None
2727

2828

@@ -51,7 +51,7 @@ def load_launch_config_data(self, data):
5151
self.repo_name = data.get("repo_name", self.repo_name)
5252
self.custom_jvm_args = data.get("custom_jvm_args", self.custom_jvm_args)
5353
if self.custom_jvm_args is not None and self.custom_jvm_args != "":
54-
print("Using custom JVM args:", self.custom_jvm_args)
54+
info(f"Using custom JVM args: {self.custom_jvm_args}")
5555

5656
def write_launch_config(self):
5757
output = {
@@ -70,28 +70,30 @@ def write_launch_config(self):
7070
os.replace("launch_config.json.tmp", "launch_config.json")
7171

7272
def create_default_launch_config(self):
73-
print("Creating default launch_config.json")
73+
info("Creating default launch_config.json")
7474
self.write_launch_config()
7575

7676
def validate_launch_config(self):
7777
if not valid_release_channel(self.release_channel):
78-
print("Invalid release channel:", self.release_channel)
78+
error(f"Invalid release channel: {self.release_channel}")
7979
return False
8080
if not version_looks_valid(self.version):
81-
print("Invalid version string:", self.version)
81+
error(f"Invalid version string: {self.version}")
8282
return False
8383
if self.repo_name == "":
84-
print("Invalid repo name:", self.repo_name)
84+
error(f"Invalid repo name: {self.repo_name}")
8585
return False
8686
if self.repo_owner == "":
87-
print("Invalid repo owner:", self.repo_owner)
87+
error(f"Invalid repo owner: {self.repo_owner}")
8888
return False
8989
return True
9090

9191
def get_mc_version(self):
9292
# extract mc version from release channel
9393
# e.g. java.1.20.1 -> 1.20.1 or linux.1.20.1 -> 1.20.1
94-
channel = self.release_channel.removesuffix(".pre")
94+
channel = self.release_channel
95+
if channel.endswith(".pre"):
96+
channel = channel[:-4]
9597
java = channel.startswith("java")
9698
linux = channel.startswith("linux")
9799
if channel.find(".") == -1 or (not java and not linux):

0 commit comments

Comments
 (0)