Spaces:
Running
Running
P01yH3dr0n
commited on
Commit
•
84ade84
1
Parent(s):
27fffd9
Update tagcomplete/javascript/_utils.js
Browse files
tagcomplete/javascript/_utils.js
CHANGED
@@ -55,12 +55,12 @@ async function readFile(filePath, json = false) {
|
|
55 |
}
|
56 |
|
57 |
if (json) {
|
58 |
-
|
59 |
localStorage.setItem(filePath, content);
|
60 |
return content;
|
61 |
}
|
62 |
else {
|
63 |
-
|
64 |
localStorage.setItem(filePath, content);
|
65 |
return content;
|
66 |
}
|
@@ -92,23 +92,6 @@ async function fetchAPI(url, json = true, cache = false) {
|
|
92 |
return await response.text();
|
93 |
}
|
94 |
|
95 |
-
// Extra network preview thumbnails
|
96 |
-
async function getExtraNetworkPreviewURL(filename, type) {
|
97 |
-
const previewJSON = await fetchAPI(`tacapi/v1/thumb-preview/${filename}?type=${type}`, true, true);
|
98 |
-
if (previewJSON?.url) {
|
99 |
-
const properURL = `sd_extra_networks/thumb?filename=${previewJSON.url}`;
|
100 |
-
if ((await fetch(properURL)).status == 200) {
|
101 |
-
return properURL;
|
102 |
-
} else {
|
103 |
-
// create blob url
|
104 |
-
const blob = await (await fetch(`tacapi/v1/thumb-preview-blob/${filename}?type=${type}`)).blob();
|
105 |
-
return URL.createObjectURL(blob);
|
106 |
-
}
|
107 |
-
} else {
|
108 |
-
return null;
|
109 |
-
}
|
110 |
-
}
|
111 |
-
|
112 |
// Debounce function to prevent spamming the autocomplete function
|
113 |
var dbTimeOut;
|
114 |
const debounce = (func, wait = 300) => {
|
|
|
55 |
}
|
56 |
|
57 |
if (json) {
|
58 |
+
let content = await response.json();
|
59 |
localStorage.setItem(filePath, content);
|
60 |
return content;
|
61 |
}
|
62 |
else {
|
63 |
+
let content = await response.text();
|
64 |
localStorage.setItem(filePath, content);
|
65 |
return content;
|
66 |
}
|
|
|
92 |
return await response.text();
|
93 |
}
|
94 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
// Debounce function to prevent spamming the autocomplete function
|
96 |
var dbTimeOut;
|
97 |
const debounce = (func, wait = 300) => {
|