From 34baa2e903fc0a37a7ecf004fb9a06a25c04a848 Mon Sep 17 00:00:00 2001 From: "Dr.Lt.Data" Date: Fri, 17 May 2024 23:24:16 +0900 Subject: [PATCH] fix: take github-stats.json from remote --- glob/manager_core.py | 2 +- glob/manager_server.py | 17 ++++++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/glob/manager_core.py b/glob/manager_core.py index 1e3b382..4e133b4 100644 --- a/glob/manager_core.py +++ b/glob/manager_core.py @@ -23,7 +23,7 @@ sys.path.append(glob_path) import cm_global from manager_util import * -version = [2, 34] +version = [2, 34, 1] version_str = f"V{version[0]}.{version[1]}" + (f'.{version[2]}' if len(version) > 2 else '') comfyui_manager_path = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) diff --git a/glob/manager_server.py b/glob/manager_server.py index 427adc8..3ad9b86 100644 --- a/glob/manager_server.py +++ b/glob/manager_server.py @@ -201,16 +201,13 @@ def print_comfyui_version(): print_comfyui_version() -async def populate_github_stats(json_obj, filename, silent=False): - uri = os.path.join(core.comfyui_manager_path, filename) - with open(uri, "r", encoding='utf-8') as f: - github_stats = json.load(f) +async def populate_github_stats(json_obj, json_obj_github): if 'custom_nodes' in json_obj: for i, node in enumerate(json_obj['custom_nodes']): url = node['reference'] - if url in github_stats: - json_obj['custom_nodes'][i]['stars'] = github_stats[url]['stars'] - json_obj['custom_nodes'][i]['last_update'] = github_stats[url]['last_update'] + if url in json_obj_github: + json_obj['custom_nodes'][i]['stars'] = json_obj_github[url]['stars'] + json_obj['custom_nodes'][i]['last_update'] = json_obj_github[url]['last_update'] else: json_obj['custom_nodes'][i]['stars'] = -1 json_obj['custom_nodes'][i]['last_update'] = -1 @@ -473,7 +470,8 @@ async def fetch_customnode_list(request): channel = core.get_config()['channel_url'] json_obj = await core.get_data_by_mode(request.rel_url.query["mode"], 'custom-node-list.json') - json_obj = await populate_github_stats(json_obj, "github-stats.json") + json_obj_github = await core.get_data_by_mode(request.rel_url.query["mode"], 'github-stats.json', 'default') + json_obj = await populate_github_stats(json_obj, json_obj_github) def is_ignored_notice(code): if code is not None and code.startswith('#NOTICE_'): @@ -1661,8 +1659,9 @@ async def default_cache_update(): b = get_cache("extension-node-map.json") c = get_cache("model-list.json") d = get_cache("alter-list.json") + e = get_cache("github-stats.json") - await asyncio.gather(a, b, c, d) + await asyncio.gather(a, b, c, d, e) threading.Thread(target=lambda: asyncio.run(default_cache_update())).start()