1
0
mirror of https://github.com/osmarks/mycorrhiza.git synced 2024-12-05 02:29:54 +00:00

Move config-related stuff to its own module

This commit is contained in:
Timur Ismagilov 2021-05-09 14:36:39 +05:00
parent 9bf5e8e471
commit 662794dd59
29 changed files with 540 additions and 514 deletions

View File

@ -1,4 +1,4 @@
package util
package cfg
import (
"log"
@ -8,7 +8,31 @@ import (
"github.com/go-ini/ini"
)
// See https://mycorrhiza.lesarbr.es/hypha/configuration/fields
var (
WikiName string
NaviTitleIcon string
HomeHypha string
UserHypha string
HeaderLinksHypha string
HTTPPort string
URL string
GeminiCertificatePath string
WikiDir string
ConfigFilePath string
UseFixedAuth bool
FixedAuthCredentialsPath string
UseRegistration bool
RegistrationCredentialsPath string
LimitRegistration int
)
// Config represents a Mycorrhiza wiki configuration file.
//
// See https://mycorrhiza.lesarbr.es/hypha/configuration/fields for fields' docs.
type Config struct {
WikiName string
NaviTitleIcon string
@ -17,18 +41,21 @@ type Config struct {
Authorization
}
// Hyphae is a section of Config which has fields related to special hyphae.
type Hyphae struct {
HomeHypha string
UserHypha string
HeaderLinksHypha string
}
// Network is a section of Config that has fields related to network stuff: HTTP and Gemini.
type Network struct {
HTTPPort uint64
URL string
GeminiCertificatePath string
}
// Authorization is a section of Config that has fields related to authorization and authentication.
type Authorization struct {
UseFixedAuth bool
FixedAuthCredentialsPath string
@ -38,6 +65,7 @@ type Authorization struct {
LimitRegistration uint64
}
// ReadConfigFile reads a config on the given path and stores the configuration.
func ReadConfigFile(path string) {
cfg := &Config{
WikiName: "MycorrhizaWiki",
@ -76,16 +104,16 @@ func ReadConfigFile(path string) {
}
// Map the struct to the global variables
SiteName = cfg.WikiName
SiteNavIcon = cfg.NaviTitleIcon
HomePage = cfg.HomeHypha
WikiName = cfg.WikiName
NaviTitleIcon = cfg.NaviTitleIcon
HomeHypha = cfg.HomeHypha
UserHypha = cfg.UserHypha
HeaderLinksHypha = cfg.HeaderLinksHypha
ServerPort = strconv.FormatUint(cfg.HTTPPort, 10)
HTTPPort = strconv.FormatUint(cfg.HTTPPort, 10)
URL = cfg.URL
GeminiCertPath = cfg.GeminiCertificatePath
GeminiCertificatePath = cfg.GeminiCertificatePath
UseFixedAuth = cfg.UseFixedAuth
FixedCredentialsPath = cfg.FixedAuthCredentialsPath
FixedAuthCredentialsPath = cfg.FixedAuthCredentialsPath
UseRegistration = cfg.UseRegistration
RegistrationCredentialsPath = cfg.RegistrationCredentialsPath
LimitRegistration = int(cfg.LimitRegistration)

View File

@ -3,11 +3,11 @@ package files
import (
"errors"
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
"path/filepath"
"strings"
"github.com/adrg/xdg"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/mitchellh/go-homedir"
)
@ -49,7 +49,7 @@ func tokenStoragePath() (string, error) {
if err != nil {
return "", err
}
if strings.HasPrefix(dir, util.WikiDir) {
if strings.HasPrefix(dir, cfg.WikiDir) {
return "", errors.New("wiki storage directory includes private config files")
}
return dir, nil
@ -57,7 +57,7 @@ func tokenStoragePath() (string, error) {
func registrationCredentialsPath() (string, error) {
var err error
path := util.RegistrationCredentialsPath
path := cfg.RegistrationCredentialsPath
if len(path) == 0 {
path, err = xdg.DataFile("mycorrhiza/registration.json")
@ -81,7 +81,7 @@ func registrationCredentialsPath() (string, error) {
func fixedCredentialsPath() (string, error) {
var err error
path := util.FixedCredentialsPath
path := cfg.FixedAuthCredentialsPath
if len(path) > 0 {
path, err = homedir.Expand(path)

15
flag.go
View File

@ -3,6 +3,7 @@ package main
import (
"flag"
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
"log"
"os"
"path/filepath"
@ -14,7 +15,7 @@ import (
var printExampleConfig bool
func init() {
flag.StringVar(&util.ConfigFilePath, "config-path", "", "Path to a configuration file. Leave empty if you don't want to use it.")
flag.StringVar(&cfg.ConfigFilePath, "config-path", "", "Path to a configuration file. Leave empty if you don't want to use it.")
flag.BoolVar(&printExampleConfig, "print-example-config", false, "If true, print an example configuration file contents and exit. You can save the output to a file and base your own configuration on it.")
flag.Usage = func() {
fmt.Fprintf(
@ -42,16 +43,16 @@ func parseCliArgs() {
var err error
WikiDir, err = filepath.Abs(args[0])
util.WikiDir = WikiDir
cfg.WikiDir = WikiDir
if err != nil {
log.Fatal(err)
}
if util.URL == "" {
util.URL = "http://0.0.0.0:" + util.ServerPort
if cfg.URL == "" {
cfg.URL = "http://0.0.0.0:" + cfg.HTTPPort
}
util.HomePage = util.CanonicalName(util.HomePage)
util.UserHypha = util.CanonicalName(util.UserHypha)
util.HeaderLinksHypha = util.CanonicalName(util.HeaderLinksHypha)
cfg.HomeHypha = util.CanonicalName(cfg.HomeHypha)
cfg.UserHypha = util.CanonicalName(cfg.UserHypha)
cfg.HeaderLinksHypha = util.CanonicalName(cfg.HeaderLinksHypha)
}

View File

@ -3,6 +3,7 @@ package main
import (
"crypto/tls"
"crypto/x509/pkix"
"github.com/bouncepaw/mycorrhiza/cfg"
"io/ioutil"
"log"
"path/filepath"
@ -13,7 +14,6 @@ import (
"github.com/bouncepaw/mycorrhiza/hyphae"
"github.com/bouncepaw/mycorrhiza/markup"
"github.com/bouncepaw/mycorrhiza/util"
)
func geminiHomeHypha(w *gemini.ResponseWriter, rq *gemini.Request) {
@ -23,7 +23,7 @@ func geminiHomeHypha(w *gemini.ResponseWriter, rq *gemini.Request) {
You have successfully served the wiki through Gemini. Currently, support is really work-in-progress; you should resort to using Mycorrhiza through the web protocols.
Visit home hypha:
=> /hypha/` + util.HomePage))
=> /hypha/` + cfg.HomeHypha))
}
func geminiHypha(w *gemini.ResponseWriter, rq *gemini.Request) {
@ -48,10 +48,10 @@ func geminiHypha(w *gemini.ResponseWriter, rq *gemini.Request) {
}
func handleGemini() {
if util.GeminiCertPath == "" {
if cfg.GeminiCertificatePath == "" {
return
}
certPath, err := filepath.Abs(util.GeminiCertPath)
certPath, err := filepath.Abs(cfg.GeminiCertificatePath)
if err != nil {
log.Fatal(err)
}

View File

@ -3,6 +3,7 @@ package history
import (
"bytes"
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
"html"
"log"
"os/exec"
@ -167,7 +168,7 @@ func (rev *Revision) bestLink() string {
func gitsh(args ...string) (out bytes.Buffer, err error) {
fmt.Printf("$ %v\n", args)
cmd := exec.Command(gitpath, args...)
cmd.Dir = util.WikiDir
cmd.Dir = cfg.WikiDir
b, err := cmd.CombinedOutput()
if err != nil {
@ -179,7 +180,7 @@ func gitsh(args ...string) (out bytes.Buffer, err error) {
// silentGitsh is like gitsh, except it writes less to the stdout.
func silentGitsh(args ...string) (out bytes.Buffer, err error) {
cmd := exec.Command(gitpath, args...)
cmd.Dir = util.WikiDir
cmd.Dir = cfg.WikiDir
b, err := cmd.CombinedOutput()
return *bytes.NewBuffer(b), err

View File

@ -4,20 +4,20 @@ package history
import (
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
"log"
"regexp"
"strconv"
"strings"
"time"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/gorilla/feeds"
)
func recentChangesFeed() *feeds.Feed {
feed := &feeds.Feed{
Title: "Recent changes",
Link: &feeds.Link{Href: util.URL},
Link: &feeds.Link{Href: cfg.URL},
Description: "List of 30 recent changes on the wiki",
Author: &feeds.Author{Name: "Wikimind", Email: "wikimind@mycorrhiza"},
Updated: time.Now(),
@ -44,7 +44,7 @@ func recentChangesFeed() *feeds.Feed {
Description: rev.descriptionForFeed(),
Created: rev.Time,
Updated: rev.Time,
Link: &feeds.Link{Href: util.URL + rev.bestLink()},
Link: &feeds.Link{Href: cfg.URL + rev.bestLink()},
})
}
return feed
@ -141,7 +141,7 @@ func (rev *Revision) asHistoryEntry(hyphaName string) (html string) {
author := ""
if rev.Username != "anon" {
author = fmt.Sprintf(`
<span class="history-entry__author">by <a href="/page/%[1]s/%[2]s" rel="author">%[2]s</span>`, util.UserHypha, rev.Username)
<span class="history-entry__author">by <a href="/page/%[1]s/%[2]s" rel="author">%[2]s</span>`, cfg.UserHypha, rev.Username)
}
return fmt.Sprintf(`
<li class="history__entry">
@ -176,7 +176,7 @@ func parseRevisionLine(line string) Revision {
// See how the file with `filepath` looked at commit with `hash`.
func FileAtRevision(filepath, hash string) (string, error) {
out, err := gitsh("show", hash+":"+strings.TrimPrefix(filepath, util.WikiDir+"/"))
out, err := gitsh("show", hash+":"+strings.TrimPrefix(filepath, cfg.WikiDir+"/"))
return out.String(), err
}

View File

@ -1,11 +1,11 @@
package main
import (
"github.com/bouncepaw/mycorrhiza/cfg"
"log"
"net/http"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
)
@ -38,6 +38,6 @@ func handlerAdminReindexUsers(w http.ResponseWriter, rq *http.Request) {
prepareRq(rq)
if user.CanProceed(rq, "admin") && rq.Method == "POST" {
user.ReadUsersFromFilesystem()
http.Redirect(w, rq, "/hypha/"+util.UserHypha, http.StatusSeeOther)
http.Redirect(w, rq, "/hypha/"+cfg.UserHypha, http.StatusSeeOther)
}
}

View File

@ -1,6 +1,7 @@
package main
import (
"github.com/bouncepaw/mycorrhiza/cfg"
"io"
"log"
"net/http"
@ -20,7 +21,7 @@ func init() {
func handlerRegister(w http.ResponseWriter, rq *http.Request) {
prepareRq(rq)
if !util.UseRegistration {
if !cfg.UseRegistration {
w.WriteHeader(http.StatusForbidden)
}
if rq.Method == http.MethodGet {

View File

@ -2,6 +2,7 @@
package main
import (
"github.com/bouncepaw/mycorrhiza/cfg"
"io"
"log"
"math/rand"
@ -32,7 +33,7 @@ func handlerList(w http.ResponseWriter, rq *http.Request) {
func handlerReindex(w http.ResponseWriter, rq *http.Request) {
prepareRq(rq)
if ok := user.CanProceed(rq, "reindex"); !ok {
HttpErr(w, http.StatusForbidden, util.HomePage, "Not enough rights", "You must be an admin to reindex hyphae.")
HttpErr(w, http.StatusForbidden, cfg.HomeHypha, "Not enough rights", "You must be an admin to reindex hyphae.")
log.Println("Rejected", rq.URL)
return
}
@ -50,7 +51,7 @@ func handlerReindex(w http.ResponseWriter, rq *http.Request) {
func handlerUpdateHeaderLinks(w http.ResponseWriter, rq *http.Request) {
prepareRq(rq)
if ok := user.CanProceed(rq, "update-header-links"); !ok {
HttpErr(w, http.StatusForbidden, util.HomePage, "Not enough rights", "You must be a moderator to update header links.")
HttpErr(w, http.StatusForbidden, cfg.HomeHypha, "Not enough rights", "You must be a moderator to update header links.")
log.Println("Rejected", rq.URL)
return
}
@ -66,7 +67,7 @@ func handlerRandom(w http.ResponseWriter, rq *http.Request) {
amountOfHyphae = hyphae.Count()
)
if amountOfHyphae == 0 {
HttpErr(w, http.StatusNotFound, util.HomePage, "There are no hyphae",
HttpErr(w, http.StatusNotFound, cfg.HomeHypha, "There are no hyphae",
"It is impossible to display a random hypha because the wiki does not contain any hyphae")
return
}
@ -84,7 +85,7 @@ func handlerRandom(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)
_, err := io.WriteString(w, base("About "+util.SiteName, views.AboutHTML(), user.FromRequest(rq)))
_, err := io.WriteString(w, base("About "+cfg.WikiName, views.AboutHTML(), user.FromRequest(rq)))
if err != nil {
log.Println(err)
}

14
main.go
View File

@ -6,6 +6,7 @@ package main
import (
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
"io/ioutil"
"log"
"net/http"
@ -19,7 +20,6 @@ import (
"github.com/bouncepaw/mycorrhiza/hyphae"
"github.com/bouncepaw/mycorrhiza/shroom"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
)
@ -52,13 +52,13 @@ var base = views.BaseHTML
func handlerStyle(w http.ResponseWriter, rq *http.Request) {
prepareRq(rq)
if _, err := os.Stat(util.WikiDir + "/static/common.css"); err == nil {
http.ServeFile(w, rq, util.WikiDir+"/static/common.css")
if _, err := os.Stat(cfg.WikiDir + "/static/common.css"); err == nil {
http.ServeFile(w, rq, cfg.WikiDir+"/static/common.css")
} else {
w.Header().Set("Content-Type", "text/css;charset=utf-8")
w.Write([]byte(assets.DefaultCSS()))
}
if bytes, err := ioutil.ReadFile(util.WikiDir + "/static/custom.css"); err == nil {
if bytes, err := ioutil.ReadFile(cfg.WikiDir + "/static/custom.css"); err == nil {
w.Write(bytes)
}
}
@ -124,7 +124,7 @@ func main() {
parseCliArgs()
// It is ok if the path is ""
util.ReadConfigFile(util.ConfigFilePath)
cfg.ReadConfigFile(cfg.ConfigFilePath)
if err := files.CalculatePaths(); err != nil {
log.Fatal(err)
@ -163,9 +163,9 @@ func main() {
http.HandleFunc("/static/icon/", handlerIcon)
http.HandleFunc("/robots.txt", handlerRobotsTxt)
http.HandleFunc("/", func(w http.ResponseWriter, rq *http.Request) {
addr, _ := url.Parse("/hypha/" + util.HomePage) // Let's pray it never fails
addr, _ := url.Parse("/hypha/" + cfg.HomeHypha) // Let's pray it never fails
rq.URL = addr
handlerHypha(w, rq)
})
log.Fatal(http.ListenAndServe("0.0.0.0:"+util.ServerPort, nil))
log.Fatal(http.ListenAndServe("0.0.0.0:"+cfg.HTTPPort, nil))
}

View File

@ -3,12 +3,12 @@ package markup
import (
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
"html"
"regexp"
"strings"
"github.com/bouncepaw/mycorrhiza/link"
"github.com/bouncepaw/mycorrhiza/util"
)
// A Mycomarkup-formatted document
@ -63,14 +63,14 @@ func (md *MycoDoc) OpenGraphHTML() string {
ogTag("title", md.hyphaName),
ogTag("type", "article"),
ogTag("image", md.firstImageURL),
ogTag("url", util.URL+"/hypha/"+md.hyphaName),
ogTag("url", cfg.URL+"/hypha/"+md.hyphaName),
ogTag("determiner", ""),
ogTag("description", htmlTagRe.ReplaceAllString(md.description, "")),
}, "\n")
}
func (md *MycoDoc) ogFillVars() *MycoDoc {
md.firstImageURL = util.URL + "/favicon.ico"
md.firstImageURL = cfg.URL + "/favicon.ico"
foundDesc := false
foundImg := false
for _, line := range md.ast {
@ -84,7 +84,7 @@ func (md *MycoDoc) ogFillVars() *MycoDoc {
if !foundImg && len(v.entries) > 0 {
md.firstImageURL = v.entries[0].srclink.ImgSrc()
if v.entries[0].srclink.Kind != link.LinkExternal {
md.firstImageURL = util.URL + md.firstImageURL
md.firstImageURL = cfg.URL + md.firstImageURL
}
foundImg = true
}

View File

@ -1,6 +1,7 @@
package main
import (
"github.com/bouncepaw/mycorrhiza/cfg"
"log"
"net/http"
"strings"
@ -19,7 +20,7 @@ func HyphaNameFromRq(rq *http.Request, actions ...string) string {
}
}
log.Println("HyphaNameFromRq: this request is invalid, fallback to home hypha")
return util.HomePage
return cfg.HomeHypha
}
// geminiHyphaNameFromRq extracts hypha name from gemini request. You have to also pass the action which is embedded in the url or several actions. For url /hypha/hypha, the action would be "hypha".

View File

@ -2,10 +2,10 @@ package shroom
import (
"errors"
"github.com/bouncepaw/mycorrhiza/cfg"
"github.com/bouncepaw/mycorrhiza/hyphae"
"github.com/bouncepaw/mycorrhiza/markup"
"github.com/bouncepaw/mycorrhiza/util"
"github.com/bouncepaw/mycorrhiza/views"
)
@ -31,8 +31,8 @@ func init() {
}
markup.HyphaImageForOG = func(hyphaName string) string {
if h := hyphae.ByName(hyphaName); h.Exists && h.BinaryPath != "" {
return util.URL + "/binary/" + hyphaName
return cfg.URL + "/binary/" + hyphaName
}
return util.URL + "/favicon.ico"
return cfg.URL + "/favicon.ico"
}
}

View File

@ -3,6 +3,7 @@ package shroom
import (
"errors"
"fmt"
"github.com/bouncepaw/mycorrhiza/cfg"
"io/ioutil"
"log"
"mime/multipart"
@ -13,7 +14,6 @@ import (
"github.com/bouncepaw/mycorrhiza/hyphae"
"github.com/bouncepaw/mycorrhiza/mimetype"
"github.com/bouncepaw/mycorrhiza/user"
"github.com/bouncepaw/mycorrhiza/util"
)
func UploadText(h *hyphae.Hypha, data []byte, u *user.User) (hop *history.HistoryOp, errtitle string) {
@ -56,7 +56,7 @@ func UploadBinary(h *hyphae.Hypha, mime string, file multipart.File, u *user.Use
// uploadHelp is a helper function for UploadText and UploadBinary
func uploadHelp(h *hyphae.Hypha, hop *history.HistoryOp, ext string, data []byte, u *user.User) (*history.HistoryOp, string) {
var (
fullPath = filepath.Join(util.WikiDir, h.Name+ext)
fullPath = filepath.Join(cfg.WikiDir, h.Name+ext)
originalFullPath = &h.TextPath
)
if hop.Type == history.TypeEditBinary {

View File

@ -1,6 +1,7 @@
package shroom
import (
"github.com/bouncepaw/mycorrhiza/cfg"
"io/ioutil"
"os"
@ -24,7 +25,7 @@ func FetchTextPart(h *hyphae.Hypha) (string, error) {
}
func SetHeaderLinks() {
if userLinksHypha := hyphae.ByName(util.HeaderLinksHypha); !userLinksHypha.Exists {
if userLinksHypha := hyphae.ByName(cfg.HeaderLinksHypha); !userLinksHypha.Exists {
util.SetDefaultHeaderLinks()
} else {
contents, err := ioutil.ReadFile(userLinksHypha.TextPath)

View File

@ -2,30 +2,30 @@ package user
import (
"encoding/json"
"github.com/bouncepaw/mycorrhiza/cfg"
"io/ioutil"
"log"
"os"
"github.com/bouncepaw/mycorrhiza/files"
"github.com/bouncepaw/mycorrhiza/util"
)
// InitUserDatabase checks the configuration for auth methods and loads users
// if necessary. Call it during initialization.
func InitUserDatabase() {
AuthUsed = util.UseFixedAuth || util.UseRegistration
AuthUsed = cfg.UseFixedAuth || cfg.UseRegistration
if AuthUsed && (util.FixedCredentialsPath != "" || util.RegistrationCredentialsPath != "") {
if AuthUsed && (cfg.FixedAuthCredentialsPath != "" || cfg.RegistrationCredentialsPath != "") {
ReadUsersFromFilesystem()
}
}
// ReadUsersFromFilesystem reads all user information from filesystem and stores it internally.
func ReadUsersFromFilesystem() {
if util.UseFixedAuth {
if cfg.UseFixedAuth {
rememberUsers(usersFromFixedCredentials())
}
if util.UseRegistration {
if cfg.UseRegistration {
rememberUsers(usersFromRegistrationCredentials())
}
readTokensToUsers()

View File

@ -2,6 +2,7 @@ package user
import (
"errors"
"github.com/bouncepaw/mycorrhiza/cfg"
"log"
"net/http"
"strconv"
@ -39,8 +40,8 @@ func Register(username, password string) error {
username = util.CanonicalName(username)
log.Println("Attempt to register user", username)
switch {
case CountRegistered() >= util.LimitRegistration && util.LimitRegistration > 0:
i := strconv.Itoa(util.LimitRegistration)
case CountRegistered() >= cfg.LimitRegistration && cfg.LimitRegistration > 0:
i := strconv.Itoa(cfg.LimitRegistration)
log.Println("Limit reached: " + i)
return errors.New("Reached the limit of registered users: " + i)
case HasUsername(username):

View File

@ -1,12 +1,13 @@
package util
import (
"github.com/bouncepaw/mycorrhiza/cfg"
"strings"
)
func SetDefaultHeaderLinks() {
HeaderLinks = []HeaderLink{
{"/", SiteName},
{"/", cfg.WikiName},
{"/recent-changes", "Recent changes"},
{"/list", "All hyphae"},
{"/random", "Random"},
@ -18,7 +19,7 @@ func ParseHeaderLinks(text string, rocketlinkλ func(string, string) (string, st
HeaderLinks = []HeaderLink{}
for _, line := range strings.Split(text, "\n") {
if strings.HasPrefix(line, "=>") {
href, text, _ := rocketlinkλ(line, HeaderLinksHypha)
href, text, _ := rocketlinkλ(line, cfg.HeaderLinksHypha)
HeaderLinks = append(HeaderLinks, HeaderLink{
Href: href,
Display: text,

View File

@ -3,35 +3,13 @@ package util
import (
"crypto/rand"
"encoding/hex"
"github.com/bouncepaw/mycorrhiza/cfg"
"net/http"
"regexp"
"strings"
"unicode"
)
// TODO: make names match to fields of config file
var (
SiteName string
SiteNavIcon string
HomePage string
UserHypha string
HeaderLinksHypha string
ServerPort string
URL string
GeminiCertPath string
WikiDir string
ConfigFilePath string
UseFixedAuth bool
FixedCredentialsPath string
UseRegistration bool
RegistrationCredentialsPath string
LimitRegistration int
)
// LettersNumbersOnly keeps letters and numbers only in the given string.
func LettersNumbersOnly(s string) string {
var (
@ -52,8 +30,8 @@ func LettersNumbersOnly(s string) string {
// ShorterPath is used by handlerList to display shorter path to the files. It simply strips WikiDir.
func ShorterPath(path string) string {
if strings.HasPrefix(path, WikiDir) {
tmp := strings.TrimPrefix(path, WikiDir)
if strings.HasPrefix(path, cfg.WikiDir) {
tmp := strings.TrimPrefix(path, cfg.WikiDir)
if tmp == "" {
return ""
}
@ -103,9 +81,9 @@ func CanonicalName(name string) string {
}
// HyphaPattern is a pattern which all hyphae must match.
var HyphaPattern = regexp.MustCompile(`[^?!:#@><*|"\'&%{}]+`)
var HyphaPattern = regexp.MustCompile(`[^?!:#@><*|"'&%{}]+`)
var UsernamePattern = regexp.MustCompile(`[^?!:#@><*|"\'&%{}/]+`)
var UsernamePattern = regexp.MustCompile(`[^?!:#@><*|"'&%{}/]+`)
// IsCanonicalName checks if the `name` is canonical.
func IsCanonicalName(name string) bool {

View File

@ -1,15 +1,15 @@
{% import "net/http" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% func RegisterHTML(rq *http.Request) %}
<div class="layout">
<main class="main-width">
<section>
{% if util.UseRegistration %}
{% if cfg.UseRegistration %}
<form class="modal" method="post" action="/register?{%s rq.URL.RawQuery %}" id="register-form" enctype="multipart/form-data" autocomplete="off">
<fieldset class="modal__fieldset">
<legend class="modal__title">Register to {%s util.SiteName %}</legend>
<legend class="modal__title">Register to {%s cfg.WikiName %}</legend>
<label for="register-form__username">Username</label>
<br>
@ -24,7 +24,7 @@
<a class="modal__action modal__cancel" href="/">Cancel</a>
</fieldset>
</form>
{% elseif util.UseFixedAuth %}
{% elseif cfg.UseFixedAuth %}
<p>Administrators have forbidden registration for this wiki. Administrators can make an account for you by hand; contact them.</p>
<p><a href="{%s rq.URL.RawQuery %}">← Go back</a></p>
{% else %}
@ -43,7 +43,7 @@
{% if user.AuthUsed %}
<form class="modal" method="post" action="/login-data" id="login-form" enctype="multipart/form-data" autocomplete="on">
<fieldset class="modal__fieldset">
<legend class="modal__title">Log in to {%s util.SiteName %}</legend>
<legend class="modal__title">Log in to {%s cfg.WikiName %}</legend>
<p>Use the data you were given by an administrator.</p>
<label for="login-form__username">Username</label>
<br>

View File

@ -11,7 +11,7 @@ import "net/http"
import "github.com/bouncepaw/mycorrhiza/user"
//line views/auth.qtpl:3
import "github.com/bouncepaw/mycorrhiza/util"
import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/auth.qtpl:5
import (
@ -35,7 +35,7 @@ func StreamRegisterHTML(qw422016 *qt422016.Writer, rq *http.Request) {
<section>
`)
//line views/auth.qtpl:9
if util.UseRegistration {
if cfg.UseRegistration {
//line views/auth.qtpl:9
qw422016.N().S(`
<form class="modal" method="post" action="/register?`)
@ -46,7 +46,7 @@ func StreamRegisterHTML(qw422016 *qt422016.Writer, rq *http.Request) {
<fieldset class="modal__fieldset">
<legend class="modal__title">Register to `)
//line views/auth.qtpl:12
qw422016.E().S(util.SiteName)
qw422016.E().S(cfg.WikiName)
//line views/auth.qtpl:12
qw422016.N().S(`</legend>
@ -65,7 +65,7 @@ func StreamRegisterHTML(qw422016 *qt422016.Writer, rq *http.Request) {
</form>
`)
//line views/auth.qtpl:27
} else if util.UseFixedAuth {
} else if cfg.UseFixedAuth {
//line views/auth.qtpl:27
qw422016.N().S(`
<p>Administrators have forbidden registration for this wiki. Administrators can make an account for you by hand; contact them.</p>
@ -139,7 +139,7 @@ func StreamLoginHTML(qw422016 *qt422016.Writer) {
<fieldset class="modal__fieldset">
<legend class="modal__title">Log in to `)
//line views/auth.qtpl:46
qw422016.E().S(util.SiteName)
qw422016.E().S(cfg.WikiName)
//line views/auth.qtpl:46
qw422016.N().S(`</legend>
<p>Use the data you were given by an administrator.</p>

View File

@ -1,5 +1,6 @@
{% import "net/http" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
@ -76,7 +77,7 @@ if err != nil {
<li class="rc-entry__time"><time>{%s rev.TimeString() %}</time></li>
<li class="rc-entry__hash">{%s rev.Hash %}</li>
<li class="rc-entry__links">{%s= rev.HyphaeLinksHTML() %}</li>
<li class="rc-entry__msg">{%s rev.Message %} {% if rev.Username != "anon" %}<span class="rc-entry__author">by <a href="/hypha/{%s util.UserHypha %}/{%s rev.Username %}" rel="author">{%s rev.Username %}</a></span>{% endif %}</li>
<li class="rc-entry__msg">{%s rev.Message %} {% if rev.Username != "anon" %}<span class="rc-entry__author">by <a href="/hypha/{%s cfg.UserHypha %}/{%s rev.Username %}" rel="author">{%s rev.Username %}</a></span>{% endif %}</li>
{% endfunc %}
{% func HistoryHTML(rq *http.Request, hyphaName, list string) %}

View File

@ -8,101 +8,104 @@ package views
import "net/http"
//line views/history.qtpl:3
import "github.com/bouncepaw/mycorrhiza/util"
import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/history.qtpl:4
import "github.com/bouncepaw/mycorrhiza/user"
import "github.com/bouncepaw/mycorrhiza/util"
//line views/history.qtpl:5
import "github.com/bouncepaw/mycorrhiza/hyphae"
import "github.com/bouncepaw/mycorrhiza/user"
//line views/history.qtpl:6
import "github.com/bouncepaw/mycorrhiza/hyphae"
//line views/history.qtpl:7
import "github.com/bouncepaw/mycorrhiza/history"
//line views/history.qtpl:9
//line views/history.qtpl:10
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line views/history.qtpl:9
//line views/history.qtpl:10
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line views/history.qtpl:9
//line views/history.qtpl:10
func StreamPrimitiveDiffHTML(qw422016 *qt422016.Writer, rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) {
//line views/history.qtpl:9
//line views/history.qtpl:10
qw422016.N().S(`
`)
//line views/history.qtpl:11
//line views/history.qtpl:12
text, err := history.PrimitiveDiffAtRevision(h.TextPath, hash)
if err != nil {
text = err.Error()
}
//line views/history.qtpl:15
//line views/history.qtpl:16
qw422016.N().S(`
`)
//line views/history.qtpl:16
//line views/history.qtpl:17
StreamNavHTML(qw422016, rq, h.Name, "history")
//line views/history.qtpl:16
//line views/history.qtpl:17
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<article>
<h1>Diff `)
//line views/history.qtpl:20
//line views/history.qtpl:21
qw422016.E().S(util.BeautifulName(h.Name))
//line views/history.qtpl:20
//line views/history.qtpl:21
qw422016.N().S(` at `)
//line views/history.qtpl:20
//line views/history.qtpl:21
qw422016.E().S(hash)
//line views/history.qtpl:20
//line views/history.qtpl:21
qw422016.N().S(`</h1>
<pre class="codeblock"><code>`)
//line views/history.qtpl:21
//line views/history.qtpl:22
qw422016.E().S(text)
//line views/history.qtpl:21
//line views/history.qtpl:22
qw422016.N().S(`</code></pre>
</article>
</main>
</div>
`)
//line views/history.qtpl:25
//line views/history.qtpl:26
}
//line views/history.qtpl:25
//line views/history.qtpl:26
func WritePrimitiveDiffHTML(qq422016 qtio422016.Writer, rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) {
//line views/history.qtpl:25
//line views/history.qtpl:26
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/history.qtpl:25
//line views/history.qtpl:26
StreamPrimitiveDiffHTML(qw422016, rq, h, u, hash)
//line views/history.qtpl:25
//line views/history.qtpl:26
qt422016.ReleaseWriter(qw422016)
//line views/history.qtpl:25
//line views/history.qtpl:26
}
//line views/history.qtpl:25
//line views/history.qtpl:26
func PrimitiveDiffHTML(rq *http.Request, h *hyphae.Hypha, u *user.User, hash string) string {
//line views/history.qtpl:25
//line views/history.qtpl:26
qb422016 := qt422016.AcquireByteBuffer()
//line views/history.qtpl:25
//line views/history.qtpl:26
WritePrimitiveDiffHTML(qb422016, rq, h, u, hash)
//line views/history.qtpl:25
//line views/history.qtpl:26
qs422016 := string(qb422016.B)
//line views/history.qtpl:25
//line views/history.qtpl:26
qt422016.ReleaseByteBuffer(qb422016)
//line views/history.qtpl:25
//line views/history.qtpl:26
return qs422016
//line views/history.qtpl:25
//line views/history.qtpl:26
}
//line views/history.qtpl:27
//line views/history.qtpl:28
func StreamRecentChangesHTML(qw422016 *qt422016.Writer, n int) {
//line views/history.qtpl:27
//line views/history.qtpl:28
qw422016.N().S(`
<div class="layout">
<main class="main-width recent-changes">
@ -111,51 +114,51 @@ func StreamRecentChangesHTML(qw422016 *qt422016.Writer, n int) {
<nav class="recent-changes__count">
See
`)
//line views/history.qtpl:34
//line views/history.qtpl:35
for _, m := range []int{20, 0, 50, 0, 100} {
//line views/history.qtpl:34
//line views/history.qtpl:35
qw422016.N().S(`
`)
//line views/history.qtpl:35
//line views/history.qtpl:36
switch m {
//line views/history.qtpl:36
//line views/history.qtpl:37
case 0:
//line views/history.qtpl:36
//line views/history.qtpl:37
qw422016.N().S(`
<span aria-hidden="true">|</span>
`)
//line views/history.qtpl:38
//line views/history.qtpl:39
case n:
//line views/history.qtpl:38
//line views/history.qtpl:39
qw422016.N().S(`
<b>`)
//line views/history.qtpl:39
//line views/history.qtpl:40
qw422016.N().D(n)
//line views/history.qtpl:39
//line views/history.qtpl:40
qw422016.N().S(`</b>
`)
//line views/history.qtpl:40
//line views/history.qtpl:41
default:
//line views/history.qtpl:40
//line views/history.qtpl:41
qw422016.N().S(`
<a href="/recent-changes/`)
//line views/history.qtpl:41
//line views/history.qtpl:42
qw422016.N().D(m)
//line views/history.qtpl:41
//line views/history.qtpl:42
qw422016.N().S(`">`)
//line views/history.qtpl:41
//line views/history.qtpl:42
qw422016.N().D(m)
//line views/history.qtpl:41
//line views/history.qtpl:42
qw422016.N().S(`</a>
`)
//line views/history.qtpl:42
//line views/history.qtpl:43
}
//line views/history.qtpl:42
//line views/history.qtpl:43
qw422016.N().S(`
`)
//line views/history.qtpl:43
//line views/history.qtpl:44
}
//line views/history.qtpl:43
//line views/history.qtpl:44
qw422016.N().S(`
recent changes
</nav>
@ -163,216 +166,216 @@ func StreamRecentChangesHTML(qw422016 *qt422016.Writer, n int) {
<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>
`)
//line views/history.qtpl:54
//line views/history.qtpl:55
qw422016.N().S(`
`)
//line views/history.qtpl:57
//line views/history.qtpl:58
changes := history.RecentChanges(n)
//line views/history.qtpl:58
//line views/history.qtpl:59
qw422016.N().S(`
<section class="recent-changes__list" role="feed">
`)
//line views/history.qtpl:60
//line views/history.qtpl:61
if len(changes) == 0 {
//line views/history.qtpl:60
//line views/history.qtpl:61
qw422016.N().S(`
<p>Could not find any recent changes.</p>
`)
//line views/history.qtpl:62
//line views/history.qtpl:63
} else {
//line views/history.qtpl:62
//line views/history.qtpl:63
qw422016.N().S(`
`)
//line views/history.qtpl:63
//line views/history.qtpl:64
for i, entry := range changes {
//line views/history.qtpl:63
//line views/history.qtpl:64
qw422016.N().S(`
<ul class="recent-changes__entry rc-entry" role="article"
aria-setsize="`)
//line views/history.qtpl:65
//line views/history.qtpl:66
qw422016.N().D(n)
//line views/history.qtpl:65
//line views/history.qtpl:66
qw422016.N().S(`" aria-posinset="`)
//line views/history.qtpl:65
//line views/history.qtpl:66
qw422016.N().D(i)
//line views/history.qtpl:65
//line views/history.qtpl:66
qw422016.N().S(`">
`)
//line views/history.qtpl:66
//line views/history.qtpl:67
qw422016.N().S(recentChangesEntry(entry))
//line views/history.qtpl:66
//line views/history.qtpl:67
qw422016.N().S(`
</ul>
`)
//line views/history.qtpl:68
//line views/history.qtpl:69
}
//line views/history.qtpl:68
//line views/history.qtpl:69
qw422016.N().S(`
`)
//line views/history.qtpl:69
//line views/history.qtpl:70
}
//line views/history.qtpl:69
//line views/history.qtpl:70
qw422016.N().S(`
</section>
</main>
</div>
`)
//line views/history.qtpl:73
//line views/history.qtpl:74
}
//line views/history.qtpl:73
//line views/history.qtpl:74
func WriteRecentChangesHTML(qq422016 qtio422016.Writer, n int) {
//line views/history.qtpl:73
//line views/history.qtpl:74
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/history.qtpl:73
//line views/history.qtpl:74
StreamRecentChangesHTML(qw422016, n)
//line views/history.qtpl:73
//line views/history.qtpl:74
qt422016.ReleaseWriter(qw422016)
//line views/history.qtpl:73
//line views/history.qtpl:74
}
//line views/history.qtpl:73
//line views/history.qtpl:74
func RecentChangesHTML(n int) string {
//line views/history.qtpl:73
//line views/history.qtpl:74
qb422016 := qt422016.AcquireByteBuffer()
//line views/history.qtpl:73
//line views/history.qtpl:74
WriteRecentChangesHTML(qb422016, n)
//line views/history.qtpl:73
//line views/history.qtpl:74
qs422016 := string(qb422016.B)
//line views/history.qtpl:73
//line views/history.qtpl:74
qt422016.ReleaseByteBuffer(qb422016)
//line views/history.qtpl:73
//line views/history.qtpl:74
return qs422016
//line views/history.qtpl:73
//line views/history.qtpl:74
}
//line views/history.qtpl:75
//line views/history.qtpl:76
func streamrecentChangesEntry(qw422016 *qt422016.Writer, rev history.Revision) {
//line views/history.qtpl:75
//line views/history.qtpl:76
qw422016.N().S(`
<li class="rc-entry__time"><time>`)
//line views/history.qtpl:76
//line views/history.qtpl:77
qw422016.E().S(rev.TimeString())
//line views/history.qtpl:76
//line views/history.qtpl:77
qw422016.N().S(`</time></li>
<li class="rc-entry__hash">`)
//line views/history.qtpl:77
//line views/history.qtpl:78
qw422016.E().S(rev.Hash)
//line views/history.qtpl:77
//line views/history.qtpl:78
qw422016.N().S(`</li>
<li class="rc-entry__links">`)
//line views/history.qtpl:78
//line views/history.qtpl:79
qw422016.N().S(rev.HyphaeLinksHTML())
//line views/history.qtpl:78
//line views/history.qtpl:79
qw422016.N().S(`</li>
<li class="rc-entry__msg">`)
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.E().S(rev.Message)
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.N().S(` `)
//line views/history.qtpl:79
//line views/history.qtpl:80
if rev.Username != "anon" {
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.N().S(`<span class="rc-entry__author">by <a href="/hypha/`)
//line views/history.qtpl:79
qw422016.E().S(util.UserHypha)
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.E().S(cfg.UserHypha)
//line views/history.qtpl:80
qw422016.N().S(`/`)
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.E().S(rev.Username)
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.N().S(`" rel="author">`)
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.E().S(rev.Username)
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.N().S(`</a></span>`)
//line views/history.qtpl:79
//line views/history.qtpl:80
}
//line views/history.qtpl:79
//line views/history.qtpl:80
qw422016.N().S(`</li>
`)
//line views/history.qtpl:80
//line views/history.qtpl:81
}
//line views/history.qtpl:80
//line views/history.qtpl:81
func writerecentChangesEntry(qq422016 qtio422016.Writer, rev history.Revision) {
//line views/history.qtpl:80
//line views/history.qtpl:81
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/history.qtpl:80
//line views/history.qtpl:81
streamrecentChangesEntry(qw422016, rev)
//line views/history.qtpl:80
//line views/history.qtpl:81
qt422016.ReleaseWriter(qw422016)
//line views/history.qtpl:80
//line views/history.qtpl:81
}
//line views/history.qtpl:80
//line views/history.qtpl:81
func recentChangesEntry(rev history.Revision) string {
//line views/history.qtpl:80
//line views/history.qtpl:81
qb422016 := qt422016.AcquireByteBuffer()
//line views/history.qtpl:80
//line views/history.qtpl:81
writerecentChangesEntry(qb422016, rev)
//line views/history.qtpl:80
//line views/history.qtpl:81
qs422016 := string(qb422016.B)
//line views/history.qtpl:80
//line views/history.qtpl:81
qt422016.ReleaseByteBuffer(qb422016)
//line views/history.qtpl:80
//line views/history.qtpl:81
return qs422016
//line views/history.qtpl:80
//line views/history.qtpl:81
}
//line views/history.qtpl:82
//line views/history.qtpl:83
func StreamHistoryHTML(qw422016 *qt422016.Writer, rq *http.Request, hyphaName, list string) {
//line views/history.qtpl:82
//line views/history.qtpl:83
qw422016.N().S(`
`)
//line views/history.qtpl:83
//line views/history.qtpl:84
StreamNavHTML(qw422016, rq, hyphaName, "history")
//line views/history.qtpl:83
//line views/history.qtpl:84
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<article class="history">
<h1>History of `)
//line views/history.qtpl:87
//line views/history.qtpl:88
qw422016.E().S(util.BeautifulName(hyphaName))
//line views/history.qtpl:87
//line views/history.qtpl:88
qw422016.N().S(`</h1>
`)
//line views/history.qtpl:88
//line views/history.qtpl:89
qw422016.N().S(list)
//line views/history.qtpl:88
//line views/history.qtpl:89
qw422016.N().S(`
</article>
</main>
</div>
`)
//line views/history.qtpl:92
//line views/history.qtpl:93
}
//line views/history.qtpl:92
//line views/history.qtpl:93
func WriteHistoryHTML(qq422016 qtio422016.Writer, rq *http.Request, hyphaName, list string) {
//line views/history.qtpl:92
//line views/history.qtpl:93
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/history.qtpl:92
//line views/history.qtpl:93
StreamHistoryHTML(qw422016, rq, hyphaName, list)
//line views/history.qtpl:92
//line views/history.qtpl:93
qt422016.ReleaseWriter(qw422016)
//line views/history.qtpl:92
//line views/history.qtpl:93
}
//line views/history.qtpl:92
//line views/history.qtpl:93
func HistoryHTML(rq *http.Request, hyphaName, list string) string {
//line views/history.qtpl:92
//line views/history.qtpl:93
qb422016 := qt422016.AcquireByteBuffer()
//line views/history.qtpl:92
//line views/history.qtpl:93
WriteHistoryHTML(qb422016, rq, hyphaName, list)
//line views/history.qtpl:92
//line views/history.qtpl:93
qs422016 := string(qb422016.B)
//line views/history.qtpl:92
//line views/history.qtpl:93
qt422016.ReleaseByteBuffer(qb422016)
//line views/history.qtpl:92
//line views/history.qtpl:93
return qs422016
//line views/history.qtpl:92
//line views/history.qtpl:93
}

View File

@ -1,5 +1,6 @@
{% import "path/filepath" %}
{% import "strings" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
@ -12,8 +13,8 @@
%}
<h1 class="navi-title">
{% stripspace %}
<a href="/hypha/{%s util.HomePage %}">
{%-s= util.SiteNavIcon -%}
<a href="/hypha/{%s cfg.HomeHypha %}">
{%-s= cfg.NaviTitleIcon -%}
<span aria-hidden="true" class="navi-title__colon">:</span>
</a>

View File

@ -11,223 +11,226 @@ import "path/filepath"
import "strings"
//line views/hypha.qtpl:3
import "github.com/bouncepaw/mycorrhiza/hyphae"
import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/hypha.qtpl:4
import "github.com/bouncepaw/mycorrhiza/hyphae"
//line views/hypha.qtpl:5
import "github.com/bouncepaw/mycorrhiza/util"
//line views/hypha.qtpl:6
//line views/hypha.qtpl:7
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line views/hypha.qtpl:6
//line views/hypha.qtpl:7
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line views/hypha.qtpl:6
//line views/hypha.qtpl:7
func StreamNaviTitleHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha) {
//line views/hypha.qtpl:6
//line views/hypha.qtpl:7
qw422016.N().S(`
`)
//line views/hypha.qtpl:8
//line views/hypha.qtpl:9
var (
prevAcc = "/hypha/"
parts = strings.Split(h.Name, "/")
)
//line views/hypha.qtpl:12
//line views/hypha.qtpl:13
qw422016.N().S(`
<h1 class="navi-title">
`)
//line views/hypha.qtpl:14
//line views/hypha.qtpl:15
qw422016.N().S(`<a href="/hypha/`)
//line views/hypha.qtpl:15
qw422016.E().S(util.HomePage)
//line views/hypha.qtpl:15
//line views/hypha.qtpl:16
qw422016.E().S(cfg.HomeHypha)
//line views/hypha.qtpl:16
qw422016.N().S(`">`)
//line views/hypha.qtpl:16
qw422016.N().S(util.SiteNavIcon)
//line views/hypha.qtpl:16
//line views/hypha.qtpl:17
qw422016.N().S(cfg.NaviTitleIcon)
//line views/hypha.qtpl:17
qw422016.N().S(`<span aria-hidden="true" class="navi-title__colon">:</span></a>`)
//line views/hypha.qtpl:20
//line views/hypha.qtpl:21
for i, part := range parts {
//line views/hypha.qtpl:21
//line views/hypha.qtpl:22
if i > 0 {
//line views/hypha.qtpl:21
//line views/hypha.qtpl:22
qw422016.N().S(`<span aria-hidden="true" class="navi-title__separator">/</span>`)
//line views/hypha.qtpl:23
//line views/hypha.qtpl:24
}
//line views/hypha.qtpl:23
//line views/hypha.qtpl:24
qw422016.N().S(`<a href="`)
//line views/hypha.qtpl:25
//line views/hypha.qtpl:26
qw422016.E().S(prevAcc + part)
//line views/hypha.qtpl:25
//line views/hypha.qtpl:26
qw422016.N().S(`" rel="`)
//line views/hypha.qtpl:25
//line views/hypha.qtpl:26
if i == len(parts)-1 {
//line views/hypha.qtpl:25
//line views/hypha.qtpl:26
qw422016.N().S(`bookmark`)
//line views/hypha.qtpl:25
//line views/hypha.qtpl:26
} else {
//line views/hypha.qtpl:25
//line views/hypha.qtpl:26
qw422016.N().S(`up`)
//line views/hypha.qtpl:25
//line views/hypha.qtpl:26
}
//line views/hypha.qtpl:25
//line views/hypha.qtpl:26
qw422016.N().S(`">`)
//line views/hypha.qtpl:26
//line views/hypha.qtpl:27
qw422016.N().S(util.BeautifulName(part))
//line views/hypha.qtpl:26
//line views/hypha.qtpl:27
qw422016.N().S(`</a>`)
//line views/hypha.qtpl:28
//line views/hypha.qtpl:29
prevAcc += part + "/"
//line views/hypha.qtpl:29
}
//line views/hypha.qtpl:30
}
//line views/hypha.qtpl:31
qw422016.N().S(`
</h1>
`)
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
}
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
func WriteNaviTitleHTML(qq422016 qtio422016.Writer, h *hyphae.Hypha) {
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
StreamNaviTitleHTML(qw422016, h)
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
}
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
func NaviTitleHTML(h *hyphae.Hypha) string {
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
WriteNaviTitleHTML(qb422016, h)
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
qs422016 := string(qb422016.B)
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
return qs422016
//line views/hypha.qtpl:32
//line views/hypha.qtpl:33
}
//line views/hypha.qtpl:34
//line views/hypha.qtpl:35
func StreamAttachmentHTML(qw422016 *qt422016.Writer, h *hyphae.Hypha) {
//line views/hypha.qtpl:34
//line views/hypha.qtpl:35
qw422016.N().S(`
`)
//line views/hypha.qtpl:35
//line views/hypha.qtpl:36
switch filepath.Ext(h.BinaryPath) {
//line views/hypha.qtpl:37
//line views/hypha.qtpl:38
case ".jpg", ".gif", ".png", ".webp", ".svg", ".ico":
//line views/hypha.qtpl:37
//line views/hypha.qtpl:38
qw422016.N().S(`
<div class="binary-container binary-container_with-img">
<a href="/binary/`)
//line views/hypha.qtpl:39
//line views/hypha.qtpl:40
qw422016.N().S(h.Name)
//line views/hypha.qtpl:39
//line views/hypha.qtpl:40
qw422016.N().S(`"><img src="/binary/`)
//line views/hypha.qtpl:39
//line views/hypha.qtpl:40
qw422016.N().S(h.Name)
//line views/hypha.qtpl:39
//line views/hypha.qtpl:40
qw422016.N().S(`"/></a>
</div>
`)
//line views/hypha.qtpl:42
//line views/hypha.qtpl:43
case ".ogg", ".webm", ".mp4":
//line views/hypha.qtpl:42
//line views/hypha.qtpl:43
qw422016.N().S(`
<div class="binary-container binary-container_with-video">
<video controls>
<source src="/binary/`)
//line views/hypha.qtpl:45
//line views/hypha.qtpl:46
qw422016.N().S(h.Name)
//line views/hypha.qtpl:45
//line views/hypha.qtpl:46
qw422016.N().S(`"/>
<p>Your browser does not support video. <a href="/binary/`)
//line views/hypha.qtpl:46
//line views/hypha.qtpl:47
qw422016.N().S(h.Name)
//line views/hypha.qtpl:46
//line views/hypha.qtpl:47
qw422016.N().S(`">Download video</a></p>
</video>
</div>
`)
//line views/hypha.qtpl:50
//line views/hypha.qtpl:51
case ".mp3":
//line views/hypha.qtpl:50
//line views/hypha.qtpl:51
qw422016.N().S(`
<div class="binary-container binary-container_with-audio">
<audio controls>
<source src="/binary/`)
//line views/hypha.qtpl:53
//line views/hypha.qtpl:54
qw422016.N().S(h.Name)
//line views/hypha.qtpl:53
//line views/hypha.qtpl:54
qw422016.N().S(`"/>
<p>Your browser does not support audio. <a href="/binary/`)
//line views/hypha.qtpl:54
//line views/hypha.qtpl:55
qw422016.N().S(h.Name)
//line views/hypha.qtpl:54
//line views/hypha.qtpl:55
qw422016.N().S(`">Download audio</a></p>
</audio>
</div>
`)
//line views/hypha.qtpl:58
//line views/hypha.qtpl:59
default:
//line views/hypha.qtpl:58
//line views/hypha.qtpl:59
qw422016.N().S(`
<div class="binary-container binary-container_with-nothing">
<p><a href="/binary/`)
//line views/hypha.qtpl:60
//line views/hypha.qtpl:61
qw422016.N().S(h.Name)
//line views/hypha.qtpl:60
//line views/hypha.qtpl:61
qw422016.N().S(`">Download media</a></p>
</div>
`)
//line views/hypha.qtpl:62
//line views/hypha.qtpl:63
}
//line views/hypha.qtpl:62
//line views/hypha.qtpl:63
qw422016.N().S(`
`)
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
}
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
func WriteAttachmentHTML(qq422016 qtio422016.Writer, h *hyphae.Hypha) {
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
StreamAttachmentHTML(qw422016, h)
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
qt422016.ReleaseWriter(qw422016)
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
}
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
func AttachmentHTML(h *hyphae.Hypha) string {
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
qb422016 := qt422016.AcquireByteBuffer()
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
WriteAttachmentHTML(qb422016, h)
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
qs422016 := string(qb422016.B)
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
qt422016.ReleaseByteBuffer(qb422016)
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
return qs422016
//line views/hypha.qtpl:63
//line views/hypha.qtpl:64
}

View File

@ -1,7 +1,7 @@
{% import "net/http" %}
{% import "strings" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
This is the <nav> seen on top of many pages.
{% code
@ -52,7 +52,7 @@ var navEntries = []navEntry{
{% if u.Group == "anon" %}
<a href="/login" class="header-links__link">Login</a>
{% else %}
<a href="/hypha/{%s util.UserHypha %}/{%s u.Name %}" class="header-links__link">{%s u.Name %}</a>
<a href="/hypha/{%s cfg.UserHypha %}/{%s u.Name %}" class="header-links__link">{%s u.Name %}</a>
{% endif %}
</li>
{% endif %}

View File

@ -11,10 +11,10 @@ import "net/http"
import "strings"
//line views/nav.qtpl:3
import "github.com/bouncepaw/mycorrhiza/user"
import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/nav.qtpl:4
import "github.com/bouncepaw/mycorrhiza/util"
import "github.com/bouncepaw/mycorrhiza/user"
// This is the <nav> seen on top of many pages.
@ -164,7 +164,7 @@ func StreamUserMenuHTML(qw422016 *qt422016.Writer, u *user.User) {
qw422016.N().S(`
<a href="/hypha/`)
//line views/nav.qtpl:55
qw422016.E().S(util.UserHypha)
qw422016.E().S(cfg.UserHypha)
//line views/nav.qtpl:55
qw422016.N().S(`/`)
//line views/nav.qtpl:55

View File

@ -1,4 +1,5 @@
{% import "path/filepath" %}
{% import "github.com/bouncepaw/mycorrhiza/cfg" %}
{% import "github.com/bouncepaw/mycorrhiza/hyphae" %}
{% import "github.com/bouncepaw/mycorrhiza/user" %}
{% import "github.com/bouncepaw/mycorrhiza/util" %}
@ -53,19 +54,19 @@ for u := range user.YieldUsers() {
<section>
<h2>Admins</h2>
<ol>{% for _, name := range admins %}
<li><a href="/page/{%s util.UserHypha %}/{%s name %}">{%s name %}</a></li>
<li><a href="/page/{%s cfg.UserHypha %}/{%s name %}">{%s name %}</a></li>
{% endfor %}</ol>
</section>
<section>
<h2>Moderators</h2>
<ol>{% for _, name := range moderators %}
<li><a href="/page/{%s util.UserHypha %}/{%s name %}">{%s name %}</a></li>
<li><a href="/page/{%s cfg.UserHypha %}/{%s name %}">{%s name %}</a></li>
{% endfor %}</ol>
</section>
<section>
<h2>Editors</h2>
<ol>{% for _, name := range editors %}
<li><a href="/page/{%s util.UserHypha %}/{%s name %}">{%s name %}</a></li>
<li><a href="/page/{%s cfg.UserHypha %}/{%s name %}">{%s name %}</a></li>
{% endfor %}</ol>
</section>
</main>
@ -95,16 +96,16 @@ for u := range user.YieldUsers() {
<div class="layout">
<main class="main-width">
<section>
<h1>About {%s util.SiteName %}</h1>
<h1>About {%s cfg.WikiName %}</h1>
<ul>
<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> 1.2.0 indev</li>
{%- if user.AuthUsed -%}
<li><b>User count:</b> {%d user.Count() %}</li>
<li><b>Home page:</b> <a href="/">{%s util.HomePage %}</a></li>
<li><b>Home page:</b> <a href="/">{%s cfg.HomeHypha %}</a></li>
<li><b>Administrators:</b> {%- for i, username := range user.ListUsersWithGroup("admin") -%}
{%- if i > 0 -%}<span aria-hidden="true">, </span>
{%- endif -%}
<a href="/page/{%s util.UserHypha %}/{%s username %}">{%s username %}</a>{%- endfor -%}</li>
<a href="/page/{%s cfg.UserHypha %}/{%s username %}">{%s username %}</a>{%- endfor -%}</li>
{%- else -%}
<li>This wiki does not use authorization</li>
{%- endif -%}

View File

@ -8,30 +8,33 @@ package views
import "path/filepath"
//line views/stuff.qtpl:2
import "github.com/bouncepaw/mycorrhiza/hyphae"
import "github.com/bouncepaw/mycorrhiza/cfg"
//line views/stuff.qtpl:3
import "github.com/bouncepaw/mycorrhiza/user"
import "github.com/bouncepaw/mycorrhiza/hyphae"
//line views/stuff.qtpl:4
import "github.com/bouncepaw/mycorrhiza/user"
//line views/stuff.qtpl:5
import "github.com/bouncepaw/mycorrhiza/util"
//line views/stuff.qtpl:6
//line views/stuff.qtpl:7
import (
qtio422016 "io"
qt422016 "github.com/valyala/quicktemplate"
)
//line views/stuff.qtpl:6
//line views/stuff.qtpl:7
var (
_ = qtio422016.Copy
_ = qt422016.AcquireByteBuffer
)
//line views/stuff.qtpl:6
//line views/stuff.qtpl:7
func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User, headElements ...string) {
//line views/stuff.qtpl:6
//line views/stuff.qtpl:7
qw422016.N().S(`
<!doctype html>
<html>
@ -40,18 +43,18 @@ func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User,
<meta charset="utf-8">
<link rel="stylesheet" type="text/css" href="/static/common.css">
<title>`)
//line views/stuff.qtpl:13
//line views/stuff.qtpl:14
qw422016.E().S(title)
//line views/stuff.qtpl:13
//line views/stuff.qtpl:14
qw422016.N().S(`</title>
`)
//line views/stuff.qtpl:14
//line views/stuff.qtpl:15
for _, el := range headElements {
//line views/stuff.qtpl:14
//line views/stuff.qtpl:15
qw422016.N().S(el)
//line views/stuff.qtpl:14
//line views/stuff.qtpl:15
}
//line views/stuff.qtpl:14
//line views/stuff.qtpl:15
qw422016.N().S(`
</head>
<body>
@ -59,76 +62,76 @@ func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, u *user.User,
<nav class="header-links main-width">
<ul class="header-links__list">
`)
//line views/stuff.qtpl:20
//line views/stuff.qtpl:21
for _, link := range util.HeaderLinks {
//line views/stuff.qtpl:20
//line views/stuff.qtpl:21
qw422016.N().S(` <li class="header-links__entry"><a class="header-links__link" href="`)
//line views/stuff.qtpl:21
//line views/stuff.qtpl:22
qw422016.E().S(link.Href)
//line views/stuff.qtpl:21
//line views/stuff.qtpl:22
qw422016.N().S(`">`)
//line views/stuff.qtpl:21
//line views/stuff.qtpl:22
qw422016.E().S(link.Display)
//line views/stuff.qtpl:21
//line views/stuff.qtpl:22
qw422016.N().S(`</a></li>
`)
//line views/stuff.qtpl:22
//line views/stuff.qtpl:23
}
//line views/stuff.qtpl:22
//line views/stuff.qtpl:23
qw422016.N().S(` `)
//line views/stuff.qtpl:23
//line views/stuff.qtpl:24
qw422016.N().S(UserMenuHTML(u))
//line views/stuff.qtpl:23
//line views/stuff.qtpl:24
qw422016.N().S(`
</ul>
</nav>
</header>
`)
//line views/stuff.qtpl:27
//line views/stuff.qtpl:28
qw422016.N().S(body)
//line views/stuff.qtpl:27
//line views/stuff.qtpl:28
qw422016.N().S(`
</body>
</html>
`)
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
}
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, u *user.User, headElements ...string) {
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
StreamBaseHTML(qw422016, title, body, u, headElements...)
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
qt422016.ReleaseWriter(qw422016)
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
}
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
func BaseHTML(title, body string, u *user.User, headElements ...string) string {
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
qb422016 := qt422016.AcquireByteBuffer()
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
WriteBaseHTML(qb422016, title, body, u, headElements...)
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
qs422016 := string(qb422016.B)
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
qt422016.ReleaseByteBuffer(qb422016)
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
return qs422016
//line views/stuff.qtpl:30
//line views/stuff.qtpl:31
}
//line views/stuff.qtpl:32
//line views/stuff.qtpl:33
func StreamUserListHTML(qw422016 *qt422016.Writer) {
//line views/stuff.qtpl:32
//line views/stuff.qtpl:33
qw422016.N().S(`
<div class="layout">
<main class="main-width user-list">
<h1>List of users</h1>
`)
//line views/stuff.qtpl:37
//line views/stuff.qtpl:38
var (
admins = make([]string, 0)
moderators = make([]string, 0)
@ -145,303 +148,303 @@ func StreamUserListHTML(qw422016 *qt422016.Writer) {
}
}
//line views/stuff.qtpl:52
//line views/stuff.qtpl:53
qw422016.N().S(`
<section>
<h2>Admins</h2>
<ol>`)
//line views/stuff.qtpl:55
//line views/stuff.qtpl:56
for _, name := range admins {
//line views/stuff.qtpl:55
//line views/stuff.qtpl:56
qw422016.N().S(`
<li><a href="/page/`)
//line views/stuff.qtpl:56
qw422016.E().S(util.UserHypha)
//line views/stuff.qtpl:56
//line views/stuff.qtpl:57
qw422016.E().S(cfg.UserHypha)
//line views/stuff.qtpl:57
qw422016.N().S(`/`)
//line views/stuff.qtpl:56
//line views/stuff.qtpl:57
qw422016.E().S(name)
//line views/stuff.qtpl:56
//line views/stuff.qtpl:57
qw422016.N().S(`">`)
//line views/stuff.qtpl:56
//line views/stuff.qtpl:57
qw422016.E().S(name)
//line views/stuff.qtpl:56
//line views/stuff.qtpl:57
qw422016.N().S(`</a></li>
`)
//line views/stuff.qtpl:57
//line views/stuff.qtpl:58
}
//line views/stuff.qtpl:57
//line views/stuff.qtpl:58
qw422016.N().S(`</ol>
</section>
<section>
<h2>Moderators</h2>
<ol>`)
//line views/stuff.qtpl:61
//line views/stuff.qtpl:62
for _, name := range moderators {
//line views/stuff.qtpl:61
//line views/stuff.qtpl:62
qw422016.N().S(`
<li><a href="/page/`)
//line views/stuff.qtpl:62
qw422016.E().S(util.UserHypha)
//line views/stuff.qtpl:62
//line views/stuff.qtpl:63
qw422016.E().S(cfg.UserHypha)
//line views/stuff.qtpl:63
qw422016.N().S(`/`)
//line views/stuff.qtpl:62
//line views/stuff.qtpl:63
qw422016.E().S(name)
//line views/stuff.qtpl:62
//line views/stuff.qtpl:63
qw422016.N().S(`">`)
//line views/stuff.qtpl:62
//line views/stuff.qtpl:63
qw422016.E().S(name)
//line views/stuff.qtpl:62
//line views/stuff.qtpl:63
qw422016.N().S(`</a></li>
`)
//line views/stuff.qtpl:63
//line views/stuff.qtpl:64
}
//line views/stuff.qtpl:63
//line views/stuff.qtpl:64
qw422016.N().S(`</ol>
</section>
<section>
<h2>Editors</h2>
<ol>`)
//line views/stuff.qtpl:67
//line views/stuff.qtpl:68
for _, name := range editors {
//line views/stuff.qtpl:67
//line views/stuff.qtpl:68
qw422016.N().S(`
<li><a href="/page/`)
//line views/stuff.qtpl:68
qw422016.E().S(util.UserHypha)
//line views/stuff.qtpl:68
//line views/stuff.qtpl:69
qw422016.E().S(cfg.UserHypha)
//line views/stuff.qtpl:69
qw422016.N().S(`/`)
//line views/stuff.qtpl:68
//line views/stuff.qtpl:69
qw422016.E().S(name)
//line views/stuff.qtpl:68
//line views/stuff.qtpl:69
qw422016.N().S(`">`)
//line views/stuff.qtpl:68
//line views/stuff.qtpl:69
qw422016.E().S(name)
//line views/stuff.qtpl:68
//line views/stuff.qtpl:69
qw422016.N().S(`</a></li>
`)
//line views/stuff.qtpl:69
//line views/stuff.qtpl:70
}
//line views/stuff.qtpl:69
//line views/stuff.qtpl:70
qw422016.N().S(`</ol>
</section>
</main>
</div>
`)
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
}
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
func WriteUserListHTML(qq422016 qtio422016.Writer) {
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
StreamUserListHTML(qw422016)
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
qt422016.ReleaseWriter(qw422016)
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
}
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
func UserListHTML() string {
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
qb422016 := qt422016.AcquireByteBuffer()
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
WriteUserListHTML(qb422016)
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
qs422016 := string(qb422016.B)
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
qt422016.ReleaseByteBuffer(qb422016)
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
return qs422016
//line views/stuff.qtpl:73
//line views/stuff.qtpl:74
}
//line views/stuff.qtpl:75
//line views/stuff.qtpl:76
func StreamHyphaListHTML(qw422016 *qt422016.Writer) {
//line views/stuff.qtpl:75
//line views/stuff.qtpl:76
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<h1>List of hyphae</h1>
<p>This wiki has `)
//line views/stuff.qtpl:79
//line views/stuff.qtpl:80
qw422016.N().D(hyphae.Count())
//line views/stuff.qtpl:79
//line views/stuff.qtpl:80
qw422016.N().S(` hyphae.</p>
<ul class="hypha-list">
`)
//line views/stuff.qtpl:81
//line views/stuff.qtpl:82
for h := range hyphae.YieldExistingHyphae() {
//line views/stuff.qtpl:81
//line views/stuff.qtpl:82
qw422016.N().S(`
<li class="hypha-list__entry">
<a class="hypha-list__link" href="/hypha/`)
//line views/stuff.qtpl:83
//line views/stuff.qtpl:84
qw422016.E().S(h.Name)
//line views/stuff.qtpl:83
//line views/stuff.qtpl:84
qw422016.N().S(`">`)
//line views/stuff.qtpl:83
//line views/stuff.qtpl:84
qw422016.E().S(util.BeautifulName(h.Name))
//line views/stuff.qtpl:83
//line views/stuff.qtpl:84
qw422016.N().S(`</a>
`)
//line views/stuff.qtpl:84
//line views/stuff.qtpl:85
if h.BinaryPath != "" {
//line views/stuff.qtpl:84
//line views/stuff.qtpl:85
qw422016.N().S(`
<span class="hypha-list__amnt-type">`)
//line views/stuff.qtpl:85
//line views/stuff.qtpl:86
qw422016.E().S(filepath.Ext(h.BinaryPath)[1:])
//line views/stuff.qtpl:85
//line views/stuff.qtpl:86
qw422016.N().S(`</span>
`)
//line views/stuff.qtpl:86
//line views/stuff.qtpl:87
}
//line views/stuff.qtpl:86
//line views/stuff.qtpl:87
qw422016.N().S(`
</li>
`)
//line views/stuff.qtpl:88
//line views/stuff.qtpl:89
}
//line views/stuff.qtpl:88
//line views/stuff.qtpl:89
qw422016.N().S(`
</ul>
</main>
</div>
`)
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
}
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
func WriteHyphaListHTML(qq422016 qtio422016.Writer) {
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
StreamHyphaListHTML(qw422016)
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
qt422016.ReleaseWriter(qw422016)
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
}
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
func HyphaListHTML() string {
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
qb422016 := qt422016.AcquireByteBuffer()
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
WriteHyphaListHTML(qb422016)
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
qs422016 := string(qb422016.B)
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
qt422016.ReleaseByteBuffer(qb422016)
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
return qs422016
//line views/stuff.qtpl:92
//line views/stuff.qtpl:93
}
//line views/stuff.qtpl:94
//line views/stuff.qtpl:95
func StreamAboutHTML(qw422016 *qt422016.Writer) {
//line views/stuff.qtpl:94
//line views/stuff.qtpl:95
qw422016.N().S(`
<div class="layout">
<main class="main-width">
<section>
<h1>About `)
//line views/stuff.qtpl:98
qw422016.E().S(util.SiteName)
//line views/stuff.qtpl:98
//line views/stuff.qtpl:99
qw422016.E().S(cfg.WikiName)
//line views/stuff.qtpl:99
qw422016.N().S(`</h1>
<ul>
<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> 1.2.0 indev</li>
`)
//line views/stuff.qtpl:101
//line views/stuff.qtpl:102
if user.AuthUsed {
//line views/stuff.qtpl:101
//line views/stuff.qtpl:102
qw422016.N().S(` <li><b>User count:</b> `)
//line views/stuff.qtpl:102
//line views/stuff.qtpl:103
qw422016.N().D(user.Count())
//line views/stuff.qtpl:102
//line views/stuff.qtpl:103
qw422016.N().S(`</li>
<li><b>Home page:</b> <a href="/">`)
//line views/stuff.qtpl:103
qw422016.E().S(util.HomePage)
//line views/stuff.qtpl:103
//line views/stuff.qtpl:104
qw422016.E().S(cfg.HomeHypha)
//line views/stuff.qtpl:104
qw422016.N().S(`</a></li>
<li><b>Administrators:</b>`)
//line views/stuff.qtpl:104
//line views/stuff.qtpl:105
for i, username := range user.ListUsersWithGroup("admin") {
//line views/stuff.qtpl:105
//line views/stuff.qtpl:106
if i > 0 {
//line views/stuff.qtpl:105
//line views/stuff.qtpl:106
qw422016.N().S(`<span aria-hidden="true">, </span>
`)
//line views/stuff.qtpl:106
//line views/stuff.qtpl:107
}
//line views/stuff.qtpl:106
//line views/stuff.qtpl:107
qw422016.N().S(` <a href="/page/`)
//line views/stuff.qtpl:107
qw422016.E().S(util.UserHypha)
//line views/stuff.qtpl:107
//line views/stuff.qtpl:108
qw422016.E().S(cfg.UserHypha)
//line views/stuff.qtpl:108
qw422016.N().S(`/`)
//line views/stuff.qtpl:107
//line views/stuff.qtpl:108
qw422016.E().S(username)
//line views/stuff.qtpl:107
//line views/stuff.qtpl:108
qw422016.N().S(`">`)
//line views/stuff.qtpl:107
//line views/stuff.qtpl:108
qw422016.E().S(username)
//line views/stuff.qtpl:107
//line views/stuff.qtpl:108
qw422016.N().S(`</a>`)
//line views/stuff.qtpl:107
//line views/stuff.qtpl:108
}
//line views/stuff.qtpl:107
//line views/stuff.qtpl:108
qw422016.N().S(`</li>
`)
//line views/stuff.qtpl:108
//line views/stuff.qtpl:109
} else {
//line views/stuff.qtpl:108
//line views/stuff.qtpl:109
qw422016.N().S(` <li>This wiki does not use authorization</li>
`)
//line views/stuff.qtpl:110
//line views/stuff.qtpl:111
}
//line views/stuff.qtpl:110
//line views/stuff.qtpl:111
qw422016.N().S(` </ul>
<p>See <a href="/list">/list</a> for information about hyphae on this wiki.</p>
</section>
</main>
</div>
`)
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
}
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
func WriteAboutHTML(qq422016 qtio422016.Writer) {
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
StreamAboutHTML(qw422016)
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
qt422016.ReleaseWriter(qw422016)
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
}
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
func AboutHTML() string {
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
qb422016 := qt422016.AcquireByteBuffer()
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
WriteAboutHTML(qb422016)
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
qs422016 := string(qb422016.B)
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
qt422016.ReleaseByteBuffer(qb422016)
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
return qs422016
//line views/stuff.qtpl:116
//line views/stuff.qtpl:117
}
//line views/stuff.qtpl:118
//line views/stuff.qtpl:119
func StreamAdminPanelHTML(qw422016 *qt422016.Writer) {
//line views/stuff.qtpl:118
//line views/stuff.qtpl:119
qw422016.N().S(`
<div class="layout">
<main class="main-width">
@ -478,31 +481,31 @@ func StreamAdminPanelHTML(qw422016 *qt422016.Writer) {
</main>
</div>
`)
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
}
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
func WriteAdminPanelHTML(qq422016 qtio422016.Writer) {
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
qw422016 := qt422016.AcquireWriter(qq422016)
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
StreamAdminPanelHTML(qw422016)
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
qt422016.ReleaseWriter(qw422016)
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
}
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
func AdminPanelHTML() string {
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
qb422016 := qt422016.AcquireByteBuffer()
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
WriteAdminPanelHTML(qb422016)
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
qs422016 := string(qb422016.B)
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
qt422016.ReleaseByteBuffer(qb422016)
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
return qs422016
//line views/stuff.qtpl:153
//line views/stuff.qtpl:154
}