1
0
Fork 0

svc: Save config after navigation
dustin/hudctrl/pipeline/head There was a failure building this commit Details

When a makes a *POST /screen/{name}/navigate* HTTP request, the URL list
is updated and saved to the configuration file.  This provides a
mechanism for configuring the URL list, since it is now part of the
display configuration file and not a separate file manged externally.
master 0.2.0
Dustin 2022-12-18 12:54:31 -06:00
parent debce63bba
commit a14921b79e
1 changed files with 7 additions and 1 deletions

View File

@ -137,8 +137,14 @@ async def get_screenshot(
'/screen/{name}/navigate', '/screen/{name}/navigate',
response_class=fastapi.responses.PlainTextResponse, response_class=fastapi.responses.PlainTextResponse,
) )
async def navigate(name: str, url: str = fastapi.Form(...)): async def navigate(
bgtasks: fastapi.BackgroundTasks,
name: str,
url: str = fastapi.Form(...),
):
await svc.navigate(name, url) await svc.navigate(name, url)
svc.urls[name] = url
bgtasks.add_task(svc.save_config)
@app.on_event('shutdown') @app.on_event('shutdown')