fix: add target='_blank' for linnk in notice board

update DB
This commit is contained in:
Dr.Lt.Data
2024-06-19 01:23:17 +09:00
parent 0e4f1713a4
commit ae0e901a2a
8 changed files with 80 additions and 9 deletions

View File

@@ -1128,6 +1128,19 @@ async def channel_url_list(request):
return web.Response(status=200)
def add_target_blank(html_text):
pattern = r'(<a\s+href="[^"]*"\s*[^>]*)(>)'
def add_target(match):
if 'target=' not in match.group(1):
return match.group(1) + ' target="_blank"' + match.group(2)
return match.group(0)
modified_html = re.sub(pattern, add_target, html_text)
return modified_html
@PromptServer.instance.routes.get("/manager/notice")
async def get_notice(request):
url = "github.com"
@@ -1148,6 +1161,8 @@ async def get_notice(request):
# markdown_content += f"<BR>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;()"
markdown_content += f"<BR>Manager: {core.version_str}"
markdown_content = add_target_blank(markdown_content)
try:
if core.comfy_ui_required_commit_datetime.date() > core.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