mirror of
https://github.com/Comfy-Org/ComfyUI-Manager.git
synced 2025-12-17 18:33:05 +08:00
made it much easier to configure credentials for sharing
This commit is contained in:
parent
b93ae5af40
commit
6623bbc979
96
__init__.py
96
__init__.py
@ -1196,24 +1196,75 @@ async def channel_url_list(request):
|
|||||||
|
|
||||||
return web.Response(status=200)
|
return web.Response(status=200)
|
||||||
|
|
||||||
@server.PromptServer.instance.routes.get("/manager/check_matrix")
|
def get_matrix_auth():
|
||||||
async def check_matrix(request):
|
if not os.path.exists(os.path.join(folder_paths.base_path, "matrix_auth")):
|
||||||
|
return None
|
||||||
|
with open(os.path.join(folder_paths.base_path, "matrix_auth"), "r") as f:
|
||||||
|
matrix_auth = f.read()
|
||||||
|
homeserver, username, password = matrix_auth.strip().split("\n")
|
||||||
|
if not homeserver or not username or not password:
|
||||||
|
return None
|
||||||
|
return {
|
||||||
|
"homeserver": homeserver,
|
||||||
|
"username": username,
|
||||||
|
"password": password,
|
||||||
|
}
|
||||||
|
|
||||||
|
def get_comfyworkflows_auth():
|
||||||
|
if not os.path.exists(os.path.join(folder_paths.base_path, "comfyworkflows_sharekey")):
|
||||||
|
return None
|
||||||
|
with open(os.path.join(folder_paths.base_path, "comfyworkflows_sharekey"), "r") as f:
|
||||||
|
share_key = f.read()
|
||||||
|
if not share_key.strip():
|
||||||
|
return None
|
||||||
|
return share_key
|
||||||
|
|
||||||
|
@server.PromptServer.instance.routes.get("/manager/get_matrix_auth")
|
||||||
|
async def api_get_matrix_auth(request):
|
||||||
|
# print("Getting stored Matrix credentials...")
|
||||||
|
matrix_auth = get_matrix_auth()
|
||||||
|
if not matrix_auth:
|
||||||
|
return web.Response(status=404)
|
||||||
|
return web.json_response(matrix_auth)
|
||||||
|
|
||||||
|
@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'
|
# Check if the user has provided Matrix credentials in a file called 'matrix_accesstoken'
|
||||||
# in the same directory as the ComfyUI base folder
|
# in the same directory as the ComfyUI base folder
|
||||||
print("Checking for Matrix credentials...")
|
# print("Getting stored Comfyworkflows.com auth...")
|
||||||
if not os.path.exists(os.path.join(folder_paths.base_path, "matrix_accesstoken")):
|
comfyworkflows_auth = get_comfyworkflows_auth()
|
||||||
|
if not comfyworkflows_auth:
|
||||||
return web.Response(status=404)
|
return web.Response(status=404)
|
||||||
with open(os.path.join(folder_paths.base_path, "matrix_accesstoken"), "r") as f:
|
return web.json_response({"comfyworkflows_sharekey" : comfyworkflows_auth})
|
||||||
access_token = f.read()
|
|
||||||
if not access_token.strip():
|
def set_matrix_auth(json_data):
|
||||||
return web.Response(status=404)
|
homeserver = json_data['homeserver']
|
||||||
return web.Response(status=200)
|
username = json_data['username']
|
||||||
|
password = json_data['password']
|
||||||
|
with open(os.path.join(folder_paths.base_path, "matrix_auth"), "w") as f:
|
||||||
|
f.write("\n".join([homeserver, username, password]))
|
||||||
|
|
||||||
|
def set_comfyworkflows_auth(comfyworkflows_sharekey):
|
||||||
|
with open(os.path.join(folder_paths.base_path, "comfyworkflows_sharekey"), "w") as f:
|
||||||
|
f.write(comfyworkflows_sharekey)
|
||||||
|
|
||||||
|
def has_provided_matrix_auth(matrix_auth):
|
||||||
|
return matrix_auth['homeserver'].strip() and matrix_auth['username'].strip() and matrix_auth['password'].strip()
|
||||||
|
|
||||||
|
def has_provided_comfyworkflows_auth(comfyworkflows_sharekey):
|
||||||
|
return comfyworkflows_sharekey.strip()
|
||||||
|
|
||||||
@server.PromptServer.instance.routes.post("/manager/share")
|
@server.PromptServer.instance.routes.post("/manager/share")
|
||||||
async def share_art(request):
|
async def share_art(request):
|
||||||
# get json data
|
# get json data
|
||||||
json_data = await request.json()
|
json_data = await request.json()
|
||||||
|
|
||||||
|
matrix_auth = json_data['matrix_auth']
|
||||||
|
comfyworkflows_sharekey = json_data['cw_auth']['cw_sharekey']
|
||||||
|
|
||||||
|
set_matrix_auth(matrix_auth)
|
||||||
|
set_comfyworkflows_auth(comfyworkflows_sharekey)
|
||||||
|
|
||||||
share_destinations = json_data['share_destinations']
|
share_destinations = json_data['share_destinations']
|
||||||
credits = json_data['credits']
|
credits = json_data['credits']
|
||||||
title = json_data['title']
|
title = json_data['title']
|
||||||
@ -1267,6 +1318,9 @@ async def share_art(request):
|
|||||||
# make a POST request to /api/upload_workflow with form data key values
|
# make a POST request to /api/upload_workflow with form data key values
|
||||||
async with aiohttp.ClientSession(trust_env=True, connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
|
async with aiohttp.ClientSession(trust_env=True, connector=aiohttp.TCPConnector(verify_ssl=False)) as session:
|
||||||
form = aiohttp.FormData()
|
form = aiohttp.FormData()
|
||||||
|
if comfyworkflows_sharekey:
|
||||||
|
form.add_field("shareKey", comfyworkflows_sharekey)
|
||||||
|
form.add_field("source", "comfyui_manager")
|
||||||
form.add_field("assetFileKey", assetFileKey)
|
form.add_field("assetFileKey", assetFileKey)
|
||||||
form.add_field("assetFileType", assetFileType)
|
form.add_field("assetFileType", assetFileType)
|
||||||
form.add_field("sharedWorkflowWorkflowJsonString", json.dumps(prompt['workflow']))
|
form.add_field("sharedWorkflowWorkflowJsonString", json.dumps(prompt['workflow']))
|
||||||
@ -1286,16 +1340,30 @@ async def share_art(request):
|
|||||||
|
|
||||||
# check if the user has provided Matrix credentials
|
# check if the user has provided Matrix credentials
|
||||||
if "matrix" in share_destinations:
|
if "matrix" in share_destinations:
|
||||||
with open(os.path.join(folder_paths.base_path, "matrix_accesstoken"), "r") as f:
|
|
||||||
access_token = f.read().strip()
|
|
||||||
|
|
||||||
comfyui_share_room_id = '!LGYSoacpJPhIfBqVfb:matrix.org'
|
comfyui_share_room_id = '!LGYSoacpJPhIfBqVfb:matrix.org'
|
||||||
filename = os.path.basename(asset_filepath)
|
filename = os.path.basename(asset_filepath)
|
||||||
content_type = assetFileType
|
content_type = assetFileType
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from matrix_client.api import MatrixHttpApi
|
from matrix_client.api import MatrixHttpApi
|
||||||
matrix = MatrixHttpApi("https://matrix.org", token=access_token)
|
from matrix_client.client import MatrixClient
|
||||||
|
|
||||||
|
homeserver = 'matrix.org'
|
||||||
|
if matrix_auth:
|
||||||
|
homeserver = matrix_auth.get('homeserver', 'matrix.org')
|
||||||
|
homeserver = homeserver.replace("http://", "https://")
|
||||||
|
if not homeserver.startswith("https://"):
|
||||||
|
homeserver = "https://" + homeserver
|
||||||
|
|
||||||
|
client = MatrixClient(homeserver)
|
||||||
|
try:
|
||||||
|
token = client.login(username=matrix_auth['username'], password=matrix_auth['password'])
|
||||||
|
if not token:
|
||||||
|
return web.json_response({"error" : "Invalid Matrix credentials."}, content_type='application/json', status=400)
|
||||||
|
except:
|
||||||
|
return web.json_response({"error" : "Invalid Matrix credentials."}, content_type='application/json', status=400)
|
||||||
|
|
||||||
|
matrix = MatrixHttpApi(homeserver, token=token)
|
||||||
with open(asset_filepath, 'rb') as f:
|
with open(asset_filepath, 'rb') as f:
|
||||||
mxc_url = matrix.media_upload(f.read(), content_type, filename=filename)['content_uri']
|
mxc_url = matrix.media_upload(f.read(), content_type, filename=filename)['content_uri']
|
||||||
text_content = ""
|
text_content = ""
|
||||||
@ -1306,9 +1374,7 @@ async def share_art(request):
|
|||||||
if credits:
|
if credits:
|
||||||
text_content += f"\ncredits: {credits}\n"
|
text_content += f"\ncredits: {credits}\n"
|
||||||
response = matrix.send_message(comfyui_share_room_id, text_content)
|
response = matrix.send_message(comfyui_share_room_id, text_content)
|
||||||
print(response)
|
|
||||||
response = matrix.send_content(comfyui_share_room_id, mxc_url, filename, 'm.image')
|
response = matrix.send_content(comfyui_share_room_id, mxc_url, filename, 'm.image')
|
||||||
print(response)
|
|
||||||
except:
|
except:
|
||||||
import traceback
|
import traceback
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|||||||
@ -1988,6 +1988,22 @@ class ManagerMenuDialog extends ComfyDialog {
|
|||||||
|
|
||||||
class ShareDialog extends ComfyDialog {
|
class ShareDialog extends ComfyDialog {
|
||||||
static instance = null;
|
static instance = null;
|
||||||
|
static matrix_auth = { homeserver: "matrix.org", username: "", password: "" };
|
||||||
|
static cw_sharekey = "";
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
|
||||||
|
this.element = $el("div.comfy-modal", { parent: document.body },
|
||||||
|
[$el("div.comfy-modal-content",
|
||||||
|
{
|
||||||
|
style: {
|
||||||
|
overflowY: "auto",
|
||||||
|
}
|
||||||
|
},
|
||||||
|
[...this.createButtons()]),
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
createButtons() {
|
createButtons() {
|
||||||
this.is_nsfw_checkbox = $el("input", { type: 'checkbox', id: "is_nsfw" }, [])
|
this.is_nsfw_checkbox = $el("input", { type: 'checkbox', id: "is_nsfw" }, [])
|
||||||
@ -2005,20 +2021,27 @@ class ShareDialog extends ComfyDialog {
|
|||||||
this.comfyworkflows_destination_checkbox.style.color = "var(--fg-color)";
|
this.comfyworkflows_destination_checkbox.style.color = "var(--fg-color)";
|
||||||
this.comfyworkflows_destination_checkbox.checked = true;
|
this.comfyworkflows_destination_checkbox.checked = true;
|
||||||
|
|
||||||
|
this.matrix_homeserver_input = $el("input", { type: 'text', id: "matrix_homeserver", placeholder: "matrix.org", value: ShareDialog.matrix_auth.homeserver || 'matrix.org' }, []);
|
||||||
|
this.matrix_username_input = $el("input", { type: 'text', placeholder: "Username", value: ShareDialog.matrix_auth.username || '' }, []);
|
||||||
|
this.matrix_password_input = $el("input", { type: 'password', placeholder: "Password", value: ShareDialog.matrix_auth.password || '' }, []);
|
||||||
|
|
||||||
|
this.cw_sharekey_input = $el("input", { type: 'text', placeholder: "Share key (found on your profile page)", value: ShareDialog.cw_sharekey || '' }, []);
|
||||||
|
this.cw_sharekey_input.style.width = "100%";
|
||||||
|
|
||||||
this.credits_input = $el("input", {
|
this.credits_input = $el("input", {
|
||||||
type: "text",
|
type: "text",
|
||||||
placeholder: "This will be used to give you credits",
|
placeholder: "This will be used to give credits",
|
||||||
required: false,
|
required: false,
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
this.title_input = $el("input", {
|
this.title_input = $el("input", {
|
||||||
type: "text",
|
type: "text",
|
||||||
// placeholder: "ex: Zombie animation - AnimateDiff",
|
placeholder: "ex: My awesome art",
|
||||||
required: false,
|
required: false,
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
this.description_input = $el("textarea", {
|
this.description_input = $el("textarea", {
|
||||||
// placeholder: "ex: ",
|
placeholder: "ex: Trying out a new workflow... ",
|
||||||
required: false,
|
required: false,
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
@ -2029,11 +2052,43 @@ class ShareDialog extends ComfyDialog {
|
|||||||
|
|
||||||
this.final_message = $el("div", {}, []);
|
this.final_message = $el("div", {}, []);
|
||||||
|
|
||||||
this.share_button.onclick = async () => {
|
// get the user's existing matrix auth and share key
|
||||||
// alert("Title: " + this.title_input.value + "\nDescription: " + this.description_input.value + "\nCredits: " + this.credits_input.value + "\nNSFW: " + this.is_nsfw_checkbox.checked);
|
ShareDialog.matrix_auth = { homeserver: "matrix.org", username: "", password: "" };
|
||||||
const prompt = await app.graphToPrompt();
|
try {
|
||||||
console.log(prompt);
|
api.fetchApi(`/manager/get_matrix_auth`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
ShareDialog.matrix_auth = data;
|
||||||
|
this.matrix_homeserver_input.value = ShareDialog.matrix_auth.homeserver;
|
||||||
|
this.matrix_username_input.value = ShareDialog.matrix_auth.username;
|
||||||
|
this.matrix_password_input.value = ShareDialog.matrix_auth.password;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
// console.log(error);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
// console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the user's existing comfyworkflows share key
|
||||||
|
ShareDialog.cw_sharekey = "";
|
||||||
|
try {
|
||||||
|
console.log("Fetching comfyworkflows share key")
|
||||||
|
api.fetchApi(`/manager/get_comfyworkflows_auth`)
|
||||||
|
.then(response => response.json())
|
||||||
|
.then(data => {
|
||||||
|
ShareDialog.cw_sharekey = data.comfyworkflows_sharekey;
|
||||||
|
this.cw_sharekey_input.value = ShareDialog.cw_sharekey;
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
// console.log(error);
|
||||||
|
});
|
||||||
|
} catch (error) {
|
||||||
|
// console.log(error);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.share_button.onclick = async () => {
|
||||||
|
const prompt = await app.graphToPrompt();
|
||||||
const nodes = app.graph._nodes;
|
const nodes = app.graph._nodes;
|
||||||
|
|
||||||
const destinations = [];
|
const destinations = [];
|
||||||
@ -2046,25 +2101,17 @@ class ShareDialog extends ComfyDialog {
|
|||||||
|
|
||||||
// if destinations includes matrix, make an api call to /manager/check_matrix to ensure that the user has configured their matrix settings
|
// if destinations includes matrix, make an api call to /manager/check_matrix to ensure that the user has configured their matrix settings
|
||||||
if (destinations.includes("matrix")) {
|
if (destinations.includes("matrix")) {
|
||||||
const response = await api.fetchApi(`/manager/check_matrix`);
|
let definedMatrixAuth = !!this.matrix_homeserver_input.value && !!this.matrix_username_input.value && !!this.matrix_password_input.value;
|
||||||
if (response.status != 200) {
|
if (!definedMatrixAuth) {
|
||||||
alert("Please add your Matrix access token in a file called 'matrix_accesstoken' in the ComfyUI folder. To get your Matrix access token, go to https://app.element.io/, click on your profile, click on 'All settings', click on 'Help & About', and copy 'Access Token', and then click on 'Regenerate'.");
|
alert("Please set your Matrix account details.");
|
||||||
// Reset state
|
|
||||||
this.matrix_destination_checkbox.checked = true;
|
|
||||||
this.comfyworkflows_destination_checkbox.checked = true;
|
|
||||||
this.share_button.textContent = "Share";
|
|
||||||
this.share_button.style.display = "inline-block";
|
|
||||||
this.final_message.innerHTML = "";
|
|
||||||
this.final_message.style.color = "white";
|
|
||||||
this.credits_input.value = "";
|
|
||||||
this.title_input.value = "";
|
|
||||||
this.description_input.value = "";
|
|
||||||
this.is_nsfw_checkbox.checked = false;
|
|
||||||
this.close();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (destinations.includes("comfyworkflows") && !this.cw_sharekey_input.value && !confirm("You have NOT set your ComfyWorkflows.com share key. Your art will NOT be connected to your account (it will be shared anonymously). Continue?")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const potential_outputs = [];
|
const potential_outputs = [];
|
||||||
const potential_output_nodes = [];
|
const potential_output_nodes = [];
|
||||||
|
|
||||||
@ -2107,6 +2154,14 @@ class ShareDialog extends ComfyDialog {
|
|||||||
method: 'POST',
|
method: 'POST',
|
||||||
headers: { 'Content-Type': 'application/json' },
|
headers: { 'Content-Type': 'application/json' },
|
||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
|
matrix_auth: {
|
||||||
|
homeserver: this.matrix_homeserver_input.value,
|
||||||
|
username: this.matrix_username_input.value,
|
||||||
|
password: this.matrix_password_input.value,
|
||||||
|
},
|
||||||
|
cw_auth: {
|
||||||
|
cw_sharekey: this.cw_sharekey_input.value,
|
||||||
|
},
|
||||||
share_destinations: destinations,
|
share_destinations: destinations,
|
||||||
credits: this.credits_input.value,
|
credits: this.credits_input.value,
|
||||||
title: this.title_input.value,
|
title: this.title_input.value,
|
||||||
@ -2119,10 +2174,23 @@ class ShareDialog extends ComfyDialog {
|
|||||||
});
|
});
|
||||||
|
|
||||||
if (response.status != 200) {
|
if (response.status != 200) {
|
||||||
|
try {
|
||||||
|
const response_json = await response.json();
|
||||||
|
if (response_json.error) {
|
||||||
|
alert(response_json.error);
|
||||||
|
this.close();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
alert("Failed to share your art. Please try again.");
|
alert("Failed to share your art. Please try again.");
|
||||||
this.close();
|
this.close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert("Failed to share your art. Please try again.");
|
||||||
|
this.close();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const response_json = await response.json();
|
const response_json = await response.json();
|
||||||
|
|
||||||
@ -2142,26 +2210,97 @@ class ShareDialog extends ComfyDialog {
|
|||||||
// hide the share button
|
// hide the share button
|
||||||
this.share_button.textContent = "Shared!";
|
this.share_button.textContent = "Shared!";
|
||||||
this.share_button.style.display = "none";
|
this.share_button.style.display = "none";
|
||||||
|
|
||||||
// this.close();
|
// this.close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const res =
|
const res =
|
||||||
[
|
[
|
||||||
$el("tr.td", { width: "100%" }, [
|
$el("tr.td", { width: "100%" }, [
|
||||||
$el("font", { size: 6, color: "white" }, [`Share your art`]),
|
$el("font", { size: 6, color: "white" }, [`Share your art`]),
|
||||||
// $el("div", { size: 3, color: "white" }, [
|
|
||||||
// $el("a", {
|
|
||||||
// href: `https://comfyworkflows.com/?ref=cms`,
|
|
||||||
// target: `_blank`,
|
|
||||||
// color: "white",
|
|
||||||
// // style: `color:white;`
|
|
||||||
// }, `comfyworkflows.com`)
|
|
||||||
// ])
|
|
||||||
]),
|
]),
|
||||||
$el("p", { size: 4, color: "white" }, [`Get a public link for this art & workflow.`]),
|
$el("br", {}, []),
|
||||||
// $el("br", {}, []),
|
|
||||||
|
$el("details", {
|
||||||
|
style: {
|
||||||
|
border: "1px solid #999",
|
||||||
|
padding: "5px",
|
||||||
|
borderRadius: "5px",
|
||||||
|
backgroundColor: "#222"
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
$el("summary", {
|
||||||
|
style: {
|
||||||
|
color: "white",
|
||||||
|
cursor: "pointer",
|
||||||
|
}
|
||||||
|
}, [`Matrix account`]),
|
||||||
|
$el("div", {
|
||||||
|
style: {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
$el("div", {
|
||||||
|
textContent: "Homeserver",
|
||||||
|
style: {
|
||||||
|
marginRight: "10px",
|
||||||
|
}
|
||||||
|
}, []),
|
||||||
|
this.matrix_homeserver_input,
|
||||||
|
]),
|
||||||
|
|
||||||
|
$el("div", {
|
||||||
|
style: {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
$el("div", {
|
||||||
|
textContent: "Username",
|
||||||
|
style: {
|
||||||
|
marginRight: "10px",
|
||||||
|
}
|
||||||
|
}, []),
|
||||||
|
this.matrix_username_input,
|
||||||
|
]),
|
||||||
|
|
||||||
|
$el("div", {
|
||||||
|
style: {
|
||||||
|
display: "flex",
|
||||||
|
flexDirection: "row",
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
$el("div", {
|
||||||
|
textContent: "Password",
|
||||||
|
style: {
|
||||||
|
marginRight: "10px",
|
||||||
|
}
|
||||||
|
}, []),
|
||||||
|
this.matrix_password_input,
|
||||||
|
]),
|
||||||
|
|
||||||
|
]),
|
||||||
|
$el("details", {
|
||||||
|
style: {
|
||||||
|
border: "1px solid #999",
|
||||||
|
marginTop: "10px",
|
||||||
|
padding: "5px",
|
||||||
|
borderRadius: "5px",
|
||||||
|
backgroundColor: "#222"
|
||||||
|
}
|
||||||
|
}, [
|
||||||
|
$el("summary", {
|
||||||
|
style: {
|
||||||
|
color: "white",
|
||||||
|
cursor: "pointer",
|
||||||
|
}
|
||||||
|
}, [`Comfyworkflows.com account`]),
|
||||||
|
$el("h4", {
|
||||||
|
textContent: "Share key (found on your profile page)",
|
||||||
|
}, []),
|
||||||
|
$el("p", { size: 3, color: "white" }, ["When provided, your art will be saved to your account."]),
|
||||||
|
this.cw_sharekey_input,
|
||||||
|
]),
|
||||||
|
|
||||||
$el("div", {}, [
|
$el("div", {}, [
|
||||||
$el("p", { size: 3, color: "white" }, [`Select where to share your art:`]),
|
$el("p", { size: 3, color: "white" }, [`Select where to share your art:`]),
|
||||||
@ -2172,23 +2311,23 @@ class ShareDialog extends ComfyDialog {
|
|||||||
comfyworkflows_destination_checkbox_text,
|
comfyworkflows_destination_checkbox_text,
|
||||||
]),
|
]),
|
||||||
|
|
||||||
$el("h2", {
|
$el("h4", {
|
||||||
textContent: "Your name/username (optional)",
|
textContent: "Credits (optional)",
|
||||||
size: 3,
|
size: 3,
|
||||||
color: "white"
|
color: "white"
|
||||||
}, []),
|
}, []),
|
||||||
this.credits_input,
|
this.credits_input,
|
||||||
$el("br", {}, []),
|
// $el("br", {}, []),
|
||||||
|
|
||||||
$el("h2", {
|
$el("h4", {
|
||||||
textContent: "Title (optional)",
|
textContent: "Title (optional)",
|
||||||
size: 3,
|
size: 3,
|
||||||
color: "white"
|
color: "white"
|
||||||
}, []),
|
}, []),
|
||||||
this.title_input,
|
this.title_input,
|
||||||
$el("br", {}, []),
|
// $el("br", {}, []),
|
||||||
|
|
||||||
$el("h2", {
|
$el("h4", {
|
||||||
textContent: "Description (optional)",
|
textContent: "Description (optional)",
|
||||||
size: 3,
|
size: 3,
|
||||||
color: "white"
|
color: "white"
|
||||||
@ -2230,14 +2369,6 @@ class ShareDialog extends ComfyDialog {
|
|||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor() {
|
|
||||||
super();
|
|
||||||
this.element = $el("div.comfy-modal", { parent: document.body },
|
|
||||||
[$el("div.comfy-modal-content",
|
|
||||||
[...this.createButtons()]),
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
|
|
||||||
show() {
|
show() {
|
||||||
this.element.style.display = "block";
|
this.element.style.display = "block";
|
||||||
}
|
}
|
||||||
@ -2264,18 +2395,18 @@ app.registerExtension({
|
|||||||
}
|
}
|
||||||
menu.append(managerButton);
|
menu.append(managerButton);
|
||||||
|
|
||||||
|
|
||||||
const shareButton = document.createElement("button");
|
const shareButton = document.createElement("button");
|
||||||
shareButton.textContent = "Share";
|
shareButton.textContent = "Share";
|
||||||
shareButton.onclick = () => {
|
shareButton.onclick = () => {
|
||||||
if (!ShareDialog.instance)
|
if (!ShareDialog.instance) {
|
||||||
ShareDialog.instance = new ShareDialog();
|
ShareDialog.instance = new ShareDialog();
|
||||||
|
}
|
||||||
ShareDialog.instance.show();
|
ShareDialog.instance.show();
|
||||||
}
|
}
|
||||||
// make the background color a gradient of blue to green
|
// make the background color a gradient of blue to green
|
||||||
shareButton.style.background = "linear-gradient(90deg, #00C9FF 0%, #92FE9D 100%)";
|
shareButton.style.background = "linear-gradient(90deg, #00C9FF 0%, #92FE9D 100%)";
|
||||||
shareButton.style.color = "black";
|
shareButton.style.color = "black";
|
||||||
// shareButton.style.border = "none";
|
|
||||||
// shareButton.style.borderRadius = "15px";
|
|
||||||
menu.append(shareButton);
|
menu.append(shareButton);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user