Remove dependency of go-bindata (#818)
* Use new embed functionality for serving UI assets * Use new embed functionality for serving resources. Remove dependency on go-bindata * Remove Go 1.15
This commit is contained in:
@@ -3,6 +3,7 @@ package app
|
||||
import (
|
||||
"encoding/json"
|
||||
"html/template"
|
||||
"io/fs"
|
||||
"io/ioutil"
|
||||
"net/http"
|
||||
"strings"
|
||||
@@ -15,7 +16,7 @@ import (
|
||||
)
|
||||
|
||||
// Injects the config in the `index.html` template
|
||||
func serveIndex(ds model.DataStore, fs http.FileSystem) http.HandlerFunc {
|
||||
func serveIndex(ds model.DataStore, fs fs.FS) http.HandlerFunc {
|
||||
policy := bluemonday.UGCPolicy()
|
||||
return func(w http.ResponseWriter, r *http.Request) {
|
||||
c, err := ds.User(r.Context()).CountAll()
|
||||
@@ -61,7 +62,7 @@ func serveIndex(ds model.DataStore, fs http.FileSystem) http.HandlerFunc {
|
||||
}
|
||||
}
|
||||
|
||||
func getIndexTemplate(r *http.Request, fs http.FileSystem) (*template.Template, error) {
|
||||
func getIndexTemplate(r *http.Request, fs fs.FS) (*template.Template, error) {
|
||||
t := template.New("initial state")
|
||||
indexHtml, err := fs.Open("index.html")
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user