fix small bug

This commit is contained in:
thecooltechguy 2023-10-30 11:41:21 -07:00
parent 5da730dd8b
commit 6aa7b2c9e7

View File

@ -1199,25 +1199,31 @@ async def channel_url_list(request):
def get_matrix_auth(): def get_matrix_auth():
if not os.path.exists(os.path.join(folder_paths.base_path, "matrix_auth")): if not os.path.exists(os.path.join(folder_paths.base_path, "matrix_auth")):
return None return None
with open(os.path.join(folder_paths.base_path, "matrix_auth"), "r") as f: try:
matrix_auth = f.read() with open(os.path.join(folder_paths.base_path, "matrix_auth"), "r") as f:
homeserver, username, password = matrix_auth.strip().split("\n") matrix_auth = f.read()
if not homeserver or not username or not password: homeserver, username, password = matrix_auth.strip().split("\n")
return None if not homeserver or not username or not password:
return { return None
"homeserver": homeserver, return {
"username": username, "homeserver": homeserver,
"password": password, "username": username,
} "password": password,
}
except:
return None
def get_comfyworkflows_auth(): def get_comfyworkflows_auth():
if not os.path.exists(os.path.join(folder_paths.base_path, "comfyworkflows_sharekey")): if not os.path.exists(os.path.join(folder_paths.base_path, "comfyworkflows_sharekey")):
return None return None
with open(os.path.join(folder_paths.base_path, "comfyworkflows_sharekey"), "r") as f: try:
share_key = f.read() with open(os.path.join(folder_paths.base_path, "comfyworkflows_sharekey"), "r") as f:
if not share_key.strip(): share_key = f.read()
return None if not share_key.strip():
return share_key return None
return share_key
except:
return None
@server.PromptServer.instance.routes.get("/manager/get_matrix_auth") @server.PromptServer.instance.routes.get("/manager/get_matrix_auth")
async def api_get_matrix_auth(request): async def api_get_matrix_auth(request):