mirror of
				https://github.com/osmarks/mycorrhiza.git
				synced 2025-10-31 15:43:00 +00:00 
			
		
		
		
	Move the user link to the header links
This commit is contained in:
		| @@ -28,7 +28,7 @@ func handlerLogout(w http.ResponseWriter, rq *http.Request) { | ||||
| 		log.Println("Unknown user tries to log out") | ||||
| 		w.WriteHeader(http.StatusForbidden) | ||||
| 	} | ||||
| 	w.Write([]byte(base("Logout?", templates.LogoutHTML(can)))) | ||||
| 	w.Write([]byte(base("Logout?", templates.LogoutHTML(can), u))) | ||||
| } | ||||
|  | ||||
| func handlerLogoutConfirm(w http.ResponseWriter, rq *http.Request) { | ||||
| @@ -44,7 +44,7 @@ func handlerLoginData(w http.ResponseWriter, rq *http.Request) { | ||||
| 		err      = user.LoginDataHTTP(w, rq, username, password) | ||||
| 	) | ||||
| 	if err != "" { | ||||
| 		w.Write([]byte(base(err, templates.LoginErrorHTML(err)))) | ||||
| 		w.Write([]byte(base(err, templates.LoginErrorHTML(err), user.EmptyUser()))) | ||||
| 	} else { | ||||
| 		http.Redirect(w, rq, "/", http.StatusSeeOther) | ||||
| 	} | ||||
| @@ -58,5 +58,5 @@ func handlerLogin(w http.ResponseWriter, rq *http.Request) { | ||||
| 	} else { | ||||
| 		w.WriteHeader(http.StatusForbidden) | ||||
| 	} | ||||
| 	w.Write([]byte(base("Login", templates.LoginHTML()))) | ||||
| 	w.Write([]byte(base("Login", templates.LoginHTML(), user.EmptyUser()))) | ||||
| } | ||||
|   | ||||
| @@ -9,6 +9,7 @@ import ( | ||||
|  | ||||
| 	"github.com/bouncepaw/mycorrhiza/history" | ||||
| 	"github.com/bouncepaw/mycorrhiza/templates" | ||||
| 	"github.com/bouncepaw/mycorrhiza/user" | ||||
| 	"github.com/bouncepaw/mycorrhiza/util" | ||||
| ) | ||||
|  | ||||
| @@ -34,7 +35,7 @@ func handlerHistory(w http.ResponseWriter, rq *http.Request) { | ||||
| 	log.Println("Found", len(revs), "revisions for", hyphaName) | ||||
|  | ||||
| 	util.HTTP200Page(w, | ||||
| 		base(hyphaName, templates.HistoryHTML(rq, hyphaName, list))) | ||||
| 		base(hyphaName, templates.HistoryHTML(rq, hyphaName, list), user.FromRequest(rq))) | ||||
| } | ||||
|  | ||||
| // Recent changes | ||||
| @@ -45,7 +46,7 @@ func handlerRecentChanges(w http.ResponseWriter, rq *http.Request) { | ||||
| 		n, err   = strconv.Atoi(noPrefix) | ||||
| 	) | ||||
| 	if err == nil && n < 101 { | ||||
| 		util.HTTP200Page(w, base(strconv.Itoa(n)+" recent changes", history.RecentChanges(n))) | ||||
| 		util.HTTP200Page(w, base(strconv.Itoa(n)+" recent changes", history.RecentChanges(n), user.FromRequest(rq))) | ||||
| 	} else { | ||||
| 		http.Redirect(w, rq, "/recent-changes/20", http.StatusSeeOther) | ||||
| 	} | ||||
|   | ||||
| @@ -41,7 +41,7 @@ func handlerUnattachAsk(w http.ResponseWriter, rq *http.Request) { | ||||
| 		log.Println("Rejected (no rights):", rq.URL) | ||||
| 		return | ||||
| 	} | ||||
| 	util.HTTP200Page(w, base("Unattach "+hyphaName+"?", templates.UnattachAskHTML(rq, hyphaName, isOld))) | ||||
| 	util.HTTP200Page(w, base("Unattach "+hyphaName+"?", templates.UnattachAskHTML(rq, hyphaName, isOld), user.FromRequest(rq))) | ||||
| } | ||||
|  | ||||
| func handlerUnattachConfirm(w http.ResponseWriter, rq *http.Request) { | ||||
| @@ -82,13 +82,14 @@ func handlerRenameAsk(w http.ResponseWriter, rq *http.Request) { | ||||
| 	var ( | ||||
| 		hyphaName = HyphaNameFromRq(rq, "rename-ask") | ||||
| 		_, isOld  = HyphaStorage[hyphaName] | ||||
| 		u         = user.FromRequest(rq) | ||||
| 	) | ||||
| 	if ok := user.CanProceed(rq, "rename-confirm"); !ok { | ||||
| 	if !u.CanProceed("rename-confirm") { | ||||
| 		HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a trusted editor to rename pages.") | ||||
| 		log.Println("Rejected", rq.URL) | ||||
| 		return | ||||
| 	} | ||||
| 	util.HTTP200Page(w, base("Rename "+hyphaName+"?", templates.RenameAskHTML(rq, hyphaName, isOld))) | ||||
| 	util.HTTP200Page(w, base("Rename "+hyphaName+"?", templates.RenameAskHTML(rq, hyphaName, isOld), u)) | ||||
| } | ||||
|  | ||||
| func handlerRenameConfirm(w http.ResponseWriter, rq *http.Request) { | ||||
| @@ -134,13 +135,14 @@ func handlerDeleteAsk(w http.ResponseWriter, rq *http.Request) { | ||||
| 	var ( | ||||
| 		hyphaName = HyphaNameFromRq(rq, "delete-ask") | ||||
| 		_, isOld  = HyphaStorage[hyphaName] | ||||
| 		u         = user.FromRequest(rq) | ||||
| 	) | ||||
| 	if ok := user.CanProceed(rq, "delete-ask"); !ok { | ||||
| 	if !u.CanProceed("delete-ask") { | ||||
| 		HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a moderator to delete pages.") | ||||
| 		log.Println("Rejected", rq.URL) | ||||
| 		return | ||||
| 	} | ||||
| 	util.HTTP200Page(w, base("Delete "+hyphaName+"?", templates.DeleteAskHTML(rq, hyphaName, isOld))) | ||||
| 	util.HTTP200Page(w, base("Delete "+hyphaName+"?", templates.DeleteAskHTML(rq, hyphaName, isOld), u)) | ||||
| } | ||||
|  | ||||
| // handlerDeleteConfirm deletes a hypha for sure | ||||
| @@ -151,7 +153,7 @@ func handlerDeleteConfirm(w http.ResponseWriter, rq *http.Request) { | ||||
| 		hyphaData, isOld = HyphaStorage[hyphaName] | ||||
| 		u                = user.FromRequest(rq) | ||||
| 	) | ||||
| 	if !user.CanProceed(rq, "delete-confirm") { | ||||
| 	if !u.CanProceed("delete-confirm") { | ||||
| 		HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be a moderator to delete pages.") | ||||
| 		log.Println("Rejected", rq.URL) | ||||
| 		return | ||||
| @@ -181,8 +183,9 @@ func handlerEdit(w http.ResponseWriter, rq *http.Request) { | ||||
| 		warning          string | ||||
| 		textAreaFill     string | ||||
| 		err              error | ||||
| 		u                = user.FromRequest(rq) | ||||
| 	) | ||||
| 	if ok := user.CanProceed(rq, "edit"); !ok { | ||||
| 	if !u.CanProceed("edit") { | ||||
| 		HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be an editor to edit pages.") | ||||
| 		log.Println("Rejected", rq.URL) | ||||
| 		return | ||||
| @@ -197,7 +200,7 @@ func handlerEdit(w http.ResponseWriter, rq *http.Request) { | ||||
| 	} else { | ||||
| 		warning = `<p>You are creating a new hypha.</p>` | ||||
| 	} | ||||
| 	util.HTTP200Page(w, base("Edit "+hyphaName, templates.EditHTML(rq, hyphaName, textAreaFill, warning))) | ||||
| 	util.HTTP200Page(w, base("Edit "+hyphaName, templates.EditHTML(rq, hyphaName, textAreaFill, warning), u)) | ||||
| } | ||||
|  | ||||
| // handlerUploadText uploads a new text part for the hypha. | ||||
| @@ -209,7 +212,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) { | ||||
| 		action    = rq.PostFormValue("action") | ||||
| 		u         = user.FromRequest(rq) | ||||
| 	) | ||||
| 	if ok := user.CanProceed(rq, "upload-text"); !ok { | ||||
| 	if !u.CanProceed("upload-text") { | ||||
| 		HttpErr(w, http.StatusForbidden, hyphaName, "Not enough rights", "You must be an editor to edit pages.") | ||||
| 		log.Println("Rejected", rq.URL) | ||||
| 		return | ||||
| @@ -219,7 +222,7 @@ func handlerUploadText(w http.ResponseWriter, rq *http.Request) { | ||||
| 		return | ||||
| 	} | ||||
| 	if action == "Preview" { | ||||
| 		util.HTTP200Page(w, base("Preview "+hyphaName, templates.PreviewHTML(rq, hyphaName, textData, "", markup.Doc(hyphaName, textData).AsHTML()))) | ||||
| 		util.HTTP200Page(w, base("Preview "+hyphaName, templates.PreviewHTML(rq, hyphaName, textData, "", markup.Doc(hyphaName, textData).AsHTML()), u)) | ||||
| 	} else if hop := UploadText(hyphaName, textData, u); len(hop.Errs) != 0 { | ||||
| 		HttpErr(w, http.StatusInternalServerError, hyphaName, "Error", hop.Errs[0].Error()) | ||||
| 	} else { | ||||
|   | ||||
| @@ -13,6 +13,7 @@ import ( | ||||
| 	"github.com/bouncepaw/mycorrhiza/markup" | ||||
| 	"github.com/bouncepaw/mycorrhiza/templates" | ||||
| 	"github.com/bouncepaw/mycorrhiza/tree" | ||||
| 	"github.com/bouncepaw/mycorrhiza/user" | ||||
| 	"github.com/bouncepaw/mycorrhiza/util" | ||||
| ) | ||||
|  | ||||
| @@ -34,6 +35,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) { | ||||
| 		contents          = fmt.Sprintf(`<p>This hypha had no text at this revision.</p>`) | ||||
| 		textPath          = hyphaName + ".myco" | ||||
| 		textContents, err = history.FileAtRevision(textPath, revHash) | ||||
| 		u                 = user.FromRequest(rq) | ||||
| 	) | ||||
| 	if err == nil { | ||||
| 		contents = markup.Doc(hyphaName, textContents).AsHTML() | ||||
| @@ -49,7 +51,7 @@ func handlerRevision(w http.ResponseWriter, rq *http.Request) { | ||||
| 	) | ||||
| 	w.Header().Set("Content-Type", "text/html;charset=utf-8") | ||||
| 	w.WriteHeader(http.StatusOK) | ||||
| 	w.Write([]byte(base(hyphaName, page))) | ||||
| 	w.Write([]byte(base(hyphaName, page, u))) | ||||
| } | ||||
|  | ||||
| // handlerText serves raw source text of the hypha. | ||||
| @@ -83,6 +85,7 @@ func handlerPage(w http.ResponseWriter, rq *http.Request) { | ||||
| 		hasAmnt           = hyphaExists && data.binaryPath != "" | ||||
| 		contents          string | ||||
| 		openGraph         string | ||||
| 		u                 = user.FromRequest(rq) | ||||
| 	) | ||||
| 	if hyphaExists { | ||||
| 		fileContentsT, errT := ioutil.ReadFile(data.textPath) | ||||
| @@ -105,5 +108,6 @@ func handlerPage(w http.ResponseWriter, rq *http.Request) { | ||||
| 				contents, | ||||
| 				treeHTML, prevHypha, nextHypha, | ||||
| 				hasAmnt), | ||||
| 			u, | ||||
| 			openGraph)) | ||||
| } | ||||
|   | ||||
							
								
								
									
										18
									
								
								main.go
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								main.go
									
									
									
									
									
								
							| @@ -41,9 +41,18 @@ func HttpErr(w http.ResponseWriter, status int, name, title, errMsg string) { | ||||
| 	log.Println(errMsg, "for", name) | ||||
| 	w.Header().Set("Content-Type", "text/html;charset=utf-8") | ||||
| 	w.WriteHeader(status) | ||||
| 	fmt.Fprint(w, base(title, fmt.Sprintf( | ||||
| 	fmt.Fprint( | ||||
| 		w, | ||||
| 		base( | ||||
| 			title, | ||||
| 			fmt.Sprintf( | ||||
| 				`<main><p>%s. <a href="/page/%s">Go back to the hypha.<a></p></main>`, | ||||
| 		errMsg, name))) | ||||
| 				errMsg, | ||||
| 				name, | ||||
| 			), | ||||
| 			user.EmptyUser(), | ||||
| 		), | ||||
| 	) | ||||
| } | ||||
|  | ||||
| // Show all hyphae | ||||
| @@ -52,11 +61,12 @@ func handlerList(w http.ResponseWriter, rq *http.Request) { | ||||
| 	var ( | ||||
| 		tbody     string | ||||
| 		pageCount = hyphae.Count() | ||||
| 		u         = user.FromRequest(rq) | ||||
| 	) | ||||
| 	for hyphaName, data := range HyphaStorage { | ||||
| 		tbody += templates.HyphaListRowHTML(hyphaName, ExtensionToMime(filepath.Ext(data.binaryPath)), data.binaryPath != "") | ||||
| 	} | ||||
| 	util.HTTP200Page(w, base("List of pages", templates.HyphaListHTML(tbody, pageCount))) | ||||
| 	util.HTTP200Page(w, base("List of pages", templates.HyphaListHTML(tbody, pageCount), u)) | ||||
| } | ||||
|  | ||||
| // This part is present in all html documents. | ||||
| @@ -146,7 +156,7 @@ func handlerIcon(w http.ResponseWriter, rq *http.Request) { | ||||
| func handlerAbout(w http.ResponseWriter, rq *http.Request) { | ||||
| 	w.Header().Set("Content-Type", "text/html;charset=utf-8") | ||||
| 	w.WriteHeader(http.StatusOK) | ||||
| 	w.Write([]byte(base("About "+util.SiteName, templates.AboutHTML()))) | ||||
| 	w.Write([]byte(base("About "+util.SiteName, templates.AboutHTML(), user.FromRequest(rq)))) | ||||
| } | ||||
|  | ||||
| func handlerRobotsTxt(w http.ResponseWriter, rq *http.Request) { | ||||
|   | ||||
| @@ -29,6 +29,7 @@ func StreamDefaultCSS(qw422016 *qt422016.Writer) { | ||||
| 	.hypha-tabs { padding: 1rem 2rem; margin: 0 auto; width: 800px; } | ||||
| 	header { margin: 0 auto; width: 800px; } | ||||
| 	.header-links__entry { margin-right: 1.5rem; } | ||||
| 	.header-links__entry_user { margin: 0 2rem 0 auto; } | ||||
| 	.header-links__entry:nth-of-type(1), | ||||
| 	.hypha-tabs__tab:nth-of-type(1) { margin-left: 2rem; } | ||||
| 	.hypha-tabs__tab { margin-right: 1.5rem; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2); border-bottom: 2px #ddd solid; padding: 0 .5rem; } | ||||
| @@ -94,13 +95,13 @@ figcaption { padding-bottom: .5rem; } | ||||
| #new-name {width:100%;} | ||||
|  | ||||
| header { margin-bottom: .5rem; } | ||||
| .header-links__entry_user { font-style:italic; } | ||||
| .header-links__link { text-decoration: none; display: block; width: 100%; height: 100%; padding: .25rem; } | ||||
| .hypha-tabs { padding: 0; } | ||||
| .header-links__list, .hypha-tabs__flex { margin: 0; padding: 0; display: flex; flex-wrap: wrap; } | ||||
| .header-links__entry, .hypha-tabs__tab { list-style-type: none; } | ||||
| .hypha-tabs__tab a { text-decoration: none; } | ||||
| .hypha-tabs__tab_active { font-weight: bold; } | ||||
| .hypha-tabs__user { font-style:italic; } | ||||
|  | ||||
| .rc-entry { display: grid; list-style-type: none; padding: .25rem; grid-template-columns: 1fr 1fr; } | ||||
| .rc-entry__time { font-style: italic; } | ||||
|   | ||||
| @@ -41,20 +41,19 @@ var navEntries = []navEntry{ | ||||
| 			</li> | ||||
| 		{%- endif -%} | ||||
| 		{%- endfor -%} | ||||
| 		{%s= userMenuHTML(u) %} | ||||
| 		</ul> | ||||
| 	</nav> | ||||
| {% endfunc %} | ||||
|  | ||||
| {% func userMenuHTML(u *user.User) %} | ||||
| 	{% if user.AuthUsed %} | ||||
| 			<li class="hypha-tabs__tab hypha-tabs__user"> | ||||
| {% if user.AuthUsed %} | ||||
| <li class="header-links__entry header-links__entry_user"> | ||||
| 	{% if u.Group == "anon" %} | ||||
| 				<a href="/login">Login</a> | ||||
| 	<a href="/login" class="header-links__link">Login</a> | ||||
| 	{% else %} | ||||
| 				<a href="/page/{%s util.UserHypha %}/{%s u.Name %}">{%s u.Name %}</a> | ||||
| 			{% endif %} | ||||
| 			</li> | ||||
| 	<a href="/page/{%s util.UserHypha %}/{%s u.Name %}" class="header-links__link">{%s u.Name %}</a> | ||||
| 	{% endif %} | ||||
| </li> | ||||
| {% endif %} | ||||
| {% endfunc %} | ||||
|  | ||||
|   | ||||
| @@ -106,114 +106,109 @@ func streamnavHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, navTy | ||||
| //line templates/common.qtpl:43 | ||||
| 	} | ||||
| //line templates/common.qtpl:43 | ||||
| 	qw422016.N().S(`		`) | ||||
| //line templates/common.qtpl:44 | ||||
| 	qw422016.N().S(userMenuHTML(u)) | ||||
| //line templates/common.qtpl:44 | ||||
| 	qw422016.N().S(` | ||||
| 		</ul> | ||||
| 	qw422016.N().S(`		</ul> | ||||
| 	</nav> | ||||
| `) | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| } | ||||
|  | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| func writenavHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, navType string, revisionHash ...string) { | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| 	streamnavHTML(qw422016, rq, hyphaName, navType, revisionHash...) | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| 	qt422016.ReleaseWriter(qw422016) | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| } | ||||
|  | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| func navHTML(rq *http.Request, hyphaName, navType string, revisionHash ...string) string { | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| 	qb422016 := qt422016.AcquireByteBuffer() | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| 	writenavHTML(qb422016, rq, hyphaName, navType, revisionHash...) | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| 	qs422016 := string(qb422016.B) | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| 	qt422016.ReleaseByteBuffer(qb422016) | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| 	return qs422016 | ||||
| //line templates/common.qtpl:47 | ||||
| //line templates/common.qtpl:46 | ||||
| } | ||||
|  | ||||
| //line templates/common.qtpl:49 | ||||
| //line templates/common.qtpl:48 | ||||
| func streamuserMenuHTML(qw422016 *qt422016.Writer, u *user.User) { | ||||
| //line templates/common.qtpl:49 | ||||
| 	qw422016.N().S(` | ||||
| 	`) | ||||
| //line templates/common.qtpl:50 | ||||
| 	if user.AuthUsed { | ||||
| //line templates/common.qtpl:50 | ||||
| 		qw422016.N().S(` | ||||
| 			<li class="hypha-tabs__tab hypha-tabs__user"> | ||||
| 			`) | ||||
| //line templates/common.qtpl:52 | ||||
| 		if u.Group == "anon" { | ||||
| //line templates/common.qtpl:52 | ||||
| 			qw422016.N().S(` | ||||
| 				<a href="/login">Login</a> | ||||
| 			`) | ||||
| //line templates/common.qtpl:54 | ||||
| 		} else { | ||||
| //line templates/common.qtpl:54 | ||||
| 			qw422016.N().S(` | ||||
| 				<a href="/page/`) | ||||
| //line templates/common.qtpl:55 | ||||
| 			qw422016.E().S(util.UserHypha) | ||||
| //line templates/common.qtpl:55 | ||||
| 			qw422016.N().S(`/`) | ||||
| //line templates/common.qtpl:55 | ||||
| 			qw422016.E().S(u.Name) | ||||
| //line templates/common.qtpl:55 | ||||
| 			qw422016.N().S(`">`) | ||||
| //line templates/common.qtpl:55 | ||||
| 			qw422016.E().S(u.Name) | ||||
| //line templates/common.qtpl:55 | ||||
| 			qw422016.N().S(`</a> | ||||
| 			`) | ||||
| //line templates/common.qtpl:56 | ||||
| 		} | ||||
| //line templates/common.qtpl:56 | ||||
| 		qw422016.N().S(` | ||||
| 			</li> | ||||
| 	`) | ||||
| //line templates/common.qtpl:58 | ||||
| 	} | ||||
| //line templates/common.qtpl:58 | ||||
| //line templates/common.qtpl:48 | ||||
| 	qw422016.N().S(` | ||||
| `) | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:49 | ||||
| 	if user.AuthUsed { | ||||
| //line templates/common.qtpl:49 | ||||
| 		qw422016.N().S(` | ||||
| <li class="header-links__entry header-links__entry_user"> | ||||
| 	`) | ||||
| //line templates/common.qtpl:51 | ||||
| 		if u.Group == "anon" { | ||||
| //line templates/common.qtpl:51 | ||||
| 			qw422016.N().S(` | ||||
| 	<a href="/login" class="header-links__link">Login</a> | ||||
| 	`) | ||||
| //line templates/common.qtpl:53 | ||||
| 		} else { | ||||
| //line templates/common.qtpl:53 | ||||
| 			qw422016.N().S(` | ||||
| 	<a href="/page/`) | ||||
| //line templates/common.qtpl:54 | ||||
| 			qw422016.E().S(util.UserHypha) | ||||
| //line templates/common.qtpl:54 | ||||
| 			qw422016.N().S(`/`) | ||||
| //line templates/common.qtpl:54 | ||||
| 			qw422016.E().S(u.Name) | ||||
| //line templates/common.qtpl:54 | ||||
| 			qw422016.N().S(`" class="header-links__link">`) | ||||
| //line templates/common.qtpl:54 | ||||
| 			qw422016.E().S(u.Name) | ||||
| //line templates/common.qtpl:54 | ||||
| 			qw422016.N().S(`</a> | ||||
| 	`) | ||||
| //line templates/common.qtpl:55 | ||||
| 		} | ||||
| //line templates/common.qtpl:55 | ||||
| 		qw422016.N().S(` | ||||
| </li> | ||||
| `) | ||||
| //line templates/common.qtpl:57 | ||||
| 	} | ||||
| //line templates/common.qtpl:57 | ||||
| 	qw422016.N().S(` | ||||
| `) | ||||
| //line templates/common.qtpl:58 | ||||
| } | ||||
|  | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| func writeuserMenuHTML(qq422016 qtio422016.Writer, u *user.User) { | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| 	streamuserMenuHTML(qw422016, u) | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| 	qt422016.ReleaseWriter(qw422016) | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| } | ||||
|  | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| func userMenuHTML(u *user.User) string { | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| 	qb422016 := qt422016.AcquireByteBuffer() | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| 	writeuserMenuHTML(qb422016, u) | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| 	qs422016 := string(qb422016.B) | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| 	qt422016.ReleaseByteBuffer(qb422016) | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| 	return qs422016 | ||||
| //line templates/common.qtpl:59 | ||||
| //line templates/common.qtpl:58 | ||||
| } | ||||
|   | ||||
| @@ -4,6 +4,7 @@ | ||||
| 	.hypha-tabs { padding: 1rem 2rem; margin: 0 auto; width: 800px; } | ||||
| 	header { margin: 0 auto; width: 800px; } | ||||
| 	.header-links__entry { margin-right: 1.5rem; } | ||||
| 	.header-links__entry_user { margin: 0 2rem 0 auto; } | ||||
| 	.header-links__entry:nth-of-type(1), | ||||
| 	.hypha-tabs__tab:nth-of-type(1) { margin-left: 2rem; } | ||||
| 	.hypha-tabs__tab { margin-right: 1.5rem; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.2); border-bottom: 2px #ddd solid; padding: 0 .5rem; } | ||||
| @@ -69,13 +70,13 @@ figcaption { padding-bottom: .5rem; } | ||||
| #new-name {width:100%;} | ||||
|  | ||||
| header { margin-bottom: .5rem; } | ||||
| .header-links__entry_user { font-style:italic; } | ||||
| .header-links__link { text-decoration: none; display: block; width: 100%; height: 100%; padding: .25rem; } | ||||
| .hypha-tabs { padding: 0; } | ||||
| .header-links__list, .hypha-tabs__flex { margin: 0; padding: 0; display: flex; flex-wrap: wrap; } | ||||
| .header-links__entry, .hypha-tabs__tab { list-style-type: none; } | ||||
| .hypha-tabs__tab a { text-decoration: none; } | ||||
| .hypha-tabs__tab_active { font-weight: bold; } | ||||
| .hypha-tabs__user { font-style:italic; } | ||||
|  | ||||
| .rc-entry { display: grid; list-style-type: none; padding: .25rem; grid-template-columns: 1fr 1fr; } | ||||
| .rc-entry__time { font-style: italic; } | ||||
|   | ||||
| @@ -1,7 +1,7 @@ | ||||
| {% import "github.com/bouncepaw/mycorrhiza/util" %} | ||||
| {% import "github.com/bouncepaw/mycorrhiza/user" %} | ||||
|  | ||||
| {% func BaseHTML(title, body string, headElements ...string) %} | ||||
| {% func BaseHTML(title, body string, u *user.User, headElements ...string) %} | ||||
| <!doctype html> | ||||
| <html> | ||||
| 	<head> | ||||
| @@ -17,6 +17,7 @@ | ||||
| 					{%- for _, link := range util.HeaderLinks -%} | ||||
| 					<li class="header-links__entry"><a class="header-links__link" href="{%s link.Href %}">{%s link.Display %}</a></li> | ||||
| 					{%- endfor -%} | ||||
| 					{%s= userMenuHTML(u) %} | ||||
| 				</ul> | ||||
| 			</nav> | ||||
| 		</header> | ||||
|   | ||||
| @@ -24,7 +24,7 @@ var ( | ||||
| ) | ||||
|  | ||||
| //line templates/http_stuff.qtpl:4 | ||||
| func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, headElements ...string) { | ||||
| func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User, headElements ...string) { | ||||
| //line templates/http_stuff.qtpl:4 | ||||
| 	qw422016.N().S(` | ||||
| <!doctype html> | ||||
| @@ -68,56 +68,61 @@ func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, headElements | ||||
| //line templates/http_stuff.qtpl:19 | ||||
| 	} | ||||
| //line templates/http_stuff.qtpl:19 | ||||
| 	qw422016.N().S(`				</ul> | ||||
| 	qw422016.N().S(`					`) | ||||
| //line templates/http_stuff.qtpl:20 | ||||
| 	qw422016.N().S(userMenuHTML(u)) | ||||
| //line templates/http_stuff.qtpl:20 | ||||
| 	qw422016.N().S(` | ||||
| 				</ul> | ||||
| 			</nav> | ||||
| 		</header> | ||||
| 		`) | ||||
| //line templates/http_stuff.qtpl:23 | ||||
| //line templates/http_stuff.qtpl:24 | ||||
| 	qw422016.N().S(body) | ||||
| //line templates/http_stuff.qtpl:23 | ||||
| //line templates/http_stuff.qtpl:24 | ||||
| 	qw422016.N().S(` | ||||
| 	</body> | ||||
| </html> | ||||
| `) | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, headElements ...string) { | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, u *user.User, headElements ...string) { | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| 	StreamBaseHTML(qw422016, title, body, headElements...) | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| 	StreamBaseHTML(qw422016, title, body, u, headElements...) | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| 	qt422016.ReleaseWriter(qw422016) | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| func BaseHTML(title, body string, headElements ...string) string { | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| func BaseHTML(title, body string, u *user.User, headElements ...string) string { | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| 	qb422016 := qt422016.AcquireByteBuffer() | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| 	WriteBaseHTML(qb422016, title, body, headElements...) | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| 	WriteBaseHTML(qb422016, title, body, u, headElements...) | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| 	qs422016 := string(qb422016.B) | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| 	qt422016.ReleaseByteBuffer(qb422016) | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| 	return qs422016 | ||||
| //line templates/http_stuff.qtpl:26 | ||||
| //line templates/http_stuff.qtpl:27 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:28 | ||||
| //line templates/http_stuff.qtpl:29 | ||||
| func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) { | ||||
| //line templates/http_stuff.qtpl:28 | ||||
| //line templates/http_stuff.qtpl:29 | ||||
| 	qw422016.N().S(` | ||||
| <main> | ||||
| 	<h1>List of hyphae</h1> | ||||
| 	<p>This wiki has `) | ||||
| //line templates/http_stuff.qtpl:31 | ||||
| //line templates/http_stuff.qtpl:32 | ||||
| 	qw422016.N().D(pageCount) | ||||
| //line templates/http_stuff.qtpl:31 | ||||
| //line templates/http_stuff.qtpl:32 | ||||
| 	qw422016.N().S(` hyphae.</p> | ||||
| 	<table> | ||||
| 		<thead> | ||||
| @@ -128,203 +133,203 @@ func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) | ||||
| 		</thead> | ||||
| 		<tbody> | ||||
| 			`) | ||||
| //line templates/http_stuff.qtpl:40 | ||||
| //line templates/http_stuff.qtpl:41 | ||||
| 	qw422016.N().S(tbody) | ||||
| //line templates/http_stuff.qtpl:40 | ||||
| //line templates/http_stuff.qtpl:41 | ||||
| 	qw422016.N().S(` | ||||
| 		</tbody> | ||||
| 	</table> | ||||
| </main> | ||||
| `) | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| func WriteHyphaListHTML(qq422016 qtio422016.Writer, tbody string, pageCount int) { | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| 	StreamHyphaListHTML(qw422016, tbody, pageCount) | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| 	qt422016.ReleaseWriter(qw422016) | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| func HyphaListHTML(tbody string, pageCount int) string { | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| 	qb422016 := qt422016.AcquireByteBuffer() | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| 	WriteHyphaListHTML(qb422016, tbody, pageCount) | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| 	qs422016 := string(qb422016.B) | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| 	qt422016.ReleaseByteBuffer(qb422016) | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| 	return qs422016 | ||||
| //line templates/http_stuff.qtpl:44 | ||||
| //line templates/http_stuff.qtpl:45 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:46 | ||||
| //line templates/http_stuff.qtpl:47 | ||||
| func StreamHyphaListRowHTML(qw422016 *qt422016.Writer, hyphaName, binaryMime string, binaryPresent bool) { | ||||
| //line templates/http_stuff.qtpl:46 | ||||
| //line templates/http_stuff.qtpl:47 | ||||
| 	qw422016.N().S(` | ||||
| 			<tr> | ||||
| 				<td><a href="/page/`) | ||||
| //line templates/http_stuff.qtpl:48 | ||||
| //line templates/http_stuff.qtpl:49 | ||||
| 	qw422016.E().S(hyphaName) | ||||
| //line templates/http_stuff.qtpl:48 | ||||
| //line templates/http_stuff.qtpl:49 | ||||
| 	qw422016.N().S(`">`) | ||||
| //line templates/http_stuff.qtpl:48 | ||||
| //line templates/http_stuff.qtpl:49 | ||||
| 	qw422016.E().S(hyphaName) | ||||
| //line templates/http_stuff.qtpl:48 | ||||
| //line templates/http_stuff.qtpl:49 | ||||
| 	qw422016.N().S(`</a></td> | ||||
| 			`) | ||||
| //line templates/http_stuff.qtpl:49 | ||||
| //line templates/http_stuff.qtpl:50 | ||||
| 	if binaryPresent { | ||||
| //line templates/http_stuff.qtpl:49 | ||||
| //line templates/http_stuff.qtpl:50 | ||||
| 		qw422016.N().S(` | ||||
| 				<td>`) | ||||
| //line templates/http_stuff.qtpl:50 | ||||
| //line templates/http_stuff.qtpl:51 | ||||
| 		qw422016.E().S(binaryMime) | ||||
| //line templates/http_stuff.qtpl:50 | ||||
| //line templates/http_stuff.qtpl:51 | ||||
| 		qw422016.N().S(`</td> | ||||
| 			`) | ||||
| //line templates/http_stuff.qtpl:51 | ||||
| //line templates/http_stuff.qtpl:52 | ||||
| 	} else { | ||||
| //line templates/http_stuff.qtpl:51 | ||||
| //line templates/http_stuff.qtpl:52 | ||||
| 		qw422016.N().S(` | ||||
| 				<td></td> | ||||
| 			`) | ||||
| //line templates/http_stuff.qtpl:53 | ||||
| //line templates/http_stuff.qtpl:54 | ||||
| 	} | ||||
| //line templates/http_stuff.qtpl:53 | ||||
| //line templates/http_stuff.qtpl:54 | ||||
| 	qw422016.N().S(` | ||||
| 			</tr> | ||||
| `) | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| func WriteHyphaListRowHTML(qq422016 qtio422016.Writer, hyphaName, binaryMime string, binaryPresent bool) { | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| 	StreamHyphaListRowHTML(qw422016, hyphaName, binaryMime, binaryPresent) | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| 	qt422016.ReleaseWriter(qw422016) | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) string { | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| 	qb422016 := qt422016.AcquireByteBuffer() | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| 	WriteHyphaListRowHTML(qb422016, hyphaName, binaryMime, binaryPresent) | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| 	qs422016 := string(qb422016.B) | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| 	qt422016.ReleaseByteBuffer(qb422016) | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| 	return qs422016 | ||||
| //line templates/http_stuff.qtpl:55 | ||||
| //line templates/http_stuff.qtpl:56 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:57 | ||||
| //line templates/http_stuff.qtpl:58 | ||||
| func StreamAboutHTML(qw422016 *qt422016.Writer) { | ||||
| //line templates/http_stuff.qtpl:57 | ||||
| //line templates/http_stuff.qtpl:58 | ||||
| 	qw422016.N().S(` | ||||
| <main> | ||||
| 	<section> | ||||
| 		<h1>About `) | ||||
| //line templates/http_stuff.qtpl:60 | ||||
| //line templates/http_stuff.qtpl:61 | ||||
| 	qw422016.E().S(util.SiteName) | ||||
| //line templates/http_stuff.qtpl:60 | ||||
| //line templates/http_stuff.qtpl:61 | ||||
| 	qw422016.N().S(`</h1> | ||||
| 		<ul> | ||||
| 			<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> β 0.12 indev</li> | ||||
| `) | ||||
| //line templates/http_stuff.qtpl:63 | ||||
| //line templates/http_stuff.qtpl:64 | ||||
| 	if user.AuthUsed { | ||||
| //line templates/http_stuff.qtpl:63 | ||||
| //line templates/http_stuff.qtpl:64 | ||||
| 		qw422016.N().S(`			<li><b>User count:</b> `) | ||||
| //line templates/http_stuff.qtpl:64 | ||||
| //line templates/http_stuff.qtpl:65 | ||||
| 		qw422016.N().D(user.Count()) | ||||
| //line templates/http_stuff.qtpl:64 | ||||
| //line templates/http_stuff.qtpl:65 | ||||
| 		qw422016.N().S(`</li> | ||||
| 			<li><b>Home page:</b> <a href="/">`) | ||||
| //line templates/http_stuff.qtpl:65 | ||||
| //line templates/http_stuff.qtpl:66 | ||||
| 		qw422016.E().S(util.HomePage) | ||||
| //line templates/http_stuff.qtpl:65 | ||||
| //line templates/http_stuff.qtpl:66 | ||||
| 		qw422016.N().S(`</a></li> | ||||
| 			<li><b>Administrators:</b>`) | ||||
| //line templates/http_stuff.qtpl:66 | ||||
| //line templates/http_stuff.qtpl:67 | ||||
| 		for i, username := range user.ListUsersWithGroup("admin") { | ||||
| //line templates/http_stuff.qtpl:67 | ||||
| //line templates/http_stuff.qtpl:68 | ||||
| 			if i > 0 { | ||||
| //line templates/http_stuff.qtpl:67 | ||||
| //line templates/http_stuff.qtpl:68 | ||||
| 				qw422016.N().S(`<span aria-hidden="true">, </span> | ||||
| `) | ||||
| //line templates/http_stuff.qtpl:68 | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| 			} | ||||
| //line templates/http_stuff.qtpl:68 | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| 			qw422016.N().S(`				<a href="/page/`) | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| 			qw422016.E().S(util.UserHypha) | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| 			qw422016.N().S(`/`) | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| 			qw422016.E().S(username) | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| 			qw422016.N().S(`">`) | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| 			qw422016.E().S(username) | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| 			qw422016.N().S(`</a>`) | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| 		} | ||||
| //line templates/http_stuff.qtpl:69 | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| 		qw422016.N().S(`</li> | ||||
| `) | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| //line templates/http_stuff.qtpl:71 | ||||
| 	} else { | ||||
| //line templates/http_stuff.qtpl:70 | ||||
| //line templates/http_stuff.qtpl:71 | ||||
| 		qw422016.N().S(`			<li>This wiki does not use authorization</li> | ||||
| `) | ||||
| //line templates/http_stuff.qtpl:72 | ||||
| //line templates/http_stuff.qtpl:73 | ||||
| 	} | ||||
| //line templates/http_stuff.qtpl:72 | ||||
| //line templates/http_stuff.qtpl:73 | ||||
| 	qw422016.N().S(`		</ul> | ||||
| 		<p>See <a href="/list">/list</a> for information about hyphae on this wiki.</p> | ||||
| 	</section> | ||||
| </main> | ||||
| `) | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| func WriteAboutHTML(qq422016 qtio422016.Writer) { | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| 	qw422016 := qt422016.AcquireWriter(qq422016) | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| 	StreamAboutHTML(qw422016) | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| 	qt422016.ReleaseWriter(qw422016) | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| } | ||||
|  | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| func AboutHTML() string { | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| 	qb422016 := qt422016.AcquireByteBuffer() | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| 	WriteAboutHTML(qb422016) | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| 	qs422016 := string(qb422016.B) | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| 	qt422016.ReleaseByteBuffer(qb422016) | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| 	return qs422016 | ||||
| //line templates/http_stuff.qtpl:77 | ||||
| //line templates/http_stuff.qtpl:78 | ||||
| } | ||||
|   | ||||
| @@ -17,7 +17,7 @@ func CanProceed(rq *http.Request, route string) bool { | ||||
| func FromRequest(rq *http.Request) *User { | ||||
| 	cookie, err := rq.Cookie("mycorrhiza_token") | ||||
| 	if err != nil { | ||||
| 		return emptyUser() | ||||
| 		return EmptyUser() | ||||
| 	} | ||||
| 	return userByToken(cookie.Value) | ||||
| } | ||||
|   | ||||
| @@ -37,7 +37,7 @@ var groupRight = map[string]int{ | ||||
| 	"admin":     4, | ||||
| } | ||||
|  | ||||
| func emptyUser() *User { | ||||
| func EmptyUser() *User { | ||||
| 	return &User{ | ||||
| 		Name:     "anon", | ||||
| 		Group:    "anon", | ||||
|   | ||||
| @@ -44,7 +44,7 @@ func userByToken(token string) *User { | ||||
| 		username := usernameUntyped.(string) | ||||
| 		return userByName(username) | ||||
| 	} | ||||
| 	return emptyUser() | ||||
| 	return EmptyUser() | ||||
| } | ||||
|  | ||||
| func userByName(username string) *User { | ||||
| @@ -52,7 +52,7 @@ func userByName(username string) *User { | ||||
| 		user := userUntyped.(*User) | ||||
| 		return user | ||||
| 	} | ||||
| 	return emptyUser() | ||||
| 	return EmptyUser() | ||||
| } | ||||
|  | ||||
| func commenceSession(username, token string) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 bouncepaw
					bouncepaw