Merge pull request 'refs #2060 add script for setting browser URL' (#12) from py-seturl into main

Reviewed-on: #12
main 3.6.0
Natalia Serrano 2025-05-21 15:48:08 +02:00
commit d44d848327
6 changed files with 54 additions and 34 deletions

View File

@ -5,6 +5,16 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [3.6.0] - 2025-05-21
### Changed
- Configure stunnel and dbus via includes rather than in python code
### Added
- Add script for changing the URL in the running browser
## [3.5.0] - 2025-05-19 ## [3.5.0] - 2025-05-19
### Changed ### Changed

View File

@ -108,37 +108,6 @@ def updateCaCertificates():
print ('Updating CA trust Store', file=sys.stderr) print ('Updating CA trust Store', file=sys.stderr)
utils.run (['update-ca-certificates']) utils.run (['update-ca-certificates'])
def configure_stunnel():
print ('configure_stunnel', file=sys.stderr)
with open ('/etc/stunnel/menu.conf', 'w') as fd:
fd.write ('setuid = stunnel4\n')
fd.write ('setgid = stunnel4\n')
fd.write ('pid = /var/run/stunnel4/menu.pid\n')
fd.write ('foreground = yes\n')
fd.write ('debug = info\n')
fd.write ('\n')
fd.write ('[menu]\n')
fd.write ('client = yes\n')
fd.write ('accept = 127.0.0.1:81\n')
fd.write ('connect = __OGCORE_IP__:__OGCORE_PORT__\n')
fd.write ('cert = /opt/opengnsys/etc/ogagent.crt\n')
fd.write ('key = /opt/opengnsys/etc/ogagent.key\n')
fd.write ('CAfile = /opt/opengnsys/etc/ca.crt\n')
fd.write ('requireCert = yes\n')
fd.write ('verifyChain = yes\n')
def configure_dbus():
print ('configure_dbus', file=sys.stderr)
with open ('/etc/dbus-1/system.d/ogbrowser.conf', 'w') as fd:
fd.write ('<busconfig>\n')
fd.write (' <policy user="root">\n')
fd.write (' <allow own="es.opengnsys.OGBrowser.browser"/>\n')
fd.write (' <allow send_destination="es.opengnsys.OGBrowser.browser"/>\n')
fd.write (' <allow send_interface="es.opengnsys.OGBrowser.browser"/>\n')
fd.write (' <allow send_type="method_call"/>\n')
fd.write (' </policy>\n')
fd.write ('</busconfig>\n')
def boottoolsPythonModules(): def boottoolsPythonModules():
utils.run (['pip3', 'install', 'pyblkid', '--break-system-packages']) utils.run (['pip3', 'install', 'pyblkid', '--break-system-packages'])
@ -195,7 +164,5 @@ if __name__ == '__main__':
boottoolsSoftwareCompile() boottoolsSoftwareCompile()
boottoolsPythonModules() boottoolsPythonModules()
boottoolsRemovePackages() boottoolsRemovePackages()
configure_stunnel()
configure_dbus()
setup_resolvconf() ## do this again, since someone seems to be overwriting the file setup_resolvconf() ## do this again, since someone seems to be overwriting the file
boottoolsInitrdGenerate (args.osrelease) boottoolsInitrdGenerate (args.osrelease)

View File

@ -0,0 +1,8 @@
<busconfig>
<policy user="root">
<allow own="es.opengnsys.OGBrowser.browser"/>
<allow send_destination="es.opengnsys.OGBrowser.browser"/>
<allow send_interface="es.opengnsys.OGBrowser.browser"/>
<allow send_type="method_call"/>
</policy>
</busconfig>

View File

@ -1 +1 @@
OpenGnsys Client 3.5.0 OpenGnsys Client 3.6.0

View File

@ -0,0 +1,15 @@
setuid = stunnel4
setgid = stunnel4
pid = /var/run/stunnel4/menu.pid
foreground = yes
debug = info
[menu]
client = yes
accept = 127.0.0.1:81
connect = __OGCORE_IP__:__OGCORE_PORT__
cert = /opt/opengnsys/etc/ogagent.crt
key = /opt/opengnsys/etc/ogagent.key
CAfile = /opt/opengnsys/etc/ca.crt
requireCert = yes
verifyChain = yes

View File

@ -0,0 +1,20 @@
#!/usr/bin/python3
import sys
import dbus
if 2 != len(sys.argv):
sys.exit (1)
dest = 'es.opengnsys.OGBrowser.browser'
path = '/'
interface = None
method = 'setURL'
signature = 's'
url = sys.argv[1]
b = dbus.SystemBus()
try:
b.call_blocking (dest, path, interface, method, 's', [url])
except Exception as e:
sys.exit (1)