mirror of
				https://github.com/osmarks/mycorrhiza.git
				synced 2025-10-30 23:23:04 +00:00 
			
		
		
		
	Drop support of icon redefining, use a different url for icons
This commit is contained in:
		
							
								
								
									
										9
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										9
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @@ -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 | ||||
							
								
								
									
										8
									
								
								.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								.idea/.gitignore
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -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/ | ||||
							
								
								
									
										6
									
								
								.idea/inspectionProfiles/Project_Default.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										6
									
								
								.idea/inspectionProfiles/Project_Default.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,6 @@ | ||||
| <component name="InspectionProjectProfileManager"> | ||||
|   <profile version="1.0"> | ||||
|     <option name="myName" value="Project Default" /> | ||||
|     <inspection_tool class="CssUnknownTarget" enabled="true" level="WEAK WARNING" enabled_by_default="true" /> | ||||
|   </profile> | ||||
| </component> | ||||
							
								
								
									
										8
									
								
								.idea/modules.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										8
									
								
								.idea/modules.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,8 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="ProjectModuleManager"> | ||||
|     <modules> | ||||
|       <module fileurl="file://$PROJECT_DIR$/.idea/mycorrhiza.iml" filepath="$PROJECT_DIR$/.idea/mycorrhiza.iml" /> | ||||
|     </modules> | ||||
|   </component> | ||||
| </project> | ||||
							
								
								
									
										9
									
								
								.idea/mycorrhiza.iml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										9
									
								
								.idea/mycorrhiza.iml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,9 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <module type="WEB_MODULE" version="4"> | ||||
|   <component name="Go" enabled="true" /> | ||||
|   <component name="NewModuleRootManager"> | ||||
|     <content url="file://$MODULE_DIR$" /> | ||||
|     <orderEntry type="inheritedJdk" /> | ||||
|     <orderEntry type="sourceFolder" forTests="false" /> | ||||
|   </component> | ||||
| </module> | ||||
							
								
								
									
										7
									
								
								.idea/vcs.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							
							
						
						
									
										7
									
								
								.idea/vcs.xml
									
									
									
										generated
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,7 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project version="4"> | ||||
|   <component name="VcsDirectoryMappings"> | ||||
|     <mapping directory="$PROJECT_DIR$" vcs="Git" /> | ||||
|     <mapping directory="$PROJECT_DIR$/metarrhiza" vcs="Git" /> | ||||
|   </component> | ||||
| </project> | ||||
| @@ -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; } | ||||
|   | ||||
| @@ -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; } | ||||
|   | ||||
							
								
								
									
										36
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										36
									
								
								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") | ||||
| 	icon := func() string { | ||||
| 		switch iconName { | ||||
| 		case "gemini": | ||||
| 		w.Write([]byte(assets.IconGemini())) | ||||
| 			return assets.IconGemini() | ||||
| 		case "mailto": | ||||
| 		w.Write([]byte(assets.IconMailto())) | ||||
| 			return assets.IconMailto() | ||||
| 		case "gopher": | ||||
| 		w.Write([]byte(assets.IconGopher())) | ||||
| 			return assets.IconGopher() | ||||
| 		case "feed": | ||||
| 		w.Write([]byte(assets.IconFeed())) | ||||
| 			return assets.IconFeed() | ||||
| 		default: | ||||
| 		w.Write([]byte(assets.IconHTTP())) | ||||
| 			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 | ||||
|   | ||||
| @@ -45,7 +45,7 @@ if err != nil { | ||||
| 		recent changes | ||||
| 	</nav> | ||||
|  | ||||
| 	<p><img class="icon" width="20" height="20" src="/static/icon/feed">Subscribe via <a href="/recent-changes-rss">RSS</a>, <a href="/recent-changes-atom">Atom</a> or <a href="/recent-changes-json">JSON feed</a>.</p> | ||||
| 	<p><img class="icon" width="20" height="20" src="/assets/icon/feed">Subscribe via <a href="/recent-changes-rss">RSS</a>, <a href="/recent-changes-atom">Atom</a> or <a href="/recent-changes-json">JSON feed</a>.</p> | ||||
|  | ||||
| 	{% comment %} | ||||
| 		Here I am, willing to add some accessibility using ARIA. Turns out, | ||||
|   | ||||
| @@ -163,7 +163,7 @@ func StreamRecentChangesHTML(qw422016 *qt422016.Writer, n int) { | ||||
| 		recent changes | ||||
| 	</nav> | ||||
|  | ||||
| 	<p><img class="icon" width="20" height="20" src="/static/icon/feed">Subscribe via <a href="/recent-changes-rss">RSS</a>, <a href="/recent-changes-atom">Atom</a> or <a href="/recent-changes-json">JSON feed</a>.</p> | ||||
| 	<p><img class="icon" width="20" height="20" src="/assets/icon/feed">Subscribe via <a href="/recent-changes-rss">RSS</a>, <a href="/recent-changes-atom">Atom</a> or <a href="/recent-changes-json">JSON feed</a>.</p> | ||||
|  | ||||
| 	`) | ||||
| //line views/history.qtpl:55 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Timur Ismagilov
					Timur Ismagilov