js decompression
This commit is contained in:
@@ -0,0 +1 @@
|
||||
/__pycache__
|
||||
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import platform
|
||||
import random
|
||||
import sys
|
||||
@@ -119,6 +120,7 @@ async def auth_callback(request):
|
||||
auth_query = await request.json()
|
||||
token = auth_query.get("token", "")
|
||||
client_key = auth_query.get("client_key", "")
|
||||
logging.info(f"### auth_callback: {token} {client_key}")
|
||||
if token and client_key:
|
||||
token = unquote(token)
|
||||
client_key = unquote(client_key)
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
import requests
|
||||
@@ -56,6 +57,9 @@ class AuthUnit:
|
||||
self.last_check_time = time.time()
|
||||
return self.token, "", RiceRoundErrorDef.SUCCESS
|
||||
else:
|
||||
logging.warn(
|
||||
f"get_user_token failed, {response.status_code} {response.text}"
|
||||
)
|
||||
error_message = "登录结果错误"
|
||||
error_code = RiceRoundErrorDef.UNKNOWN_ERROR
|
||||
try:
|
||||
@@ -119,6 +123,7 @@ class AuthUnit:
|
||||
|
||||
def set_user_token(self, user_token, client_key):
|
||||
if not client_key or self.client_key != client_key:
|
||||
logging.warn(f"client_key is not match, {self.client_key} != {client_key}")
|
||||
return
|
||||
if not user_token:
|
||||
user_token = ""
|
||||
|
||||
+159
-1
@@ -1 +1,159 @@
|
||||
import{api}from"../../../scripts/api.js";import{ComfyApp,app}from"../../../scripts/app.js";import{showToast}from"./riceround.js";const UserTokenKey="riceround_user_token";function isValidJWTFormat(e){if("string"!=typeof e)return!1;if(e.length<50)return!1;const t=e.split(".");if(3!==t.length)return!1;const o=/^[A-Za-z0-9_-]+$/;return t.every((e=>e.length>0&&o.test(e)))}async function set_exclusive_user(e){e?localStorage.setItem("RiceRound.Cloud.exclusive",e):localStorage.removeItem("RiceRound.Cloud.exclusive");200!=(await api.fetchApi("/riceround/set_exclusive_user",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({exclusive_user:e})})).status&&showToast("设置专属用户客户ID失败","error")}app.registerExtension({name:"riceround.config",async setup(){app.ui.settings.addSetting({id:"RiceRound.User.logout",name:"登出当前用户",type:()=>{const e=document.createElement("tr"),t=document.createElement("td"),o=document.createElement("input");return o.type="button",o.value="登出",o.style.borderRadius="8px",o.style.padding="8px 16px",o.style.fontSize="14px",o.style.cursor="pointer",o.style.border="1px solid #666",o.style.backgroundColor="#444",o.style.color="#fff",o.onclick=async()=>{localStorage.removeItem("Comfy.Settings.RiceRound.User.long_token"),localStorage.removeItem(UserTokenKey),app.ui.settings.setSettingValue("RiceRound.User.long_token",""),await api.fetchApi("/riceround/logout"),showToast("登出成功")},t.appendChild(o),e.appendChild(t),e}}),app.ui.settings.addSetting({id:"RiceRound.User.long_token",name:"设置长效token",type:"text",textType:"password",defaultValue:"",tooltip:"用于非本机授权登录情况,请勿泄露!提倡使用本机登录授权更安全!",onChange:async function(e){isValidJWTFormat(e)&&await api.fetchApi("/riceround/set_long_token",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({long_token:e})})}}),app.ui.settings.addSetting({id:"RiceRound.Setting.wait-time",name:"任务排队等待时间(秒)",tooltip:"不建议设置太短,否则可能等不到运行结果就退出了",type:"slider",attrs:{min:30,max:7200,step:10},defaultValue:600,onChange:e=>{api.fetchApi("/riceround/set_wait_time",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({wait_time:e})})}}),app.ui.settings.addSetting({id:"RiceRound.Publish",name:"自动发布工作流",type:"boolean",defaultValue:!0,tooltip:"设置为true时,会自动发布工作流",onChange:function(e){api.fetchApi("/riceround/set_auto_publish",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({auto_publish:e})}),e||localStorage.setItem("RiceRound.Setting.auto_overwrite",e)}}),app.ui.settings.addSetting({id:"RiceRound.Publish.auto_overwrite",name:"自动覆盖更新同id工作流",type:"boolean",tooltip:"设置为true时,会自动覆盖已有的template_id的数据",onChange:function(e){api.fetchApi("/riceround/set_auto_overwrite",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({auto_overwrite:e})})}}),app.ui.settings.addSetting({id:"RiceRound.Cloud.run_client",name:"自启动云节点客户端",type:"boolean",defaultValue:!0,tooltip:"没有任何云节点客户运行的话,则该用户云节点无法运行",onChange:function(e){api.fetchApi("/riceround/set_run_client",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({run_client:e})})}}),app.ui.settings.addSetting({id:"RiceRound.Advanced.setting",name:"模型列表存放位置,手动清理或安装高级节点",type:()=>{const e=document.createElement("tr"),t=document.createElement("td"),o=document.createElement("input");return o.type="button",o.value="打开文件夹",o.style.borderRadius="8px",o.style.padding="8px 16px",o.style.fontSize="14px",o.style.cursor="pointer",o.style.border="1px solid #666",o.style.backgroundColor="#444",o.style.color="#fff",o.onmouseover=()=>{o.style.backgroundColor="#555"},o.onmouseout=()=>{o.style.backgroundColor="#444"},o.onclick=()=>{api.fetchApi("/riceround/open_selector_list_folder",{method:"GET",headers:{"Content-Type":"application/json"}})},t.appendChild(o),e.appendChild(t),e}})}});
|
||||
import { api as e } from "../../../scripts/api.js";
|
||||
|
||||
import { ComfyApp as t, app as o } from "../../../scripts/app.js";
|
||||
|
||||
import { showToast as n } from "./riceround.js";
|
||||
|
||||
const i = "riceround_user_token";
|
||||
|
||||
function r(e) {
|
||||
if ("string" != typeof e) return !1;
|
||||
if (e.length < 50) return !1;
|
||||
const t = e.split(".");
|
||||
if (3 !== t.length) return !1;
|
||||
const o = /^[A-Za-z0-9_-]+$/;
|
||||
return t.every((e => e.length > 0 && o.test(e)));
|
||||
}
|
||||
|
||||
async function s(t) {
|
||||
t ? localStorage.setItem("RiceRound.Cloud.exclusive", t) : localStorage.removeItem("RiceRound.Cloud.exclusive");
|
||||
200 != (await e.fetchApi("/riceround/set_exclusive_user", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
exclusive_user: t
|
||||
})
|
||||
})).status && n("设置专属用户客户ID失败", "error");
|
||||
}
|
||||
|
||||
o.registerExtension({
|
||||
name: "riceround.config",
|
||||
async setup() {
|
||||
o.ui.settings.addSetting({
|
||||
id: "RiceRound.User.logout",
|
||||
name: "登出当前用户",
|
||||
type: () => {
|
||||
const t = document.createElement("tr"), r = document.createElement("td"), s = document.createElement("input");
|
||||
return s.type = "button", s.value = "登出", s.style.borderRadius = "8px", s.style.padding = "8px 16px",
|
||||
s.style.fontSize = "14px", s.style.cursor = "pointer", s.style.border = "1px solid #666",
|
||||
s.style.backgroundColor = "#444", s.style.color = "#fff", s.onclick = async () => {
|
||||
localStorage.removeItem("Comfy.Settings.RiceRound.User.long_token"), localStorage.removeItem(i),
|
||||
o.ui.settings.setSettingValue("RiceRound.User.long_token", ""), await e.fetchApi("/riceround/logout"),
|
||||
n("登出成功");
|
||||
}, r.appendChild(s), t.appendChild(r), t;
|
||||
}
|
||||
}), o.ui.settings.addSetting({
|
||||
id: "RiceRound.User.long_token",
|
||||
name: "设置长效token",
|
||||
type: "text",
|
||||
textType: "password",
|
||||
defaultValue: "",
|
||||
tooltip: "用于非本机授权登录情况,请勿泄露!提倡使用本机登录授权更安全!",
|
||||
onChange: async function(t) {
|
||||
r(t) && await e.fetchApi("/riceround/set_long_token", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
long_token: t
|
||||
})
|
||||
});
|
||||
}
|
||||
}), o.ui.settings.addSetting({
|
||||
id: "RiceRound.Setting.wait-time",
|
||||
name: "任务排队等待时间(秒)",
|
||||
tooltip: "不建议设置太短,否则可能等不到运行结果就退出了",
|
||||
type: "slider",
|
||||
attrs: {
|
||||
min: 30,
|
||||
max: 7200,
|
||||
step: 10
|
||||
},
|
||||
defaultValue: 600,
|
||||
onChange: t => {
|
||||
e.fetchApi("/riceround/set_wait_time", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
wait_time: t
|
||||
})
|
||||
});
|
||||
}
|
||||
}), o.ui.settings.addSetting({
|
||||
id: "RiceRound.Publish",
|
||||
name: "自动发布工作流",
|
||||
type: "boolean",
|
||||
defaultValue: !0,
|
||||
tooltip: "设置为true时,会自动发布工作流",
|
||||
onChange: function(t) {
|
||||
e.fetchApi("/riceround/set_auto_publish", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
auto_publish: t
|
||||
})
|
||||
}), t || localStorage.setItem("RiceRound.Setting.auto_overwrite", t);
|
||||
}
|
||||
}), o.ui.settings.addSetting({
|
||||
id: "RiceRound.Publish.auto_overwrite",
|
||||
name: "自动覆盖更新同id工作流",
|
||||
type: "boolean",
|
||||
tooltip: "设置为true时,会自动覆盖已有的template_id的数据",
|
||||
onChange: function(t) {
|
||||
e.fetchApi("/riceround/set_auto_overwrite", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
auto_overwrite: t
|
||||
})
|
||||
});
|
||||
}
|
||||
}), o.ui.settings.addSetting({
|
||||
id: "RiceRound.Cloud.run_client",
|
||||
name: "自启动云节点客户端",
|
||||
type: "boolean",
|
||||
defaultValue: !0,
|
||||
tooltip: "没有任何云节点客户运行的话,则该用户云节点无法运行",
|
||||
onChange: function(t) {
|
||||
e.fetchApi("/riceround/set_run_client", {
|
||||
method: "POST",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
},
|
||||
body: JSON.stringify({
|
||||
run_client: t
|
||||
})
|
||||
});
|
||||
}
|
||||
}), o.ui.settings.addSetting({
|
||||
id: "RiceRound.Advanced.setting",
|
||||
name: "模型列表存放位置,手动清理或安装高级节点",
|
||||
type: () => {
|
||||
const t = document.createElement("tr"), o = document.createElement("td"), n = document.createElement("input");
|
||||
return n.type = "button", n.value = "打开文件夹", n.style.borderRadius = "8px", n.style.padding = "8px 16px",
|
||||
n.style.fontSize = "14px", n.style.cursor = "pointer", n.style.border = "1px solid #666",
|
||||
n.style.backgroundColor = "#444", n.style.color = "#fff", n.onmouseover = () => {
|
||||
n.style.backgroundColor = "#555";
|
||||
}, n.onmouseout = () => {
|
||||
n.style.backgroundColor = "#444";
|
||||
}, n.onclick = () => {
|
||||
e.fetchApi("/riceround/open_selector_list_folder", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Content-Type": "application/json"
|
||||
}
|
||||
});
|
||||
}, o.appendChild(n), t.appendChild(o), t;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
+432
-1
File diff suppressed because one or more lines are too long
@@ -1,4 +1,5 @@
|
||||
import json
|
||||
import logging
|
||||
import os
|
||||
import requests
|
||||
from .rice_prompt_info import RicePromptInfo
|
||||
@@ -112,6 +113,7 @@ class Publish:
|
||||
else:
|
||||
return False, response_data.get("message", "Unknown error")
|
||||
else:
|
||||
logging.error(f"Server returned status: {response}")
|
||||
return False, f"Server returned status code: {response.status_code}"
|
||||
except Exception as e:
|
||||
return False, str(e)
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user