mirror of
https://github.com/vladmandic/sdnext.git
synced 2026-01-27 15:02:48 +03:00
add webmanifest
This commit is contained in:
8
html/manifest.json
Normal file
8
html/manifest.json
Normal file
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"name": "SD.Next",
|
||||
"short_name": "SD.Next",
|
||||
"icons": [{ "src": "favicon.png", "sizes": "256x256", "type": "image/png", "purpose": "any maskable" }],
|
||||
"start_url": "./index.html",
|
||||
"scope": "/",
|
||||
"display": "standalone"
|
||||
}
|
||||
@@ -81,11 +81,21 @@ def reload_javascript():
|
||||
head = html_head()
|
||||
css = html_css(base_css)
|
||||
body = html_body()
|
||||
title = '<title>SD.Next</title>'
|
||||
manifest = f'<link rel="manifest" href="{webpath(os.path.join(script_path, "html", "manifest.json"))}">'
|
||||
|
||||
def template_response(*args, **kwargs):
|
||||
res = shared.GradioTemplateResponseOriginal(*args, **kwargs)
|
||||
res.body = res.body.replace(b'<head>', f'<head>{title}'.encode("utf8"))
|
||||
res.body = res.body.replace(b'</head>', f'{head}</head>'.encode("utf8"))
|
||||
res.body = res.body.replace(b'</head>', f'{manifest}</head>'.encode("utf8"))
|
||||
res.body = res.body.replace(b'</body>', f'{css}{body}</body>'.encode("utf8"))
|
||||
lines = res.body.decode("utf8").split('\n')
|
||||
for line in lines:
|
||||
if 'meta name="twitter:' in line:
|
||||
res.body = res.body.replace(line.encode("utf8"), b'')
|
||||
# if 'iframeResizer.contentWindow.min.js' in line:
|
||||
# res.body = res.body.replace(line.encode("utf8"), b'<script src="/javascript/iframeResizer.js" async=""></script>')
|
||||
res.init_headers()
|
||||
return res
|
||||
|
||||
|
||||
Reference in New Issue
Block a user