simplyprint: remove call to escape_url

The url received from SimplyPrint should already be escaped.  It
isn't possibly to reliably quote a full url if any of the parts contain
special characters.

This commit also corrects some minor type checking issues.

Signed-off-by:  Eric Callahan <arksine.code@gmail.com>
This commit is contained in:
Eric Callahan 2023-02-11 07:47:55 -05:00
parent 55ebe120c5
commit 5661b0216c
No known key found for this signature in database
GPG Key ID: 5A1EB336DFB4C71B
1 changed files with 7 additions and 9 deletions

View File

@ -520,14 +520,14 @@ class SimplyPrint(Subscribable):
"webcam_status", {"connected": self.webcam_stream.connected} "webcam_status", {"connected": self.webcam_stream.connected}
) )
async def _on_klippy_ready(self): async def _on_klippy_ready(self) -> None:
last_stats: Dict[str, Any] = self.job_state.get_last_stats() last_stats: Dict[str, Any] = self.job_state.get_last_stats()
if last_stats["state"] == "printing": if last_stats["state"] == "printing":
self._on_print_start(last_stats, last_stats, False) self._on_print_start(last_stats, last_stats, False)
else: else:
self._update_state("operational") self._update_state("operational")
query: Dict[str] = await self.klippy_apis.query_objects( query: Optional[Dict[str, Any]]
{"heaters": None}, None) query = await self.klippy_apis.query_objects({"heaters": None}, None)
sub_objs = { sub_objs = {
"display_status": ["progress"], "display_status": ["progress"],
"bed_mesh": ["mesh_matrix", "mesh_min", "mesh_max"], "bed_mesh": ["mesh_matrix", "mesh_min", "mesh_max"],
@ -571,7 +571,6 @@ class SimplyPrint(Subscribable):
# Add filament sensor subscription # Add filament sensor subscription
if not sub_objs: if not sub_objs:
return return
status: Dict[str, Any]
# Create our own subscription rather than use the host sub # Create our own subscription rather than use the host sub
args = {'objects': sub_objs} args = {'objects': sub_objs}
klippy: KlippyConnection klippy: KlippyConnection
@ -957,7 +956,7 @@ class SimplyPrint(Subscribable):
self.cache.current_wsid = longest.uid self.cache.current_wsid = longest.uid
return ui_data return ui_data
async def _send_machine_data(self): async def _send_machine_data(self) -> None:
app_args = self.server.get_app_args() app_args = self.server.get_app_args()
data = self._get_ui_info() data = self._get_ui_info()
data["api"] = "Moonraker" data["api"] = "Moonraker"
@ -984,7 +983,7 @@ class SimplyPrint(Subscribable):
self.cache.machine_info = data self.cache.machine_info = data
self.send_sp("machine_data", data) self.send_sp("machine_data", data)
def _send_firmware_data(self): def _send_firmware_data(self) -> None:
kinfo = self.server.get_klippy_info() kinfo = self.server.get_klippy_info()
if "software_version" not in kinfo: if "software_version" not in kinfo:
return return
@ -1335,7 +1334,7 @@ class WebcamStream:
def connected(self) -> bool: def connected(self) -> bool:
return self._connected return self._connected
async def intialize_url(self): async def intialize_url(self) -> None:
wcmgr: WebcamManager = self.server.lookup_component("webcam") wcmgr: WebcamManager = self.server.lookup_component("webcam")
cams = wcmgr.get_webcams() cams = wcmgr.get_webcams()
if not cams: if not cams:
@ -1509,7 +1508,6 @@ class PrintHandler:
{"state": "error", "message": "GCode Path not Registered"} {"state": "error", "message": "GCode Path not Registered"}
) )
return return
url = client.escape_url(url)
accept = "text/plain,applicaton/octet-stream" accept = "text/plain,applicaton/octet-stream"
self._on_download_progress(0, 0, 0) self._on_download_progress(0, 0, 0)
try: try:
@ -1580,7 +1578,7 @@ class PrintHandler:
state = "ready" state = "ready"
self.simplyprint.send_sp("file_progress", {"state": state}) self.simplyprint.send_sp("file_progress", {"state": state})
async def start_print(self): async def start_print(self) -> None:
if not self.pending_file: if not self.pending_file:
return return
pending = self.pending_file pending = self.pending_file