fix: when there is auth token, replace it locally

This commit is contained in:
bennykok 2024-01-27 11:40:06 +08:00
parent 2afcade4f2
commit a838cb7ad4

View File

@ -15,9 +15,7 @@ const ext = {
const auth_token = queryParams.get("auth_token"); const auth_token = queryParams.get("auth_token");
const org_display = queryParams.get("org_display"); const org_display = queryParams.get("org_display");
const origin = queryParams.get("origin"); const origin = queryParams.get("origin");
if (!workflow_version_id) {
console.error("No workflow_version_id provided in query parameters.");
} else {
const data = getData(); const data = getData();
let endpoint = data.endpoint; let endpoint = data.endpoint;
let apiKey = data.apiKey; let apiKey = data.apiKey;
@ -36,6 +34,9 @@ const ext = {
localStorage.setItem("comfy_deploy_env", "cloud"); localStorage.setItem("comfy_deploy_env", "cloud");
} }
if (!workflow_version_id) {
console.error("No workflow_version_id provided in query parameters.");
} else {
loadingDialog.showLoading( loadingDialog.showLoading(
"Loading workflow from " + org_display, "Loading workflow from " + org_display,
"Please wait...", "Please wait...",
@ -681,18 +682,15 @@ export class ConfigDialog extends ComfyDialog {
</label> </label>
<label style="color: white; width: 100%;"> <label style="color: white; width: 100%;">
Endpoint: Endpoint:
<input id="endpoint" style="margin-top: 8px; width: 100%; height:40px; box-sizing: border-box; padding: 0px 6px;" type="text" value="${ <input id="endpoint" style="margin-top: 8px; width: 100%; height:40px; box-sizing: border-box; padding: 0px 6px;" type="text" value="${data.endpoint
data.endpoint
}"> }">
</label> </label>
<label style="color: white;"> <label style="color: white;">
API Key: ${data.displayName ?? ""} API Key: ${data.displayName ?? ""}
<input id="apiKey" style="margin-top: 8px; width: 100%; height:40px; box-sizing: border-box; padding: 0px 6px;" type="password" value="${ <input id="apiKey" style="margin-top: 8px; width: 100%; height:40px; box-sizing: border-box; padding: 0px 6px;" type="password" value="${data.apiKey
data.apiKey
}"> }">
<button id="loginButton" style="margin-top: 8px; width: 100%; height:40px; box-sizing: border-box; padding: 0px 6px;"> <button id="loginButton" style="margin-top: 8px; width: 100%; height:40px; box-sizing: border-box; padding: 0px 6px;">
${ ${data.apiKey ? "Re-login with ComfyDeploy" : "Login with ComfyDeploy"
data.apiKey ? "Re-login with ComfyDeploy" : "Login with ComfyDeploy"
} }
</button> </button>
</label> </label>