mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-17 02:12:58 +08:00
Share to esheep (#517)
* share to esheep * enable_cors_header * Chiness to English * remove chiness * rearrange order. * version marker --------- Co-authored-by: huyunan <huyunan@bilibili.com> Co-authored-by: Dr.Lt.Data <dr.lt.data@gmail.com> Co-authored-by: Dr.Lt.Data <128333288+ltdrdata@users.noreply.github.com>
This commit is contained in:
parent
4c9198d018
commit
019f0cd53d
23
__init__.py
23
__init__.py
@ -29,7 +29,7 @@ except:
|
|||||||
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.")
|
print(f"[WARN] ComfyUI-Manager: Your ComfyUI version is outdated. Please update to the latest version.")
|
||||||
|
|
||||||
|
|
||||||
version = [2, 10, 3]
|
version = [2, 11]
|
||||||
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
|
version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '')
|
||||||
print(f"### Loading: ComfyUI-Manager ({version_str})")
|
print(f"### Loading: ComfyUI-Manager ({version_str})")
|
||||||
|
|
||||||
@ -831,7 +831,6 @@ def nickname_filter(json_obj):
|
|||||||
|
|
||||||
return json_obj
|
return json_obj
|
||||||
|
|
||||||
|
|
||||||
@server.PromptServer.instance.routes.get("/customnode/getmappings")
|
@server.PromptServer.instance.routes.get("/customnode/getmappings")
|
||||||
async def fetch_customnode_mappings(request):
|
async def fetch_customnode_mappings(request):
|
||||||
mode = request.rel_url.query["mode"]
|
mode = request.rel_url.query["mode"]
|
||||||
@ -2127,6 +2126,26 @@ async def api_get_comfyworkflows_auth(request):
|
|||||||
return web.Response(status=404)
|
return web.Response(status=404)
|
||||||
return web.json_response({"comfyworkflows_sharekey" : comfyworkflows_auth})
|
return web.json_response({"comfyworkflows_sharekey" : comfyworkflows_auth})
|
||||||
|
|
||||||
|
args.enable_cors_header = "*"
|
||||||
|
if hasattr(server.PromptServer.instance, "app"):
|
||||||
|
app = server.PromptServer.instance.app
|
||||||
|
cors_middleware = server.create_cors_middleware(args.enable_cors_header)
|
||||||
|
app.middlewares.append(cors_middleware)
|
||||||
|
|
||||||
|
@server.PromptServer.instance.routes.post("/manager/set_esheep_workflow_and_images")
|
||||||
|
async def set_esheep_workflow_and_images(request):
|
||||||
|
json_data = await request.json()
|
||||||
|
current_workflow = json_data['workflow']
|
||||||
|
images = json_data['images']
|
||||||
|
with open(os.path.join(comfyui_manager_path, "esheep_share_message.json"), "w", encoding='utf-8') as file:
|
||||||
|
json.dump(json_data, file, indent=4)
|
||||||
|
return web.Response(status=200)
|
||||||
|
|
||||||
|
@server.PromptServer.instance.routes.get("/manager/get_esheep_workflow_and_images")
|
||||||
|
async def get_esheep_workflow_and_images(request):
|
||||||
|
with open(os.path.join(comfyui_manager_path, "esheep_share_message.json"), 'r', encoding='utf-8') as file:
|
||||||
|
data = json.load(file)
|
||||||
|
return web.Response(status=200, text=json.dumps(data))
|
||||||
|
|
||||||
def set_matrix_auth(json_data):
|
def set_matrix_auth(json_data):
|
||||||
homeserver = json_data['homeserver']
|
homeserver = json_data['homeserver']
|
||||||
|
|||||||
@ -1210,6 +1210,15 @@ class ManagerMenuDialog extends ComfyDialog {
|
|||||||
modifyButtonStyle(url);
|
modifyButtonStyle(url);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
title: "Open 'esheep'",
|
||||||
|
callback: () => {
|
||||||
|
const url = "https://www.esheep.com";
|
||||||
|
localStorage.setItem("wg_last_visited", url);
|
||||||
|
window.open(url, url);
|
||||||
|
modifyButtonStyle(url);
|
||||||
|
},
|
||||||
|
},
|
||||||
{
|
{
|
||||||
title: "Close",
|
title: "Close",
|
||||||
callback: () => {
|
callback: () => {
|
||||||
|
|||||||
@ -164,6 +164,29 @@ export function parseURLPath(urlPath) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
export const shareToEsheep= () => {
|
||||||
|
app.graphToPrompt()
|
||||||
|
.then(prompt => {
|
||||||
|
const nodes = app.graph._nodes
|
||||||
|
const { potential_outputs, potential_output_nodes } = getPotentialOutputsAndOutputNodes(nodes);
|
||||||
|
const workflow = prompt['workflow']
|
||||||
|
api.fetchApi(`/manager/set_esheep_workflow_and_images`, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({
|
||||||
|
workflow: workflow,
|
||||||
|
images: potential_outputs
|
||||||
|
})
|
||||||
|
}).then(response => {
|
||||||
|
var domain = window.location.hostname;
|
||||||
|
var port = window.location.port;
|
||||||
|
port = port || (window.location.protocol === 'http:' ? '80' : window.location.protocol === 'https:' ? '443' : '');
|
||||||
|
var full_domin = domain + ':' + port
|
||||||
|
window.open('https://www.esheep.com/app/workflow_upload?from_local='+ full_domin, '_blank');
|
||||||
|
});
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
export const showOpenArtShareDialog = () => {
|
export const showOpenArtShareDialog = () => {
|
||||||
if (!OpenArtShareDialog.instance) {
|
if (!OpenArtShareDialog.instance) {
|
||||||
OpenArtShareDialog.instance = new OpenArtShareDialog();
|
OpenArtShareDialog.instance = new OpenArtShareDialog();
|
||||||
@ -283,6 +306,16 @@ export class ShareDialogChooser extends ComfyDialog {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
key: "esheep",
|
||||||
|
textContent: "eSheep",
|
||||||
|
website: "https://www.esheep.com",
|
||||||
|
description: "Share & download thousands of ComfyUI workflows on <a style='color:white;' href='https://www.esheep.com' target='_blank'>esheep.com</a>",
|
||||||
|
onclick: () => {
|
||||||
|
shareToEsheep();
|
||||||
|
this.close();
|
||||||
|
}
|
||||||
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
function createShareButtonsWithDescriptions() {
|
function createShareButtonsWithDescriptions() {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user