mirror of
https://github.com/dgtlmoon/changedetection.io.git
synced 2025-11-26 03:13:21 +00:00
Compare commits
4 Commits
navigation
...
mark-selec
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4648fe7b02 | ||
|
|
e7ac356d99 | ||
|
|
e874df4ffc | ||
|
|
d1f44d0345 |
@@ -430,15 +430,26 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
has_unviewed=datastore.has_unviewed,
|
has_unviewed=datastore.has_unviewed,
|
||||||
hosted_sticky=os.getenv("SALTED_PASS", False) == False,
|
hosted_sticky=os.getenv("SALTED_PASS", False) == False,
|
||||||
queued_uuids=[q_uuid.item['uuid'] for q_uuid in update_q.queue],
|
queued_uuids=[q_uuid.item['uuid'] for q_uuid in update_q.queue],
|
||||||
|
sort_attribute=request.args.get('sort') if request.args.get('sort') else request.cookies.get('sort'),
|
||||||
|
sort_order=request.args.get('order') if request.args.get('order') else request.cookies.get('order'),
|
||||||
system_default_fetcher=datastore.data['settings']['application'].get('fetch_backend'),
|
system_default_fetcher=datastore.data['settings']['application'].get('fetch_backend'),
|
||||||
tags=existing_tags,
|
tags=existing_tags,
|
||||||
watches=sorted_watches
|
watches=sorted_watches
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
if session.get('share-link'):
|
if session.get('share-link'):
|
||||||
del(session['share-link'])
|
del(session['share-link'])
|
||||||
return output
|
|
||||||
|
resp = make_response(output)
|
||||||
|
|
||||||
|
# The template can run on cookie or url query info
|
||||||
|
if request.args.get('sort'):
|
||||||
|
resp.set_cookie('sort', request.args.get('sort'))
|
||||||
|
if request.args.get('order'):
|
||||||
|
resp.set_cookie('order', request.args.get('order'))
|
||||||
|
|
||||||
|
return resp
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# AJAX endpoint for sending a test
|
# AJAX endpoint for sending a test
|
||||||
@@ -463,11 +474,19 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
n_object = {'watch_url': request.form['window_url'],
|
n_object = {'watch_url': request.form['window_url'],
|
||||||
'notification_urls': request.form['notification_urls'].splitlines(),
|
'notification_urls': request.form['notification_urls'].splitlines()
|
||||||
'notification_title': request.form['notification_title'].strip(),
|
|
||||||
'notification_body': request.form['notification_body'].strip(),
|
|
||||||
'notification_format': request.form['notification_format'].strip()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Only use if present, if not set in n_object it should use the default system value
|
||||||
|
if 'notification_format' in request.form and request.form['notification_format'].strip():
|
||||||
|
n_object['notification_format'] = request.form.get('notification_format', '').strip()
|
||||||
|
|
||||||
|
if 'notification_title' in request.form and request.form['notification_title'].strip():
|
||||||
|
n_object['notification_title'] = request.form.get('notification_title', '').strip()
|
||||||
|
|
||||||
|
if 'notification_body' in request.form and request.form['notification_body'].strip():
|
||||||
|
n_object['notification_body'] = request.form.get('notification_body', '').strip()
|
||||||
|
|
||||||
notification_q.put(n_object)
|
notification_q.put(n_object)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
return make_response({'error': str(e)}, 400)
|
return make_response({'error': str(e)}, 400)
|
||||||
@@ -1258,6 +1277,13 @@ def changedetection_app(config=None, datastore_o=None):
|
|||||||
datastore.data['watching'][uuid.strip()]['paused'] = False
|
datastore.data['watching'][uuid.strip()]['paused'] = False
|
||||||
flash("{} watches unpaused".format(len(uuids)))
|
flash("{} watches unpaused".format(len(uuids)))
|
||||||
|
|
||||||
|
elif (op == 'mark-viewed'):
|
||||||
|
for uuid in uuids:
|
||||||
|
uuid = uuid.strip()
|
||||||
|
if datastore.data['watching'].get(uuid):
|
||||||
|
datastore.set_last_viewed(uuid, int(time.time()))
|
||||||
|
flash("{} watches updated".format(len(uuids)))
|
||||||
|
|
||||||
elif (op == 'mute'):
|
elif (op == 'mute'):
|
||||||
for uuid in uuids:
|
for uuid in uuids:
|
||||||
uuid = uuid.strip()
|
uuid = uuid.strip()
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ base_config = {
|
|||||||
'body': None,
|
'body': None,
|
||||||
'check_unique_lines': False, # On change-detected, compare against all history if its something new
|
'check_unique_lines': False, # On change-detected, compare against all history if its something new
|
||||||
'check_count': 0,
|
'check_count': 0,
|
||||||
|
'date_created': None,
|
||||||
'consecutive_filter_failures': 0, # Every time the CSS/xPath filter cannot be located, reset when all is fine.
|
'consecutive_filter_failures': 0, # Every time the CSS/xPath filter cannot be located, reset when all is fine.
|
||||||
'extract_text': [], # Extract text by regex after filters
|
'extract_text': [], # Extract text by regex after filters
|
||||||
'extract_title_as_title': False,
|
'extract_title_as_title': False,
|
||||||
|
|||||||
@@ -89,7 +89,7 @@ def process_notification(n_object, datastore):
|
|||||||
n_body = jinja2_env.from_string(n_object.get('notification_body', default_notification_body)).render(**notification_parameters)
|
n_body = jinja2_env.from_string(n_object.get('notification_body', default_notification_body)).render(**notification_parameters)
|
||||||
n_title = jinja2_env.from_string(n_object.get('notification_title', default_notification_title)).render(**notification_parameters)
|
n_title = jinja2_env.from_string(n_object.get('notification_title', default_notification_title)).render(**notification_parameters)
|
||||||
n_format = valid_notification_formats.get(
|
n_format = valid_notification_formats.get(
|
||||||
n_object['notification_format'],
|
n_object.get('notification_format', default_notification_format),
|
||||||
valid_notification_formats[default_notification_format],
|
valid_notification_formats[default_notification_format],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,6 @@ $(document).ready(function() {
|
|||||||
data = {
|
data = {
|
||||||
window_url : window.location.href,
|
window_url : window.location.href,
|
||||||
notification_urls : $('.notification-urls').val(),
|
notification_urls : $('.notification-urls').val(),
|
||||||
notification_title : $('.notification-title').val(),
|
|
||||||
notification_body : $('.notification-body').val(),
|
|
||||||
notification_format : $('.notification-format').val(),
|
|
||||||
}
|
}
|
||||||
for (key in data) {
|
for (key in data) {
|
||||||
if (!data[key].length) {
|
if (!data[key].length) {
|
||||||
|
|||||||
@@ -316,7 +316,8 @@ class ChangeDetectionStore:
|
|||||||
# #Re 569
|
# #Re 569
|
||||||
new_watch = Watch.model(datastore_path=self.datastore_path, default={
|
new_watch = Watch.model(datastore_path=self.datastore_path, default={
|
||||||
'url': url,
|
'url': url,
|
||||||
'tag': tag
|
'tag': tag,
|
||||||
|
'date_created': int(time.time())
|
||||||
})
|
})
|
||||||
|
|
||||||
new_uuid = new_watch['uuid']
|
new_uuid = new_watch['uuid']
|
||||||
@@ -679,3 +680,13 @@ class ChangeDetectionStore:
|
|||||||
except:
|
except:
|
||||||
continue
|
continue
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# We don't know when the date_created was in the past until now, so just add an index number for now.
|
||||||
|
def update_11(self):
|
||||||
|
i = 0
|
||||||
|
for uuid, watch in self.data['watching'].items():
|
||||||
|
if not watch.get('date_created'):
|
||||||
|
watch['date_created'] = i
|
||||||
|
i+=1
|
||||||
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -37,6 +37,7 @@
|
|||||||
<button class="pure-button button-secondary button-xsmall" name="op" value="mute">Mute</button>
|
<button class="pure-button button-secondary button-xsmall" name="op" value="mute">Mute</button>
|
||||||
<button class="pure-button button-secondary button-xsmall" name="op" value="unmute">UnMute</button>
|
<button class="pure-button button-secondary button-xsmall" name="op" value="unmute">UnMute</button>
|
||||||
<button class="pure-button button-secondary button-xsmall" name="op" value="recheck">Recheck</button>
|
<button class="pure-button button-secondary button-xsmall" name="op" value="recheck">Recheck</button>
|
||||||
|
<button class="pure-button button-secondary button-xsmall" name="op" value="mark-viewed">Mark viewed</button>
|
||||||
<button class="pure-button button-secondary button-xsmall" name="op" value="notification-default">Use default notification</button>
|
<button class="pure-button button-secondary button-xsmall" name="op" value="notification-default">Use default notification</button>
|
||||||
<button class="pure-button button-secondary button-xsmall" style="background: #dd4242; font-size: 70%" name="op" value="delete">Delete</button>
|
<button class="pure-button button-secondary button-xsmall" style="background: #dd4242; font-size: 70%" name="op" value="delete">Delete</button>
|
||||||
</div>
|
</div>
|
||||||
@@ -49,18 +50,18 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% set sort_order = request.args.get('order', 'asc') == 'asc' %}
|
{% set sort_order = sort_order or 'asc' %}
|
||||||
{% set sort_attribute = request.args.get('sort', 'last_changed') %}
|
{% set sort_attribute = sort_attribute or 'last_changed' %}
|
||||||
{% set pagination_page = request.args.get('page', 0) %}
|
{% set pagination_page = request.args.get('page', 0) %}
|
||||||
|
|
||||||
<div id="watch-table-wrapper">
|
<div id="watch-table-wrapper">
|
||||||
<table class="pure-table pure-table-striped watch-table">
|
<table class="pure-table pure-table-striped watch-table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th><input style="vertical-align: middle" type="checkbox" id="check-all"/> #</th>
|
{% set link_order = "desc" if sort_order == 'asc' else "asc" %}
|
||||||
<th></th>
|
|
||||||
{% set link_order = "desc" if sort_order else "asc" %}
|
|
||||||
{% set arrow_span = "" %}
|
{% set arrow_span = "" %}
|
||||||
|
<th><input style="vertical-align: middle" type="checkbox" id="check-all"/> <a class="{{ 'active '+link_order if sort_attribute == 'date_created' else 'inactive' }}" href="{{url_for('index', sort='date_created', order=link_order, tag=active_tag)}}"># <span class='arrow {{link_order}}'></span></a></th>
|
||||||
|
<th></th>
|
||||||
<th><a class="{{ 'active '+link_order if sort_attribute == 'label' else 'inactive' }}" href="{{url_for('index', sort='label', order=link_order, tag=active_tag)}}">Website <span class='arrow {{link_order}}'></span></a></th>
|
<th><a class="{{ 'active '+link_order if sort_attribute == 'label' else 'inactive' }}" href="{{url_for('index', sort='label', order=link_order, tag=active_tag)}}">Website <span class='arrow {{link_order}}'></span></a></th>
|
||||||
<th><a class="{{ 'active '+link_order if sort_attribute == 'last_checked' else 'inactive' }}" href="{{url_for('index', sort='last_checked', order=link_order, tag=active_tag)}}">Last Checked <span class='arrow {{link_order}}'></span></a></th>
|
<th><a class="{{ 'active '+link_order if sort_attribute == 'last_checked' else 'inactive' }}" href="{{url_for('index', sort='last_checked', order=link_order, tag=active_tag)}}">Last Checked <span class='arrow {{link_order}}'></span></a></th>
|
||||||
<th><a class="{{ 'active '+link_order if sort_attribute == 'last_changed' else 'inactive' }}" href="{{url_for('index', sort='last_changed', order=link_order, tag=active_tag)}}">Last Changed <span class='arrow {{link_order}}'></span></a></th>
|
<th><a class="{{ 'active '+link_order if sort_attribute == 'last_changed' else 'inactive' }}" href="{{url_for('index', sort='last_changed', order=link_order, tag=active_tag)}}">Last Changed <span class='arrow {{link_order}}'></span></a></th>
|
||||||
@@ -69,8 +70,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
{% set sorted_watches = watches|sort(attribute=sort_attribute, reverse=sort_order) %}
|
{% for watch in watches|sort(attribute=sort_attribute, reverse=sort_order == 'asc') %}
|
||||||
{% for watch in sorted_watches %}
|
|
||||||
|
|
||||||
{# WIP for pagination, disabled for now
|
{# WIP for pagination, disabled for now
|
||||||
{% if not ( loop.index >= 3 and loop.index <=4) %}{% continue %}{% endif %} -->
|
{% if not ( loop.index >= 3 and loop.index <=4) %}{% continue %}{% endif %} -->
|
||||||
@@ -135,6 +135,7 @@
|
|||||||
{% else %}
|
{% else %}
|
||||||
Not yet checked
|
Not yet checked
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if not active_tag %}
|
{% if not active_tag %}
|
||||||
|
|||||||
Reference in New Issue
Block a user