diff --git a/.gitignore b/.gitignore
index f6d437f..4c3450f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,9 @@
mycorrhiza
-hyphae/*.gog
-# go editors and IDEA folders
-.idea/
+# VScode and IDEA folders
.vscode/
+.idea/**/workspace.xml
+.idea/**/tasks.xml
+.idea/**/usage.statistics.xml
+.idea/**/dictionaries
+.idea/**/shelf
\ No newline at end of file
diff --git a/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..73f69e0
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# Default ignored files
+/shelf/
+/workspace.xml
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
+# Editor-based HTTP Client requests
+/httpRequests/
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..5154f76
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..467eff0
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/mycorrhiza.iml b/.idea/mycorrhiza.iml
new file mode 100644
index 0000000..5e764c4
--- /dev/null
+++ b/.idea/mycorrhiza.iml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..3a1beee
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/assets/assets.qtpl.go b/assets/assets.qtpl.go
index 653b028..4877da2 100644
--- a/assets/assets.qtpl.go
+++ b/assets/assets.qtpl.go
@@ -228,12 +228,12 @@ main h1:not(.navi-title) {font-size:1.7rem;}
blockquote { margin-left: 0; padding-left: 1rem; }
.wikilink_external::before { display: inline-block; width: 18px; height: 16px; vertical-align: sub; }
/* .wikilink_external { padding-left: 16px; } */
-.wikilink_gopher::before { content: url("/static/icon/gopher"); }
-.wikilink_http::before { content: url("/static/icon/http"); }
-.wikilink_https::before { content: url("/static/icon/http"); }
-/* .wikilink_https { background: transparent url("/static/icon/http") center left no-repeat; } */
-.wikilink_gemini::before { content: url("/static/icon/gemini"); }
-.wikilink_mailto::before { content: url("/static/icon/mailto"); }
+.wikilink_gopher::before { content: url("/assets/icon/gopher"); }
+.wikilink_http::before { content: url("/assets/icon/http"); }
+.wikilink_https::before { content: url("/assets/icon/http"); }
+/* .wikilink_https { background: transparent url("/assets/icon/http") center left no-repeat; } */
+.wikilink_gemini::before { content: url("/assets/icon/gemini"); }
+.wikilink_mailto::before { content: url("/assets/icon/mailto"); }
article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; }
main h1, main h2, main h3, main h4, main h5, main h6 { margin: 1.5rem 0 0 0; }
diff --git a/assets/default.css b/assets/default.css
index c3905b7..96d6791 100644
--- a/assets/default.css
+++ b/assets/default.css
@@ -113,12 +113,12 @@ main h1:not(.navi-title) {font-size:1.7rem;}
blockquote { margin-left: 0; padding-left: 1rem; }
.wikilink_external::before { display: inline-block; width: 18px; height: 16px; vertical-align: sub; }
/* .wikilink_external { padding-left: 16px; } */
-.wikilink_gopher::before { content: url("/static/icon/gopher"); }
-.wikilink_http::before { content: url("/static/icon/http"); }
-.wikilink_https::before { content: url("/static/icon/http"); }
-/* .wikilink_https { background: transparent url("/static/icon/http") center left no-repeat; } */
-.wikilink_gemini::before { content: url("/static/icon/gemini"); }
-.wikilink_mailto::before { content: url("/static/icon/mailto"); }
+.wikilink_gopher::before { content: url("/assets/icon/gopher"); }
+.wikilink_http::before { content: url("/assets/icon/http"); }
+.wikilink_https::before { content: url("/assets/icon/http"); }
+/* .wikilink_https { background: transparent url("/assets/icon/http") center left no-repeat; } */
+.wikilink_gemini::before { content: url("/assets/icon/gemini"); }
+.wikilink_mailto::before { content: url("/assets/icon/mailto"); }
article { overflow-wrap: break-word; word-wrap: break-word; word-break: break-word; line-height: 150%; }
main h1, main h2, main h3, main h4, main h5, main h6 { margin: 1.5rem 0 0 0; }
diff --git a/main.go b/main.go
index 1d17db2..3d5d722 100644
--- a/main.go
+++ b/main.go
@@ -7,6 +7,7 @@ package main
import (
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
+ "io"
"io/ioutil"
"log"
"net/http"
@@ -48,8 +49,6 @@ func HttpErr(w http.ResponseWriter, status int, name, title, errMsg string) {
// This part is present in all html documents.
var base = views.BaseHTML
-// Stop the wiki
-
func handlerStyle(w http.ResponseWriter, rq *http.Request) {
prepareRq(rq)
if _, err := os.Stat(cfg.WikiDir + "/static/common.css"); err == nil {
@@ -69,33 +68,34 @@ func handlerToolbar(w http.ResponseWriter, rq *http.Request) {
w.Write([]byte(assets.ToolbarJS()))
}
+// handlerIcon serves the requested icon. All icons are distributed as part of the Mycorrhiza binary.
+//
+// See assets/assets/icon/ for icons themselves, see assets/assets.qtpl for their sources.
func handlerIcon(w http.ResponseWriter, rq *http.Request) {
- iconName := strings.TrimPrefix(rq.URL.Path, "/static/icon/")
+ iconName := strings.TrimPrefix(rq.URL.Path, "/assets/icon/")
if iconName == "https" {
iconName = "http"
}
- files, err := ioutil.ReadDir(WikiDir + "/static/icon")
- if err == nil {
- for _, f := range files {
- if strings.HasPrefix(f.Name(), iconName+"-protocol-icon") {
- http.ServeFile(w, rq, WikiDir+"/static/icon/"+f.Name())
- return
- }
- }
- }
w.Header().Set("Content-Type", "image/svg+xml")
- switch iconName {
- case "gemini":
- w.Write([]byte(assets.IconGemini()))
- case "mailto":
- w.Write([]byte(assets.IconMailto()))
- case "gopher":
- w.Write([]byte(assets.IconGopher()))
- case "feed":
- w.Write([]byte(assets.IconFeed()))
- default:
- w.Write([]byte(assets.IconHTTP()))
+ icon := func() string {
+ switch iconName {
+ case "gemini":
+ return assets.IconGemini()
+ case "mailto":
+ return assets.IconMailto()
+ case "gopher":
+ return assets.IconGopher()
+ case "feed":
+ return assets.IconFeed()
+ default:
+ return assets.IconHTTP()
+ }
+ }()
+ _, err := io.WriteString(w, icon)
+ if err != nil {
+ log.Println(err)
}
+
}
func handlerUserList(w http.ResponseWriter, rq *http.Request) {
@@ -160,7 +160,7 @@ func main() {
})
http.HandleFunc("/static/common.css", handlerStyle)
http.HandleFunc("/static/toolbar.js", handlerToolbar)
- http.HandleFunc("/static/icon/", handlerIcon)
+ http.HandleFunc("/assets/icon/", handlerIcon)
http.HandleFunc("/robots.txt", handlerRobotsTxt)
http.HandleFunc("/", func(w http.ResponseWriter, rq *http.Request) {
addr, _ := url.Parse("/hypha/" + cfg.HomeHypha) // Let's pray it never fails
diff --git a/views/history.qtpl b/views/history.qtpl
index 1ecfe48..7049261 100644
--- a/views/history.qtpl
+++ b/views/history.qtpl
@@ -45,7 +45,7 @@ if err != nil {
recent changes
-
Subscribe via RSS, Atom or JSON feed.
+
Subscribe via RSS, Atom or JSON feed.
{% comment %}
Here I am, willing to add some accessibility using ARIA. Turns out,
diff --git a/views/history.qtpl.go b/views/history.qtpl.go
index 262db7d..0a0462b 100644
--- a/views/history.qtpl.go
+++ b/views/history.qtpl.go
@@ -163,7 +163,7 @@ func StreamRecentChangesHTML(qw422016 *qt422016.Writer, n int) {
recent changes
-
Subscribe via RSS, Atom or JSON feed.
+
Subscribe via RSS, Atom or JSON feed.
`)
//line views/history.qtpl:55