svc: Add navigate operation
The *POST /screen/{name}/navigate* path operation allows the client to request the screen navigate to a different URL, specified by the `url` form field.master
parent
0536574072
commit
e452393b9f
|
@ -126,6 +126,14 @@ async def get_screenshot(
|
|||
return response
|
||||
|
||||
|
||||
@app.post(
|
||||
'/screen/{name}/navigate',
|
||||
response_class=fastapi.responses.PlainTextResponse,
|
||||
)
|
||||
async def navigate(name: str, url: str = fastapi.Form(...)):
|
||||
await svc.navigate(name, url)
|
||||
|
||||
|
||||
@app.on_event('shutdown')
|
||||
async def on_shutdown():
|
||||
await svc.shutdown()
|
||||
|
|
|
@ -116,6 +116,12 @@ class HUDService:
|
|||
dict,
|
||||
)
|
||||
|
||||
async def navigate(self, name: str, url: str) -> None:
|
||||
assert self.marionette
|
||||
async with self.lock:
|
||||
await self.marionette.switch_to_window(self.windows[name])
|
||||
await self.marionette.navigate(url)
|
||||
|
||||
async def refresh_screen(self, name: str) -> None:
|
||||
assert self.marionette
|
||||
async with self.lock:
|
||||
|
|
Loading…
Reference in New Issue