Просмотр исходного кода

Stop the unread-count poller after the session ends (#9065)

* fix: stop the unread poller after the session ends

refreshUnreads() polls nbUnreadsPerFeed every 2 minutes and never checks
the response status, so once the session ends it keeps polling a dead
session indefinitely. Each request is a 401 (auth proxy / OIDC image) or
403 (stock); behind fail2ban the repeated failures ban the client IP.

Handle it like the other badAjax(status == 403) call sites: on a 401/403,
reload to re-authenticate instead of retrying.

* Enlarge HTTP 4xx status range

---------

Co-authored-by: Alexandre Alapetite <alexandre@alapetite.fr>
Cron 2 дней назад
Родитель
Сommit
94ff6e4366
1 измененных файлов с 1 добавлено и 1 удалено
  1. 1 1
      p/scripts/main.js

+ 1 - 1
p/scripts/main.js

@@ -2107,7 +2107,7 @@ function refreshUnreads() {
 	req.onload = function (e) {
 		const json = xmlHttpRequestJson(this);
 		if (!json) {
-			return badAjax(false);
+			return badAjax(this.status >= 400 && this.status <= 499);
 		}
 		const isAll = document.querySelector('.category.all.active');
 		let new_articles = false;