kopia lustrzana https://github.com/dgtlmoon/changedetection.io
Proxy scan improvements - handle custom proxies, dont restart when a scan is already running (#1689)
rodzic
7cb7eebbc5
commit
661f7fe32c
|
@ -46,14 +46,18 @@ def construct_blueprint(datastore: ChangeDetectionStore):
|
|||
except content_fetcher.Non200ErrorCodeReceived as e:
|
||||
if e.status_code == 404:
|
||||
status.update({'status': 'OK', 'length': len(contents), 'text': f"OK but 404 (page not found)"})
|
||||
elif e.status_code == 403:
|
||||
status.update({'status': 'ERROR', 'length': len(contents), 'text': f"403 - Access denied"})
|
||||
elif e.status_code == 403 or e.status_code == 401:
|
||||
status.update({'status': 'ERROR', 'length': len(contents), 'text': f"{e.status_code} - Access denied"})
|
||||
else:
|
||||
status.update({'status': 'ERROR', 'length': len(contents), 'text': f"Status code: {e.status_code}"})
|
||||
except text_json_diff.FilterNotFoundInResponse:
|
||||
status.update({'status': 'OK', 'length': len(contents), 'text': f"OK but CSS/xPath filter not found (page changed layout?)"})
|
||||
except content_fetcher.EmptyReply as e:
|
||||
status.update({'status': 'ERROR OTHER', 'length': len(contents) if contents else 0, 'text': "Empty reply, needs chrome?"})
|
||||
if e.status_code == 403 or e.status_code == 401:
|
||||
status.update({'status': 'ERROR OTHER', 'length': len(contents), 'text': f"Got empty reply with code {e.status_code} - Access denied"})
|
||||
else:
|
||||
status.update({'status': 'ERROR OTHER', 'length': len(contents) if contents else 0, 'text': f"Empty reply with code {e.status_code}, needs chrome?"})
|
||||
|
||||
except Exception as e:
|
||||
status.update({'status': 'ERROR OTHER', 'length': len(contents) if contents else 0, 'text': 'Error: '+str(e)})
|
||||
else:
|
||||
|
@ -94,8 +98,13 @@ def construct_blueprint(datastore: ChangeDetectionStore):
|
|||
if not datastore.proxy_list:
|
||||
return
|
||||
|
||||
# @todo - Cancel any existing runs
|
||||
checks_in_progress[uuid] = {}
|
||||
if checks_in_progress.get(uuid):
|
||||
state = _recalc_check_status(uuid=uuid)
|
||||
for proxy_key, v in state.items():
|
||||
if v.get('status') == 'RUNNING':
|
||||
return state
|
||||
else:
|
||||
checks_in_progress[uuid] = {}
|
||||
|
||||
for k, v in datastore.proxy_list.items():
|
||||
if not checks_in_progress[uuid].get(k):
|
||||
|
|
|
@ -12,7 +12,7 @@ $(function () {
|
|||
|
||||
function set_proxy_check_status(proxy_key, state) {
|
||||
// select input by value name
|
||||
const proxy_li = $("input[value=" + proxy_key + "]").parent();
|
||||
const proxy_li = $('input[value="' + proxy_key + '" ]').parent();
|
||||
if (state['status'] === 'RUNNING') {
|
||||
$('.proxy-status', proxy_li).html('<span class="spinner"></span>');
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue