diff --git a/py/image_comparer.py b/py/image_comparer.py
index f3b4942..079ebdb 100644
--- a/py/image_comparer.py
+++ b/py/image_comparer.py
@@ -9,6 +9,7 @@ class RgthreeImageComparer(PreviewImage):
NAME = get_name('Image Comparer')
CATEGORY = get_category()
FUNCTION = "compare_images"
+ DESCRIPTION = "Compares two images with a hover slider, or click from properties."
@classmethod
def INPUT_TYPES(cls): # pylint: disable = invalid-name, missing-function-docstring
diff --git a/py/pyproject.py b/py/pyproject.py
index ba21a8d..7622911 100644
--- a/py/pyproject.py
+++ b/py/pyproject.py
@@ -1,7 +1,6 @@
import os
import re
import json
-import requests
from .utils import set_dict_value
@@ -45,14 +44,29 @@ LOGO_URL: str = _DATA['tool']['comfy']['Icon']
if not LOGO_URL.endswith('.svg'):
raise ValueError('Bad logo url.')
-# Fetch the logo so we have any updated markup.
-try:
- LOGO_SVG = requests.get(
- LOGO_URL,
- headers={"user-agent": f"rgthree-comfy/{VERSION}"},
- timeout=10
- ).text
- LOGO_SVG = re.sub(r'(id="bg".*fill=)"[^\"]+"', r'\1"{bg}"', LOGO_SVG)
- LOGO_SVG = re.sub(r'(id="fg".*fill=)"[^\"]+"', r'\1"{fg}"', LOGO_SVG)
-except Exception:
- LOGO_SVG = ''
+LOGO_SVG = None
+async def get_logo_svg():
+ import aiohttp
+ global LOGO_SVG
+ if LOGO_SVG is not None:
+ return LOGO_SVG
+ # Fetch the logo so we have any updated markup.
+ try:
+ async with aiohttp.ClientSession(
+ trust_env=True, connector=aiohttp.TCPConnector(verify_ssl=True)
+ ) as session:
+ headers = {
+ "user-agent": f"rgthree-comfy/{VERSION}",
+ 'Cache-Control': 'no-cache',
+ 'Pragma': 'no-cache',
+ 'Expires': '0'
+ }
+ async with session.get(LOGO_URL, headers=headers) as resp:
+ LOGO_SVG = await resp.text()
+ LOGO_SVG = ''
+ LOGO_SVG = re.sub(r'(id="bg".*fill=)"[^\"]+"', r'\1"{bg}"', LOGO_SVG)
+ LOGO_SVG = re.sub(r'(id="fg".*fill=)"[^\"]+"', r'\1"{fg}"', LOGO_SVG)
+ except Exception:
+ LOGO_SVG = ''
+ print(LOGO_SVG)
+ return LOGO_SVG
diff --git a/py/server/routes_config.py b/py/server/routes_config.py
index 21339d1..d67b159 100644
--- a/py/server/routes_config.py
+++ b/py/server/routes_config.py
@@ -4,12 +4,13 @@ from aiohttp import web
from server import PromptServer
-from ..pyproject import LOGO_SVG
+from ..pyproject import get_logo_svg
from .utils_server import is_param_truthy, get_param
from ..config import get_config, set_user_config, refresh_config
routes = PromptServer.instance.routes
+
@routes.get('/rgthree/config.js')
def api_get_user_config_file(request):
""" Returns the user configuration as a javascript file. """
@@ -36,9 +37,29 @@ async def api_set_user_config(request):
@routes.get('/rgthree/logo.svg')
-async def get_logo(request):
+async def get_logo(request, as_markup=False):
""" Returns the rgthree logo with color config. """
bg = get_param(request, 'bg', 'transparent')
fg = get_param(request, 'fg', '#111111')
- resp = LOGO_SVG.format(bg=bg, fg=fg)
+ w = get_param(request, 'w')
+ h = get_param(request, 'h')
+ css_class = get_param(request, 'cssClass')
+ svg = await get_logo_svg()
+ resp = svg.format(bg=bg, fg=fg)
+ if w is not None:
+ resp = re.sub(r'(