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:
huyunan496
2024-03-27 21:49:18 +08:00
committed by GitHub
parent 4c9198d018
commit 019f0cd53d
3 changed files with 63 additions and 2 deletions

View File

@@ -1210,6 +1210,15 @@ class ManagerMenuDialog extends ComfyDialog {
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",
callback: () => {

View File

@@ -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 = () => {
if (!OpenArtShareDialog.instance) {
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() {