From 141537fa9aa0768dd517cbb804bf46b5eec4c8fe Mon Sep 17 00:00:00 2001 From: Sparky Fen Date: Thu, 2 Jul 2026 17:23:38 -0700 Subject: [PATCH 1/2] Bind publish as a boolean in create_extn The publish column is boolean (per the schema supersat posted in #2), and asyncpg rejects a str parameter for a boolean column, so inserting the string 't'/'f' fails with a DataError. Pass a real bool instead. --- steakweb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steakweb.py b/steakweb.py index 6b43db0..d80f0b4 100644 --- a/steakweb.py +++ b/steakweb.py @@ -156,7 +156,7 @@ async def create_extn(request): await init_db_pool() name = data.get('name', '') - publish = 't' if data.get('publish') else 'f' + publish = bool(data.get('publish')) if data['type'] == 'sip': switch = 11 authcode = gen_sip_pw() From 979ddfb019cc97e518f6c8131734c55bee95dea6 Mon Sep 17 00:00:00 2001 From: Sparky Fen Date: Thu, 2 Jul 2026 17:23:52 -0700 Subject: [PATCH 2/2] Read the published checkbox by its actual field name in publish_extn The homepage row form posts the checkbox as 'published', but the non-admin path read 'publish' with a default of '1', so a regular user could never unpublish a line. Use the same key and default as the admin path. --- steakweb.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/steakweb.py b/steakweb.py index d80f0b4..6988dbf 100644 --- a/steakweb.py +++ b/steakweb.py @@ -187,7 +187,7 @@ async def publish_extn(request): if check_auth_isadmin(session): n = await dbconn.execute("UPDATE registered_extensions SET publish = $2 WHERE extn = $1", int(data['extn']), data.get('published', '0')== '1') else: - n = await dbconn.execute("UPDATE registered_extensions SET publish = $2 WHERE extn = $1 AND userid = $3", int(data['extn']), data.get('publish', '1') == '1', int(session['uid'])) + n = await dbconn.execute("UPDATE registered_extensions SET publish = $2 WHERE extn = $1 AND userid = $3", int(data['extn']), data.get('published', '0') == '1', int(session['uid'])) if n != 'UPDATE 1': session['error'] = 'Could not change directory name; contact support'