You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
self.Logger.error("Our websocket connection to moonraker needs auth and we failed to get the API key.")
596
-
raiseException("Websocket unauthorized.")
597
-
else:
601
+
ifself._TryToGetWebsocketAuth():
602
+
# On success, shut down the websocket so we do the reconnect logic.
598
603
self.Logger.info("Successfully got the API key, restarting the websocket to try again using it.")
599
-
# Shut down the websocket so we do the reconnect logic.
600
604
self._RestartWebsocket()
601
605
return
606
+
# Since we know we will keep failing, sleep for a while to avoid spamming the logs and so the user sees this error.
607
+
self.Logger.error("!!!! Moonraker auth is required, so you must re-run the OctoEverywhere installer or generate an API key in Mainsail or Fluidd and set it the octoeverywhere.conf. The octoeverywhere.conf config file can be found in /data for docker or ~/.octoeverywhere*/ for CLI installs")
608
+
time.sleep(10)
609
+
raiseException("Websocket unauthorized.")
602
610
603
611
# Handle the timeout without throwing, since this happens sometimes when the system is down.
raiseException("Failed to get the oneshot token from moonraker. No content.")
73
+
74
+
# Decode & parse the response.
75
+
jsonMsg=json.loads(buf.decode(encoding="utf-8"))
76
+
token=jsonMsg.get("result", None)
77
+
iftokenisNone:
78
+
raiseException("Failed to get the oneshot token from moonraker. No result.")
79
+
returnstr(token)
80
+
exceptExceptionase:
81
+
Sentry.Exception("TryToGetOneshotToken failed to get the token.", e)
82
+
returnNone
83
+
84
+
85
+
defTryToGetApiKey(self) ->Optional[str]:
50
86
# If this is an companion plugin, we dont' have the moonraker config file nor can we access the UNIX socket.
51
87
ifself.IsCompanionMode:
52
-
self.Logger.error("!!!! Moonraker auth is required, so you must generate an API key in Mainsail or Fluidd and set it the octoeverywhere.conf file in the companion root folder. The config file can be found in /data for docker or ~/.octoeverywhere-companion for CLI installs")
53
-
# Since we know we will keep failing, sleep for a while to avoid spamming the logs and so the user sees this error.
54
-
time.sleep(10)
55
88
returnNone
56
89
57
90
# First, we need to find the unix socket to connect to
@@ -124,7 +157,7 @@ def TryToGetApiKey(self) -> str or None:
124
157
returnNone
125
158
126
159
127
-
def_TryToFindUnixSocket(self) ->strorNone:
160
+
def_TryToFindUnixSocket(self) ->Optional[str]:
128
161
129
162
# First, try to parse the moonraker config to find the klipper socket path, since the moonraker socket should be similar.
0 commit comments