mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-12-29 19:05:05 +08:00
remove preconnects
This commit is contained in:
parent
48239090f1
commit
eed3b43252
@ -1,4 +1,5 @@
|
||||
import os
|
||||
import re
|
||||
import gradio as gr
|
||||
|
||||
from modules import localization, shared, scripts, util
|
||||
@ -49,12 +50,19 @@ def css_html():
|
||||
return head
|
||||
|
||||
|
||||
re_preconnect = re.compile(rb'<link\s+rel="preconnect"\s+href="([^"]+)"(?:\s+[^>]*)?/?>')
|
||||
|
||||
|
||||
def reload_javascript():
|
||||
js = javascript_html()
|
||||
css = css_html()
|
||||
|
||||
def template_response(*args, **kwargs):
|
||||
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
|
||||
|
||||
# remove preconnects
|
||||
res.body = re_preconnect.sub(b'', res.body)
|
||||
|
||||
res.body = res.body.replace(b'</head>', f'{js}<meta name="referrer" content="no-referrer"/></head>'.encode("utf8"))
|
||||
res.body = res.body.replace(b'</body>', f'{css}</body>'.encode("utf8"))
|
||||
res.init_headers()
|
||||
|
Loading…
Reference in New Issue
Block a user