diff --git a/app.py b/app.py index dec73d2..a120824 100644 --- a/app.py +++ b/app.py @@ -1347,9 +1347,14 @@ def admin_polling_add(): platform = request.form.get('platform') source_id = request.form.get('source_id') + custom_source_id = request.form.get('custom_source_id') display_name = request.form.get('display_name') poll_interval = int(request.form.get('poll_interval', 60)) + # Use custom source if provided, otherwise use dropdown + if custom_source_id and custom_source_id.strip(): + source_id = custom_source_id.strip() + if not platform or not source_id or not display_name: flash('Missing required fields', 'error') return redirect(url_for('admin_polling')) diff --git a/templates/admin_polling.html b/templates/admin_polling.html index c8932b9..d6599ca 100644 --- a/templates/admin_polling.html +++ b/templates/admin_polling.html @@ -223,6 +223,13 @@ +

Or enter custom source below

+ + +
+ + +

For Reddit: r/subreddit | For RSS: full URL | Leave blank to use dropdown

@@ -370,6 +377,16 @@ displayNameInput.value = selectedOption.dataset.displayName; } } + + // Handle custom source input - make dropdown optional when custom is filled + document.getElementById('custom_source_id').addEventListener('input', function() { + const sourceSelect = document.getElementById('source_id'); + if (this.value.trim()) { + sourceSelect.removeAttribute('required'); + } else { + sourceSelect.setAttribute('required', 'required'); + } + });