mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-17 23:16:10 +00:00
Compare commits
1 Commits
fetch-reli
...
1207-no-me
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a1feda5a21 |
@@ -4,6 +4,9 @@ from flask import Blueprint, flash, redirect, url_for
|
|||||||
from flask_login import login_required
|
from flask_login import login_required
|
||||||
from changedetectionio.store import ChangeDetectionStore
|
from changedetectionio.store import ChangeDetectionStore
|
||||||
|
|
||||||
|
PRICE_DATA_TRACK_ACCEPT = 'accepted'
|
||||||
|
PRICE_DATA_TRACK_REJECT = 'rejected'
|
||||||
|
|
||||||
def construct_blueprint(datastore: ChangeDetectionStore):
|
def construct_blueprint(datastore: ChangeDetectionStore):
|
||||||
|
|
||||||
price_data_follower_blueprint = Blueprint('price_data_follower', __name__)
|
price_data_follower_blueprint = Blueprint('price_data_follower', __name__)
|
||||||
@@ -11,14 +14,14 @@ def construct_blueprint(datastore: ChangeDetectionStore):
|
|||||||
@login_required
|
@login_required
|
||||||
@price_data_follower_blueprint.route("/<string:uuid>/accept", methods=['GET'])
|
@price_data_follower_blueprint.route("/<string:uuid>/accept", methods=['GET'])
|
||||||
def accept(uuid):
|
def accept(uuid):
|
||||||
datastore.data['watching'][uuid]['track_ldjson_price_data'] = 'accepted'
|
datastore.data['watching'][uuid]['track_ldjson_price_data'] = PRICE_DATA_TRACK_ACCEPT
|
||||||
return redirect(url_for("form_watch_checknow", uuid=uuid))
|
return redirect(url_for("form_watch_checknow", uuid=uuid))
|
||||||
|
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
@price_data_follower_blueprint.route("/<string:uuid>/reject", methods=['GET'])
|
@price_data_follower_blueprint.route("/<string:uuid>/reject", methods=['GET'])
|
||||||
def reject(uuid):
|
def reject(uuid):
|
||||||
datastore.data['watching'][uuid]['track_ldjson_price_data'] = 'rejected'
|
datastore.data['watching'][uuid]['track_ldjson_price_data'] = PRICE_DATA_TRACK_REJECT
|
||||||
return redirect(url_for("index"))
|
return redirect(url_for("index"))
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import re
|
|||||||
import urllib3
|
import urllib3
|
||||||
|
|
||||||
from changedetectionio import content_fetcher, html_tools
|
from changedetectionio import content_fetcher, html_tools
|
||||||
|
from changedetectionio.blueprint.price_data_follower import PRICE_DATA_TRACK_ACCEPT, PRICE_DATA_TRACK_REJECT
|
||||||
|
|
||||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||||
|
|
||||||
@@ -148,7 +149,7 @@ class perform_site_check():
|
|||||||
)
|
)
|
||||||
|
|
||||||
# Inject a virtual LD+JSON price tracker rule
|
# Inject a virtual LD+JSON price tracker rule
|
||||||
if watch.get('track_ldjson_price_data'):
|
if watch.get('track_ldjson_price_data', '') == PRICE_DATA_TRACK_ACCEPT:
|
||||||
include_filters_rule.append(html_tools.LD_JSON_PRODUCT_OFFER_SELECTOR)
|
include_filters_rule.append(html_tools.LD_JSON_PRODUCT_OFFER_SELECTOR)
|
||||||
|
|
||||||
has_filter_rule = include_filters_rule and len("".join(include_filters_rule).strip())
|
has_filter_rule = include_filters_rule and len("".join(include_filters_rule).strip())
|
||||||
|
|||||||
Reference in New Issue
Block a user