Simplify screenshot dimensions
Remove width/height query params from screenshot endpoint. New sessions created by screenshot use DEFAULT_TERMINAL_SIZE. Existing sessions keep their current size.
This commit is contained in:
@@ -527,26 +527,13 @@ class LocalServer:
|
||||
if route_key is None:
|
||||
raise web.HTTPNotFound(text="No running session")
|
||||
|
||||
# Parse requested dimensions (used when creating new sessions)
|
||||
try:
|
||||
req_width = int(request.query.get("width", str(DEFAULT_TERMINAL_SIZE[0])))
|
||||
except ValueError:
|
||||
req_width = DEFAULT_TERMINAL_SIZE[0]
|
||||
req_width = max(10, min(400, req_width))
|
||||
|
||||
try:
|
||||
req_height = int(request.query.get("height", str(DEFAULT_TERMINAL_SIZE[1])))
|
||||
except ValueError:
|
||||
req_height = DEFAULT_TERMINAL_SIZE[1]
|
||||
req_height = max(5, min(200, req_height))
|
||||
|
||||
session_process = self.session_manager.get_session_by_route_key(RouteKey(route_key))
|
||||
if session_process is None and route_key in self.session_manager.apps_by_slug:
|
||||
# Create session with requested dimensions
|
||||
# Create session with default dimensions
|
||||
await self._create_terminal_session(
|
||||
route_key,
|
||||
width=req_width,
|
||||
height=req_height,
|
||||
width=DEFAULT_TERMINAL_SIZE[0],
|
||||
height=DEFAULT_TERMINAL_SIZE[1],
|
||||
)
|
||||
session_process = self.session_manager.get_session_by_route_key(RouteKey(route_key))
|
||||
# Give the session a moment to start and produce initial output
|
||||
|
||||
Reference in New Issue
Block a user