fix: real listener restart + remove listen_port editing from UI
Reviewer concerns: 1. POST /api/proxy/restart only saved config (reload), did not restart the listener. Now it touches data/restart.signal; proxy watcher polls that file separately and force-restarts the listener even when config is unchanged. 2. Editing proxy.listen_port via UI could break Docker port mapping (compose publishes 25565:25565 only). UI now shows it read-only; README documents how to change it together with compose. - proxy/main.py: ProxyState.check_restart_signal() + watcher uses it - api/config_io.py: touch_restart_signal() helper - api/routes/status.py: /api/proxy/restart -> touch_restart_signal() - frontend Settings: disabled listen_port input + 프록시 재시작 button - README + .gitignore updated
This commit is contained in:
@@ -6,7 +6,7 @@ import time
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from config_io import LOG_DB, load_config, save_config
|
||||
from config_io import LOG_DB, load_config, touch_restart_signal
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
@@ -53,7 +53,10 @@ def status() -> dict:
|
||||
|
||||
@router.post("/proxy/restart")
|
||||
def restart_proxy() -> dict:
|
||||
"""config 파일 mtime 을 갱신해서 프록시 watcher 가 재로드하게 한다."""
|
||||
cfg = load_config()
|
||||
save_config(cfg)
|
||||
return {"ok": True, "note": "config touched; proxy will reload"}
|
||||
"""프록시 listener 를 강제로 stop → start 시킨다.
|
||||
|
||||
config 가 바뀌지 않았어도 listener 자체를 재시작하기 때문에 단순
|
||||
config reload 와는 다르다. (proxy watcher 가 별도 신호 파일을 폴링)
|
||||
"""
|
||||
ts = touch_restart_signal()
|
||||
return {"ok": True, "restart_signal_ts": ts}
|
||||
|
||||
Reference in New Issue
Block a user