From 91382fc53c2ec7981f09758d6abde9beec49c5c2 Mon Sep 17 00:00:00 2001 From: SirHumza <204067870+SirHumza@users.noreply.github.com> Date: Sat, 15 Aug 2026 00:32:34 +0200 Subject: [PATCH] daemon: reload config before each token attempt The daemon loaded config once at startup and held it in memory, so an operator editing auth_code/refresh_token on the console (FTP) while it ran was ignored. Re-read the disk config each ensure_token() so edits take effect live without a plugin reload. --- orbisrpc/daemon.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/orbisrpc/daemon.c b/orbisrpc/daemon.c index fea35d4..7329e69 100644 --- a/orbisrpc/daemon.c +++ b/orbisrpc/daemon.c @@ -28,6 +28,10 @@ void daemon_request_stop(void){ s_stop = 1; } void daemon_clear_stop(void){ s_stop = 0; } static int ensure_token(void){ + /* Re-read config each attempt: the operator edits auth_code/refresh_token + * on the console (FTP) while the daemon runs, and cfg_save() persists new + * tokens after refresh — the disk file is the source of truth. */ + cfg_load(CFG_PATH, &g_cfg); int64_t now=time(NULL); if(g_cfg.access_token[0] && now < g_cfg.token_expires_at - 120) return 0; /* fresh */ char at[256]="", rt[256]=""; int64_t exp=0;