diff --git a/README.md b/README.md index 4606fc5..7410473 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Theme Song Booth -**Version:** `v0.5.6` +**Version:** `v0.5.7` A Flask web application for running a convention booth where visitors request a custom AI-generated theme song. Operators manage the queue from an admin dashboard, generate Suno prompts, upload MP3 previews, collect payment, and deliver final songs by email. diff --git a/VERSION b/VERSION index b49b253..d3532a1 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.5.6 +0.5.7 diff --git a/app.py b/app.py index 099fc82..20f9324 100644 --- a/app.py +++ b/app.py @@ -415,11 +415,12 @@ def mask_api_key(key): def get_ntfy_config(): - """Return the effective ntfy server URL and topic from runtime settings.""" + """Return the effective ntfy server URL, topic, and access token from runtime settings.""" cfg = load_booth_settings() return { 'server': cfg.get('ntfy_server', ''), 'topic': cfg.get('ntfy_topic', ''), + 'token': decrypt_value(cfg.get('ntfy_token', '')) or '', } @@ -437,6 +438,9 @@ def send_ntfy(message, title='Theme Song Booth', priority='default', tags='bell' 'Priority': priority, 'Tags': tags, } + token = ntfy.get('token', '') + if token: + headers['Authorization'] = f'Bearer {token}' try: resp = requests.post(url, data=message.encode('utf-8'), headers=headers, timeout=10) return resp.status_code in (200, 202) @@ -1672,10 +1676,13 @@ def admin_settings(): return redirect(url_for('admin_settings')) elif action == 'save_ntfy': - # Update ntfy push notification server/topic from the settings form. + # Update ntfy push notification server/topic/access token from the settings form. cfg = load_booth_settings() cfg['ntfy_server'] = request.form.get('ntfy_server', '').strip().rstrip('/') cfg['ntfy_topic'] = request.form.get('ntfy_topic', '').strip() + new_token = request.form.get('ntfy_token', '').strip() + if new_token: + cfg['ntfy_token'] = encrypt_value(new_token) save_booth_settings(cfg) flash('ntfy notification settings saved.', 'success') return redirect(url_for('admin_settings')) @@ -1690,7 +1697,7 @@ def admin_settings(): if ok: flash('Test ntfy notification sent.', 'success') else: - flash('Failed to send ntfy test notification. Check server and topic.', 'error') + flash('Failed to send ntfy test notification. Check server, topic, and access token.', 'error') return redirect(url_for('admin_settings')) return render_template( diff --git a/templates/admin/settings.html b/templates/admin/settings.html index 395da38..f94a0f2 100644 --- a/templates/admin/settings.html +++ b/templates/admin/settings.html @@ -308,6 +308,13 @@ ntfy Topic + + ntfy Access Token + + +

Required if the topic is access-controlled. Leave blank to keep the existing stored token.

+ +