Compare commits

..

3 Commits

Author SHA1 Message Date
dgtlmoon
60d54bf92b tweak text 2025-06-04 11:14:08 +02:00
dgtlmoon
4b94e5b7f5 Add JS stub handler 2025-06-04 11:12:24 +02:00
dgtlmoon
1a2192680a Realtime UI - Ability to notify browser/client if there was a notification event 2025-06-04 11:03:17 +02:00
19 changed files with 90 additions and 220 deletions

View File

@@ -179,26 +179,6 @@ jobs:
docker kill test-changedetectionio
- name: Test HTTPS SSL mode
run: |
openssl req -x509 -newkey rsa:4096 -keyout privkey.pem -out cert.pem -days 365 -nodes -subj "/CN=localhost"
docker run --name test-changedetectionio-ssl --rm -e SSL_CERT_FILE=cert.pem -e SSL_PRIVKEY_FILE=privkey.pem -p 5000:5000 -v ./cert.pem:/app/cert.pem -v ./privkey.pem:/app/privkey.pem -d test-changedetectionio
sleep 3
# Should return 0 (no error) when grep finds it
# -k because its self-signed
curl --retry-connrefused --retry 6 -k https://localhost:5000 -v|grep -q checkbox-uuid
docker kill test-changedetectionio-ssl
- name: Test IPv6 Mode
run: |
# IPv6 - :: bind to all interfaces inside container (like 0.0.0.0), ::1 would be localhost only
docker run --name test-changedetectionio-ipv6 --rm -p 5000:5000 -e LISTEN_HOST=:: -d test-changedetectionio
sleep 3
# Should return 0 (no error) when grep finds it on localhost
curl --retry-connrefused --retry 6 http://[::1]:5000 -v|grep -q checkbox-uuid
docker kill test-changedetectionio-ipv6
- name: Test changedetection.io SIGTERM and SIGINT signal shutdown
run: |

View File

@@ -2,7 +2,7 @@
# Read more https://github.com/dgtlmoon/changedetection.io/wiki
__version__ = '0.50.3'
__version__ = '0.50.2'
from changedetectionio.strtobool import strtobool
from json.decoder import JSONDecodeError
@@ -65,7 +65,8 @@ def main():
datastore_path = None
do_cleanup = False
host = os.environ.get("LISTEN_HOST", "0.0.0.0").strip()
host = "0.0.0.0"
ipv6_enabled = False
port = int(os.environ.get('PORT', 5000))
ssl_mode = False
@@ -107,6 +108,10 @@ def main():
if opt == '-d':
datastore_path = arg
if opt == '-6':
logger.success("Enabling IPv6 listen support")
ipv6_enabled = True
# Cleanup (remove text files that arent in the index)
if opt == '-c':
do_cleanup = True
@@ -118,20 +123,6 @@ def main():
if opt == '-l':
logger_level = int(arg) if arg.isdigit() else arg.upper()
logger.success(f"changedetection.io version {get_version()} starting.")
# Launch using SocketIO run method for proper integration (if enabled)
ssl_cert_file = os.getenv("SSL_CERT_FILE", 'cert.pem')
ssl_privkey_file = os.getenv("SSL_PRIVKEY_FILE", 'privkey.pem')
if os.getenv("SSL_CERT_FILE") and os.getenv("SSL_PRIVKEY_FILE"):
ssl_mode = True
# SSL mode could have been set by -s too, therefor fallback to default values
if ssl_mode:
if not os.path.isfile(ssl_cert_file) or not os.path.isfile(ssl_privkey_file):
logger.critical(f"Cannot start SSL/HTTPS mode, Please be sure that {ssl_cert_file}' and '{ssl_privkey_file}' exist in in {os.getcwd()}")
os._exit(2)
# Without this, a logger will be duplicated
logger.remove()
try:
@@ -231,19 +222,19 @@ def main():
# SocketIO instance is already initialized in flask_app.py
# Launch using SocketIO run method for proper integration (if enabled)
if socketio_server:
if ssl_mode:
logger.success(f"SSL mode enabled, attempting to start with '{ssl_cert_file}' and '{ssl_privkey_file}' in {os.getcwd()}")
socketio.run(app, host=host, port=int(port), debug=False,
ssl_context=(ssl_cert_file, ssl_privkey_file), allow_unsafe_werkzeug=True)
socketio.run(app, host=host, port=int(port), debug=False,
certfile='cert.pem', keyfile='privkey.pem', allow_unsafe_werkzeug=True)
else:
socketio.run(app, host=host, port=int(port), debug=False, allow_unsafe_werkzeug=True)
else:
# Run Flask app without Socket.IO if disabled
logger.info("Starting Flask app without Socket.IO server")
if ssl_mode:
logger.success(f"SSL mode enabled, attempting to start with '{ssl_cert_file}' and '{ssl_privkey_file}' in {os.getcwd()}")
app.run(host=host, port=int(port), debug=False,
ssl_context=(ssl_cert_file, ssl_privkey_file))
app.run(host=host, port=int(port), debug=False,
ssl_context=('cert.pem', 'privkey.pem'))
else:
app.run(host=host, port=int(port), debug=False)

View File

@@ -132,7 +132,7 @@ class steppable_browser_interface():
# Incase they request to go back to the start
async def action_goto_site(self, selector=None, value=None):
return await self.action_goto_url(value=re.sub(r'^source:', '', self.start_url, flags=re.IGNORECASE))
return await self.action_goto_url(value=self.start_url)
async def action_click_element_containing_text(self, selector=None, value=''):
logger.debug("Clicking element containing text")

View File

@@ -10,7 +10,7 @@
<legend>Add a new organisational tag</legend>
<div id="watch-add-wrapper-zone">
<div>
{{ render_simple_field(form.name, placeholder="Watch group / tag") }}
{{ render_simple_field(form.name, placeholder="watch label / tag") }}
</div>
<div>
{{ render_simple_field(form.save_button, title="Save" ) }}

View File

@@ -159,20 +159,12 @@ def construct_blueprint(datastore: ChangeDetectionStore, update_q, worker_handle
def mark_all_viewed():
# Save the current newest history as the most recently viewed
with_errors = request.args.get('with_errors') == "1"
tag_limit = request.args.get('tag')
logger.debug(f"Limiting to tag {tag_limit}")
now = int(time.time())
for watch_uuid, watch in datastore.data['watching'].items():
if with_errors and not watch.get('last_error'):
continue
datastore.set_last_viewed(watch_uuid, int(time.time()))
if tag_limit and ( not watch.get('tags') or tag_limit not in watch['tags'] ):
logger.debug(f"Skipping watch {watch_uuid}")
continue
datastore.set_last_viewed(watch_uuid, now)
return redirect(url_for('watchlist.index', tag=tag_limit))
return redirect(url_for('watchlist.index'))
@ui_blueprint.route("/delete", methods=['GET'])
@login_optionally_required

View File

@@ -18,20 +18,19 @@ document.addEventListener('DOMContentLoaded', function() {
transition: background-size 0.9s ease
}
</style>
<div class="box" id="form-quick-watch-add">
<div class="box">
<form class="pure-form" action="{{ url_for('ui.ui_views.form_quick_watch_add', tag=active_tag_uuid) }}" method="POST" id="new-watch-form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" >
<fieldset>
<legend>Add a new web page change detection watch</legend>
<legend>Add a new change detection watch</legend>
<div id="watch-add-wrapper-zone">
{{ render_nolabel_field(form.url, placeholder="https://...", required=true) }}
{{ render_nolabel_field(form.tags, value=active_tag.title if active_tag_uuid else '', placeholder="watch label / tag") }}
{{ render_nolabel_field(form.watch_submit_button, title="Watch this URL!" ) }}
{{ render_nolabel_field(form.edit_and_watch_submit_button, title="Edit first then Watch") }}
</div>
<div id="watch-group-tag">
{{ render_field(form.tags, value=active_tag.title if active_tag_uuid else '', placeholder="Watch group / tag", class="transparent-field") }}
</div>
<div id="quick-watch-processor-type">
{{ render_simple_field(form.processor) }}
</div>
@@ -39,8 +38,7 @@ document.addEventListener('DOMContentLoaded', function() {
</fieldset>
<span style="color:#eee; font-size: 80%;"><img alt="Create a shareable link" style="height: 1em;display:inline-block;" src="{{url_for('static_content', group='images', filename='spread-white.svg')}}" > Tip: You can also add 'shared' watches. <a href="https://github.com/dgtlmoon/changedetection.io/wiki/Sharing-a-Watch">More info</a></span>
</form>
</div>
<div class="box">
<form class="pure-form" action="{{ url_for('ui.form_watch_list_checkbox_operations') }}" method="POST" id="watch-list-form">
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}" >
<input type="hidden" id="op_extradata" name="op_extradata" value="" >
@@ -214,14 +212,9 @@ document.addEventListener('DOMContentLoaded', function() {
<li id="post-list-mark-views" class="{%- if has_unviewed -%}has-unviewed{%- endif -%}" style="display: none;" >
<a href="{{url_for('ui.mark_all_viewed',with_errors=request.args.get('with_errors',0)) }}" class="pure-button button-tag " id="mark-all-viewed">Mark all viewed</a>
</li>
{%- if active_tag_uuid -%}
<li id="post-list-mark-views-tag">
<a href="{{url_for('ui.mark_all_viewed', tag=active_tag_uuid) }}" class="pure-button button-tag " id="mark-all-viewed">Mark all viewed in '{{active_tag.title}}'</a>
</li>
{%- endif -%}
<li>
<a href="{{ url_for('ui.form_watch_checknow', tag=active_tag_uuid, with_errors=request.args.get('with_errors',0)) }}" class="pure-button button-tag" id="recheck-all">Recheck
all {% if active_tag_uuid %} in '{{active_tag.title}}'{%endif%}</a>
all {%- if active_tag_uuid-%} in "{{active_tag.title}}"{%endif%}</a>
</li>
<li>
<a href="{{ url_for('rss.feed', tag=active_tag_uuid, token=app_rss_token)}}"><img alt="RSS Feed" id="feed-icon" src="{{url_for('static_content', group='images', filename='generic_feed-icon.svg')}}" height="15"></a>

View File

@@ -100,7 +100,7 @@ watch_api = Api(app, decorators=[csrf.exempt])
def init_app_secret(datastore_path):
secret = ""
path = os.path.join(datastore_path, "secret.txt")
path = "{}/secret.txt".format(datastore_path)
try:
with open(path, "r") as f:

View File

@@ -738,7 +738,7 @@ class globalSettingsRequestForm(Form):
return False
class globalSettingsApplicationUIForm(Form):
open_diff_in_new_tab = BooleanField("Open 'History' page in a new tab", default=True, validators=[validators.Optional()])
open_diff_in_new_tab = BooleanField('Open diff page in a new tab', default=True, validators=[validators.Optional()])
socket_io_enabled = BooleanField('Realtime UI Updates Enabled', default=True, validators=[validators.Optional()])
# datastore.data['settings']['application']..

View File

@@ -48,9 +48,9 @@ $(document).ready(function () {
// Connect to Socket.IO on the same host/port, with path from template
const socket = io({
path: socketio_url, // This will be the path prefix like "/app/socket.io" from the template
transports: ['websocket', 'polling'],
reconnectionDelay: 3000,
reconnectionAttempts: 25
transports: ['polling', 'websocket'], // Try WebSocket but fall back to polling
reconnectionDelay: 1000,
reconnectionAttempts: 15
});
// Connection status logging
@@ -98,12 +98,6 @@ $(document).ready(function () {
console.log(`Stub handler for notification_event ${data.watch_uuid}`)
});
socket.on('watch_deleted', function (data) {
$('tr[data-watch-uuid="' + data.uuid + '"] td').fadeOut(500, function () {
$(this).closest('tr').remove();
});
});
// Listen for periodically emitted watch data
console.log('Adding watch_update event listener');

View File

@@ -16,12 +16,6 @@ $(function () {
$('#op_extradata').val(prompt("Enter a tag name"));
});
$('.history-link').click(function (e) {
// Incase they click 'back' in the browser, it should be removed.
$(this).closest('tr').removeClass('unviewed');
});
$('.with-share-link > *').click(function () {
$("#copied-clipboard").remove();

View File

@@ -71,7 +71,6 @@
--color-text-watch-tag-list: rgba(231, 0, 105, 0.4);
--color-background-new-watch-form: rgba(0, 0, 0, 0.05);
--color-background-new-watch-input: var(--color-white);
--color-background-new-watch-input-transparent: rgba(255, 255, 255, 0.1);
--color-text-new-watch-input: var(--color-text);
--color-border-input: var(--color-grey-500);
--color-shadow-input: var(--color-grey-400);
@@ -98,7 +97,6 @@ html[data-darkmode="true"] {
--color-background-gradient-second: #1e316c;
--color-background-gradient-third: #4d2c64;
--color-background-new-watch-input: var(--color-grey-100);
--color-background-new-watch-input-transparent: var(--color-grey-100);
--color-text-new-watch-input: var(--color-text);
--color-background-table-thead: var(--color-grey-200);
--color-table-background: var(--color-grey-300);

View File

@@ -78,7 +78,6 @@
--color-text-watch-tag-list: rgba(231, 0, 105, 0.4);
--color-background-new-watch-form: rgba(0, 0, 0, 0.05);
--color-background-new-watch-input: var(--color-white);
--color-background-new-watch-input-transparent: rgba(255, 255, 255, 0.1);
--color-text-new-watch-input: var(--color-text);
--color-border-input: var(--color-grey-500);
@@ -113,7 +112,6 @@ html[data-darkmode="true"] {
--color-background-gradient-third: #4d2c64;
--color-background-new-watch-input: var(--color-grey-100);
--color-background-new-watch-input-transparent: var(--color-grey-100);
--color-text-new-watch-input: var(--color-text);
--color-background-table-thead: var(--color-grey-200);
--color-table-background: var(--color-grey-300);

View File

@@ -17,13 +17,11 @@
&.title-col {
word-break: break-all;
white-space: normal;
a::after {
content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
margin: 0 3px 0 5px;
}
}
a.external::after {
content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
margin: 0 3px 0 5px;
}
}

View File

@@ -185,8 +185,7 @@ code {
}
.box {
max-width: 100%;
margin: 0 1em;
max-width: 80%;
flex-direction: column;
display: flex;
justify-content: center;
@@ -280,7 +279,7 @@ a.pure-button-selected {
font-size: 65%;
border-bottom-left-radius: initial;
border-bottom-right-radius: initial;
margin-right: 4px;
&.active {
background: var(--color-background-button-tag-active);
font-weight: bold;
@@ -373,32 +372,11 @@ label {
}
}
// Some field colouring for transperant field
.pure-form input[type=text].transparent-field {
background-color: var(--color-background-new-watch-input-transparent) !important;
color: var(--color-white) !important;
border: 1px solid rgba(255, 255, 255, 0.2) !important;
box-shadow: none !important;
-webkit-box-shadow: none !important;
&::placeholder {
opacity: 0.5;
color: rgba(255, 255, 255, 0.7);
font-weight: lighter;
}
}
#new-watch-form {
background: var(--color-background-new-watch-form);
padding: 1em;
border-radius: 10px;
margin-bottom: 1em;
max-width: 100%;
#url {
&::placeholder {
font-weight: bold;
}
}
input {
display: inline-block;
@@ -419,13 +397,12 @@ label {
font-weight: bold;
}
#watch-add-wrapper-zone {
@media only screen and (min-width: 760px) {
display: flex;
gap: 0.3rem;
flex-direction: row;
min-width: 70vw;
}
/* URL field grows always, other stay static in width */
> span {
@@ -447,22 +424,6 @@ label {
}
}
}
#watch-group-tag {
font-size: 0.9rem;
padding: 0.3rem;
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--color-white);
label, input {
margin: 0;
}
input {
flex: 1;
}
}
}
@@ -659,6 +620,10 @@ footer {
@media only screen and (max-width: 760px),
(min-device-width: 768px) and (max-device-width: 1024px) {
.box {
max-width: 95%
}
.edit-form {
padding: 0.5em;
margin: 0;
@@ -1178,14 +1143,16 @@ ul {
color: #fff;
ul {
padding: 0.3rem;
li {
list-style: none;
font-size: 0.9rem;
font-size: 0.8rem;
> * {
display: inline-block;
}
}
}
}
.restock-label {

View File

@@ -322,7 +322,6 @@ ul#requests-extra_browsers {
--color-text-watch-tag-list: rgba(231, 0, 105, 0.4);
--color-background-new-watch-form: rgba(0, 0, 0, 0.05);
--color-background-new-watch-input: var(--color-white);
--color-background-new-watch-input-transparent: rgba(255, 255, 255, 0.1);
--color-text-new-watch-input: var(--color-text);
--color-border-input: var(--color-grey-500);
--color-shadow-input: var(--color-grey-400);
@@ -349,7 +348,6 @@ html[data-darkmode="true"] {
--color-background-gradient-second: #1e316c;
--color-background-gradient-third: #4d2c64;
--color-background-new-watch-input: var(--color-grey-100);
--color-background-new-watch-input-transparent: var(--color-grey-100);
--color-text-new-watch-input: var(--color-text);
--color-background-table-thead: var(--color-grey-200);
--color-table-background: var(--color-grey-300);
@@ -539,9 +537,9 @@ body.preview-text-enabled {
.watch-table td.title-col {
word-break: break-all;
white-space: normal; }
.watch-table td a.external::after {
content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
margin: 0 3px 0 5px; }
.watch-table td.title-col a::after {
content: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAoAAAAKCAYAAACNMs+9AAAAQElEQVR42qXKwQkAIAxDUUdxtO6/RBQkQZvSi8I/pL4BoGw/XPkh4XigPmsUgh0626AjRsgxHTkUThsG2T/sIlzdTsp52kSS1wAAAABJRU5ErkJggg==);
margin: 0 3px 0 5px; }
.watch-table th {
white-space: nowrap; }
.watch-table th a {
@@ -828,8 +826,7 @@ code {
background: var(--color-text-watch-tag-list); }
.box {
max-width: 100%;
margin: 0 1em;
max-width: 80%;
flex-direction: column;
display: flex;
justify-content: center; }
@@ -902,8 +899,7 @@ a.pure-button-selected {
color: var(--color-text-button);
font-size: 65%;
border-bottom-left-radius: initial;
border-bottom-right-radius: initial;
margin-right: 4px; }
border-bottom-right-radius: initial; }
.button-tag.active {
background: var(--color-background-button-tag-active);
font-weight: bold; }
@@ -966,25 +962,11 @@ label:hover {
#token-table.pure-table th {
font-size: 80%; }
.pure-form input[type=text].transparent-field {
background-color: var(--color-background-new-watch-input-transparent) !important;
color: var(--color-white) !important;
border: 1px solid rgba(255, 255, 255, 0.2) !important;
box-shadow: none !important;
-webkit-box-shadow: none !important; }
.pure-form input[type=text].transparent-field::placeholder {
opacity: 0.5;
color: rgba(255, 255, 255, 0.7);
font-weight: lighter; }
#new-watch-form {
background: var(--color-background-new-watch-form);
padding: 1em;
border-radius: 10px;
margin-bottom: 1em;
max-width: 100%; }
#new-watch-form #url::placeholder {
font-weight: bold; }
margin-bottom: 1em; }
#new-watch-form input {
display: inline-block;
margin-bottom: 5px; }
@@ -1002,8 +984,7 @@ label:hover {
#new-watch-form #watch-add-wrapper-zone {
display: flex;
gap: 0.3rem;
flex-direction: row;
min-width: 70vw; } }
flex-direction: row; } }
#new-watch-form #watch-add-wrapper-zone > span {
flex-grow: 0; }
#new-watch-form #watch-add-wrapper-zone > span input {
@@ -1014,17 +995,6 @@ label:hover {
@media only screen and (max-width: 760px) {
#new-watch-form #watch-add-wrapper-zone #url {
width: 100%; } }
#new-watch-form #watch-group-tag {
font-size: 0.9rem;
padding: 0.3rem;
display: flex;
align-items: center;
gap: 0.5rem;
color: var(--color-white); }
#new-watch-form #watch-group-tag label, #new-watch-form #watch-group-tag input {
margin: 0; }
#new-watch-form #watch-group-tag input {
flex: 1; }
#diff-col {
padding-left: 40px; }
@@ -1159,6 +1129,8 @@ footer {
gap: 1em; }
@media only screen and (max-width: 760px), (min-device-width: 768px) and (max-device-width: 1024px) {
.box {
max-width: 95%; }
.edit-form {
padding: 0.5em;
margin: 0; }
@@ -1534,7 +1506,7 @@ ul {
padding: 0.3rem; }
#quick-watch-processor-type ul li {
list-style: none;
font-size: 0.9rem; }
font-size: 0.8rem; }
#quick-watch-processor-type ul li > * {
display: inline-block; }

