-
Notifications
You must be signed in to change notification settings - Fork 2
/
__init__.py
36 lines (27 loc) · 882 Bytes
/
__init__.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import folder_paths
import os
import hashlib
comfy_path = os.path.dirname(folder_paths.__file__)
js_path = os.path.join(comfy_path, "web")
def hash_file(filename: str, blocksize: int = 4096) -> str:
hsh = hashlib.md5()
with open(filename, "rb") as f:
while True:
buf = f.read(blocksize)
if not buf:
break
hsh.update(buf)
return hsh.hexdigest()
def need_update():
return hash_file(os.path.join(os.path.dirname(__file__), "user.css")) != hash_file(
os.path.join(js_path, "user.css")
)
cur_css = ""
if need_update():
print("updating user.css")
with open(os.path.join(os.path.dirname(__file__), "user.css")) as file:
cur_css = file.read()
with open(os.path.join(js_path, "user.css"), "w") as f:
f.write(cur_css)
WEB_DIRECTORY = "./web"
NODE_CLASS_MAPPINGS = {}