Skip to content

Commit dc6efc7

Browse files
committed
v1.1.9: Linux stability fixes, RAM safety, smart close behavior
1 parent 150e02c commit dc6efc7

File tree

17 files changed

+398
-16019
lines changed

17 files changed

+398
-16019
lines changed

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@
3434

3535
| Platform | Download |
3636
|:--------:|:---------|
37-
| **Windows** | [📦 Download Installer (.exe)](https://github.com/CalaKuad1/Minecraft-Local-Server-GUI/releases/download/v1.1.7/Minecraft-Local-Server-GUI-Setup-1.1.7.exe) |
38-
| **Linux** | [📦 Download AppImage (.AppImage)](https://github.com/CalaKuad1/Minecraft-Local-Server-GUI/releases/download/v1.1.7/Minecraft-Local-Server-GUI-1.1.7.AppImage) |
37+
| **Windows** | [📦 Download Installer (.exe)](https://github.com/CalaKuad1/Minecraft-Local-Server-GUI/releases/download/v1.1.9/Minecraft-Local-Server-GUI-Setup-1.1.9.exe) |
38+
| **Linux** | [📦 Download AppImage (.AppImage)](https://github.com/CalaKuad1/Minecraft-Local-Server-GUI/releases/download/v1.1.9/Minecraft-Local-Server-GUI-1.1.9.AppImage) |
3939

4040
> **Note:** The app automatically downloads and manages Java for you. Just install and play!
4141
@@ -91,7 +91,7 @@
9191
### ⚙️ Configuration
9292
- **Visual settings editor** — No file editing required
9393
- **server.properties GUI** — All options organized by category
94-
- **RAM allocation** — Customize min/max memory per server
94+
- **RAM allocation** — Customize min/max memory per server with smart system limits
9595
- **Player management** — Op, ban, whitelist with one click
9696

9797
### 👥 Players
@@ -170,7 +170,7 @@ This project is configured with GitHub Actions. To trigger a new release with Wi
170170

171171
### For Users (Installer)
172172
- **Windows 10/11** (64-bit)
173-
- **Linux** (Any disto supporting AppImage or `.deb`)
173+
- **Linux** (Any distro supporting AppImage or `.deb`)
174174
- **Internet connection** (for initial Java download)
175175
- ~500MB disk space
176176

@@ -214,6 +214,12 @@ Server files are stored in the location you choose during setup. App configurati
214214
Click "Add Server" → "Use Existing" → Select your server folder. The app will auto-detect the server type and version.
215215
</details>
216216

217+
<details>
218+
<summary><strong>Where is app data stored on Linux?</strong></summary>
219+
220+
On Linux, all app data (Java runtimes, config files, logs) is stored in `~/.minecraft_server_gui/`. On Windows, it's in `%APPDATA%/MinecraftServerGUI`.
221+
</details>
222+
217223
---
218224

219225
## 📄 License

backend/api_server.exe

46.8 MB
Binary file not shown.

backend/api_server.py

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import collections
23
import threading
34
from fastapi import FastAPI, WebSocket, WebSocketDisconnect, HTTPException, Request, Query
45
from fastapi.middleware.cors import CORSMiddleware
@@ -55,8 +56,8 @@
5556
# Enable CORS
5657
app.add_middleware(
5758
CORSMiddleware,
58-
allow_origins=["*"],
59-
allow_credentials=True,
59+
allow_origin_regex=".*",
60+
allow_credentials=False,
6061
allow_methods=["*"],
6162
allow_headers=["*"],
6263
)
@@ -127,7 +128,7 @@ def __init__(self):
127128
self.active_handlers = {} # server_id -> ServerHandler
128129

129130
# App-level log history for Dashboard mini-console
130-
self.app_log_history = []
131+
self.app_log_history = collections.deque(maxlen=500)
131132

132133
def start_background_tasks(self):
133134
if self._log_broadcaster_task is None:
@@ -288,8 +289,7 @@ def broadcast_log_sync(self, message, level="normal", server_id=None):
288289

289290
if not is_verbose_installer:
290291
self.app_log_history.append(msg_obj)
291-
if len(self.app_log_history) > 500:
292-
self.app_log_history.pop(0)
292+
# deque auto-evicts oldest when full — no manual pop needed
293293

294294
# Thread-safe enqueue into the asyncio queue (only non-verbose logs)
295295
try:
@@ -1687,12 +1687,14 @@ def watch():
16871687
raise psutil.NoSuchProcess(parent_pid)
16881688
except (psutil.NoSuchProcess, psutil.AccessDenied):
16891689
logging.warning("Parent process lost. Shutting down backend and servers...")
1690-
# Intentar cerrar servidores limpiamente si es posible
1691-
if state and state.server_handler:
1692-
try:
1693-
state.server_handler.stop(force=True, silent=True)
1694-
except:
1695-
pass
1690+
# Stop ALL active server handlers, not just the selected one
1691+
if state and state.active_handlers:
1692+
for server_id, handler in state.active_handlers.items():
1693+
try:
1694+
if handler.is_running() or handler.is_starting():
1695+
handler.stop(force=True, silent=True)
1696+
except:
1697+
pass
16961698
os._exit(0)
16971699
time.sleep(2)
16981700

@@ -1908,6 +1910,37 @@ def progress(pct, msg):
19081910
threading.Thread(target=run_plugin_install, daemon=True).start()
19091911
return {"status": "started", "message": "Plugin installation started"}
19101912

1913+
# --- System Info (RAM validation) ---
1914+
1915+
@app.get("/system/info")
1916+
def get_system_info():
1917+
"""Returns system information for frontend validation (e.g. RAM limits)."""
1918+
try:
1919+
mem = psutil.virtual_memory()
1920+
total_gb = round(mem.total / (1024 ** 3), 1)
1921+
available_gb = round(mem.available / (1024 ** 3), 1)
1922+
return {
1923+
"total_ram_gb": total_gb,
1924+
"available_ram_gb": available_gb,
1925+
"cpu_count": psutil.cpu_count(logical=True),
1926+
# Recommended max: 80% of total RAM
1927+
"max_recommended_ram_gb": round(total_gb * 0.8, 1)
1928+
}
1929+
except Exception as e:
1930+
logging.error(f"Error getting system info: {e}")
1931+
return {"total_ram_gb": 16, "available_ram_gb": 8, "cpu_count": 4, "max_recommended_ram_gb": 12}
1932+
1933+
@app.get("/servers/running")
1934+
def get_running_servers():
1935+
"""Returns whether any server is currently running. Used by Electron close handler."""
1936+
if not state:
1937+
return {"any_running": False}
1938+
for handler in state.active_handlers.values():
1939+
if handler.is_running() or handler.is_starting():
1940+
return {"any_running": True}
1941+
return {"any_running": False}
1942+
1943+
19111944
if __name__ == "__main__":
19121945
import uvicorn
19131946
# Iniciar el watchdog antes de arrancar el servidor

backend/api_server.spec

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# -*- mode: python ; coding: utf-8 -*-
2+
3+
4+
a = Analysis(
5+
['api_server.py'],
6+
pathex=[],
7+
binaries=[],
8+
datas=[],
9+
hiddenimports=[],
10+
hookspath=[],
11+
hooksconfig={},
12+
runtime_hooks=[],
13+
excludes=[],
14+
noarchive=False,
15+
optimize=0,
16+
)
17+
pyz = PYZ(a.pure)
18+
19+
exe = EXE(
20+
pyz,
21+
a.scripts,
22+
a.binaries,
23+
a.datas,
24+
[],
25+
name='api_server',
26+
debug=False,
27+
bootloader_ignore_signals=False,
28+
strip=False,
29+
upx=True,
30+
upx_exclude=[],
31+
runtime_tmpdir=None,
32+
console=True,
33+
disable_windowed_traceback=False,
34+
argv_emulation=False,
35+
target_arch=None,
36+
codesign_identity=None,
37+
entitlements_file=None,
38+
)

backend/main.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)