@ -7,7 +7,6 @@ import folder_paths
import os
import sys
import threading
import datetime
import locale
import subprocess # don't remove this
from tqdm . auto import tqdm
@ -17,6 +16,8 @@ import http.client
import re
import nodes
import hashlib
from datetime import datetime
try :
import cm_global
@ -102,9 +103,11 @@ sys.path.append('../..')
from torchvision . datasets . utils import download_url
comfy_ui_required_revision = 1917
comfy_ui_required_revision = 1930
comfy_ui_required_commit_datetime = datetime ( 2024 , 1 , 24 , 0 , 0 , 0 )
comfy_ui_revision = " Unknown "
comfy_ui_commit_date = " "
comfy_ui_commit_datetime = datetime ( 1900 , 1 , 1 , 0 , 0 , 0 )
comfy_path = os . path . dirname ( folder_paths . __file__ )
custom_nodes_path = os . path . join ( comfy_path , ' custom_nodes ' )
@ -259,14 +262,7 @@ def set_component_policy(mode):
def try_install_script ( url , repo_path , install_cmd ) :
int_comfyui_revision = 0
if type ( comfy_ui_revision ) == int :
int_comfyui_revision = comfy_ui_revision
elif comfy_ui_revision . isdigit ( ) :
int_comfyui_revision = int ( comfy_ui_revision )
if platform . system ( ) == " Windows " and int_comfyui_revision > = comfy_ui_required_revision :
if platform . system ( ) == " Windows " and comfy_ui_commit_datetime . date ( ) > = comfy_ui_required_commit_datetime . date ( ) :
if not os . path . exists ( startup_script_path ) :
os . makedirs ( startup_script_path )
@ -282,9 +278,9 @@ def try_install_script(url, repo_path, install_cmd):
if platform . system ( ) == " Windows " :
try :
if int ( comfy_ui_revision ) < comfy_ui_required_revision :
if comfy_ui_commit_datetime . date ( ) < comfy_ui_required_commit_datetime . date ( ) :
print ( " \n \n ################################################################### " )
print ( f " [WARN] ComfyUI-Manager: Your ComfyUI version ( { comfy_ui_revision } ) is too old. Please update to the latest version. " )
print ( f " [WARN] ComfyUI-Manager: Your ComfyUI version ( { comfy_ui_revision } )[ { comfy_ui_commit_datetime . date ( ) } ] is too old. Please update to the latest version. " )
print ( f " [WARN] The extension installation feature may not work properly in the current installed ComfyUI version on Windows environment. " )
print ( " ################################################################### \n \n " )
except :
@ -298,7 +294,7 @@ def try_install_script(url, repo_path, install_cmd):
def print_comfyui_version ( ) :
global comfy_ui_revision
global comfy_ui_commit_date
global comfy_ui_commit_datetime
global comfy_ui_hash
try :
@ -310,14 +306,14 @@ def print_comfyui_version():
cm_global . variables [ ' comfyui.revision ' ] = comfy_ui_revision
comfy_ui_commit_datetime = repo . head . commit . committed_datetime
try :
if int ( comfy_ui_revision ) < comfy_ui_required_revision :
print ( f " \n \n ## [WARN] ComfyUI-Manager: Your ComfyUI version ( { comfy_ui_revision } ) is too old. Please update to the latest version. ## \n \n " )
if comfy_ui_commit_datetime . date ( ) < comfy_ui_required_commit_datetime . date ( ) :
print ( f " \n \n ## [WARN] ComfyUI-Manager: Your ComfyUI version ( { comfy_ui_revision } )[ { comfy_ui_commit_datetime . date ( ) } ] is too old. Please update to the latest version. ## \n \n " )
except :
pass
comfy_ui_commit_date = repo . head . commit . committed_datetime . date ( )
# process on_revision_detected -->
if ' cm.on_revision_detected_handler ' in cm_global . variables :
for k , f in cm_global . variables [ ' cm.on_revision_detected_handler ' ] :
@ -333,9 +329,9 @@ def print_comfyui_version():
# <--
if current_branch == " master " :
print ( f " ### ComfyUI Revision: { comfy_ui_revision } [ { comfy_ui_hash [ : 8 ] } ] | Released on ' { comfy_ui_commit_date } ' " )
print ( f " ### ComfyUI Revision: { comfy_ui_revision } [ { comfy_ui_hash [ : 8 ] } ] | Released on ' { comfy_ui_commit_datetime . date ( ) } ' " )
else :
print ( f " ### ComfyUI Revision: { comfy_ui_revision } on ' { current_branch } ' [ { comfy_ui_hash [ : 8 ] } ] | Released on ' { comfy_ui_commit_date } ' " )
print ( f " ### ComfyUI Revision: { comfy_ui_revision } on ' { current_branch } ' [ { comfy_ui_hash [ : 8 ] } ] | Released on ' { comfy_ui_commit_datetime . date ( ) } ' " )
except :
print ( " ### ComfyUI Revision: UNKNOWN (The currently installed ComfyUI is not a Git repository) " )
@ -526,8 +522,10 @@ def git_pull(path):
return True
async def get_data ( uri ) :
print ( f " FETCH DATA from: { uri } " )
async def get_data ( uri , silent = False ) :
if not silent :
print ( f " FETCH DATA from: { uri } " )
if uri . startswith ( " http " ) :
async with aiohttp . ClientSession ( trust_env = True , connector = aiohttp . TCPConnector ( verify_ssl = False ) ) as session :
async with session . get ( uri ) as resp :
@ -595,7 +593,7 @@ def is_file_created_within_one_day(file_path):
return False
file_creation_time = os . path . getctime ( file_path )
current_time = datetime . datetime . now ( ) . timestamp ( )
current_time = datetime . now ( ) . timestamp ( )
time_difference = current_time - file_creation_time
return time_difference < = 86400
@ -1077,14 +1075,14 @@ def get_current_snapshot():
def save_snapshot_with_postfix ( postfix ) :
now = datetime . datetime . now ( )
now = datetime . now ( )
date_time_format = now . strftime ( " % Y- % m- %d _ % H- % M- % S " )
file_name = f " { date_time_format } _ { postfix } "
date_time_format = now . strftime ( " % Y- % m- %d _ % H- % M- % S " )
file_name = f " { date_time_format } _ { postfix } "
path = os . path . join ( os . path . dirname ( __file__ ) , ' snapshots ' , f " { file_name } .json " )
with open ( path , " w " ) as json_file :
json . dump ( get_current_snapshot ( ) , json_file , indent = 4 )
path = os . path . join ( os . path . dirname ( __file__ ) , ' snapshots ' , f " { file_name } .json " )
with open ( path , " w " ) as json_file :
json . dump ( get_current_snapshot ( ) , json_file , indent = 4 )
@server . PromptServer . instance . routes . get ( " /snapshot/get_current " )
@ -1831,12 +1829,12 @@ async def get_notice(request):
if match :
markdown_content = match . group ( 1 )
markdown_content + = f " <HR>ComfyUI: { comfy_ui_revision } [ { comfy_ui_hash [ : 6 ] } ]( { comfy_ui_commit_date } ) "
markdown_content + = f " <HR>ComfyUI: { comfy_ui_revision } [ { comfy_ui_hash [ : 6 ] } ]( { comfy_ui_commit_datetime . date ( ) } ) "
# markdown_content += f"<BR> ()"
markdown_content + = f " <BR>Manager: { version_str } "
try :
if comfy_ui_required_revision > int ( comfy_ui_revision ) :
if comfy_ui_required_commit_datetime . date ( ) > comfy_ui_commit_datetime . date ( ) :
markdown_content = f ' <P style= " text-align: center; color:red; background-color:white; font-weight:bold " >Your ComfyUI is too OUTDATED!!!</P> ' + markdown_content
except :
pass
@ -2321,7 +2319,7 @@ async def default_cache_update():
cache_uri = str ( simple_hash ( uri ) ) + ' _ ' + filename
cache_uri = os . path . join ( cache_dir , cache_uri )
json_obj = await get_data ( uri )
json_obj = await get_data ( uri , True )
with cache_lock :
with open ( cache_uri , " w " , encoding = ' utf-8 ' ) as file :