View File

@@ -13,7 +13,6 @@ import json
import os
import re
import secrets
import sys
import threading
import time
import uuid as uuid_builder
@@ -46,7 +45,7 @@ class ChangeDetectionStore:
# logging.basicConfig(filename='/dev/stdout', level=logging.INFO)
self.__data = App.model()
self.datastore_path = datastore_path
self.json_store_path = os.path.join(self.datastore_path, "url-watches.json")
self.json_store_path = "{}/url-watches.json".format(self.datastore_path)
logger.info(f"Datastore path is '{self.json_store_path}'")
self.needs_write = False
self.start_time = time.time()
@@ -119,12 +118,14 @@ class ChangeDetectionStore:
test_list = self.proxy_list
# Helper to remove password protection
password_reset_lockfile = os.path.join(self.datastore_path, "removepassword.lock")
password_reset_lockfile = "{}/removepassword.lock".format(self.datastore_path)
if path.isfile(password_reset_lockfile):
self.__data['settings']['application']['password'] = False
unlink(password_reset_lockfile)
if not 'app_guid' in self.__data:
import os
import sys
if "pytest" in sys.modules or "PYTEST_CURRENT_TEST" in os.environ:
self.__data['app_guid'] = "test-" + str(uuid_builder.uuid4())
else:
@@ -385,9 +386,9 @@ class ChangeDetectionStore:
return new_uuid
def visualselector_data_is_ready(self, watch_uuid):
output_path = os.path.join(self.datastore_path, watch_uuid)
screenshot_filename = os.path.join(output_path, "last-screenshot.png")
elements_index_filename = os.path.join(output_path, "elements.deflate")
output_path = "{}/{}".format(self.datastore_path, watch_uuid)
screenshot_filename = "{}/last-screenshot.png".format(output_path)
elements_index_filename = "{}/elements.deflate".format(output_path)
if path.isfile(screenshot_filename) and path.isfile(elements_index_filename) :
return True
@@ -411,8 +412,12 @@ class ChangeDetectionStore:
# system was out of memory, out of RAM etc
with open(self.json_store_path+".tmp", 'w') as json_file:
# Use compact JSON in production for better performance
json.dump(data, json_file, indent=2)
os.replace(self.json_store_path+".tmp", self.json_store_path)
debug_mode = os.environ.get('CHANGEDETECTION_DEBUG', 'false').lower() == 'true'
if debug_mode:
json.dump(data, json_file, indent=4)
else:
json.dump(data, json_file, separators=(',', ':'))
os.replace(self.json_store_path+".tmp", self.json_store_path)
except Exception as e:
logger.error(f"Error writing JSON!! (Main JSON file save was skipped) : {str(e)}")
@@ -473,7 +478,7 @@ class ChangeDetectionStore:
# Load from external config file
if path.isfile(proxy_list_file):
with open(os.path.join(self.datastore_path, "proxies.json")) as f:
with open("{}/proxies.json".format(self.datastore_path)) as f:
proxy_list = json.load(f)
# Mapping from UI config if available
@@ -731,10 +736,10 @@ class ChangeDetectionStore:
logger.critical(f"Applying update_{update_n}")
# Wont exist on fresh installs
if os.path.exists(self.json_store_path):
shutil.copyfile(self.json_store_path, os.path.join(self.datastore_path, f"url-watches-before-{update_n}.json"))
shutil.copyfile(self.json_store_path, self.datastore_path+"/url-watches-before-{}.json".format(update_n))
try:
update_method = getattr(self, f"update_{update_n}")()
update_method = getattr(self, "update_{}".format(update_n))()
except Exception as e:
logger.error(f"Error while trying update_{update_n}")
logger.error(e)

