Fix redirect bug, add note about serving under non-root path
This commit is contained in:
		
							parent
							
								
									d32ca9fc6a
								
							
						
					
					
						commit
						8f647a85b9
					
				
					 2 changed files with 18 additions and 5 deletions
				
			
		|  | @ -210,7 +210,7 @@ def main(page: ft.Page): | ||||||
|             redirect = '/pos' if user_uuid else '/login' |             redirect = '/pos' if user_uuid else '/login' | ||||||
| 
 | 
 | ||||||
|         if redirect and page.route != redirect: |         if redirect and page.route != redirect: | ||||||
|             page.go(other) |             page.go(redirect) | ||||||
|             return |             return | ||||||
| 
 | 
 | ||||||
|         if page.route == '/pos': |         if page.route == '/pos': | ||||||
|  |  | ||||||
|  | @ -79,15 +79,28 @@ class Serve(commands.Subcommand): | ||||||
|         import flet as ft |         import flet as ft | ||||||
|         from wuttapos.app import main |         from wuttapos.app import main | ||||||
| 
 | 
 | ||||||
|  |         kw = {} | ||||||
|  | 
 | ||||||
|         host = self.config.get('wuttapos', 'serve.host', |         host = self.config.get('wuttapos', 'serve.host', | ||||||
|                                default='0.0.0.0') |                                default='0.0.0.0') | ||||||
|  |         kw['host'] = host | ||||||
|  | 
 | ||||||
|         port = self.config.getint('wuttapos', 'serve.port', |         port = self.config.getint('wuttapos', 'serve.port', | ||||||
|                                   default=8332) |                                   default=8332) | ||||||
|         path = self.config.get('wuttapos', 'serve.path') |         kw['port'] = port | ||||||
| 
 | 
 | ||||||
|         log.info(f"will serve WuttaPOS on http://{host}:{port}") |         # TODO: we technically "support" this, in that we do pass the | ||||||
|         ft.app(name=path, target=main, view=None, host=host, port=port, |         # value on to Flet, but in practice it does not work right | ||||||
|                assets_dir=resource_path('wuttapos:assets')) |         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): | class Status(commands.Subcommand): | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Lance Edgar
						Lance Edgar