allow setting a few more custom messages

master
Ted Unangst 5 years ago
parent 5d7ed580b4
commit 47bdc1256b

@ -81,14 +81,12 @@ Site CSS may be overridden by creating a
.Pa views/local.css
file.
.Pp
A custom message me be set by editing the database.
Custom messages may be set by editing the database.
(Sorry.)
.Dl insert into config values ('servermsg', 'message');
.Dl insert into config values ('aboutmsg', 'message');
.Dl insert into config values ('loginmsg', 'message');
.Pp
The
.Pa views/about.html
page doesn't change too frequently.
It should be safe to edit.
.Ss ADMIN
New users can be added with the
.Ic adduser

@ -137,7 +137,9 @@ type Honker struct {
var serverName string
var iconName = "icon.png"
var serverMsg = "Things happen."
var serverMsg = template.HTML(`<h2>Things happen.</h2>`)
var aboutMsg = template.HTML(`<h3>What is honk?</h3><p>Honk is amazing!`)
var loginMsg = template.HTML(`<h2>login</h2>`)
func ElaborateUnitTests() {
}
@ -160,6 +162,8 @@ func main() {
log.Fatal("incorrect database version. run upgrade.")
}
getconfig("servermsg", &serverMsg)
getconfig("aboutmsg", &aboutMsg)
getconfig("loginmsg", &loginMsg)
getconfig("servername", &serverName)
getconfig("usersep", &userSep)
getconfig("honksep", &honkSep)

@ -1,7 +1,6 @@
{{ template "header.html" . }}
<main>
<div class="info">
<h3>What is honk?</h3>
<p>Honk is amazing!
{{ .AboutMsg }}
</div>
</main>

@ -1,8 +1,8 @@
{{ template "header.html" . }}
<main>
<div class="info">
{{ .LoginMsg }}
<form action="/dologin" method="POST">
<p><span class="title">login</span>
<p><input tabindex=1 type="text" name="username" autocomplete=off> - username
<p><input tabindex=1 type="password" name="password"> - password
<p><button tabindex=1 name="login" value="login">login</button>

@ -98,7 +98,7 @@ func homepage(w http.ResponseWriter, r *http.Request) {
userid = u.UserID
switch r.URL.Path {
case "/atme":
templinfo["PageName"] = "at me!"
templinfo["ServerMessage"] = "at me!"
templinfo["PageName"] = "atme"
honks = gethonksforme(userid, 0)
case "/events":
@ -1586,6 +1586,8 @@ func servehelp(w http.ResponseWriter, r *http.Request) {
}
func servehtml(w http.ResponseWriter, r *http.Request) {
templinfo := getInfo(r)
templinfo["AboutMsg"] = aboutMsg
templinfo["LoginMsg"] = loginMsg
err := readviews.Execute(w, r.URL.Path[1:]+".html", templinfo)
if err != nil {
log.Print(err)

Loading…
Cancel
Save