alandmoore / admbrowser Goto Github PK
View Code? Open in Web Editor NEWA Web browser for kiosks and digital signage, based on Python, PyQt, and Blink
A Web browser for kiosks and digital signage, based on Python, PyQt, and Blink
Use QMessageBox
to display some errors rather than overwriting the contents of the browser window and leaving a user stranded on a nonexistent page.
Possible errors to display:
External content isn't handled or loaded. Attempting to download or view a non-HTML link just results in an error.
The user and password are not automatically filled in —like other browsers with password management do— on the Jellyfin media system.
This can be tested with the following demo YAML file:
default_password: ''
default_user: demo
navigation: False
start_url: https://demo.jellyfin.org/stable/web/index.html
window_size: max
This would be nice to have for a kiosk browser without keyboard.
Even when popup windows are enabled, they don't show.
[sirlattwich@sirlattwich-ntp admbrowser]$ python admbrowser.py Traceback (most recent call last): File "admbrowser.py", line 1, in <module> from admbrowser import main File "/home/sirlattwich/Downloads/admbrowser/admbrowser/__init__.py", line 1, in <module> from .browser import * File "/home/sirlattwich/Downloads/admbrowser/admbrowser/browser.py", line 21, in <module> from PyQt5 import QtWebEngineWidgets as qtwe ImportError: cannot import name 'QtWebEngineWidgets' from 'PyQt5' (/usr/lib/python3.7/site-packages/PyQt5/__init__.py)
Root cause: https://stackoverflow.com/questions/37876987/cannot-import-qtwebkitwidgets-in-pyqt5
Solution: Add "python-pyqtwebengine" to requirements
https://www.archlinux.org/packages/extra/x86_64/python-pyqtwebengine/
Downloading a file with a handler configured to a command that doesn't exist causes the browser to crash.
On Xubuntu 22.04 LTS:
~/admbrowser$ python setup.py install
running install
/usr/lib/python3/dist-packages/setuptools/command/install.py:34: SetuptoolsDeprecationWarning:
setup.py install is deprecated. Use build and pip and other standards-based tools.
warnings.warn(
/usr/lib/python3/dist-packages/setuptools/command/easy_install.py:158: EasyInstallDeprecationWarning:
easy_install command is deprecated. Use build and pip and other standards-based tools.
Plugins don't seem to work, and they cannot be enabled or disabled.
The proxy server & port cannot be set. The setting has no effect.
This is an idea that originates from the surf
browser. Suckless.org's surf
is a small WebKit2/GTK+ based browser that I used to use quite often before encountering this great WebEngine/PyQt5 ADMBrowser.
surf
allows to write a couple of CSS statements that will overwrite some of the CSS of a known web site. This results to be a handy way to eleminate ads and other annoyances or rather to emphasise parts of a web page one is interested in.
Here is an actual example for some of the named CSS classes of the domain rtl.fr
:
.ads, .legal-notice, .newsletter, .produit {display: none !important;}
.hResultPrincipal {font-size: 175% !important;}
CSS overwrite statements would be a great and natural addition to ADMBrowser's .yaml
site-dependent configuration files. It would also solve the issue of ADMBrowser users currently being exposed to ads that could be perceived as offensive in an educational or public library setting.
if not hasattr(self, 'really_quit'):
# set hidden quit action
self.really_quit = self.createAction(
"",
self.close,
qtg.QKeySequence("Ctrl+Alt+Q"),
None,
""
)
Should solve your Ambiguos shortcut issue..
Popup windows, when allowed by allow_popups
, do not inherit some essential properties, such as:
navigation
, window_icon
, window_size
and window_title
.
By consequence, popup windows open with the smallest possible dimensions on the desktop, after which one needs to maximise these to even see these.
The zoom_factor
is correctly inherited, though.
It would be nice if one could define a custom window title in the YAML file to replace the default "Browser" window title.
This is to announce that I have been dabbling a bit with Qt Geolocation & Notifications in the following branch of my fork: https://github.com/stroobandt/admbrowser/tree/geolocation
Beware, this has not been properly tested yet.
Nonetheless, most if not all of the Qt infrastructure required for this has been added to this branch of ADMbrowser.
However, I am still struggling quite a bit with the Linux geoclue
service and permissions. That project happens to be a complete mess and poorly documented. Is seems to be hastily pulled together to exclusively serve the need of Android smartphones. Help & testers (also on Windows/Mac) are more than welcome.
Neither have I tested notifications yet. It came as a low hanging fruit when writing the code for geolocation.
My intention for ADMbrowser geolocation is to run it on a cyberdeck as a smartphone replacer. (I hate smartphones for a slew of reasons.) Here are some examples of cyberdecks:
privacy mode setting has no effect, does nothing.
admbrowser.py
needs the "crunch bang" statement #!/usr/bin/env python
to render it executable on *nix systems as per documentation.
The documentation also needs editing as it mentions browser.py
, whereas it should read admbrowser.py
.
#!/usr/bin/env python
is preferred over #!/usr/bin/python
as this is less dogmatic about the organisation of the file system. For example, the first statement will work on BSD systems, whereas the second will not.
I have prepared two pull requests that resolve these issues:
SSL certificate handling is broken. The setting for ssl_mode does nothing.
Included admbrowser
bash script is broken.
ADMBrowser can't run on latest version of Raspbian (Buster).
After I have installed PyQt5 with sudo apt-get install python3-pyqt5
when I try to run python3 admbrowser.py
I get the following error:
Traceback (most recent call last):
File "admbrowser.py", line 1, in <module>
from admbrowser import main
File "/home/pi/admbrowser/admbrowser/__init__.py", line 1, in <module>
from .browser import *
File "/home/pi/admbrowser/admbrowser/browser.py", line 21, in <module>
from PyQt5 import QtWebEngineWidgets as qtwe
ImportError: cannot import name 'QtWebEngineWidgets' from 'PyQt5' (/usr/lib/python3/dist-packages/PyQt5/__init__.py)
Do you know a workaround to make it working on Raspberry Pi?
Hello, congratulations for the well structured and ordered code.
I ask, how can I download a file?
my call is:
<a href='Controller/name_file/date' targhet='_blank' /a>
the called controller processes the data and responds with a octed-stram header.
in my case I use codeigniter 4
return $ this-> response-> download ($ file, null) -> setFileName ($ fileName);
the browser sees the request twice.
header octed-stream
i set admbrowser.yaml
content_handlers:
'application / octed-stram': 'file'
and the file is downloaded.
But the window new tab stays open in 'abaut: blank'.
How should I set the download header?
Or
How can I close the window new tab when the download is finished?
Thank you
just for information python-yaml is no longer maintained you have to use pyYAML.
To change in requirements.
Currently no way to make the custom 404 and network error pages display, because the value passed into QtWebEngineView.loadFinished
is unreliable and has many false negatives. There is also no way to inspect the reasons why loading apparently failed, or to hook into the HTTP process to view response codes, etc.
Looking for a reasonable workaround
An honour-full mention on https://en.wikipedia.org/wiki/Comparison_of_lightweight_web_browsers is certainly well deserved. This is especially the case because admbrowser
is one of the few lightweight browsers employing WebEngine and perhaps the only one that is fully configurable.
Doing so, would attract more users, and by extension, more potential developers.
For some reason, setting the user agent string doesn't actually work. Web servers still get the default string.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.