Make videos on the computer you already own. FreeVideo runs MiniMax H3 in as little as 8 GB of VRAM and 16 GB of RAM, and adapts its acceleration path to your hardware.
Use the Windows certificate store for HTTPS checks
Bowen Xueb21e6f00e1e3
diff --git a/freevideo_engine/comfy_chain.py b/freevideo_engine/comfy_chain.pyindex 0dc9b56..210fcc5 100644--- a/freevideo_engine/comfy_chain.py+++ b/freevideo_engine/comfy_chain.py@@ -124,7 +124,7 @@ class ComfyHost:# This request belongs to our own server, even with an inherited proxy.handlers = [request.ProxyHandler({})]if tls:- context = ssl.create_default_context()+ context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)context.check_hostname = Falsecontext.verify_mode = ssl.CERT_NONEhandlers.append(request.HTTPSHandler(context=context))diff --git a/freevideo_engine/comfy_launcher_runtime.py b/freevideo_engine/comfy_launcher_runtime.pyindex e5bf4bd..c78a85a 100644--- a/freevideo_engine/comfy_launcher_runtime.py+++ b/freevideo_engine/comfy_launcher_runtime.py@@ -630,6 +630,34 @@ def checkout_entry(data, folder):and (io_path(folder) / 'freevideo_engine' / 'comfy_nodes.py').is_file())+PRESTARTUP_MARK = '# Installed by FreeVideo launcher.\n'+++def install_prestartup(target, engine):+ """ComfyUI runs prestartup_script.py of a node folder before it imports its server. The launcher's+ small loader runs the certificate fix from the source; a file that is not the launcher's stays."""+ path = target / 'prestartup_script.py'+ if path.is_file() and not path.read_text(encoding='utf-8', errors='replace').startswith(PRESTARTUP_MARK):+ return+ code = (PRESTARTUP_MARK ++ "import json as _json\nfrom pathlib import Path as _Path\n"+ "_source = _Path(_json.loads((_Path(__file__).parent / 'freevideo-launcher.json').read_text(encoding='utf-8'))['source'])\n"+ + launch_view.entry_lines(launch_view.for_engine(engine)) ++ "_script = _source / 'freevideo_engine' / 'windows_ssl.py'\n"+ "if _script.is_file():\n"+ " exec(compile(_script.read_text(encoding='utf-8'), str(_script), 'exec'))\n").encode()+ if path.is_file() and path.read_bytes() != code:+ # An older loader, or one the user added to: keep a copy, as for the entry point.+ backup = engine / 'launcher' / 'backups' / (target.name + '-' + hashlib.sha256(path.read_bytes()).hexdigest()[:12] + '-prestartup.py')+ backup.parent.mkdir(parents=True, exist_ok=True)+ if not backup.exists():+ backup.write_bytes(path.read_bytes())+ if not path.is_file() or path.read_bytes() != code:+ temporary = path.with_suffix('.py.launcher-tmp')+ temporary.write_bytes(code)+ os.replace(temporary, path)++def deploy(root, source, engine):"""Update only our entry point; preserve source edits, libraries and templates."""root, source, engine = map(resolved, (root, source, engine))@@ -665,6 +693,7 @@ def deploy(root, source, engine):temporary = entry.with_suffix('.py.launcher-tmp')temporary.write_bytes(code)os.replace(temporary, entry)+ install_prestartup(target, engine)template = (source / 'example_workflows' / TEMPLATE).read_bytes()digest = hashlib.sha256(template).hexdigest()[:12]saved = []diff --git a/freevideo_engine/comfy_service.py b/freevideo_engine/comfy_service.pyindex 3f4f54d..1160264 100644--- a/freevideo_engine/comfy_service.py+++ b/freevideo_engine/comfy_service.py@@ -267,8 +267,9 @@ def request(url, *, headers=None, timeout=3):class Stay(HTTPRedirectHandler):def redirect_request(self, *args, **kwargs):return None- context = ssl.create_default_context()- context.check_hostname, context.verify_mode = False, ssl.CERT_NONE # Our own certificate, possibly self-signed.+ # Our own certificate, possibly self-signed: nothing is verified, so the system certificates are not loaded.+ context = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)+ context.check_hostname, context.verify_mode = False, ssl.CERT_NONEopener = build_opener(ProxyHandler({}), Stay(), HTTPSHandler(context=context))try:with opener.open(Request(url, headers=headers or {}), timeout=timeout) as reply:diff --git a/freevideo_engine/windows_ssl.py b/freevideo_engine/windows_ssl.pynew file mode 100644index 0000000..32a99bd--- /dev/null+++ b/freevideo_engine/windows_ssl.py@@ -0,0 +1,52 @@+"""Run by ComfyUI before it imports its server (and aiohttp), through the prestartup loader the launcher+writes: keep one unreadable Windows root certificate from stopping the start."""+import ssl+import sys+import warnings+++def tolerate_unreadable_store_certificates():+ """Windows hands Python every trusted root as one block, and OpenSSL rejects the whole block when a+ single certificate in it does not parse. Without this, creating any default TLS context raises+ "[ASN1] nested asn1 error" and ComfyUI quits on its first import of aiohttp.++ Only after that failure are the certificates loaded one by one, skipping the ones OpenSSL cannot+ read. Roots installed by an administrator stay trusted, and a store without a bad certificate takes+ exactly the same path as before."""+ original = getattr(ssl.SSLContext, '_load_windows_store_certs', None)+ if sys.platform != 'win32' or original is None or getattr(original, 'freevideo_tolerant', False):+ return False++ def load(self, storename, purpose):+ try:+ return original(self, storename, purpose)+ except ssl.SSLError:+ pass+ # Read again on every context, so a root an administrator removes later is not trusted from memory.+ certificates = []+ try:+ probe = ssl.SSLContext(ssl.PROTOCOL_TLS_CLIENT)+ for certificate, encoding, trust in ssl.enum_certificates(storename):+ if encoding != 'x509_asn' or not (trust is True or purpose.oid in trust):+ continue+ try:+ probe.load_verify_locations(cadata=certificate)+ except ssl.SSLError:+ continue+ certificates.append(certificate)+ except PermissionError:+ warnings.warn('unable to enumerate Windows certificate store')+ loaded = bytearray(b''.join(certificates))+ if loaded:+ self.load_verify_locations(cadata=loaded)+ return loaded++ load.freevideo_tolerant = True+ ssl.SSLContext._load_windows_store_certs = load+ return True+++try:+ tolerate_unreadable_store_certificates()+except Exception as error:+ print('[FreeVideo] Windows certificate store check skipped: %s' % error)