From ca174df03866ca781a4fcd00d2dbb4c695200669 Mon Sep 17 00:00:00 2001 From: Advocaite Date: Sat, 3 Oct 2026 07:01:27 +0800 Subject: [PATCH] Support site: relative cert paths, RA login from the launcher's console account (repack) --- contrib/support_site/support_server.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/contrib/support_site/support_server.py b/contrib/support_site/support_server.py index 3854471ae0..81c85bc57b 100644 --- a/contrib/support_site/support_server.py +++ b/contrib/support_site/support_server.py @@ -1088,6 +1088,22 @@ def load_config(path): global CFG with open(path, encoding='utf-8') as f: CFG = json.load(f) + # paths in the config may be relative to the config file (repack: web\support_site.json -> ..\server\forever.cert.pem) + base = os.path.dirname(os.path.abspath(path)) + for key in ('cert', 'key'): + if CFG.get(key) and not os.path.isabs(CFG[key]): + CFG[key] = os.path.normpath(os.path.join(base, CFG[key])) + # no RA account of its own: use the launcher's console account (localservers.json "consoleUser"/"consolePassword") + ra = CFG.setdefault('ra', {}) + if not ra.get('user') and ra.get('localservers'): + try: + with open(os.path.normpath(os.path.join(base, ra['localservers'])), encoding='utf-8-sig') as f: + for server in json.load(f).values(): + if server.get('consoleUser'): + ra['user'], ra['password'] = server['consoleUser'], server.get('consolePassword', '') + break + except (OSError, ValueError) as e: + print('RA account from localservers.json:', e) def ensure_armory_export():