summaryrefslogtreecommitdiffstats
path: root/templates
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2020-12-22 12:13:50 +0100
committerGitHub <noreply@github.com>2020-12-22 19:13:50 +0800
commit3a21f8a9865d1112d1b847fb20710e6b735174ec (patch)
treea0dd55fa92457fec77dabc6d3e83311ec3af8bb9 /templates
parentcd607b5f98ccf66acd99a47309a3411a8e5c8993 (diff)
downloadgitea-3a21f8a9865d1112d1b847fb20710e6b735174ec.tar.gz
gitea-3a21f8a9865d1112d1b847fb20710e6b735174ec.zip
Inline manifest.json (#14038)
* Inline manifest.json Improve performance by eliminating this separate request and just inline this small JSON in HTML directly as a data uri. Also update previously static app name scripts to use AppName. I've confirmed this as working via "Add to Homescreen" feature which offered to save the shortcut under the new app name. * prerender manifest data on startup * move to settings * restore setting.AppStartTime and use it on admin page * use double quotes because template.URL escapes everything * fix lint * move variable to global context variable * delete template file Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: zeripath <art27@cantab.net>
Diffstat (limited to 'templates')
-rw-r--r--templates/base/head.tmpl2
-rw-r--r--templates/pwa/manifest_json.tmpl31
2 files changed, 1 insertions, 32 deletions
diff --git a/templates/base/head.tmpl b/templates/base/head.tmpl
index 51d60c46f8..99b942bcf4 100644
--- a/templates/base/head.tmpl
+++ b/templates/base/head.tmpl
@@ -5,7 +5,7 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<title>{{if .Title}}{{.Title | RenderEmojiPlain}} - {{end}} {{if .Repository.Name}}{{.Repository.Name}} - {{end}}{{AppName}} </title>
- <link rel="manifest" href="{{AppSubUrl}}/manifest.json" crossorigin="use-credentials">
+ <link rel="manifest" href="{{.ManifestData}}"/>
<meta name="theme-color" content="{{ThemeColorMetaTag}}">
<meta name="default-theme" content="{{DefaultTheme}}" />
<meta name="author" content="{{if .Repository}}{{.Owner.Name}}{{else}}{{MetaAuthor}}{{end}}" />
diff --git a/templates/pwa/manifest_json.tmpl b/templates/pwa/manifest_json.tmpl
deleted file mode 100644
index 7eba1f45bb..0000000000
--- a/templates/pwa/manifest_json.tmpl
+++ /dev/null
@@ -1,31 +0,0 @@
-{
- "short_name": "Gitea",
- "name": "Gitea - Git with a cup of tea",
- "icons": [
- {
- "src": "{{StaticUrlPrefix}}/img/logo-lg.png",
- "type": "image/png",
- "sizes": "880x880"
- },
- {
- "src": "{{StaticUrlPrefix}}/img/logo-sm.png",
- "type": "image/png",
- "sizes": "120x120"
- },
- {
- "src": "{{StaticUrlPrefix}}/img/logo-512.png",
- "type": "image/png",
- "sizes": "512x512"
- },
- {
- "src": "{{StaticUrlPrefix}}/img/logo-192.png",
- "type": "image/png",
- "sizes": "192x192"
- }
- ],
- "start_url": "{{AppSubUrl}}/",
- "scope": "{{AppSubUrl}}/",
- "background_color": "#FAFAFA",
- "display": "standalone",
- "theme_color": "{{ThemeColorMetaTag}}"
-}