allow to configure web page / websocket ports individually

This commit is contained in:
DIL5
2026-08-04 11:13:31 +02:00
parent 16513e79ba
commit 2bf5c24dd9
3 changed files with 9 additions and 17 deletions
+2 -1
View File
@@ -16,5 +16,6 @@ port=5000
cfg=dil5
[BOXWEB]
port=80
port=8050
wsport=8010
page=dil5
+6 -15
View File
@@ -157,24 +157,13 @@ ExecStart = /usr/bin/python3 {TOOLS}/display.py -d
WantedBy = multi-user.target
"""
DISPLAY_SERVICE = f"""[Unit]
Description = status display
After = network.target
[Service]
User = root
ExecStart = /usr/bin/python3 {TOOLS}/display.py -d
[Install]
WantedBy = multi-user.target
"""
BOXWEB_SERVICE = """[Unit]
Description = Web service for local GUI on a box
After = waitboot.target
[Service]
ExecStart = /usr/bin/python /home/l_samenv/boxweb/flaskserver.py {page} {port}
WorkingDirectory = /home/l_samenv/boxweb
ExecStart = /usr/bin/python flaskserver.py {page}.{port}.{wsport}
[Install]
WantedBy = default.target
@@ -267,15 +256,17 @@ def pip():
show.dirty = True
def boxweb(port=8080, page=None):
def boxweb(port=8080, wsport=8051, page=None):
if page is None:
servicecfg = None
else:
port = int(port)
main_ports.add(port)
wsport = int(wsport)
main_ports.add(wsport)
if port == 8080:
main_ports.add(80)
servicecfg = BOXWEB_SERVICE.format(port=port, page=page)
servicecfg = BOXWEB_SERVICE.format(port=port, wsport=wsport, page=page)
for file, dest in (('labwc.service', '/etc/systemd/system'),
('boxweb-browser.service', '/home/l_samenv/.config/systemd/user')):
src = TOOLS / 'desktop' / file
+1 -1
View File
@@ -25,7 +25,7 @@ boxweb() {
if [[ -z "$1" ]]; then
echo "Usage: boxweb status|start|stop|restart"
else
sudo systemctl $1 boxweb
systemctl --user $1 boxweb
fi
}