Fix redirect bug, add note about serving under non-root path

This commit is contained in:
Lance Edgar 2023-10-04 21:03:57 -05:00
parent d32ca9fc6a
commit 8f647a85b9
2 changed files with 18 additions and 5 deletions

View file

@ -210,7 +210,7 @@ def main(page: ft.Page):
redirect = '/pos' if user_uuid else '/login'
if redirect and page.route != redirect:
page.go(other)
page.go(redirect)
return
if page.route == '/pos':

View file

@ -79,15 +79,28 @@ class Serve(commands.Subcommand):
import flet as ft
from wuttapos.app import main
kw = {}
host = self.config.get('wuttapos', 'serve.host',
default='0.0.0.0')
kw['host'] = host
port = self.config.getint('wuttapos', 'serve.port',
default=8332)
path = self.config.get('wuttapos', 'serve.path')
kw['port'] = port
log.info(f"will serve WuttaPOS on http://{host}:{port}")
ft.app(name=path, target=main, view=None, host=host, port=port,
assets_dir=resource_path('wuttapos:assets'))
# TODO: we technically "support" this, in that we do pass the
# value on to Flet, but in practice it does not work right
path = self.config.get('wuttapos', 'serve.path', default='')
if path:
path = path.strip('/') + '/'
kw['name'] = path
# kw['route_url_strategy'] = 'hash'
log.info(f"will serve WuttaPOS on http://{host}:{port}/{path}")
ft.app(target=main, view=None,
assets_dir=resource_path('wuttapos:assets'),
**kw)
class Status(commands.Subcommand):