M TODO => TODO +8 -5
@@ 1,10 1,13 @@
-atom feed
-config page rewrite
+MULTI INSTANCE TODO
+finish config page rewrite
+atom feed based on search term
+TOS privacy policy
+login from another instance somehow
+
+-- waterline --
+
move email and username to change password page
-get forum should 404 instead of 500
-get thread should 404 instead of 500
auth cookie not set until refresh? on oauth
-TOS privacy policy
'no threads' should be full width.
cleanup change password
Forum sections
M server/config.go => server/config.go +5 -1
@@ 58,8 58,12 @@ func SaveConfig(c Config) error {
func GetConfig() (Config, error) {
var c Config
// TODO cleanup
+ var err error
+ c.BoardName, err = GetConfigValue("board-name")
+ if err != nil {
+ return Config{}, err
+ }
c.BoardDescription, _ = GetConfigValue("board-description")
- c.BoardName, _ = GetConfigValue("board-description")
if SingleInstance {
c.GoogleOAuthClientID, _ = GetConfigValue("google-oauth-client-id")
c.GoogleOAuthClientSecret, _ = GetConfigValue("google-oauth-client-secret")
M server/views/control.html => server/views/control.html +4 -7
@@ 4,14 4,11 @@
<h2>Config</h2>
<form method="POST" action="/update-config">
<label for="requires-approval">Registration requires admin approval?
- </label><br>
- <select name="requires-approval" id="requires-approval">
- <option value="1">true</option>
- <option value="0">false</option>
- </select><br>
- <label for="board-description">Board description</label><br>
+ </label>
+ <input {{if .Config.RequiresApproval}}checked{{end}} name="requires-approval" id="reqiures-approval" type="checkbox"><br>
+ <label for="board-description">Board description:</label><br>
<input name="board-description" id="board-description" value="{{.Config.BoardDescription}}"></input><br>
- <input type="hidden" name="CSRF" value="{{.CSRFToken}}"><br>
+ <input type="hidden" name="CSRF" value="{{.CSRFToken}}">
{{ if .SingleInstace }}
googleconfig goes here
{{ end }}
M server/views/style.css => server/views/style.css +1 -0
@@ 128,6 128,7 @@ body {
display:inline;
}
+
#page-header {
padding: 0.5rem;
display: flex;
M server/web.go => server/web.go +12 -2
@@ 1,6 1,8 @@
package server
import (
+ "database/sql"
+ "errors"
"fmt"
"log/slog"
"net/http"
@@ 94,7 96,10 @@ func indexPage(w http.ResponseWriter, r *http.Request) {
func forumPage(w http.ResponseWriter, r *http.Request) {
tmpl := make(map[string]any)
f, err := getForumBySlug(r.PathValue("forum"))
- if err != nil {
+ if errors.Is(err, sql.ErrNoRows) {
+ notFound(w, r)
+ return
+ } else if err != nil {
serverError(w, r, err)
return
}
@@ 126,13 131,18 @@ func threadPage(w http.ResponseWriter, r *http.Request) {
notFound(w, r)
return
}
+
forum, err := getForumBySlug(r.PathValue("forum"))
if err != nil {
serverError(w, r, err)
}
page := page(r)
thread, err := getThread(threadID)
- if err != nil {
+ // TODO -- doesnt work?
+ if errors.Is(err, sql.ErrNoRows) {
+ notFound(w, r)
+ return
+ } else if err != nil {
serverError(w, r, err)
return
}