mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2025-04-04 19:49:01 +08:00
Merge 4861dccf7c2114e3782747e9f39c3c64e723e2f3 into 374bb6cc384d2a19422c0b07d69de0a41d1f3f4d
This commit is contained in:
commit
78bf0fbc23
@ -1,4 +1,5 @@
|
|||||||
import os
|
import os
|
||||||
|
import re
|
||||||
import gradio as gr
|
import gradio as gr
|
||||||
|
|
||||||
from modules import localization, shared, scripts, util
|
from modules import localization, shared, scripts, util
|
||||||
@ -49,12 +50,21 @@ def css_html():
|
|||||||
return head
|
return head
|
||||||
|
|
||||||
|
|
||||||
|
re_preconnect = re.compile(rb'<link\s+rel="preconnect"\s+href="([^"]+)"(?:\s+[^>]*)?/?>')
|
||||||
|
|
||||||
|
|
||||||
def reload_javascript():
|
def reload_javascript():
|
||||||
js = javascript_html()
|
js = javascript_html()
|
||||||
css = css_html()
|
css = css_html()
|
||||||
|
|
||||||
def template_response(*args, **kwargs):
|
def template_response(*args, **kwargs):
|
||||||
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
|
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
|
||||||
|
|
||||||
|
# remove preconnects
|
||||||
|
res.body = re_preconnect.sub(b'', res.body)
|
||||||
|
# replace iframeResizer with local version
|
||||||
|
res.body = res.body.replace(b'src="https://cdnjs.cloudflare.com/ajax/libs/iframe-resizer/4.3.6/iframeResizer.contentWindow.min.js"', b'src="webui-assets/js/iframe-resizer/4.3.6/iframeResizer.contentWindow.min.js"')
|
||||||
|
|
||||||
res.body = res.body.replace(b'</head>', f'{js}<meta name="referrer" content="no-referrer"/></head>'.encode("utf8"))
|
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.body = res.body.replace(b'</body>', f'{css}</body>'.encode("utf8"))
|
||||||
res.init_headers()
|
res.init_headers()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user