diff --git a/changedetectionio/blueprint/price_data_follower/__init__.py b/changedetectionio/blueprint/price_data_follower/__init__.py index 8cb504aea..1be81c389 100644 --- a/changedetectionio/blueprint/price_data_follower/__init__.py +++ b/changedetectionio/blueprint/price_data_follower/__init__.py @@ -14,7 +14,7 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q: PriorityQueue price_data_follower_blueprint = Blueprint('price_data_follower', __name__) - @price_data_follower_blueprint.route("//accept", methods=['GET']) + @price_data_follower_blueprint.route("//accept", methods=['POST']) @login_optionally_required def accept(uuid): datastore.data['watching'][uuid]['track_ldjson_price_data'] = PRICE_DATA_TRACK_ACCEPT @@ -24,7 +24,7 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q: PriorityQueue worker_pool.queue_item_async_safe(update_q, queuedWatchMetaData.PrioritizedItem(priority=1, item={'uuid': uuid})) return redirect(url_for("watchlist.index")) - @price_data_follower_blueprint.route("//reject", methods=['GET']) + @price_data_follower_blueprint.route("//reject", methods=['POST']) @login_optionally_required def reject(uuid): datastore.data['watching'][uuid]['track_ldjson_price_data'] = PRICE_DATA_TRACK_REJECT diff --git a/changedetectionio/blueprint/settings/__init__.py b/changedetectionio/blueprint/settings/__init__.py index c05a55acb..19962aea8 100644 --- a/changedetectionio/blueprint/settings/__init__.py +++ b/changedetectionio/blueprint/settings/__init__.py @@ -278,7 +278,7 @@ def construct_blueprint(datastore: ChangeDetectionStore): return output - @settings_blueprint.route("/reset-api-key", methods=['GET']) + @settings_blueprint.route("/reset-api-key", methods=['POST']) @login_optionally_required def settings_reset_api_key(): secret = secrets.token_hex(16) @@ -295,7 +295,7 @@ def construct_blueprint(datastore: ChangeDetectionStore): logs=notification_debug_log if len(notification_debug_log) else ["Notification logs are empty - no notifications sent yet."]) return output - @settings_blueprint.route("/toggle-all-paused", methods=['GET']) + @settings_blueprint.route("/toggle-all-paused", methods=['POST']) @login_optionally_required def toggle_all_paused(): current_state = datastore.data['settings']['application'].get('all_paused', False) @@ -309,7 +309,7 @@ def construct_blueprint(datastore: ChangeDetectionStore): return redirect(url_for('watchlist.index')) - @settings_blueprint.route("/toggle-all-muted", methods=['GET']) + @settings_blueprint.route("/toggle-all-muted", methods=['POST']) @login_optionally_required def toggle_all_muted(): current_state = datastore.data['settings']['application'].get('all_muted', False) diff --git a/changedetectionio/blueprint/settings/templates/settings.html b/changedetectionio/blueprint/settings/templates/settings.html index 0f8ea7fc8..34069b41e 100644 --- a/changedetectionio/blueprint/settings/templates/settings.html +++ b/changedetectionio/blueprint/settings/templates/settings.html @@ -208,7 +208,7 @@ nav
- {{ _('Regenerate API key') }} +

{{ _('Chrome Extension') }}

diff --git a/changedetectionio/blueprint/tags/__init__.py b/changedetectionio/blueprint/tags/__init__.py index 2fa5bdb0d..4235c9240 100644 --- a/changedetectionio/blueprint/tags/__init__.py +++ b/changedetectionio/blueprint/tags/__init__.py @@ -62,7 +62,7 @@ def construct_blueprint(datastore: ChangeDetectionStore): return redirect(url_for('tags.tags_overview_page')) - @tags_blueprint.route("/mute/", methods=['GET']) + @tags_blueprint.route("/mute/", methods=['POST']) @login_optionally_required def mute(uuid): tag = datastore.data['settings']['application']['tags'].get(uuid) diff --git a/changedetectionio/blueprint/tags/templates/groups-overview.html b/changedetectionio/blueprint/tags/templates/groups-overview.html index 927d500b5..527cbca3e 100644 --- a/changedetectionio/blueprint/tags/templates/groups-overview.html +++ b/changedetectionio/blueprint/tags/templates/groups-overview.html @@ -68,7 +68,10 @@ html[data-darkmode="true"] .watch-tag-list.tag-{{ class_name }} { {#-{{ loop.cycle('pure-table-odd', 'pure-table-even') }}-#} - +
+ + +
{{ "{:,}".format(tag_count[uuid]) if uuid in tag_count else 0 }} {{ tag.title }} diff --git a/changedetectionio/blueprint/ui/__init__.py b/changedetectionio/blueprint/ui/__init__.py index 5c4d85aa1..82249bbe3 100644 --- a/changedetectionio/blueprint/ui/__init__.py +++ b/changedetectionio/blueprint/ui/__init__.py @@ -407,7 +407,7 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, worker_pool, return redirect(url_for('watchlist.index')) - @ui_blueprint.route("/share-url/", methods=['GET']) + @ui_blueprint.route("/share-url/", methods=['POST']) @login_optionally_required def form_share_put_watch(uuid): """Given a watch UUID, upload the info and return a share-link diff --git a/changedetectionio/blueprint/watchlist/__init__.py b/changedetectionio/blueprint/watchlist/__init__.py index aa72adb31..8973cea50 100644 --- a/changedetectionio/blueprint/watchlist/__init__.py +++ b/changedetectionio/blueprint/watchlist/__init__.py @@ -18,6 +18,24 @@ from changedetectionio.blueprint.watchlist.row_context import watch_row_context def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMetaData): watchlist_blueprint = Blueprint('watchlist', __name__, template_folder="templates") + @watchlist_blueprint.route("/toggle", methods=['POST']) + @login_optionally_required + def toggle(): + op = request.args.get('op') + uuid = request.args.get('uuid') + watch = datastore.data['watching'].get(uuid) + + if not watch: + flash(_('Watch not found'), 'error') + else: + if op == 'pause': + watch.toggle_pause() + elif op == 'mute': + watch.toggle_mute() + watch.commit() + + return redirect(url_for('watchlist.index', tag=request.args.get('tag'))) + @watchlist_blueprint.route("/", methods=['GET']) @login_optionally_required def index(): @@ -36,17 +54,6 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, queuedWatchMe if request.args.get('rss'): return redirect(url_for('rss.feed', tag=active_tag_uuid)) - op = request.args.get('op') - if op: - uuid = request.args.get('uuid') - if op == 'pause': - datastore.data['watching'][uuid].toggle_pause() - elif op == 'mute': - datastore.data['watching'][uuid].toggle_mute() - - datastore.data['watching'][uuid].commit() - return redirect(url_for('watchlist.index', tag = active_tag_uuid)) - # Sort by last_changed and add the uuid which is usually the key.. sorted_watches = [] active_processor = request.args.get('processor', '').strip() diff --git a/changedetectionio/blueprint/watchlist/templates/watch-overview-single-row.html b/changedetectionio/blueprint/watchlist/templates/watch-overview-single-row.html index 9f79325db..b0579bfc6 100644 --- a/changedetectionio/blueprint/watchlist/templates/watch-overview-single-row.html +++ b/changedetectionio/blueprint/watchlist/templates/watch-overview-single-row.html @@ -35,10 +35,12 @@
{# {{ loop.index+pagination.skip }}#}
- - - - + {%- set pause_action = url_for('watchlist.toggle', op='pause', uuid=watch.uuid, tag=active_tag_uuid) -%} + {%- set mute_action = url_for('watchlist.toggle', op='mute', uuid=watch.uuid, tag=active_tag_uuid) -%} + + + +
@@ -81,13 +83,13 @@ {%- if watch['processor'] == 'text_json_diff' -%} {%- if watch['has_ldjson_price_data'] and not watch['track_ldjson_price_data'] -%} -
Switch to Restock & Price watch mode? Yes No
+
Switch to Restock & Price watch mode?
{%- endif -%} {%- endif -%}
- + {%- set effective_fetcher = watch.get_fetch_backend if watch.get_fetch_backend != "system" else system_default_fetcher -%} {%- if effective_fetcher and ("html_webdriver" in effective_fetcher or "html_" in effective_fetcher or "extra_browser_" in effective_fetcher) -%} {{ effective_fetcher|fetcher_status_icons }} @@ -163,7 +165,9 @@
{%- set target_attr = ' target="' ~ watch.uuid ~ '"' if datastore.data['settings']['application']['ui'].get('open_diff_in_new_tab') else '' -%} - {{ _('Recheck') }} + {{ _('Edit') }} diff --git a/changedetectionio/static/styles/scss/parts/_button.scss b/changedetectionio/static/styles/scss/parts/_button.scss index 6257af2a7..a6299cc9c 100644 --- a/changedetectionio/static/styles/scss/parts/_button.scss +++ b/changedetectionio/static/styles/scss/parts/_button.scss @@ -91,3 +91,26 @@ &:hover { color: #d68a00; border-color: #d68a00; } } } + +// State-mutating controls have to POST, and only a + {%- if current_user.is_authenticated -%}