mirror of
https://git.datalinker.icu/comfyanonymous/ComfyUI
synced 2026-11-20 16:17:03 +08:00
cleanup api.js code
This commit is contained in:
parent
c3e56dde28
commit
b73636613a
@ -6,14 +6,8 @@ export class ComfyApi extends EventTarget {
|
|||||||
this.api_host = location.host;
|
this.api_host = location.host;
|
||||||
this.api_base = location.pathname.split('/').slice(0, -1).join('/');
|
this.api_base = location.pathname.split('/').slice(0, -1).join('/');
|
||||||
this.initialClientId = sessionStorage.getItem("clientId");
|
this.initialClientId = sessionStorage.getItem("clientId");
|
||||||
this.clientId = this.initialClientId ?? this.generateSimpleUID();
|
|
||||||
sessionStorage.setItem("clientId", this.clientId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
generateSimpleUID() {
|
|
||||||
return Math.random().toString(36).slice(2,10);
|
|
||||||
}
|
|
||||||
|
|
||||||
apiURL(route) {
|
apiURL(route) {
|
||||||
return this.api_base + route;
|
return this.api_base + route;
|
||||||
}
|
}
|
||||||
@ -580,6 +574,14 @@ export class ServerlessComfyApi extends ComfyApi {
|
|||||||
|
|
||||||
return await res.json();
|
return await res.json();
|
||||||
}
|
}
|
||||||
|
generateSimpleUID() {
|
||||||
|
return Math.random().toString(36).slice(2,10);
|
||||||
|
}
|
||||||
|
|
||||||
|
async init() {
|
||||||
|
this.clientId = this.initialClientId ?? this.generateSimpleUID();
|
||||||
|
sessionStorage.setItem("clientId", this.clientId);
|
||||||
|
}
|
||||||
async getExtensions() {
|
async getExtensions() {
|
||||||
const COMFYUI_CORE_EXTENSIONS = [
|
const COMFYUI_CORE_EXTENSIONS = [
|
||||||
"/extensions/core/clipspace.js",
|
"/extensions/core/clipspace.js",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user