Browse Source

refactor

pull/226/head
Dr.Lt.Data 12 months ago
parent
commit
a5bf859193
  1. 22
      __init__.py

22
__init__.py

@ -493,6 +493,17 @@ def simple_hash(input_string):
return hash_value return hash_value
def is_file_created_within_one_day(file_path):
if not os.path.exists(file_path):
return False
file_creation_time = os.path.getctime(file_path)
current_time = datetime.datetime.now().timestamp()
time_difference = current_time - file_creation_time
return time_difference <= 86400
async def get_data_by_mode(mode, filename): async def get_data_by_mode(mode, filename):
try: try:
if mode == "local": if mode == "local":
@ -648,17 +659,6 @@ def check_custom_nodes_installed(json_obj, do_fetch=False, do_update_check=True,
print(f"\x1b[2K\rUpdate check done.") print(f"\x1b[2K\rUpdate check done.")
def is_file_created_within_one_day(file_path):
if not os.path.exists(file_path):
return False
file_creation_time = os.path.getctime(file_path)
current_time = datetime.datetime.now().timestamp()
time_difference = current_time - file_creation_time
return time_difference <= 86400
@server.PromptServer.instance.routes.get("/customnode/getmappings") @server.PromptServer.instance.routes.get("/customnode/getmappings")
async def fetch_customnode_mappings(request): async def fetch_customnode_mappings(request):
json_obj = await get_data_by_mode(request.rel_url.query["mode"], 'extension-node-map.json') json_obj = await get_data_by_mode(request.rel_url.query["mode"], 'extension-node-map.json')

Loading…
Cancel
Save