diff --git a/generate.go b/generate.go index a6b3c04f..9980577f 100644 --- a/generate.go +++ b/generate.go @@ -8,7 +8,6 @@ package main import ( "crypto/sha256" - "encoding/base64" "fmt" "os" "path" @@ -153,21 +152,6 @@ func generateCSSBundle(bundleFile string, themes map[string][]string) { bundle.Write(bundleFile) } -func generateBinaryBundle(bundleFile string, srcFiles []string) { - bundle := NewBundle("static", "Binaries", "ui/static") - - for _, srcFile := range srcFiles { - data := readFile(srcFile) - filename := basename(srcFile) - encodedData := base64.StdEncoding.EncodeToString(data) - - bundle.Files[filename] = string(encodedData) - bundle.Checksums[filename] = checksum(data) - } - - bundle.Write(bundleFile) -} - func generateBundle(bundleFile, pkg, mapName string, srcFiles []string) { bundle := NewBundle(pkg, mapName, pkg) @@ -212,8 +196,6 @@ func main() { "system_sans_serif": []string{"ui/static/css/system.css", "ui/static/css/sans_serif.css", "ui/static/css/common.css"}, }) - generateBinaryBundle("ui/static/bin.go", glob("ui/static/bin/*")) - generateBundle("template/views.go", "template", "templateViewsMap", glob("template/html/*.html")) generateBundle("template/common.go", "template", "templateCommonMap", glob("template/html/common/*.html")) } diff --git a/main.go b/main.go index 7f0787b9..b74ed399 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,6 @@ package main // import "miniflux.app" //go:generate go run generate.go //go:generate gofmt -s -w ui/static/css.go -//go:generate gofmt -s -w ui/static/bin.go //go:generate gofmt -s -w ui/static/js.go //go:generate gofmt -s -w template/views.go //go:generate gofmt -s -w template/common.go diff --git a/ui/static/bin.go b/ui/static/bin.go deleted file mode 100644 index 447c1af3..00000000 --- a/ui/static/bin.go +++ /dev/null @@ -1,29 +0,0 @@ -// Code generated by go generate; DO NOT EDIT. - -package static // import "miniflux.app/ui/static" - -var Binaries = map[string]string{ - "favicon-16.png": `iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAAAAAA6mKC9AAAAAXNCSVQI5gpbmQAAAAlwSFlzAAAHYgAAB2IBOHqZ2wAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAKdEVYdFRpdGxlAGljb27OjKq6AAAAfklEQVQY02P4jwYYsAn8+IcssC5Sm+VhurTi5L8TtaViP/9n+KbGwJCy3YyBMXZRNQNDK1CLKQPDy/+1DAyz/19nYPCGCfQxMEz4/5KBwQxJoA8kYEodgT+aDAx3/89iYGj4/5mRQesPw9ry8vKu/89rysvv/Z9SXr6OgaBvAUyyoQDU+m9nAAAAAElFTkSuQmCC`, - "favicon-32.png": `iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAAAAABWESUoAAAAAXNCSVQI5gpbmQAAAAlwSFlzAAAOxAAADsQBlSsOGwAAABl0RVh0U29mdHdhcmUAd3d3Lmlua3NjYXBlLm9yZ5vuPBoAAAAKdEVYdFRpdGxlAGljb27OjKq6AAAA20lEQVQ4y2P4TwAwDCIFT37jVPDt9Jxce0GGx//fTXLR0A3bDxK9UWyropd2A6zgMDMDGDxeJAymGSf+/5rLCGZyHQWbcEsfzIsRym9RADFYL1lqNJSwgZg6/8BuyAArsHv5//8RMIuzDOieKjDzLFhBJph9GWjcX3YQyxZk9U6w4HQkBVdAwhIglgmIdQYsWIWuQB7EUgaxLoMFc7EqkEcoyB5VQCsFCnAFVxAKPtqA2YtAwqbg9HALyHoJFrT9+J/hKCckyTF4A4VngzmMTUBmBBNY8VGGoZD1ADmAhZM2DZSEAAAAAElFTkSuQmCC`, - "favicon.ico": `AAABAAIAEBAAAAEAIABoBAAAJgAAACAgAAABACAAqBAAAI4EAAAoAAAAEAAAACAAAAABACAAAAAAAAAEAABhBwAAYQcAAAAAAAAAAAAA//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////+tra3/d3d3/3d3d/93d3f/ioqK///////n5+f/fHx8/3d3d/93d3f/3t7e//////+UlJT/d3d3/3d3d/+urq7//Pz8/ykpKf8AAAD/AAAA/93d3f//////mpqa/wAAAP8AAAD/gICA///////z8/P/AQEB/wAAAP8qKir//Pz8//////81NTX/AAAA/wAAAP/p6en//////46Ojv8AAAD/AAAA/46Ojv//////6enp/wAAAP8AAAD/NTU1////////////NTU1/wAAAP8AAAD/6enp//////+Ojo7/AAAA/wAAAP+Ojo7//////+np6f8AAAD/AAAA/zU1Nf///////////zU1Nf8AAAD/AAAA/+np6f//////jo6O/wAAAP8AAAD/jo6O///////p6en/AAAA/wAAAP81NTX///////////81NTX/AAAA/wAAAP/p6en//////46Ojv8AAAD/AAAA/46Ojv//////6enp/wAAAP8AAAD/NTU1////////////NTU1/wAAAP8AAAD/6enp//////+Ojo7/AAAA/wAAAP+Ojo7//////+np6f8AAAD/AAAA/zU1Nf///////////zU1Nf8AAAD/AAAA/+np6f//////jo6O/wAAAP8AAAD/kJCQ///////p6en/AAAA/wAAAP82Njb///////////81NTX/AAAA/wAAAP/p6en//////319ff8AAAD/AAAA/5ubm///////19fX/wAAAP8AAAD/S0tL///////29vb/JiYm/wAAAP8AAAD/ZGRk/7e3t/82Njb/AAAA/wEBAf9dXV3/oqKi/3t7e/8AAAD/AAAA/4WFhf//////rq6u/1lZWf8rKyv/BAQE/+Hh4f9nZ2f/Gxsb/yEhIf+Tk5P//f39/5GRkf8rKyv/Ghoa/11dXf/z8/P///////////////////////j4+P/+/v7//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAoAAAAIAAAAEAAAAABACAAAAAAAAAQAADDDgAAww4AAAAAAAAAAAAA/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8XFxf8JCQn/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/0tLS/////////////////+bm5v/CQkJ/wAAAP8AAAD/AAAA/wAAAP8BAQH/goKC/////////////////1hYWP8CAgL/AAAA/wAAAP8AAAD/AAAA/wkJCf/FxcX///////Hx8f88PDz/AAAA/wAAAP8AAAD/AAAA/wAAAP+ioqL//////////////////////zU1Nf8AAAD/AAAA/wAAAP8AAAD/CQkJ/9ra2v/////////////////p6en/AAAA/wAAAP8AAAD/AAAA/wAAAP89PT3/8fHx/////////////////2lpaf8AAAD/AAAA/wAAAP8AAAD/AAAA/9TU1P//////////////////////ICAg/wAAAP8AAAD/AAAA/wAAAP8fHx///////////////////////9TU1P8AAAD/AAAA/wAAAP8AAAD/AAAA/2tra///////////////////////aWlp/wAAAP8AAAD/AAAA/wAAAP8AAAD/1NTU//////////////////////8fHx//AAAA/wAAAP8AAAD/AAAA/x8fH///////////////////////09PT/wAAAP8AAAD/AAAA/wAAAP8AAAD/a2tr//////////////////////9paWn/AAAA/wAAAP8AAAD/AAAA/wAAAP/U1NT//////////////////////x8fH/8AAAD/AAAA/wAAAP8AAAD/Hx8f///////////////////////T09P/AAAA/wAAAP8AAAD/AAAA/wAAAP9ra2v//////////////////////2lpaf8AAAD/AAAA/wAAAP8AAAD/AAAA/9TU1P//////////////////////Hx8f/wAAAP8AAAD/AAAA/wAAAP8fHx///////////////////////9PT0/8AAAD/AAAA/wAAAP8AAAD/AAAA/2tra///////////////////////aWlp/wAAAP8AAAD/AAAA/wAAAP8AAAD/1NTU//////////////////////8fHx//AAAA/wAAAP8AAAD/AAAA/x8fH///////////////////////09PT/wAAAP8AAAD/AAAA/wAAAP8AAAD/a2tr//////////////////////9paWn/AAAA/wAAAP8AAAD/AAAA/wAAAP/U1NT//////////////////////x8fH/8AAAD/AAAA/wAAAP8AAAD/Hx8f///////////////////////T09P/AAAA/wAAAP8AAAD/AAAA/wAAAP9ra2v//////////////////////2lpaf8AAAD/AAAA/wAAAP8AAAD/AAAA/9TU1P//////////////////////Hx8f/wAAAP8AAAD/AAAA/wAAAP8fHx///////////////////////9PT0/8AAAD/AAAA/wAAAP8AAAD/AAAA/2tra///////////////////////aWlp/wAAAP8AAAD/AAAA/wAAAP8AAAD/1NTU//////////////////////8fHx//AAAA/wAAAP8AAAD/AAAA/x8fH///////////////////////09PT/wAAAP8AAAD/AAAA/wAAAP8AAAD/a2tr//////////////////////9paWn/AAAA/wAAAP8AAAD/AAAA/wAAAP/U1NT//////////////////////x8fH/8AAAD/AAAA/wAAAP8AAAD/Hx8f///////////////////////T09P/AAAA/wAAAP8AAAD/AAAA/wAAAP9ra2v//////////////////////2lpaf8AAAD/AAAA/wAAAP8AAAD/AAAA/9TU1P//////////////////////Hx8f/wAAAP8AAAD/AAAA/wAAAP8fHx///////////////////////9PT0/8AAAD/AAAA/wAAAP8AAAD/AAAA/2tra///////////////////////aWlp/wAAAP8AAAD/AAAA/wAAAP8AAAD/1NTU//////////////////////8fHx//AAAA/wAAAP8AAAD/AAAA/x8fH///////////////////////09PT/wAAAP8AAAD/AAAA/wAAAP8AAAD/a2tr//////////////////////9paWn/AAAA/wAAAP8AAAD/AAAA/wAAAP/U1NT//////////////////////x8fH/8AAAD/AAAA/wAAAP8AAAD/Hx8f///////////////////////T09P/AAAA/wAAAP8AAAD/AAAA/wAAAP9ra2v//////////////////////2lpaf8AAAD/AAAA/wAAAP8AAAD/AAAA/9TU1P//////////////////////Hx8f/wAAAP8AAAD/AAAA/wAAAP8jIyP//////////////////////9PT0/8AAAD/AAAA/wAAAP8AAAD/AAAA/21tbf//////////////////////aWlp/wAAAP8AAAD/AAAA/wAAAP8AAAD/1NTU//////////////////////8YGBj/AAAA/wAAAP8AAAD/AAAA/zQ0NP//////////////////////zMzM/wAAAP8AAAD/AAAA/wAAAP8AAAD/enp6//////////////////////9paWn/AAAA/wAAAP8AAAD/AAAA/wAAAP/T09P//////////////////f39/wcHB/8AAAD/AAAA/wAAAP8AAAD/PT09//////////////////////+5ubn/AAAA/wAAAP8AAAD/AAAA/wAAAP+Xl5f//////////////////////2hoaP8AAAD/AAAA/wAAAP8AAAD/AAAA/z4+Pv/p6en////////////ExMT/AAAA/wAAAP8AAAD/AAAA/wAAAP8JCQn/dnZ2//v7+////////////3p6ev8AAAD/AAAA/wAAAP8AAAD/AAAA/83Nzf/////////////////a2tr/Ly8v/wAAAP8AAAD/AAAA/wAAAP8AAAD/XFxc/xISEv9vb2//hISE/yAgIP8AAAD/AAAA/wAAAP8AAAD/BQUF/9LS0v85OTn/KCgo/4CAgP90dHT/BgYG/wAAAP8AAAD/AAAA/wAAAP8sLCz//v7+////////////w8PD/wMDA/8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP/j4+P/oqKi/xMTE/8AAAD/AAAA/wAAAP8AAAD/AAAA/wEBAf+RkZH///////X19f9tbW3/AQEB/wAAAP8AAAD/AAAA/wAAAP8AAAD/CgoK/8XFxf//////////////////////9vb2/8vLy/+cnJz/bW1t/z8/P/8RERH/AAAA/+Pj4///////7u7u/5KSkv9ERET/KCgo/y0tLf9WVlb/v7+////////////////////////Y2Nj/c3Nz/z09Pf8kJCT/Li4u/2ZmZv/Y2Nj////////////////////////////////////////////////////////////k5OT/+/v7/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABEWekpxFgLAN83n3al/13s0wForfShYw1HA2hyfEkxVvoWZKw69Fjd0QDKIsOXFANmm+dYl4MBTMGPf1HnudJVkLGCXzHLgwGEvwUIdBfY5XkTEH6s/lAAEU4AgU62ffgz0xJgrCH4WNVyIICpjAEgAOoYDwKKSwABc5EfzM0Alq6IVIg77ghjVQHeoETYMmV/CIC5K4toNfvvA5oYc9X93u12iTFWtWusLQDmW13E7bJ3t13jzFW2wy4Dt0jr1W43UOR39H+wbofMbgL+w7ljw035jVXkePT/e01zTlfbEAaq7MYqcj36Py+73cbP4droOJeMLk07xioyPvp7LgZjihPUktM1YONYjwEYjzr6v17UnNfJdvuz+Ca3sR4D0BUHt/5JbJ9krhzPTOvGOi2ANKeAtzxPAQCk2mvPP9Z5AUS/494GILexTgxgqbMEkOIiAEAqAc8/1pkBJFjqbWM1AKQBEH/wrWOVAKQB8Da3OQLIaKyzA3g/4d4uZXYA3sfq8xjrwUfB3cHt/IrIPEZ6Bc8/Vpgf4+lpAwAAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgAAQAAJAAAgAASAABIAAEAACQAAIAAEgAASAABAAAAgAASAABIAAEAACQAAIAAEgAASAABAAAkAACAABIAAEgADQU/cPa/In9oheDS0AAAAASUVORK5CYII=`, -} - -var BinariesChecksums = map[string]string{ - "favicon-16.png": "e19eaad2375e4d9cf0d71296719c807fff13a1e5fe9f4049b4848537c14d347b", - "favicon-32.png": "46e48ce5c6d7e0f30ddd07df3d2df901d273377d5af75f7917ac4aa2ea98e631", - "favicon.ico": "98b08c2d66e3d4e4ac4b05a96098f7dba864f1468c9d1183c6a1ba9033bf3e26", - "icon-120.png": "1ff2e1c2436c1ad3f9db0f2ebb34a0a5efd3993cdceb0635e07798579b1811ae", - "icon-128.png": "9efe18e919fbc5ad325879900cf925f040c9aff8a95ac2eca67035759609a362", - "icon-152.png": "368e44afe444ab57932998a4e9f40848a3efb0589a8b4632d73b555b78bd4dee", - "icon-167.png": "a18954f5b8dbbd76797c98b61a36c52437ad19dac8b972b699d1833df7506645", - "icon-180.png": "6a79d9573a9b180cd76e8b4882f7bd4a886e829b1972f437649731bcf871d6e8", - "icon-192.png": "b0b36eceb45f494fa4151a7ffce7a31d603f50e1a58c98e335c12776d24e755f", - "icon-512.png": "f60e49807df3011ebe01c1e9fb45303d91c21f6edb9d618832b28f970bc7fee6", -} diff --git a/ui/static/static.go b/ui/static/static.go new file mode 100644 index 00000000..f70cc2e8 --- /dev/null +++ b/ui/static/static.go @@ -0,0 +1,47 @@ +// Copyright 2021 Frédéric Guillot. All rights reserved. +// Use of this source code is governed by the Apache 2.0 +// license that can be found in the LICENSE file. + +package static // import "miniflux.app/ui/static" + +import ( + "crypto/sha256" + "embed" + "fmt" +) + +//go:embed bin/* +var binaryFiles embed.FS + +var binaryFileChecksums map[string]string + +func init() { + binaryFileChecksums = make(map[string]string) + + dirEntries, err := binaryFiles.ReadDir("bin") + if err != nil { + panic(err) + } + + for _, dirEntry := range dirEntries { + data, err := LoadBinaryFile(dirEntry.Name()) + if err != nil { + panic(err) + } + + binaryFileChecksums[dirEntry.Name()] = fmt.Sprintf("%x", sha256.Sum256(data)) + } +} + +// LoadBinaryFile loads an embed binary file. +func LoadBinaryFile(filename string) ([]byte, error) { + return binaryFiles.ReadFile(fmt.Sprintf(`bin/%s`, filename)) +} + +// GetBinaryFileChecksum returns a binary file checksum. +func GetBinaryFileChecksum(filename string) (string, error) { + if _, found := binaryFileChecksums[filename]; !found { + return "", fmt.Errorf(`static: unable to find checksum for %q`, filename) + } + return binaryFileChecksums[filename], nil +} diff --git a/ui/static_app_icon.go b/ui/static_app_icon.go index ea0290b4..3124e2f1 100644 --- a/ui/static_app_icon.go +++ b/ui/static_app_icon.go @@ -5,7 +5,6 @@ package ui // import "miniflux.app/ui" import ( - "encoding/base64" "net/http" "time" @@ -17,14 +16,14 @@ import ( func (h *handler) showAppIcon(w http.ResponseWriter, r *http.Request) { filename := request.RouteStringParam(r, "filename") - etag, found := static.BinariesChecksums[filename] - if !found { + etag, err := static.GetBinaryFileChecksum(filename) + if err != nil { html.NotFound(w, r) return } response.New(w, r).WithCaching(etag, 72*time.Hour, func(b *response.Builder) { - blob, err := base64.StdEncoding.DecodeString(static.Binaries[filename]) + blob, err := static.LoadBinaryFile(filename) if err != nil { html.ServerError(w, r, err) return diff --git a/ui/static_favicon.go b/ui/static_favicon.go index 80060a5e..1f158fd2 100644 --- a/ui/static_favicon.go +++ b/ui/static_favicon.go @@ -5,7 +5,6 @@ package ui // import "miniflux.app/ui" import ( - "encoding/base64" "net/http" "time" @@ -15,14 +14,14 @@ import ( ) func (h *handler) showFavicon(w http.ResponseWriter, r *http.Request) { - etag, found := static.BinariesChecksums["favicon.ico"] - if !found { + etag, err := static.GetBinaryFileChecksum("favicon.ico") + if err != nil { html.NotFound(w, r) return } response.New(w, r).WithCaching(etag, 48*time.Hour, func(b *response.Builder) { - blob, err := base64.StdEncoding.DecodeString(static.Binaries["favicon.ico"]) + blob, err := static.LoadBinaryFile("favicon.ico") if err != nil { html.ServerError(w, r, err) return