Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add key combo for hard refresh in kiosk #147

Merged
merged 3 commits into from
Jan 4, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions controller/Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## Added

- kiosk: Add a key combination to perform hard refresh (Ctrl-Shift-R)
- os: Added localization options for Polish and Czech

# [2023.9.0] - 2023-09-12
Expand Down
4 changes: 4 additions & 0 deletions docs/user-manual/Readme.org
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ View what has been added, changed and fixed with each version.

A status screen providing a brief status report about various components of the system is available on ~tty8~. It can be accessed using the key combination ~Ctrl-Alt-F8~. To get back from the status screen to the graphical interface, use ~Ctrl-Alt-F7~.

** Clearing kiosk browser cache

At times network issues may cause corrupted media resources to end up in the kiosk browser's cache. In this case it may be helpful to clear this cache to force all resources being downloaded again. A hard refresh can be triggered using ~Ctrl-Shift-R~, which clears the cache and then reloads the kiosk application. The hard refresh does not affect user sessions or preferences, so it can be performed without the user having to log in again.

** Wiping user data

Certain user data such as Play login credentials, wireless settings are stored persistently on the computer's disk.
Expand Down
15 changes: 15 additions & 0 deletions kiosk/kiosk_browser/browser_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def __init__(self, url, get_current_proxy, parent):
# Shortcut to manually reload
self.reload_shortcut = QtWidgets.QShortcut('CTRL+R', self)
self.reload_shortcut.activated.connect(self.reload)
# Shortcut to perform a hard refresh
self.hard_refresh_shortcut = QtWidgets.QShortcut('CTRL+SHIFT+R', self)
self.hard_refresh_shortcut.activated.connect(self.hard_refresh)

# Prepare reload timer
self._reload_timer = QtCore.QTimer(self)
Expand All @@ -77,6 +80,18 @@ def reload(self):
if self._reload_timer.isActive():
self._reload_timer.stop()

def hard_refresh(self):
guyonvarch marked this conversation as resolved.
Show resolved Hide resolved
""" Clear cache, then reload.

Does not affect cookies or localstorage contents.

NOTE This clears the entire HTTP cache, assumed to be OK as the kiosk targets a specific page.
"""
logging.info(f"Clearing HTTP cache (hard refresh)")
QtWebEngineWidgets.QWebEngineProfile.defaultProfile().clearHttpCache()
guyonvarch marked this conversation as resolved.
Show resolved Hide resolved

self.reload()

def load(self, url: str):
""" Load specific URL.
"""
Expand Down