forked from GithubBackups/vichan
Merge pull request #118 from topkek/master
404/Error handling for thread updater
This commit is contained in:
commit
4b3e33c5b0
@ -43,6 +43,7 @@ $(document).ready(function(){
|
|||||||
var settings = new script_settings('auto-reload');
|
var settings = new script_settings('auto-reload');
|
||||||
var poll_interval_mindelay = settings.get('min_delay_bottom', 5000);
|
var poll_interval_mindelay = settings.get('min_delay_bottom', 5000);
|
||||||
var poll_interval_maxdelay = settings.get('max_delay', 600000);
|
var poll_interval_maxdelay = settings.get('max_delay', 600000);
|
||||||
|
var poll_interval_errordelay = settings.get('error_delay', 30000);
|
||||||
|
|
||||||
// number of ms to wait before reloading
|
// number of ms to wait before reloading
|
||||||
var poll_interval_delay = poll_interval_mindelay;
|
var poll_interval_delay = poll_interval_mindelay;
|
||||||
@ -191,6 +192,28 @@ $(document).ready(function(){
|
|||||||
else
|
else
|
||||||
$('#update_secs').text("No new posts found");
|
$('#update_secs').text("No new posts found");
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
error: function(xhr, status_text, error_text) {
|
||||||
|
if (status_text == "error") {
|
||||||
|
if (error_text == "Not Found") {
|
||||||
|
$('#update_secs').text("Thread deleted or pruned");
|
||||||
|
$('#auto_update_status').prop('checked', false);
|
||||||
|
$('#auto_update_status').prop('disabled', true); // disable updates if thread is deleted
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
$('#update_secs').text("Error: "+error_text);
|
||||||
|
}
|
||||||
|
} else if (status_text) {
|
||||||
|
$('#update_secs').text("Error: "+status_text);
|
||||||
|
} else {
|
||||||
|
$('#update_secs').text("Unknown error");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Keep trying to update
|
||||||
|
if ($('#auto_update_status').is(':checked')) {
|
||||||
|
poll_interval_delay = poll_interval_errordelay;
|
||||||
|
auto_update(poll_interval_delay);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -58,6 +58,8 @@ tb_settings['auto-reload'] = {
|
|||||||
min_delay_bottom: 5000,
|
min_delay_bottom: 5000,
|
||||||
// Maximum delay before reloading the page
|
// Maximum delay before reloading the page
|
||||||
max_delay: 600000,
|
max_delay: 600000,
|
||||||
|
// Delay if there was an error
|
||||||
|
error_delay: 30000,
|
||||||
// Reset the delay to the minimum upon focussing the window.
|
// Reset the delay to the minimum upon focussing the window.
|
||||||
reset_focus: true
|
reset_focus: true
|
||||||
};
|
};
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
<div class="thread grid-li grid-size-small">
|
<div class="thread grid-li grid-size-small">
|
||||||
<a href="{{post.link}}">
|
<a href="{{post.link}}">
|
||||||
{% if post.youtube %}
|
{% if post.youtube %}
|
||||||
<img src="http://img.youtube.com/vi/{{ post.youtube }}/0.jpg"
|
<img src="https://img.youtube.com/vi/{{ post.youtube }}/0.jpg"
|
||||||
{% else %}
|
{% else %}
|
||||||
<img src="{{post.file}}"
|
<img src="{{post.file}}"
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user