From 46dc3941c24dd33c4f789b405f425f5d68c60537 Mon Sep 17 00:00:00 2001 From: WXbet <57314510+WXbet@users.noreply.github.com> Date: Fri, 2 Oct 2026 13:20:00 +0200 Subject: [PATCH] fix the approval question and the session state, keep the viewer live A participant renamed while the approval question was open was still asked for with the old name until the question timed out and counted as not approved. The question is now withdrawn and asked again with the new name. The screen and the indicator kept showing the access as approved after everybody approved had left, they are updated now when the approval is dropped. UP in the viewer on a terminal without history held its output back without showing it, so the view seemed to stop. It only pauses now when there is something to scroll back to. --- src/RemoteSupport/plugin.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/RemoteSupport/plugin.py b/src/RemoteSupport/plugin.py index a0e0298..20c601d 100644 --- a/src/RemoteSupport/plugin.py +++ b/src/RemoteSupport/plugin.py @@ -111,6 +111,7 @@ def __init__(self): self.question = "" self.askedUids = set() self.askedNames = [] + self.approved = False self.declinedUids = set() # Not approved before anybody was, asked again on a new terminal. self.declinedRequests = set() self.declines = 0 @@ -278,6 +279,7 @@ def cleanup(self, reason=None, error=False): self.url = None self.approvalPending = False # A late answer is ignored as the session is gone. self.askedUids = set() + self.approved = False self.declinedUids = set() self.declinedRequests = set() self.declines = 0 @@ -317,6 +319,9 @@ def checkParticipants(self): # Everybody who joins has to be approved, meanwhil fd.write("".join(f"{uid}\n" for uid in sorted(approvedUids))) self.logEvent(f"Access for {', '.join(name for uid, name, final in connected)} kept from before the takeover") approvedUids = currentApprovals() + if bool(approvedUids) != self.approved: # Dropped once nobody approved is connected. + self.approved = bool(approvedUids) + self.setState(self.state) waiting = [(uid, name, final) for uid, name, final in participants() if uid not in approvedUids] if waiting and not exists(LOCK_FILE): fileWriteLine(LOCK_FILE, "1", source=MODULE_NAME) @@ -324,9 +329,9 @@ def checkParticipants(self): # Everybody who joins has to be approved, meanwhil remove(LOCK_FILE) waitingUids = {uid for uid, name, final in waiting} if self.approvalPending: - if waitingUids == self.askedUids: + if waitingUids == self.askedUids and sorted(name for uid, name, final in waiting) == sorted(self.askedNames): return - withdrawQuestion(self.approvalCallback) # Somebody joined or left meanwhile. + withdrawQuestion(self.approvalCallback) # Somebody joined, left or was renamed meanwhile. self.approvalPending = False self.setState(self.state) if not waiting or not all(final for uid, name, final in waiting): # The browser sets the name a few seconds after joining. @@ -1039,8 +1044,8 @@ def scrolledBack(self): def scroll(self, up): if up: - self.paused = True self.screen.prev_page() + self.paused = bool(self.scrolledBack()) # Without history there is nothing to scroll back to. elif self.scrolledBack(): self.screen.next_page() @@ -1222,8 +1227,9 @@ def unfreeze(self): def keyUp(self): large = self.largeTerminal() if self.focusLarge and large: - self.frozen = large self.terminals[large].scroll(up=True) + if self.terminals[large].scrolledBack(): + self.frozen = large self.render() elif not self.focusLarge: self.moveSelection(-1)