diff --git a/wuttapos/app.py b/wuttapos/app.py index 58786ee..c0d976e 100644 --- a/wuttapos/app.py +++ b/wuttapos/app.py @@ -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': diff --git a/wuttapos/commands.py b/wuttapos/commands.py index f177d64..5c73ba4 100644 --- a/wuttapos/commands.py +++ b/wuttapos/commands.py @@ -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):