🐛 Fix stale session reporting

Fix handling of `stale` reauthRequired in UI and
document it. Also send it in case of an `auth`
message with an unknown session.

Closes #4653
This commit is contained in:
Gina Häußge committed 2022-09-27 13:43:32 +02:00
1 parent 0093d96da4
commit be0d452ab9
3 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -30,7 +30,7 @@ following message types are currently available for usage by 3rd party clients:
* ``connected``: Initial connection information, sent only right after establishing the socket connection. See
:ref:`the payload data model <sec-api-push-datamodel-connected>`.
* ``reauthRequired``: A reauthentication of the current login session is required. The ``reason`` parameter in the
payload defines whether a full active login is necessary (values ``logout`` and ``removed``) or a simple passive
payload defines whether a full active login is necessary (values ``logout``, ``stale``, ``removed``) or a simple passive
login will suffice (all other values).
* ``current``: Rate limited general state update, payload contains information about the printer's state, job progress,
accumulated temperature points and log lines since last update. OctoPrint will send these updates when new information
+1
View File
@@ -305,6 +305,7 @@ class PrinterStateConnection(
f"Unknown user/session combo: {user_id}:{user_session}"
)
self._on_logout()
self._sendReauthRequired("stale")
self._register()
@@ -308,7 +308,7 @@ $(function () {
};
self.onDataUpdaterReauthRequired = function (reason) {
if (reason === "logout" || reason === "removed") {
if (reason === "logout" || reason === "stale" || reason === "removed") {
self.logout();
} else {
self.requestData();