Add new workflow sharing option

Add YouML as an option to share workflows and convert them into interactive apps.
This commit is contained in:
alexp
2024-01-07 11:39:20 -08:00
committed by Alex Prokofiev
parent dec8784840
commit 211532e9f0
5 changed files with 658 additions and 5 deletions

View File

@@ -1874,6 +1874,22 @@ def get_comfyworkflows_auth():
return None
def get_youml_settings():
if not os.path.exists(os.path.join(comfyui_manager_path, ".youml")):
return None
try:
with open(os.path.join(comfyui_manager_path, ".youml"), "r") as f:
youml_settings = f.read().strip()
return youml_settings if youml_settings else None
except:
return None
def set_youml_settings(settings):
with open(os.path.join(comfyui_manager_path, ".youml"), "w") as f:
f.write(settings)
@server.PromptServer.instance.routes.get("/manager/get_openart_auth")
async def api_get_openart_auth(request):
# print("Getting stored Matrix credentials...")
@@ -1901,6 +1917,21 @@ async def api_get_matrix_auth(request):
return web.json_response(matrix_auth)
@server.PromptServer.instance.routes.get("/manager/youml/settings")
async def api_get_youml_settings(request):
youml_settings = get_youml_settings()
if not youml_settings:
return web.Response(status=404)
return web.json_response(json.loads(youml_settings))
@server.PromptServer.instance.routes.post("/manager/youml/settings")
async def api_set_youml_settings(request):
json_data = await request.json()
set_youml_settings(json.dumps(json_data))
return web.Response(status=200)
@server.PromptServer.instance.routes.get("/manager/get_comfyworkflows_auth")
async def api_get_comfyworkflows_auth(request):
# Check if the user has provided Matrix credentials in a file called 'matrix_accesstoken'