Frédéric Guillot 8 лет назад
Родитель
Сommit
231ebf2daa

+ 1 - 1
server/core/response.go

@@ -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))
 

+ 1 - 1
server/middleware/session.go

@@ -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

+ 2 - 1
server/routes.go

@@ -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")

Разница между файлами не показана из-за своего большого размера
+ 1 - 1
server/static/bin.go


BIN
server/static/bin/favicon.png


BIN
server/static/bin/touch-icon-ipad-retina.png


BIN
server/static/bin/touch-icon-ipad.png


BIN
server/static/bin/touch-icon-iphone-retina.png


BIN
server/static/bin/touch-icon-iphone.png


+ 14 - 2
server/template/common.go

@@ -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",
 }

+ 12 - 0
server/template/html/common/layout.html

@@ -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 }}

+ 20 - 0
server/ui/controller/static.go

@@ -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)
+}

Некоторые файлы не были показаны из-за большого количества измененных файлов