flounder

A simple gemini site builder
Log | Files | Refs | README | LICENSE

commit 94c1000834fa69f594135dc75f0b2bdeb8fb6821
parent ce6666f9f02374b70bf44526674173ddd8bb5b46
Author: alex wennerberg <alex@alexwennerberg.com>
Date:   Sat, 20 Feb 2021 16:15:12 -0800

Remove Favicon

There was a discussion around this in the IRC channel, which I agree
with. The only reason I supported it was bc it was relatively popular

Diffstat:
Mhttp.go | 17+----------------
Mproxy.go | 3+--
Mtemplates/emptyfolder.html | 1-
Mtemplates/user_page.html | 1-
4 files changed, 2 insertions(+), 20 deletions(-)

diff --git a/http.go b/http.go @@ -528,19 +528,6 @@ func adminHandler(w http.ResponseWriter, r *http.Request) { } } -func getFavicon(user string) string { - faviconPath := path.Join(c.FilesDirectory, filepath.Clean(user), "favicon.txt") - content, err := ioutil.ReadFile(faviconPath) - if err != nil { - return "" - } - strcontent := []rune(string(content)) - if len(strcontent) > 0 { - return string(strcontent[0]) - } - return "" -} - // Server a user's file // TODO replace with gemini proxy // Here be dragons @@ -612,7 +599,6 @@ func userFile(w http.ResponseWriter, r *http.Request) { parse, _ := gmi.ParseText(strings.NewReader(geminiContent)) htmlDoc = textToHTML(nil, parse) } - favicon := getFavicon(userName) hostname := strings.Split(r.Host, ":")[0] uri := url.URL{ Scheme: "gemini", @@ -624,12 +610,11 @@ func userFile(w http.ResponseWriter, r *http.Request) { } data := struct { SiteBody template.HTML - Favicon string PageTitle string URI *url.URL GeminiURI *url.URL Config Config - }{template.HTML(htmlDoc.Content), favicon, htmlDoc.Title, &uri, &uri, c} + }{template.HTML(htmlDoc.Content), htmlDoc.Title, &uri, &uri, c} buff := bytes.NewBuffer([]byte{}) err = t.ExecuteTemplate(buff, "user_page.html", data) if err != nil { diff --git a/proxy.go b/proxy.go @@ -125,12 +125,11 @@ func proxyGemini(w http.ResponseWriter, r *http.Request) { } data := struct { SiteBody template.HTML - Favicon string PageTitle string GeminiURI *url.URL URI *url.URL Config Config - }{template.HTML(htmlDoc.Content), "", htmlDoc.Title, req.URL, r.URL, c} + }{template.HTML(htmlDoc.Content), htmlDoc.Title, req.URL, r.URL, c} err = t.ExecuteTemplate(w, "user_page.html", data) if err != nil { diff --git a/templates/emptyfolder.html b/templates/emptyfolder.html @@ -5,7 +5,6 @@ <title>{{.PageTitle }}</title> <meta name="viewport" content="width=device-width" /> <link rel="stylesheet" type="text/css" href="/style.css" /> - <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{.Favicon}}</text></svg>"> </head> <body> <main> diff --git a/templates/user_page.html b/templates/user_page.html @@ -10,7 +10,6 @@ {{ end }} <meta name="viewport" content="width=device-width" /> <link rel="stylesheet" type="text/css" href="//{{.Config.Host}}/style.css" /> - <link rel="icon" href="data:image/svg+xml,<svg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%220 0 100 100%22><text y=%22.9em%22 font-size=%2290%22>{{.Favicon}}</text></svg>"> </head> <body> <main>