View File

@@ -74,7 +74,7 @@
</tr>
<tr>
<td><code>{{ '{{watch_tag}}' }}</code></td>
<td>The watch group / tag</td>
<td>The watch label / tag</td>
</tr>
<tr>
<td><code>{{ '{{preview_url}}' }}</code></td>

View File

@@ -236,41 +236,39 @@ def test_group_tag_notification(client, live_server, measure_memory_usage):
assert b'Deleted' in res.data
def test_limit_tag_ui(client, live_server, measure_memory_usage):
test_url = url_for('test_random_content_endpoint', _external=True)
test_url = url_for('test_endpoint', _external=True)
urls=[]
# A space can label the tag, only the first one will have a tag
client.post(
for i in range(20):
urls.append(test_url+"?x="+str(i)+" test-tag")
for i in range(20):
urls.append(test_url+"?non-grouped="+str(i))
res = client.post(
url_for("imports.import_page"),
data={"urls": f"{test_url} test-tag\r\n{test_url}"},
data={"urls": "\r\n".join(urls)},
follow_redirects=True
)
tag_uuid = get_UUID_for_tag_name(client, name="test-tag")
assert tag_uuid
assert b"40 Imported" in res.data
res = client.get(url_for("watchlist.index"))
assert b'test-tag' in res.data
client.get(url_for("ui.form_watch_checknow"), follow_redirects=True)
wait_for_all_checks(client)
client.get(url_for("ui.form_watch_checknow"), follow_redirects=True)
wait_for_all_checks(client)
# Should be both unviewed
res = client.get(url_for("watchlist.index"))
assert res.data.count(b' unviewed ') == 2
# All should be here
assert res.data.count(b'processor-text_json_diff') == 40
tag_uuid = get_UUID_for_tag_name(client, name="test-tag")
# Now we recheck only the tag
client.get(url_for('ui.mark_all_viewed', tag=tag_uuid), follow_redirects=True)
wait_for_all_checks(client)
with open('/tmp/fuck.html', 'wb') as f:
f.write(res.data)
# Should be only 1 unviewed
res = client.get(url_for("watchlist.index"))
assert res.data.count(b' unviewed ') == 1
res = client.get(url_for("watchlist.index", tag=tag_uuid))
# Just a subset should be here
assert b'test-tag' in res.data
assert res.data.count(b'processor-text_json_diff') == 20
assert b"object at" not in res.data
res = client.get(url_for("ui.form_delete", uuid="all"), follow_redirects=True)
assert b'Deleted' in res.data
res = client.get(url_for("tags.delete_all"), follow_redirects=True)

View File

@@ -69,16 +69,6 @@ services:
# Maximum height of screenshots, default is 16000 px, screenshots will be clipped to this if exceeded.
# RAM usage will be higher if you increase this.
# - SCREENSHOT_MAX_HEIGHT=16000
#
# HTTPS SSL Mode for webserver, unset both of these, you may need to volume mount these files also.
# ./cert.pem:/app/cert.pem and ./privkey.pem:/app/privkey.pem
# - SSL_CERT_FILE=cert.pem
# - SSL_PRIVKEY_FILE=privkey.pem
#
# LISTEN_HOST / "host", Same as -h
# - LISTEN_HOST=::
# - LISTEN_HOST=0.0.0.0
# Comment out ports: when using behind a reverse proxy , enable networks: etc.
ports: