mirror of
https://github.com/osmarks/mycorrhiza.git
synced 2024-12-12 05:20:26 +00:00
Add /about page, remove -title option, add -name and -icon options
This commit is contained in:
parent
355fd4b1b0
commit
e72ca863e3
@ -24,10 +24,12 @@ Options:
|
|||||||
Used when -auth-method=fixed. Path to file with user credentials. (default "mycocredentials.json")
|
Used when -auth-method=fixed. Path to file with user credentials. (default "mycocredentials.json")
|
||||||
-home string
|
-home string
|
||||||
The home page (default "home")
|
The home page (default "home")
|
||||||
|
-icon string
|
||||||
|
What to show in the navititle in the beginning, before the colon (default "🍄")
|
||||||
|
-name string
|
||||||
|
What is the name of your wiki (default "wiki")
|
||||||
-port string
|
-port string
|
||||||
Port to serve the wiki at (default "1737")
|
Port to serve the wiki at (default "1737")
|
||||||
-title string
|
|
||||||
How to call your wiki in the navititle (default "🍄")
|
|
||||||
-url string
|
-url string
|
||||||
URL at which your wiki can be found. Used to generate feeds (default "http://0.0.0.0:$port")
|
URL at which your wiki can be found. Used to generate feeds (default "http://0.0.0.0:$port")
|
||||||
-user-tree string
|
-user-tree string
|
||||||
|
3
flag.go
3
flag.go
@ -13,7 +13,8 @@ func init() {
|
|||||||
flag.StringVar(&util.URL, "url", "http://0.0.0.0:$port", "URL at which your wiki can be found. Used to generate feeds and social media previews")
|
flag.StringVar(&util.URL, "url", "http://0.0.0.0:$port", "URL at which your wiki can be found. Used to generate feeds and social media previews")
|
||||||
flag.StringVar(&util.ServerPort, "port", "1737", "Port to serve the wiki at using HTTP")
|
flag.StringVar(&util.ServerPort, "port", "1737", "Port to serve the wiki at using HTTP")
|
||||||
flag.StringVar(&util.HomePage, "home", "home", "The home page name")
|
flag.StringVar(&util.HomePage, "home", "home", "The home page name")
|
||||||
flag.StringVar(&util.SiteTitle, "title", "🍄", "How to call your wiki in the navititle")
|
flag.StringVar(&util.SiteNavIcon, "icon", "🍄", "What to show in the navititle in the beginning, before the colon")
|
||||||
|
flag.StringVar(&util.SiteName, "name", "wiki", "What is the name of your wiki")
|
||||||
flag.StringVar(&util.UserTree, "user-tree", "u", "Hypha which is a superhypha of all user pages")
|
flag.StringVar(&util.UserTree, "user-tree", "u", "Hypha which is a superhypha of all user pages")
|
||||||
flag.StringVar(&util.AuthMethod, "auth-method", "none", "What auth method to use. Variants: \"none\", \"fixed\"")
|
flag.StringVar(&util.AuthMethod, "auth-method", "none", "What auth method to use. Variants: \"none\", \"fixed\"")
|
||||||
flag.StringVar(&util.FixedCredentialsPath, "fixed-credentials-path", "mycocredentials.json", "Used when -auth-method=fixed. Path to file with user credentials.")
|
flag.StringVar(&util.FixedCredentialsPath, "fixed-credentials-path", "mycocredentials.json", "Used when -auth-method=fixed. Path to file with user credentials.")
|
||||||
|
7
main.go
7
main.go
@ -129,6 +129,12 @@ 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())))
|
||||||
|
}
|
||||||
|
|
||||||
func handlerRobotsTxt(w http.ResponseWriter, rq *http.Request) {
|
func handlerRobotsTxt(w http.ResponseWriter, rq *http.Request) {
|
||||||
w.Header().Set("Content-Type", "text/plain")
|
w.Header().Set("Content-Type", "text/plain")
|
||||||
w.WriteHeader(http.StatusOK)
|
w.WriteHeader(http.StatusOK)
|
||||||
@ -160,6 +166,7 @@ func main() {
|
|||||||
http.HandleFunc("/list", handlerList)
|
http.HandleFunc("/list", handlerList)
|
||||||
http.HandleFunc("/reindex", handlerReindex)
|
http.HandleFunc("/reindex", handlerReindex)
|
||||||
http.HandleFunc("/random", handlerRandom)
|
http.HandleFunc("/random", handlerRandom)
|
||||||
|
http.HandleFunc("/about", handlerAbout)
|
||||||
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(WikiDir+"/static"))))
|
http.Handle("/static/", http.StripPrefix("/static/", http.FileServer(http.Dir(WikiDir+"/static"))))
|
||||||
http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, rq *http.Request) {
|
http.HandleFunc("/favicon.ico", func(w http.ResponseWriter, rq *http.Request) {
|
||||||
http.ServeFile(w, rq, WikiDir+"/static/favicon.ico")
|
http.ServeFile(w, rq, WikiDir+"/static/favicon.ico")
|
||||||
|
2
name.go
2
name.go
@ -23,7 +23,7 @@ func CanonicalName(name string) string {
|
|||||||
func naviTitle(canonicalName string) string {
|
func naviTitle(canonicalName string) string {
|
||||||
var (
|
var (
|
||||||
html = fmt.Sprintf(`<h1 class="navi-title" id="navi-title">
|
html = fmt.Sprintf(`<h1 class="navi-title" id="navi-title">
|
||||||
<a href="/page/%s">%s</a><span aria-hidden="true" class="navi-title__colon">:</span>`, util.HomePage, util.SiteTitle)
|
<a href="/page/%s">%s</a><span aria-hidden="true" class="navi-title__colon">:</span>`, util.HomePage, util.SiteNavIcon)
|
||||||
prevAcc = `/page/`
|
prevAcc = `/page/`
|
||||||
parts = strings.Split(canonicalName, "/")
|
parts = strings.Split(canonicalName, "/")
|
||||||
rel = "up"
|
rel = "up"
|
||||||
|
@ -1,3 +1,6 @@
|
|||||||
|
{% import "github.com/bouncepaw/mycorrhiza/util" %}
|
||||||
|
{% import "github.com/bouncepaw/mycorrhiza/user" %}
|
||||||
|
|
||||||
{% func BaseHTML(title, body string, headElements ...string) %}
|
{% func BaseHTML(title, body string, headElements ...string) %}
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
@ -41,3 +44,25 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</tr>
|
||||||
{% endfunc %}
|
{% endfunc %}
|
||||||
|
|
||||||
|
{% func AboutHTML() %}
|
||||||
|
<main>
|
||||||
|
<section>
|
||||||
|
<h1>About {%s util.SiteName %}</h1>
|
||||||
|
<ul>
|
||||||
|
<li><b><a href="https://mycorrhiza.lesarbr.es">MycorrhizaWiki</a> version:</b> β 0.12 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>Administrators:</b> {%- for i, username := range user.ListUsersWithGroup("admin") -%}
|
||||||
|
{%- if i > 0 -%}<span aria-hidden="true">, </span>
|
||||||
|
{%- endif -%}
|
||||||
|
<a href="/page/{%s util.UserTree %}/{%s username %}">{%s username %}</a>{%- endfor -%}</li>
|
||||||
|
{%- else -%}
|
||||||
|
<li>This wiki does not use authorization</li>
|
||||||
|
{%- endif -%}
|
||||||
|
</ul>
|
||||||
|
<p>See <a href="/list">/list</a> for information about hyphae on this wiki.</p>
|
||||||
|
</section>
|
||||||
|
</main>
|
||||||
|
{% endfunc %}
|
||||||
|
@ -5,21 +5,27 @@
|
|||||||
package templates
|
package templates
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:1
|
//line templates/http_stuff.qtpl:1
|
||||||
|
import "github.com/bouncepaw/mycorrhiza/util"
|
||||||
|
|
||||||
|
//line templates/http_stuff.qtpl:2
|
||||||
|
import "github.com/bouncepaw/mycorrhiza/user"
|
||||||
|
|
||||||
|
//line templates/http_stuff.qtpl:4
|
||||||
import (
|
import (
|
||||||
qtio422016 "io"
|
qtio422016 "io"
|
||||||
|
|
||||||
qt422016 "github.com/valyala/quicktemplate"
|
qt422016 "github.com/valyala/quicktemplate"
|
||||||
)
|
)
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:1
|
//line templates/http_stuff.qtpl:4
|
||||||
var (
|
var (
|
||||||
_ = qtio422016.Copy
|
_ = qtio422016.Copy
|
||||||
_ = qt422016.AcquireByteBuffer
|
_ = qt422016.AcquireByteBuffer
|
||||||
)
|
)
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:1
|
//line templates/http_stuff.qtpl:4
|
||||||
func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, headElements ...string) {
|
func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, headElements ...string) {
|
||||||
//line templates/http_stuff.qtpl:1
|
//line templates/http_stuff.qtpl:4
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html>
|
<html>
|
||||||
@ -27,68 +33,68 @@ func StreamBaseHTML(qw422016 *qt422016.Writer, title, body string, headElements
|
|||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
<link rel="stylesheet" type="text/css" href="/static/common.css">
|
<link rel="stylesheet" type="text/css" href="/static/common.css">
|
||||||
<title>`)
|
<title>`)
|
||||||
//line templates/http_stuff.qtpl:7
|
//line templates/http_stuff.qtpl:10
|
||||||
qw422016.E().S(title)
|
qw422016.E().S(title)
|
||||||
//line templates/http_stuff.qtpl:7
|
//line templates/http_stuff.qtpl:10
|
||||||
qw422016.N().S(`</title>
|
qw422016.N().S(`</title>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:8
|
//line templates/http_stuff.qtpl:11
|
||||||
for _, el := range headElements {
|
for _, el := range headElements {
|
||||||
//line templates/http_stuff.qtpl:8
|
//line templates/http_stuff.qtpl:11
|
||||||
qw422016.N().S(el)
|
qw422016.N().S(el)
|
||||||
//line templates/http_stuff.qtpl:8
|
//line templates/http_stuff.qtpl:11
|
||||||
}
|
}
|
||||||
//line templates/http_stuff.qtpl:8
|
//line templates/http_stuff.qtpl:11
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:11
|
//line templates/http_stuff.qtpl:14
|
||||||
qw422016.N().S(body)
|
qw422016.N().S(body)
|
||||||
//line templates/http_stuff.qtpl:11
|
//line templates/http_stuff.qtpl:14
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, headElements ...string) {
|
func WriteBaseHTML(qq422016 qtio422016.Writer, title, body string, headElements ...string) {
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
StreamBaseHTML(qw422016, title, body, headElements...)
|
StreamBaseHTML(qw422016, title, body, headElements...)
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
func BaseHTML(title, body string, headElements ...string) string {
|
func BaseHTML(title, body string, headElements ...string) string {
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
WriteBaseHTML(qb422016, title, body, headElements...)
|
WriteBaseHTML(qb422016, title, body, headElements...)
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/http_stuff.qtpl:14
|
//line templates/http_stuff.qtpl:17
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:16
|
//line templates/http_stuff.qtpl:19
|
||||||
func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) {
|
func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int) {
|
||||||
//line templates/http_stuff.qtpl:16
|
//line templates/http_stuff.qtpl:19
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<main>
|
<main>
|
||||||
<h1>List of hyphae</h1>
|
<h1>List of hyphae</h1>
|
||||||
<p>This wiki has `)
|
<p>This wiki has `)
|
||||||
//line templates/http_stuff.qtpl:19
|
//line templates/http_stuff.qtpl:22
|
||||||
qw422016.N().D(pageCount)
|
qw422016.N().D(pageCount)
|
||||||
//line templates/http_stuff.qtpl:19
|
//line templates/http_stuff.qtpl:22
|
||||||
qw422016.N().S(` hyphae.</p>
|
qw422016.N().S(` hyphae.</p>
|
||||||
<table>
|
<table>
|
||||||
<thead>
|
<thead>
|
||||||
@ -99,105 +105,203 @@ func StreamHyphaListHTML(qw422016 *qt422016.Writer, tbody string, pageCount int)
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:28
|
//line templates/http_stuff.qtpl:31
|
||||||
qw422016.N().S(tbody)
|
qw422016.N().S(tbody)
|
||||||
//line templates/http_stuff.qtpl:28
|
//line templates/http_stuff.qtpl:31
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</main>
|
</main>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
func WriteHyphaListHTML(qq422016 qtio422016.Writer, tbody string, pageCount int) {
|
func WriteHyphaListHTML(qq422016 qtio422016.Writer, tbody string, pageCount int) {
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
StreamHyphaListHTML(qw422016, tbody, pageCount)
|
StreamHyphaListHTML(qw422016, tbody, pageCount)
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
func HyphaListHTML(tbody string, pageCount int) string {
|
func HyphaListHTML(tbody string, pageCount int) string {
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
WriteHyphaListHTML(qb422016, tbody, pageCount)
|
WriteHyphaListHTML(qb422016, tbody, pageCount)
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/http_stuff.qtpl:32
|
//line templates/http_stuff.qtpl:35
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:34
|
//line templates/http_stuff.qtpl:37
|
||||||
func StreamHyphaListRowHTML(qw422016 *qt422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
|
func StreamHyphaListRowHTML(qw422016 *qt422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
|
||||||
//line templates/http_stuff.qtpl:34
|
//line templates/http_stuff.qtpl:37
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="/page/`)
|
<td><a href="/page/`)
|
||||||
//line templates/http_stuff.qtpl:36
|
//line templates/http_stuff.qtpl:39
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line templates/http_stuff.qtpl:36
|
//line templates/http_stuff.qtpl:39
|
||||||
qw422016.N().S(`">`)
|
qw422016.N().S(`">`)
|
||||||
//line templates/http_stuff.qtpl:36
|
//line templates/http_stuff.qtpl:39
|
||||||
qw422016.E().S(hyphaName)
|
qw422016.E().S(hyphaName)
|
||||||
//line templates/http_stuff.qtpl:36
|
//line templates/http_stuff.qtpl:39
|
||||||
qw422016.N().S(`</a></td>
|
qw422016.N().S(`</a></td>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:37
|
//line templates/http_stuff.qtpl:40
|
||||||
if binaryPresent {
|
if binaryPresent {
|
||||||
//line templates/http_stuff.qtpl:37
|
//line templates/http_stuff.qtpl:40
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<td>`)
|
<td>`)
|
||||||
//line templates/http_stuff.qtpl:38
|
//line templates/http_stuff.qtpl:41
|
||||||
qw422016.E().S(binaryMime)
|
qw422016.E().S(binaryMime)
|
||||||
//line templates/http_stuff.qtpl:38
|
//line templates/http_stuff.qtpl:41
|
||||||
qw422016.N().S(`</td>
|
qw422016.N().S(`</td>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:39
|
//line templates/http_stuff.qtpl:42
|
||||||
} else {
|
} else {
|
||||||
//line templates/http_stuff.qtpl:39
|
//line templates/http_stuff.qtpl:42
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
<td></td>
|
<td></td>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:41
|
//line templates/http_stuff.qtpl:44
|
||||||
}
|
}
|
||||||
//line templates/http_stuff.qtpl:41
|
//line templates/http_stuff.qtpl:44
|
||||||
qw422016.N().S(`
|
qw422016.N().S(`
|
||||||
</tr>
|
</tr>
|
||||||
`)
|
`)
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
func WriteHyphaListRowHTML(qq422016 qtio422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
|
func WriteHyphaListRowHTML(qq422016 qtio422016.Writer, hyphaName, binaryMime string, binaryPresent bool) {
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
qw422016 := qt422016.AcquireWriter(qq422016)
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
StreamHyphaListRowHTML(qw422016, hyphaName, binaryMime, binaryPresent)
|
StreamHyphaListRowHTML(qw422016, hyphaName, binaryMime, binaryPresent)
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
qt422016.ReleaseWriter(qw422016)
|
qt422016.ReleaseWriter(qw422016)
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
}
|
}
|
||||||
|
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) string {
|
func HyphaListRowHTML(hyphaName, binaryMime string, binaryPresent bool) string {
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
qb422016 := qt422016.AcquireByteBuffer()
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
WriteHyphaListRowHTML(qb422016, hyphaName, binaryMime, binaryPresent)
|
WriteHyphaListRowHTML(qb422016, hyphaName, binaryMime, binaryPresent)
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
qs422016 := string(qb422016.B)
|
qs422016 := string(qb422016.B)
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
qt422016.ReleaseByteBuffer(qb422016)
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
return qs422016
|
return qs422016
|
||||||
//line templates/http_stuff.qtpl:43
|
//line templates/http_stuff.qtpl:46
|
||||||
|
}
|
||||||
|
|
||||||
|
//line templates/http_stuff.qtpl:48
|
||||||
|
func StreamAboutHTML(qw422016 *qt422016.Writer) {
|
||||||
|
//line templates/http_stuff.qtpl:48
|
||||||
|
qw422016.N().S(`
|
||||||
|
<main>
|
||||||
|
<section>
|
||||||
|
<h1>About `)
|
||||||
|
//line templates/http_stuff.qtpl:51
|
||||||
|
qw422016.E().S(util.SiteName)
|
||||||
|
//line templates/http_stuff.qtpl:51
|
||||||
|
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:54
|
||||||
|
if user.AuthUsed {
|
||||||
|
//line templates/http_stuff.qtpl:54
|
||||||
|
qw422016.N().S(` <li><b>User count:</b> `)
|
||||||
|
//line templates/http_stuff.qtpl:55
|
||||||
|
qw422016.N().D(user.Count())
|
||||||
|
//line templates/http_stuff.qtpl:55
|
||||||
|
qw422016.N().S(`</li>
|
||||||
|
<li><b>Home page:</b> <a href="/">`)
|
||||||
|
//line templates/http_stuff.qtpl:56
|
||||||
|
qw422016.E().S(util.HomePage)
|
||||||
|
//line templates/http_stuff.qtpl:56
|
||||||
|
qw422016.N().S(`</a></li>
|
||||||
|
<li><b>Administrators:</b>`)
|
||||||
|
//line templates/http_stuff.qtpl:57
|
||||||
|
for i, username := range user.ListUsersWithGroup("admin") {
|
||||||
|
//line templates/http_stuff.qtpl:58
|
||||||
|
if i > 0 {
|
||||||
|
//line templates/http_stuff.qtpl:58
|
||||||
|
qw422016.N().S(`<span aria-hidden="true">, </span>
|
||||||
|
`)
|
||||||
|
//line templates/http_stuff.qtpl:59
|
||||||
|
}
|
||||||
|
//line templates/http_stuff.qtpl:59
|
||||||
|
qw422016.N().S(` <a href="/page/`)
|
||||||
|
//line templates/http_stuff.qtpl:60
|
||||||
|
qw422016.E().S(util.UserTree)
|
||||||
|
//line templates/http_stuff.qtpl:60
|
||||||
|
qw422016.N().S(`/`)
|
||||||
|
//line templates/http_stuff.qtpl:60
|
||||||
|
qw422016.E().S(username)
|
||||||
|
//line templates/http_stuff.qtpl:60
|
||||||
|
qw422016.N().S(`">`)
|
||||||
|
//line templates/http_stuff.qtpl:60
|
||||||
|
qw422016.E().S(username)
|
||||||
|
//line templates/http_stuff.qtpl:60
|
||||||
|
qw422016.N().S(`</a>`)
|
||||||
|
//line templates/http_stuff.qtpl:60
|
||||||
|
}
|
||||||
|
//line templates/http_stuff.qtpl:60
|
||||||
|
qw422016.N().S(`</li>
|
||||||
|
`)
|
||||||
|
//line templates/http_stuff.qtpl:61
|
||||||
|
} else {
|
||||||
|
//line templates/http_stuff.qtpl:61
|
||||||
|
qw422016.N().S(` <li>This wiki does not use authorization</li>
|
||||||
|
`)
|
||||||
|
//line templates/http_stuff.qtpl:63
|
||||||
|
}
|
||||||
|
//line templates/http_stuff.qtpl:63
|
||||||
|
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:68
|
||||||
|
}
|
||||||
|
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
func WriteAboutHTML(qq422016 qtio422016.Writer) {
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
qw422016 := qt422016.AcquireWriter(qq422016)
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
StreamAboutHTML(qw422016)
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
qt422016.ReleaseWriter(qw422016)
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
}
|
||||||
|
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
func AboutHTML() string {
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
qb422016 := qt422016.AcquireByteBuffer()
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
WriteAboutHTML(qb422016)
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
qs422016 := string(qb422016.B)
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
qt422016.ReleaseByteBuffer(qb422016)
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
|
return qs422016
|
||||||
|
//line templates/http_stuff.qtpl:68
|
||||||
}
|
}
|
||||||
|
@ -8,6 +8,28 @@ var AuthUsed bool
|
|||||||
var users sync.Map
|
var users sync.Map
|
||||||
var tokens sync.Map
|
var tokens sync.Map
|
||||||
|
|
||||||
|
func ListUsersWithGroup(group string) []string {
|
||||||
|
usersWithTheGroup := []string{}
|
||||||
|
users.Range(func(_, v interface{}) bool {
|
||||||
|
userobj := v.(*User)
|
||||||
|
|
||||||
|
if userobj.Group == group {
|
||||||
|
usersWithTheGroup = append(usersWithTheGroup, userobj.Name)
|
||||||
|
}
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
return usersWithTheGroup
|
||||||
|
}
|
||||||
|
|
||||||
|
func Count() int {
|
||||||
|
i := 0
|
||||||
|
users.Range(func(k, v interface{}) bool {
|
||||||
|
i++
|
||||||
|
return true
|
||||||
|
})
|
||||||
|
return i
|
||||||
|
}
|
||||||
|
|
||||||
func HasUsername(username string) bool {
|
func HasUsername(username string) bool {
|
||||||
_, has := users.Load(username)
|
_, has := users.Load(username)
|
||||||
return has
|
return has
|
||||||
|
@ -11,7 +11,8 @@ var (
|
|||||||
URL string
|
URL string
|
||||||
ServerPort string
|
ServerPort string
|
||||||
HomePage string
|
HomePage string
|
||||||
SiteTitle string
|
SiteNavIcon string
|
||||||
|
SiteName string
|
||||||
WikiDir string
|
WikiDir string
|
||||||
UserTree string
|
UserTree string
|
||||||
AuthMethod string
|
AuthMethod string
|
||||||
|
Loading…
Reference in New Issue
Block a user