diff options
Diffstat (limited to 'modules/setting/setting.go')
-rw-r--r-- | modules/setting/setting.go | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 63ae15af97..290ec94c44 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -8,6 +8,7 @@ package setting import ( "encoding/base64" "fmt" + "html/template" "io" "io/ioutil" "math" @@ -293,6 +294,8 @@ var ( CSRFCookieName = "_csrf" CSRFCookieHTTPOnly = true + ManifestData template.URL + // Mirror settings Mirror struct { DefaultInterval time.Duration @@ -642,6 +645,8 @@ func NewContext() { LandingPageURL = LandingPageHome } + ManifestData = makeManifestData() + if len(SSH.Domain) == 0 { SSH.Domain = Domain } @@ -1040,6 +1045,14 @@ func loadOrGenerateInternalToken(sec *ini.Section) string { return token } +func makeManifestData() template.URL { + name := url.QueryEscape(AppName) + prefix := url.QueryEscape(StaticURLPrefix) + subURL := url.QueryEscape(AppSubURL) + "/" + + return template.URL(`data:application/json,{"short_name":"` + name + `","name":"` + name + `","icons":[{"src":"` + prefix + `/img/logo-lg.png","type":"image/png","sizes":"880x880"},{"src":"` + prefix + `/img/logo-sm.png","type":"image/png","sizes":"120x120"},{"src":"` + prefix + `/img/logo-512.png","type":"image/png","sizes":"512x512"},{"src":"` + prefix + `/img/logo-192.png","type":"image/png","sizes":"192x192"}],"start_url":"` + subURL + `","scope":"` + subURL + `","background_color":"%23FAFAFA","display":"standalone"}`) +} + // NewServices initializes the services func NewServices() { InitDBConfig() |