Add application icons
This commit is contained in:
parent
1d8193b892
commit
231ebf2daa
12 changed files with 63 additions and 8 deletions
|
@ -54,7 +54,7 @@ func (r *Response) NotModified() {
|
|||
// Cache returns a response with caching headers.
|
||||
func (r *Response) Cache(mimeType, etag string, content []byte, duration time.Duration) {
|
||||
r.writer.Header().Set("Content-Type", mimeType)
|
||||
r.writer.Header().Set("Etag", etag)
|
||||
r.writer.Header().Set("ETag", etag)
|
||||
r.writer.Header().Set("Cache-Control", "public")
|
||||
r.writer.Header().Set("Expires", time.Now().Add(duration).Format(time.RFC1123))
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ func (s *SessionMiddleware) Handler(next http.Handler) http.Handler {
|
|||
func (s *SessionMiddleware) isPublicRoute(r *http.Request) bool {
|
||||
route := mux.CurrentRoute(r)
|
||||
switch route.GetName() {
|
||||
case "login", "checkLogin", "stylesheet", "javascript", "oauth2Redirect", "oauth2Callback":
|
||||
case "login", "checkLogin", "stylesheet", "javascript", "oauth2Redirect", "oauth2Callback", "appIcon", "favicon":
|
||||
return true
|
||||
default:
|
||||
return false
|
||||
|
|
|
@ -76,6 +76,7 @@ func getRoutes(cfg *config.Config, store *storage.Storage, feedHandler *feed.Han
|
|||
router.Handle("/stylesheets/{name}.css", uiHandler.Use(uiController.Stylesheet)).Name("stylesheet").Methods("GET")
|
||||
router.Handle("/js", uiHandler.Use(uiController.Javascript)).Name("javascript").Methods("GET")
|
||||
router.Handle("/favicon.ico", uiHandler.Use(uiController.Favicon)).Name("favicon").Methods("GET")
|
||||
router.Handle("/icon/{filename}", uiHandler.Use(uiController.AppIcon)).Name("appIcon").Methods("GET")
|
||||
|
||||
router.Handle("/subscribe", uiHandler.Use(uiController.AddSubscription)).Name("addSubscription").Methods("GET")
|
||||
router.Handle("/subscribe", uiHandler.Use(uiController.SubmitSubscription)).Name("submitSubscription").Methods("POST")
|
||||
|
@ -110,7 +111,7 @@ func getRoutes(cfg *config.Config, store *storage.Storage, feedHandler *feed.Han
|
|||
router.Handle("/category/{categoryID}/update", uiHandler.Use(uiController.UpdateCategory)).Name("updateCategory").Methods("POST")
|
||||
router.Handle("/category/{categoryID}/remove", uiHandler.Use(uiController.RemoveCategory)).Name("removeCategory").Methods("POST")
|
||||
|
||||
router.Handle("/icon/{iconID}", uiHandler.Use(uiController.ShowIcon)).Name("icon").Methods("GET")
|
||||
router.Handle("/feed/icon/{iconID}", uiHandler.Use(uiController.ShowIcon)).Name("icon").Methods("GET")
|
||||
router.Handle("/proxy/{encodedURL}", uiHandler.Use(uiController.ImageProxy)).Name("proxy").Methods("GET")
|
||||
|
||||
router.Handle("/users", uiHandler.Use(uiController.ShowUsers)).Name("users").Methods("GET")
|
||||
|
|
File diff suppressed because one or more lines are too long
BIN
server/static/bin/favicon.png
Normal file
BIN
server/static/bin/favicon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 847 B |
BIN
server/static/bin/touch-icon-ipad-retina.png
Normal file
BIN
server/static/bin/touch-icon-ipad-retina.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.1 KiB |
BIN
server/static/bin/touch-icon-ipad.png
Normal file
BIN
server/static/bin/touch-icon-ipad.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
server/static/bin/touch-icon-iphone-retina.png
Normal file
BIN
server/static/bin/touch-icon-iphone-retina.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.8 KiB |
BIN
server/static/bin/touch-icon-iphone.png
Normal file
BIN
server/static/bin/touch-icon-iphone.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 947 B |
|
@ -1,5 +1,5 @@
|
|||
// Code generated by go generate; DO NOT EDIT.
|
||||
// 2017-12-15 18:49:24.05332735 -0800 PST m=+0.025923222
|
||||
// 2017-12-15 21:24:38.377969493 -0800 PST m=+0.007061903
|
||||
|
||||
package template
|
||||
|
||||
|
@ -29,9 +29,21 @@ var templateCommonMap = map[string]string{
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-title" content="Miniflux">
|
||||
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
|
||||
<link rel="icon" type="image/png" href="{{ route "appIcon" "filename" "favicon.png" }}">
|
||||
<link rel="apple-touch-icon" href="{{ route "appIcon" "filename" "touch-icon-iphone.png" }}">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="{{ route "appIcon" "filename" "touch-icon-ipad.png" }}">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="{{ route "appIcon" "filename" "touch-icon-iphone-retina.png" }}">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="{{ route "appIcon" "filename" "touch-icon-ipad-retina.png" }}">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{{ route "favicon" }}">
|
||||
|
||||
{{ if .csrf }}
|
||||
<meta name="X-CSRF-Token" value="{{ .csrf }}">
|
||||
{{ end }}
|
||||
|
@ -106,6 +118,6 @@ var templateCommonMap = map[string]string{
|
|||
|
||||
var templateCommonMapChecksums = map[string]string{
|
||||
"entry_pagination": "f1465fa70f585ae8043b200ec9de5bf437ffbb0c19fb7aefc015c3555614ee27",
|
||||
"layout": "d1f96640bf90eca64571cfa4fe73be55b09d1d5a49da85b1ea9f9d4f9c670a07",
|
||||
"layout": "100d1ffff506b9cdd4c28233ff883c323452ea01fa224ff891d4ad69997b62b1",
|
||||
"pagination": "6ff462c2b2a53bc5448b651da017f40a39f1d4f16cef4b2f09784f0797286924",
|
||||
}
|
||||
|
|
|
@ -4,9 +4,21 @@
|
|||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-title" content="Miniflux">
|
||||
|
||||
<meta name="robots" content="noindex,nofollow">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
|
||||
<link rel="icon" type="image/png" href="{{ route "appIcon" "filename" "favicon.png" }}">
|
||||
<link rel="apple-touch-icon" href="{{ route "appIcon" "filename" "touch-icon-iphone.png" }}">
|
||||
<link rel="apple-touch-icon" sizes="72x72" href="{{ route "appIcon" "filename" "touch-icon-ipad.png" }}">
|
||||
<link rel="apple-touch-icon" sizes="114x114" href="{{ route "appIcon" "filename" "touch-icon-iphone-retina.png" }}">
|
||||
<link rel="apple-touch-icon" sizes="144x144" href="{{ route "appIcon" "filename" "touch-icon-ipad-retina.png" }}">
|
||||
<link rel="shortcut icon" type="image/x-icon" href="{{ route "favicon" }}">
|
||||
|
||||
{{ if .csrf }}
|
||||
<meta name="X-CSRF-Token" value="{{ .csrf }}">
|
||||
{{ end }}
|
||||
|
|
|
@ -43,3 +43,23 @@ func (c *Controller) Favicon(ctx *core.Context, request *core.Request, response
|
|||
|
||||
response.Cache("image/x-icon", static.BinariesChecksums["favicon.ico"], blob, 48*time.Hour)
|
||||
}
|
||||
|
||||
// AppIcon returns application icons.
|
||||
func (c *Controller) AppIcon(ctx *core.Context, request *core.Request, response *core.Response) {
|
||||
filename := request.StringParam("filename", "favicon.png")
|
||||
encodedBlob, found := static.Binaries[filename]
|
||||
if !found {
|
||||
logger.Info("[Controller:AppIcon] This icon doesn't exists: %s", filename)
|
||||
response.HTML().NotFound()
|
||||
return
|
||||
}
|
||||
|
||||
blob, err := base64.StdEncoding.DecodeString(encodedBlob)
|
||||
if err != nil {
|
||||
logger.Error("[Controller:AppIcon] %v", err)
|
||||
response.HTML().NotFound()
|
||||
return
|
||||
}
|
||||
|
||||
response.Cache("image/png", static.BinariesChecksums[filename], blob, 48*time.Hour)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue