This commit is contained in:
dgtlmoon
2025-05-16 13:32:17 +02:00
parent 32bfcbde9d
commit d5b679d77e
6 changed files with 37 additions and 31 deletions

View File

@@ -105,7 +105,7 @@
<tr id="{{ watch.uuid }}" data-watch-uuid="{{ watch.uuid }}"
class="{{ loop.cycle('pure-table-odd', 'pure-table-even') }} processor-{{ watch['processor'] }}
{# socket.js also sets these vars on the row for update #}
{% if watch.last_error is defined and watch.last_error != False %}error{% endif %}
{% if watch.render_errors_as_text %}has-error{% endif %}
{% if watch.last_notification_error is defined and watch.last_notification_error != False %}error{% endif %}
{% if watch.paused is defined and watch.paused != False %}paused{% endif %}
{% if watch.has_unviewed %}unviewed{% endif %}
@@ -133,26 +133,10 @@
<img class="status-icon" src="{{url_for('static_content', group='images', filename='google-chrome-icon.png')}}" alt="Using a Chrome browser" title="Using a Chrome browser" >
{% endif %}
{%if watch.is_pdf %}<img class="status-icon" src="{{url_for('static_content', group='images', filename='pdf-icon.svg')}}" title="Converting PDF to text" >{% endif %}
{% if watch.has_browser_steps %}<img class="status-icon status-browsersteps" src="{{url_for('static_content', group='images', filename='steps.svg')}}" title="Browser Steps is enabled" >{% endif %}
{%if watch.is_pdf %}<img class="status-icon" src="{{url_for('static_content', group='images', filename='pdf-icon.svg')}}" alt="Converting PDF to text" >{% endif %}
{% if watch.has_browser_steps %}<img class="status-icon status-browsersteps" src="{{url_for('static_content', group='images', filename='steps.svg')}}" alt="Browser Steps is enabled" >{% endif %}
<div class="error" style="display: none;">{{ watch.last_error }} {{ watch.last_notification_error }}
{# @todo - link this to ajax update or update someother way.. maybe watch.full_error text method? #}
{# #}{% if watch.last_error and '403' in watch.last_error %}
{# #}{% if has_proxies %}
{# #}<a href="{{ url_for('settings.settings_page', uuid=watch.uuid) }}#proxies">Try other proxies/location</a>&nbsp;
{# #}{% endif %}
{# #}<a href="{{ url_for('settings.settings_page', uuid=watch.uuid) }}#proxies">Try adding external proxies/locations</a>
{# #}{% endif %}
{# #}{% if watch.last_error and 'empty result or contain only an image' in watch.last_error %}
{# #}<a href="https://github.com/dgtlmoon/changedetection.io/wiki/Detecting-changes-in-images">more help here</a>.
{# #}{% endif %}
</div>
{#@todo - link this to ajax update or update someother way.. maybe watch.full_error text method?#}
{# #}{% if watch.last_notification_error is defined and watch.last_notification_error != False %}
{# #}<div class="fetch-error notification-error"><a href="{{url_for('settings.notification_logs')}}">{{ watch.last_notification_error }}</a></div>
{# #}{% endif %}
<div class="error-text">{{ watch.compile_error_texts|safe }}</div>
{% if watch['processor'] == 'text_json_diff' %}
{% if watch['has_ldjson_price_data'] and not watch['track_ldjson_price_data'] %}

View File

@@ -27,7 +27,6 @@ from flask import (
)
from flask_compress import Compress as FlaskCompress
from flask_login import current_user
from flask_paginate import Pagination, get_page_parameter
from flask_restful import abort, Api
from flask_cors import CORS
@@ -36,7 +35,6 @@ from flask_cors import CORS
watch_check_update = signal('watch_check_update', doc='Signal sent when a watch check is completed')
from flask_wtf import CSRFProtect
from loguru import logger
import eventlet
from changedetectionio import __version__
from changedetectionio import queuedWatchMetaData
@@ -581,6 +579,8 @@ def notification_runner():
# Trim the log length
notification_debug_log = notification_debug_log[-100:]
# Threaded runner, look for new watches to feed into the Queue.
def ticker_thread_check_time_launch_checks():
import random

View File

@@ -658,3 +658,29 @@ class model(watch_base):
if step_n:
available.append(step_n.group(1))
return available
@property
def compile_error_texts(self):
from flask import (
Markup, url_for
)
output = ""
last_error = self.get('last_error','')
has_proxies = datastore.proxy_list
if last_error and '403' in last_error:
if has_proxies:
output.append(str(Markup(f"{last_error} - <a href=\"{url_for('settings.settings_page', uuid=self.get('uuid'))}\">Try other proxies/location</a>&nbsp;'")))
else:
output.append(str(Markup(f"{last_error} - <a href=\"{url_for('settings.settings_page', uuid=self.get('uuid'))}\">Try adding external proxies/locations</a>&nbsp;'")))
if self.get('last_notification_error'):
output.append(str(Markup(f"<div class=\"notification-error\"><a href=\"{url_for('settings.notification_logs')}\">{ self.get('last_notification_error') }</a></div>")))
res = "\n".join(output)
return res

View File

@@ -2,10 +2,8 @@
import time
import apprise
from loguru import logger
from .apprise_plugin.assets import apprise_asset, APPRISE_AVATAR_URL
def process_notification(n_object, datastore):
from changedetectionio.safe_jinja import render as jinja_render
from . import default_notification_format_for_watch, default_notification_format, valid_notification_formats

View File

@@ -9,7 +9,6 @@ from blinker import signal
from changedetectionio import strtobool
class SignalHandler:
"""A standalone class to receive signals"""
def __init__(self, socketio_instance, datastore):
@@ -79,14 +78,13 @@ def handle_watch_update(socketio, **kwargs):
queue_list.append(q_item.item['uuid'])
# Create a simplified watch data object to send to clients
last_error_text = ' - '.join(filter(None, [watch.get('last_notification_error', ''), watch.get('error_text', '')])).strip()
watch_data = {
'checking_now': True if watch.get('uuid') in running_uuids else False,
'fetch_time': watch.get('fetch_time'),
'has_error': True if watch.get('last_error') or watch.get('last_notification_error') else False,
'has_error': True if watch.compile_error_texts.strip() else False,
'last_changed': watch.get('last_changed'),
'last_checked': watch.get('last_checked'),
'error_text': last_error_text,
'error_text': watch.compile_error_texts,
'last_checked_text': _jinja2_filter_datetime(watch),
'last_changed_text': timeago.format(int(watch['last_changed']), time.time()) if watch.history_n >= 2 and int(watch.get('last_changed', 0)) > 0 else 'Not yet',
'queued': True if watch.get('uuid') in queue_list else False,
@@ -224,8 +222,8 @@ def init_socketio(app, datastore):
else "Socket.IO: Queue update thread did not exit in time")
# Close any remaining client connections
if hasattr(socketio, 'server'):
socketio.server.disconnect()
#if hasattr(socketio, 'server'):
# socketio.server.disconnect()
logger.info("Socket.IO: Server shutdown complete")
except Exception as e:
logger.error(f"Socket.IO error during shutdown: {str(e)}")

View File

@@ -60,7 +60,7 @@ $(document).ready(function () {
$($watchRow).toggleClass('notification_muted', watch.notification_muted);
$($watchRow).toggleClass('paused', watch.paused);
$('td.error', $watchRow).text(watch.last_error_text)
$('td.error-text', $watchRow).text(watch.error_text)
$('td.last-changed', $watchRow).text(watch.last_checked_text)