From 4309efcbb0f1fe449485cbc92c5494d8b2a316d3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=B6dl?= Date: Thu, 24 Jul 2025 15:49:26 +0200 Subject: [PATCH 1/7] =?UTF-8?q?Fixed=20crash=20when=20status=20folder=20?= =?UTF-8?q?=E2=80=98waiting=E2=80=99=20doesn=E2=80=99t=20exist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- spooler.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/spooler.py b/spooler.py index b7ef43c..66ab4ef 100644 --- a/spooler.py +++ b/spooler.py @@ -663,8 +663,12 @@ def attr(attr, ns = NS): async def resume_queue_from_disk(): import xml.etree.ElementTree as ElementTree - list = sorted(os.listdir(STATUS_FOLDERS['waiting'])) - list = [ os.path.join(STATUS_FOLDERS['waiting'], x) for x in list if x.endswith('.svg') ] + try: + list = sorted(os.listdir(STATUS_FOLDERS['waiting'])) + list = [ os.path.join(STATUS_FOLDERS['waiting'], x) for x in list if x.endswith('.svg') ] + except FileNotFoundError: + list = [] + resumable_jobs = [] for filename in list: # print('Loading ', filename) From 778fb154aeb104b5c32d84d6e7c3aaad607cc710 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=B6dl?= Date: Fri, 25 Jul 2025 15:07:02 +0200 Subject: [PATCH 2/7] Automatically activate virtual env (venv/bin/activate) --- start | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/start b/start index cfdafac..4fc8a70 100755 --- a/start +++ b/start @@ -74,6 +74,12 @@ if $start_ngrok; then ngrok_pid=$! fi +# Try to activate venv +if [ -f ./venv/bin/activate ]; then + echo "Activating virtual env..." + source ./venv/bin/activate +fi + # run plotter-server if $dev; then textual run --dev main.py From 7023f73815807f63b3d8a5bf0dd20bd30d813ea6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=B6dl?= Date: Fri, 25 Jul 2025 15:14:43 +0200 Subject: [PATCH 3/7] Warn about missing Porkbun config file --- porkbun.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/porkbun.py b/porkbun.py index fa979b2..7f839dd 100644 --- a/porkbun.py +++ b/porkbun.py @@ -15,6 +15,9 @@ def get_lanip(): return ipaddrlist[-1] def get_config(): + if not os.path.exists(CONFIG_FILE): + print(f"Error: Porkbun (DNS Service) config file is missing: {CONFIG_FILE}") + exit() with open(CONFIG_FILE) as f: api_config = json.load(f) return api_config From ce030fcc6b57c0ba8471407b2eed529bfa94b264 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=B6dl?= Date: Fri, 25 Jul 2025 15:27:10 +0200 Subject: [PATCH 4/7] Add warning for missing frp.aut --- frpc.sh | 12 +++++++++--- start | 2 +- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/frpc.sh b/frpc.sh index 25542f7..896e600 100755 --- a/frpc.sh +++ b/frpc.sh @@ -12,14 +12,20 @@ frpc=$(which "frpc") if [[ -z $frpc ]]; then frpc=$(which "../frp-mac/latest/frpcx") if [[ -z $frpc ]]; then - >&2 echo "frpc not found; try installing with 'brew install frpc'" + >&2 echo "Error: frpc not found; Try installing with 'brew install frpc'" exit 1 fi fi ->&2 echo "Using frpc: $frpc" ->&2 echo "Plotter URL (via frp): wss://plotter.process.tools" +if [[ ! -f ./frp.authx ]]; then + >&2 echo "Error: Missing frp auth file: frp.auth" + exit 1 +fi + source frp.auth # read auth token from file export FRP_AUTH_TOKEN +>&2 echo "Using frpc: $frpc" +>&2 echo "Plotter URL (via frp): wss://plotter.process.tools" + $frpc -c frpc.toml diff --git a/start b/start index 4fc8a70..871caeb 100755 --- a/start +++ b/start @@ -75,7 +75,7 @@ if $start_ngrok; then fi # Try to activate venv -if [ -f ./venv/bin/activate ]; then +if [[ -f ./venv/bin/activate ]]; then echo "Activating virtual env..." source ./venv/bin/activate fi From 3f4c3bf21dfa47424b7d6f747a90d071f63c8a40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=B6dl?= Date: Fri, 25 Jul 2025 16:22:09 +0200 Subject: [PATCH 5/7] =?UTF-8?q?Don=E2=80=99t=20swallow=20server=20task=20e?= =?UTF-8?q?xceptions=20Reprint=20after=20app=20exit?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/main.py b/main.py index b60e287..ed54385 100644 --- a/main.py +++ b/main.py @@ -274,14 +274,16 @@ def on_mount(self): server_task = asyncio.create_task(run_server(self)) def on_server_task_exit(task): - tprint('server task exit') + print('[red]Server task exit') if not task.cancelled(): # not a intentional exit ex = task.exception() if ex != None: import traceback - tprint('Server task exception:') - tprint(''.join(traceback.format_exception(ex))) - self.exit() + print('Server task exited with exception:') + print(''.join(traceback.format_exception(ex))) + global server_task_exception + server_task_exception = ex + self.exit() # This line can be removed, exception will then be show inside app log area server_task.add_done_callback(on_server_task_exit) @@ -561,6 +563,8 @@ def prompt_ui(self, variant, message = ''): if __name__ == "__main__": global print global tprint + global server_task_exception + tprint = print if USE_PORKBUN: @@ -574,4 +578,10 @@ def prompt_ui(self, variant, message = ''): print = app.print app.tprint = tprint - app.run() \ No newline at end of file + app.run() + + print = tprint # restore print function + if server_task_exception != None: + print() + print("Server task exited with exception:") + raise server_task_exception \ No newline at end of file From 8146e1b83578d5db438355121c704999dc7207c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=B6dl?= Date: Thu, 4 Sep 2025 18:05:54 +0200 Subject: [PATCH 6/7] Fixed error in frpc.sh --- frpc.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frpc.sh b/frpc.sh index 896e600..e9a0627 100755 --- a/frpc.sh +++ b/frpc.sh @@ -10,14 +10,14 @@ trap quit EXIT # find frpc frpc=$(which "frpc") if [[ -z $frpc ]]; then - frpc=$(which "../frp-mac/latest/frpcx") + frpc=$(which "../frp-mac/latest/frpc") if [[ -z $frpc ]]; then >&2 echo "Error: frpc not found; Try installing with 'brew install frpc'" exit 1 fi fi -if [[ ! -f ./frp.authx ]]; then +if [[ ! -f ./frp.auth ]]; then >&2 echo "Error: Missing frp auth file: frp.auth" exit 1 fi From d1186594ab5dea7df79d5dd30945c472ecc66926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=B6dl?= Date: Thu, 29 Jan 2026 16:24:52 +0100 Subject: [PATCH 7/7] Fix `name 'server_task_exception' is not defined` --- main.py | 1 + 1 file changed, 1 insertion(+) diff --git a/main.py b/main.py index ed54385..f0a9e76 100644 --- a/main.py +++ b/main.py @@ -566,6 +566,7 @@ def prompt_ui(self, variant, message = ''): global server_task_exception tprint = print + server_task_exception = None if USE_PORKBUN: porkbun.ddns_update(PORKBUN_ROOT_DOMAIN, PORKBUN_SUBDOMAIN, PORKBUN_TTL)