Web forum themes: a classic theme in the manner of IPB 2

The forum can wear more than one look.  A theme is a stylesheet and,
in themes/NAME/, templates of its own for the pages it lays out
differently, parsed over the default's.

- ipb2: a board of the mid-2000s in the manner of Invision Power Board
  2's default skin: white page, navy-outlined boxes, gradient title and
  sub-title bars, pale blue rows, Logged in as / Welcome Guest bars,
  Last Post Info, topic folders, post tables with Member No. and Top,
  quote boxes, big blue buttons, Fast Reply, the footer bar.  Its own
  CSS and templates; no code or images taken from IPB.
- ipb3: the existing look (its stylesheet now ipb3.css)
- a theme chooser at the foot of every page, for guests too, kept in a
  cookie; [http] forum_theme sets the forum's own, checked by bbs check
- docs: Web-Forum themes, configuration, development

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01AFQhReUqUc7F5srk2hViqr
This commit is contained in:
Claude committed 2026-10-12 23:39:12 +00:00
1 parent 546af1eee3
commit ae228616f2
20 files changed
+865 -22

No files matched your search

+1 -1
View File
@@ -84,7 +84,7 @@ What there is:
elsewhere by telnet or RLogin, and the door networks BBSLink and DoorParty
- [chat](https://github.com/Neo-Desktop/bbs-sec/wiki/Chat-and-Paging): rooms, messages to a node, paging the sysop
- [finger and gopher](https://github.com/Neo-Desktop/bbs-sec/wiki/Finger-and-Gopher): who is on, and chosen areas in gopherspace
- [a web forum](https://github.com/Neo-Desktop/bbs-sec/wiki/Web-Forum): the message areas as a bulletin board in the browser, in the manner of Invision Power Board 3
- [a web forum](https://github.com/Neo-Desktop/bbs-sec/wiki/Web-Forum): the message areas as a bulletin board in the browser, in the manner of Invision Power Board 3, or of IPB 2 (themes)
- [a web terminal](https://github.com/Neo-Desktop/bbs-sec/wiki/HTTP-API#the-web-terminal): the BBS in a browser (xterm.js, built in)
- [an HTTP API](https://github.com/Neo-Desktop/bbs-sec/wiki/HTTP-API): REST, server-sent events, and WebSockets (JSON or protobuf) where web clients chat with terminal callers; Prometheus metrics
- [customization](https://github.com/Neo-Desktop/bbs-sec/wiki/Customization): ANSI art and 3270 screens, menus of the sysop's, @-codes, the prompts' words
+3
View File
@@ -211,6 +211,9 @@ address = 127.0.0.1:2513
; forum_guests: those not logged in read the areas anyone may read
;forum = yes
;forum_guests = yes
; the forum's theme until a caller chooses (at the foot of each page):
; ipb3 (in the manner of Invision Power Board 3) or ipb2 (classic, as IPB 2)
;forum_theme = ipb3
; Access levels: a user's level (0-255) gets what the [level] at or
; below it says; areas, doors and menus may require a level and flags
+5 -2
View File
@@ -30,7 +30,7 @@
| `doors/dosemu2` | the Docker image DOS doors run in: dosemu2, its FOSSIL on COM1 |
| `internal/finger` | the finger server |
| `internal/gopher` | the gopher server |
| `internal/forum` | the web forum: its pages (html/template), the skin's CSS (`static/`), sessions by the API's tokens |
| `internal/forum` | the web forum: its pages (html/template; `themes/NAME/` a theme's own, over `templates/`), the themes' CSS (`static/`), sessions by the API's tokens |
| `internal/api` | the HTTP API: REST, server-sent events, WebSockets, metrics, OpenAPI; the web terminal page (`web/`: xterm.js, the page) |
| `proto` | the WebSocket protocol, `bbs.v1` (`make proto` regenerates `internal/api/pb`) |
| `internal/tcpserv` | what finger and gopher share: limits, timeouts |
@@ -240,7 +240,10 @@ topics and areas, aliases hiding the writer, deleting (the writer's own,
the sysop's any), news-only areas, search and who's online; in the store,
topics threaded across areas, read marks, a topic mended when its first
post or its replies' parent goes, and threads found for messages from
before. Updating xterm.js:
before. Every page in each theme, for a guest and a member; choosing a
theme (a member's form needing its token, an unknown theme refused, no
going back off the forum), and the forum's own theme until a caller
chooses. Updating xterm.js:
`npm pack @xterm/xterm @xterm/addon-fit`, and copy `lib/xterm.js`,
`css/xterm.css`, `lib/addon-fit.js` and the license into
`internal/api/web` (without their source map lines).
+1 -1
View File
@@ -26,7 +26,7 @@ key_file = /etc/bbs/tls/key.pem
| `rate`, `burst` | `10`, `20` | requests a second per token (per address without one), and how many may come at once |
| `session_hours` | `24` | how long a login's token lasts |
| `terminal` | `yes` | the web terminal page (below) |
| `forum`, `forum_guests` | `yes`, `yes` | the [web forum](Web-Forum), and guests reading it |
| `forum`, `forum_guests`, `forum_theme` | `yes`, `yes`, `ipb3` | the [web forum](Web-Forum), guests reading it, and its theme (`ipb3` or `ipb2`) |
The OpenAPI 3.1 description is at `/api/v1/openapi.json`.
+1 -1
View File
@@ -83,7 +83,7 @@ What there is:
[IRC](IRC) channels too, for IRC clients, and [MRC](MRC)'s rooms join the
BBSes' Multi Relay Chat
- [finger and gopher](Finger-and-Gopher): who is on, and chosen areas in gopherspace
- [a web forum](Web-Forum): the message areas as a bulletin board in the browser, in the manner of Invision Power Board 3
- [a web forum](Web-Forum): the message areas as a bulletin board in the browser, in the manner of Invision Power Board 3, or of IPB 2 (themes)
- [a web terminal](HTTP-API#the-web-terminal): the BBS in a browser (xterm.js, built in)
- [an HTTP API](HTTP-API): REST, server-sent events, and WebSockets (JSON or protobuf) where web clients chat with terminal callers; Prometheus metrics
- [customization](Customization): ANSI art and 3270 screens, menus of the sysop's, @-codes, the prompts' words
+20 -4
View File
@@ -2,10 +2,10 @@
The HTTP API's server also serves the message areas as a web forum, at
`/forum/` (and `/`, which goes there). It is laid out like the bulletin
boards of the early 2010s (Invision Power Board 3 and its kind):
categories of forums, topics, and posts with their authors beside them.
The look is the BBS's own CSS, built into the `bbs` binary; nothing is
loaded from elsewhere, and no script runs on the pages.
boards of their day: categories of forums, topics, and posts with their
authors beside them, in one of two [themes](#themes). The look is the
BBS's own CSS, built into the `bbs` binary; nothing is loaded from
elsewhere, and no script runs on the pages.
It is the same BBS: the same accounts, areas and messages. A post on the
forum is a message on the terminals, in QWK packets, on NNTP and FidoNet
@@ -16,12 +16,14 @@ forum is a message on the terminals, in QWK packets, on NNTP and FidoNet
address = :8443
;forum = yes
;forum_guests = yes
;forum_theme = ipb3
```
| setting | default | |
|---|---|---|
| `forum` | `yes` | the forum at `/forum/` (with `no`, `/` goes to the web terminal again) |
| `forum_guests` | `yes` | those not logged in may read the areas anyone may read (areas with a `read` requirement never) |
| `forum_theme` | `ipb3` | the theme callers get until they choose one ([below](#themes)) |
## The pages
@@ -67,6 +69,20 @@ On a post:
- A poll is answered by those who may post in its area; answering again
changes the answer.
## Themes
| theme | |
|---|---|
| `ipb3` | the default: a board of the early 2010s in the manner of Invision Power Board 3: a dark user bar, a navy header with tabs, rounded blue category bars, posts with their author's column on the left |
| `ipb2` | classic: a board of the mid-2000s in the manner of Invision Power Board 2: a white page, boxes outlined in navy, blue gradient title bars, pale blue rows, small Verdana; *Logged in as* and *Welcome Guest* bars, *Last Post Info*, *Fast Reply*, big blue buttons |
Both are this BBS's own CSS and templates, drawn to look like the boards
they recall; no code or images are taken from them. `forum_theme` is the
forum's; anyone (guests too) may choose another at the foot of every page,
kept in a cookie (`bbs_forum_theme`) for a year. A theme lays out the
board, topic lists, topics and profiles its own way, and shows the rest
(posting, searching, signing in) in its colors.
## Logins
A login is the HTTP API's session token (lasting `session_hours`), kept in
+1
View File
@@ -46,6 +46,7 @@ type Settings struct {
Terminal bool // the web terminal page (if Server.Terminal is set)
Forum bool // the web forum, /forum/
Guests bool // the forum's guests read the areas anyone may
Theme string // the forum's theme until a caller chooses ("": the default)
}
// Server serves the API.
+1 -1
View File
@@ -50,7 +50,7 @@ func (f forumSessions) Logout(secret string) {
// caller's address as the API's are.
func (s *Server) forum() (http.Handler, error) {
f := &forum.Server{B: s.B, Sessions: forumSessions{s}, Guests: s.S.Guests, Secure: s.S.TLS,
Terminal: s.terminalOn(), TTL: s.S.SessionTTL}
Terminal: s.terminalOn(), TTL: s.S.SessionTTL, Theme: s.S.Theme}
h, err := f.Handler()
if err != nil {
return nil, err
+18
View File
@@ -20,6 +20,7 @@ var funcs = template.FuncMap{
"body": renderBody,
"when": when,
"date": func(t time.Time) string { return t.Format("02 January 2006") },
"longdate": longDate,
"initial": initial,
"avatar": avatarClass,
"group": groupTitle,
@@ -60,6 +61,23 @@ func when(t time.Time) string {
return t.Format("02 January 2006 - 03:04 PM")
}
// longDate is a time in full, as "12th October 2026 - 11:21 PM".
func longDate(t time.Time) string {
d := t.Day()
suffix := "th"
if d < 11 || d > 13 {
switch d % 10 {
case 1:
suffix = "st"
case 2:
suffix = "nd"
case 3:
suffix = "rd"
}
}
return strconv.Itoa(d) + suffix + t.Format(" January 2006 - 03:04 PM")
}
func plural(n int, one, many string) string {
if n == 1 {
return groupDigits(n) + " " + one
+77 -10
View File
@@ -24,7 +24,7 @@ import (
"github.com/Neo-Desktop/bbs-sec/internal/store"
)
//go:embed templates/*.html static/*
//go:embed templates/*.html themes/*/*.html static/*
var content embed.FS
// Sessions are the logins: the HTTP API's session tokens.
@@ -38,6 +38,30 @@ type Sessions interface {
Logout(secret string)
}
// Theme is a look the forum can wear: its own stylesheet, and templates
// of its own in themes/<Name>/ for the pages it lays out differently
// (the rest are the default's).
type Theme struct {
Name string // as in bbs.conf's forum_theme
Title string // as the theme chooser shows it
}
// Themes are the forum's looks; the first is the default.
var Themes = []Theme{
{"ipb3", "Default (IPB 3 style)"},
{"ipb2", "Classic (IPB 2 style)"},
}
// KnownTheme says whether there is a theme of the name.
func KnownTheme(name string) bool {
for _, t := range Themes {
if t.Name == name {
return true
}
}
return false
}
// Server serves the forum.
type Server struct {
B *bbs.BBS
@@ -46,27 +70,41 @@ type Server struct {
Secure bool // the cookie only over TLS
Terminal bool // the web terminal is there to link to
TTL time.Duration // a login's
Theme string // the theme callers get until they choose ("": the first)
tmpl *template.Template
key []byte // for forms' CSRF tokens
tmpl map[string]*template.Template // by theme
key []byte // for forms' CSRF tokens
}
// Base is where the forum is.
const Base = "/forum"
const (
cookieName = "bbs_forum"
perPage = 20
cookieName = "bbs_forum"
themeCookie = "bbs_forum_theme"
perPage = 20
)
// Handler is the forum's routes, under Base.
func (s *Server) Handler() (http.Handler, error) {
if s.tmpl == nil {
t, err := template.New("").Funcs(funcs).ParseFS(content, "templates/*.html")
base, err := template.New("").Funcs(funcs).ParseFS(content, "templates/*.html")
if err != nil {
return nil, err
}
s.tmpl = t
s.tmpl = map[string]*template.Template{}
for _, th := range Themes {
t, err := base.Clone()
if err != nil {
return nil, err
}
if own, _ := fs.Glob(content, "themes/"+th.Name+"/*.html"); len(own) > 0 {
if t, err = t.ParseFS(content, own...); err != nil {
return nil, fmt.Errorf("theme %s: %w", th.Name, err)
}
}
s.tmpl[th.Name] = t
}
s.key = make([]byte, 32)
rand.Read(s.key)
}
@@ -93,6 +131,7 @@ func (s *Server) Handler() (http.Handler, error) {
"POST " + Base + "/logout": s.logout,
"GET " + Base + "/register": s.register,
"POST " + Base + "/register": s.register,
"POST " + Base + "/theme": s.chooseTheme,
} {
mux.HandleFunc(pattern, s.wrap(h))
}
@@ -220,7 +259,10 @@ type page struct {
Notice string
Now time.Time
Online int
Body any // the page's own
Theme string // the theme in use
Themes []Theme // to choose from
Path string // this page's, to come back to
Body any // the page's own
}
type crumb struct {
@@ -230,7 +272,8 @@ type crumb struct {
// render shows a page.
func (q *req) render(status int, name, title string, crumbs []crumb, body any) {
p := page{Title: title, BBS: q.s.B.Name, User: q.user, CSRF: q.csrf(), Crumbs: crumbs, Terminal: q.s.Terminal,
Register: q.user == nil && q.s.B.NewUsers, Now: time.Now(), Body: body, Notice: q.r.URL.Query().Get("notice")}
Register: q.user == nil && q.s.B.NewUsers, Now: time.Now(), Body: body, Notice: q.r.URL.Query().Get("notice"),
Theme: q.theme(), Themes: Themes, Path: q.r.URL.RequestURI()}
switch {
case strings.HasPrefix(name, "online"):
p.Tab = "online"
@@ -245,7 +288,7 @@ func (q *req) render(status int, name, title string, crumbs []crumb, body any) {
}
}
var buf strings.Builder
if err := q.s.tmpl.ExecuteTemplate(&buf, name, p); err != nil {
if err := q.s.tmpl[p.Theme].ExecuteTemplate(&buf, name, p); err != nil {
q.s.B.Log.Printf("forum: %s: %v", name, err)
http.Error(q.w, "the page could not be made", http.StatusInternalServerError)
return
@@ -256,6 +299,30 @@ func (q *req) render(status int, name, title string, crumbs []crumb, body any) {
fmt.Fprint(q.w, buf.String())
}
// theme is the theme the caller chose, or the forum's.
func (q *req) theme() string {
if c, err := q.r.Cookie(themeCookie); err == nil && KnownTheme(c.Value) {
return c.Value
}
if KnownTheme(q.s.Theme) {
return q.s.Theme
}
return Themes[0].Name
}
// chooseTheme keeps the caller's choice of theme (in a cookie: guests
// choose too) and goes back to the page they chose it on.
func (s *Server) chooseTheme(q *req) {
name := q.r.PostForm.Get("theme")
if !KnownTheme(name) {
q.fail(http.StatusBadRequest, "There is no such theme.")
return
}
http.SetCookie(q.w, &http.Cookie{Name: themeCookie, Value: name, Path: Base, MaxAge: 365 * 24 * 3600,
HttpOnly: true, Secure: s.Secure, SameSite: http.SameSiteLaxMode})
q.redirect(safeBack(q.r.PostForm.Get("back")))
}
// fail shows an error page.
func (q *req) fail(status int, msg string) {
q.render(status, "error.html", "Error", nil, map[string]any{"Message": msg, "Status": status})
+65 -1
View File
@@ -65,6 +65,7 @@ type site struct {
b *bbs.BBS
ts *httptest.Server
ar map[string]*store.Area
fs *Server
}
func setup(t *testing.T) *site {
@@ -101,7 +102,7 @@ func setup(t *testing.T) *site {
}
ts := httptest.NewServer(h)
t.Cleanup(ts.Close)
return &site{t: t, b: b, ts: ts, ar: ar}
return &site{t: t, b: b, ts: ts, ar: ar, fs: fs}
}
// browser is a client with its cookies.
@@ -369,3 +370,66 @@ func TestRenderBody(t *testing.T) {
t.Error(groupDigits(1234567))
}
}
func TestThemes(t *testing.T) {
s := setup(t)
alice, guest := s.browser(), s.browser()
alice.login("alice")
gen := "/forum/area/" + itoa(s.ar["General"].ID)
_, topic, _ := alice.post(gen+"/new", gen+"/new", url.Values{"subject": {"Old skins"},
"body": {"Remember these?"}, "poll": {"Yes\nNo"}})
alice.post(topic, topic+"/reply", url.Values{"body": {"alice wrote:\n> Remember these?\n\nI do."}})
pages := []string{"/forum/", gen, gen + "/new", topic, "/forum/user/alice", "/forum/online",
"/forum/search?q=skins", "/forum/area/999"}
// the default theme, and the chooser offering both
_, _, body := guest.get("/forum/")
has(t, "default", body, "/forum/static/ipb3.css", `<option value="ipb2">`, `<option value="ipb3" selected>`)
for _, th := range Themes {
css := "/forum/static/" + th.Name + ".css"
if code, _, _ := guest.get(css); code != 200 {
t.Errorf("%s: %d", css, code)
}
// chosen by a guest (no token) and by a member (with one): back
// to the page it was chosen on
code, at, _ := guest.post("", "/forum/theme", url.Values{"theme": {th.Name}, "back": {gen}})
if code != 200 || at != gen {
t.Errorf("guest choosing %s: %d %s", th.Name, code, at)
}
if code, _, _ := alice.post("", "/forum/theme", url.Values{"theme": {th.Name}, "back": {gen}}); code != 403 {
t.Errorf("member choosing %s without a token: %d", th.Name, code)
}
alice.post(gen, "/forum/theme", url.Values{"theme": {th.Name}, "back": {gen}})
for _, who := range []*browser{guest, alice} {
for _, p := range pages {
code, _, body := who.get(p)
if code >= 500 || !strings.Contains(body, css) {
t.Errorf("%s %s: %d, no %s", th.Name, p, code, css)
}
has(t, th.Name+" "+p, body, `<option value="`+th.Name+`" selected>`)
}
}
_, _, body := alice.get(topic)
has(t, th.Name+" topic", body, "Remember these?", "I do.", `class="quote"`, `name="answer"`)
}
_, _, body = alice.get(topic)
has(t, "classic topic", body, "Logged in as:", "Fast Reply", "Member No.:", "Add Reply")
_, _, body = guest.get("/forum/")
has(t, "classic index", body, "Welcome Guest", "Last Post Info", "Board Statistics")
// no such theme; an outside page to go back to
if code, _, _ := guest.post("", "/forum/theme", url.Values{"theme": {"nope"}}); code != 400 {
t.Errorf("unknown theme: %d", code)
}
if _, at, _ := guest.post("", "/forum/theme", url.Values{"theme": {"ipb3"}, "back": {"//evil.example/"}}); at != "/forum/" {
t.Errorf("went back to %s", at)
}
// the forum's own choice, until a caller makes theirs
s.fs.Theme = "ipb2"
_, _, body = s.browser().get("/forum/")
has(t, "forum's theme", body, "/forum/static/ipb2.css")
_, _, body = guest.get("/forum/")
has(t, "guest's own", body, "/forum/static/ipb3.css")
}
+386
View File
@@ -0,0 +1,386 @@
/*
* The forum's classic theme: laid out in the manner of the bulletin boards
* of the mid-2000s (Invision Power Board 2's default skin and its kind):
* a white page, boxes outlined in navy, blue gradient title bars, pale
* blue rows, small Verdana. Written for this BBS; it takes no code or
* images from any board.
*/
:root {
--navy: #072a66;
--title-top: #5176b5;
--title-bottom: #75adee;
--sub-top: #b3c1d8;
--sub-bottom: #d6ddea;
--subtext: #3a4f6c;
--row1: #dfe6ef;
--row2: #e4eaf2;
--post1: #f5f9fd;
--post2: #eef2f7;
--dark3: #d1dceb;
--catend: #8394b2;
--line: #5176b5;
--text: #222;
--muted: #434951;
--link-hover: #34498b;
}
html { overflow-x: auto; }
body {
margin: 0;
padding: 0;
background: #fff;
color: var(--text);
font: 11px/135% Verdana, Tahoma, Arial, sans-serif;
}
a:link, a:visited, a:active { color: var(--text); text-decoration: underline; }
a:hover { color: var(--link-hover); }
b, strong { font-weight: bold; }
p { margin: 0; }
form { margin: 0; }
img { border: 0; vertical-align: middle; }
#ipbwrapper { width: 98%; max-width: 1400px; margin: 20px auto; text-align: left; }
.inline-form { display: inline; }
.linkish { background: none; border: 0; padding: 0; margin: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }
.linkish:hover { color: var(--link-hover); }
.desc { color: var(--muted); font-size: 10px; }
/* --- the header: logo strip, menu bar */
.borderwrap { background: #fff; border: 1px solid var(--navy); margin: 0 0 15px; padding: 0; }
#header { margin-bottom: 0; }
#logostrip {
height: 68px;
border: 1px solid #fff;
background: linear-gradient(to bottom, #5075b4, #77b0f1);
overflow: hidden;
}
#logostrip .logo { display: flex; align-items: center; height: 68px; padding: 0 14px; text-decoration: none; color: #fff; }
.logo-mark {
width: 40px; height: 40px; margin-right: 12px; flex: none;
border: 3px solid #fff; border-radius: 3px;
background: linear-gradient(135deg, rgba(255,255,255,0.35) 0 45%, transparent 45%), linear-gradient(to bottom, #3f63a3, #5d8ccf);
box-shadow: 0 1px 2px rgba(0,0,0,0.25);
}
.logo-text { display: flex; flex-direction: column; line-height: 1; }
.logo-name { font: bold 28px/1 "Trebuchet MS", Verdana, Arial, sans-serif; letter-spacing: 1px; text-shadow: 0 1px 1px rgba(7,42,102,0.5); }
.logo-sub { margin-top: 5px; font-size: 10px; letter-spacing: 6px; text-transform: uppercase; color: #e8f0fb; }
#submenu {
display: flex; justify-content: space-between; align-items: stretch;
height: 29px;
border: 1px solid #fff; border-top: 0;
background: linear-gradient(to bottom, var(--sub-top), var(--sub-bottom));
color: var(--subtext);
font-size: 10px; font-weight: bold;
}
#submenu p { display: flex; }
#submenu a:link, #submenu a:visited {
display: block; padding: 7px 8px; color: var(--subtext); text-decoration: none;
border-left: 1px solid #dce3ee;
}
#submenu p.home a { border-left: 0; border-right: 1px solid #dce3ee; }
#submenu a:hover { color: var(--line); background: linear-gradient(to bottom, #b8c2d2, #d9dee7); }
#userlinks, #userlinksguest {
display: flex; justify-content: space-between; flex-wrap: wrap;
margin: 5px 0 0;
padding: 0 6px;
background: #f0f5fa;
border: 1px solid #c2cfdf;
}
#userlinksguest { background: #f4e7ea; border-color: #986265; justify-content: center; }
#userlinks > div, #userlinksguest > div { padding: 7px 0; font-size: 10px; }
#navstrip { padding: 14px 0 8px; font-size: 12px; font-weight: bold; color: #999; }
#navstrip a:link, #navstrip a:visited { color: var(--text); text-decoration: none; }
#navstrip a:hover { color: var(--line); text-decoration: underline; }
.navhome {
display: inline-block; width: 14px; height: 11px; margin-right: 6px; vertical-align: -1px;
background: linear-gradient(to bottom, var(--title-top), var(--navy)); border-radius: 2px;
}
.navsep { color: var(--line); margin: 0 3px; }
/* --- boxes: their title bars, sub-title bars and ends */
.maintitle, .box > h2.maintitle {
display: flex; align-items: center; flex-wrap: wrap; gap: 0 6px;
margin: 0;
padding: 8px;
border: 1px solid #fff; border-bottom-color: var(--line);
background: linear-gradient(to bottom, var(--title-top), var(--title-bottom));
color: #fff;
font-size: 12px; font-weight: bold;
}
.maintitle a:link, .maintitle a:visited { color: #fff; text-decoration: none; }
.maintitle .tdesc, .maintitle .count { margin-left: auto; font-size: 10px; font-weight: normal; color: #eef4fc; }
.maintitle .tdesc::before { content: ""; }
.caticon {
display: inline-block; width: 9px; height: 9px; flex: none;
border: 1px solid #fff; background: var(--navy);
box-shadow: inset 0 0 0 2px var(--title-bottom);
}
.catend { height: 5px; background: var(--catend); font-size: 1px; }
.ipbtable { width: 100%; border-collapse: separate; border-spacing: 1px; }
.ipbtable td { padding: 5px; vertical-align: middle; }
.ipbtable th, table.board th, .formsubtitle {
padding: 5px;
border-bottom: 1px solid var(--line);
background: linear-gradient(to bottom, var(--sub-top), var(--sub-bottom));
color: var(--subtext);
font-size: 10px; font-weight: bold; letter-spacing: 1px; text-align: left;
}
.formsubtitle { border: 0; border-top: 1px solid var(--line); letter-spacing: 0; }
.ipbtable th.num, .ipbtable td.num { text-align: center; width: 7%; white-space: nowrap; }
.ipbtable th.lastcol, .ipbtable td.lastcol { width: 24%; }
.row1 { background: var(--row1); }
.row2 { background: var(--row2); }
.post1 { background: var(--post1); }
.post2 { background: var(--post2); }
.darkrow2, .darkrow3 { background: var(--dark3); color: var(--subtext); }
.darkrow2 { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; padding: 5px 7px; border-top: 1px solid var(--line); font-size: 10px; }
.tablepad { padding: 6px; background: var(--post1); }
td.none { text-align: center; padding: 14px; color: var(--muted); }
/* --- the board: forums and their icons */
td.icon { width: 1%; text-align: center; padding: 5px 6px; }
.forumcol b a { font-size: 12px; }
.forumdesc { margin-top: 2px; font-size: 10px; color: #666; line-height: 135%; }
.lastcol { font-size: 10px; line-height: 150%; }
.lastdate { color: var(--muted); }
/* a forum's icon: a navy book-like tile, lit when there is something new */
.bf {
display: inline-block; position: relative; width: 23px; height: 23px;
border: 1px solid var(--navy); border-bottom-width: 3px; border-radius: 1px;
background: linear-gradient(to bottom, #85b8f5, #3f66a8);
}
.bf::after { content: ""; position: absolute; left: 4px; right: 4px; top: 6px; height: 3px; background: rgba(255,255,255,0.9); box-shadow: 0 6px 0 rgba(255,255,255,0.6); }
.bf.nonew { border-color: #8c9dba; background: linear-gradient(to bottom, #d6e3f3, #b4c9e7); }
.bf.nonew::after { background: rgba(255,255,255,0.8); box-shadow: 0 6px 0 rgba(255,255,255,0.5); }
/* a topic's icon: a folder, lit when new, red-edged when hot */
.folder {
display: inline-block; position: relative; width: 18px; height: 12px; margin-top: 3px;
border: 1px solid var(--navy); border-radius: 0 1px 1px 1px;
background: linear-gradient(to bottom, #6a9be0, #3c64a8);
}
.folder::before { content: ""; position: absolute; left: -1px; top: -4px; width: 8px; height: 3px; border: 1px solid var(--navy); border-bottom: 0; border-radius: 1px 1px 0 0; background: #6a9be0; }
.folder.nonew { border-color: #8c9dba; background: linear-gradient(to bottom, #e3ebf6, #bccfe8); }
.folder.nonew::before { border-color: #8c9dba; background: #e3ebf6; }
.folder.hot { box-shadow: 0 0 0 1px #d0751e; }
.statsicon {
display: inline-block; width: 22px; height: 18px;
border: 1px solid var(--navy); border-bottom-width: 3px;
background: linear-gradient(to right, transparent 3px, #ffd659 3px 7px, transparent 7px 9px, #ffd659 9px 13px, transparent 13px 15px, #ffd659 15px 19px, transparent 19px) bottom / 100% 60% no-repeat, linear-gradient(to bottom, #6a9be0, #3c64a8);
}
/* --- a forum's topics */
.topiccol .topictitle { font-weight: bold; }
.topiccol .desc { margin-top: 2px; }
.newmark { font-size: 9px; font-weight: bold; color: #fff; background: #c2470b; padding: 0 3px; border-radius: 2px; }
.minipages { font-size: 10px; margin-left: 4px; }
.minipagelink { display: inline-block; margin: 0 1px; padding: 0 3px; border: 1px solid #c2cfdf; background: #f0f5fa; text-decoration: none !important; }
.starter { white-space: nowrap; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: -6px 0 14px; padding: 6px 8px; background: #f0f5fa; border: 1px solid #c2cfdf; font-size: 10px; color: var(--muted); }
.legend .folder { vertical-align: middle; margin: 0 4px 0 0; }
/* the bar above and below lists: pages on the left, buttons on the right */
.topbar { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.topbar.bottom { margin: -8px 0 15px; }
.tbuttons { display: flex; gap: 6px; margin-left: auto; }
.pagelinks { display: flex; flex-wrap: wrap; gap: 2px; align-items: center; }
.pagelink, .pagelinklast, .pagecurrent, .pagegap {
padding: 1px 4px; border: 1px solid var(--navy); background: #f0f5fa;
}
.pagelinklast { background: var(--row1); }
.pagecurrent { background: #ffc9a5; font-weight: bold; }
.pagegap { border: 0; background: none; }
.pagelinks a { text-decoration: none; }
/* the big blue buttons, in the manner of the image buttons of old */
.ibutton:link, .ibutton:visited {
display: inline-flex; align-items: center; gap: 5px;
padding: 5px 10px 5px 7px;
border: 1px solid var(--navy); border-radius: 3px;
background: linear-gradient(to bottom, #8ec0f7 0%, #6a9fe2 45%, #4a7cc3 55%, #5e93da 100%);
box-shadow: inset 0 1px 0 rgba(255,255,255,0.6), 0 1px 0 #eaedf1;
color: #fff; font-size: 11px; font-weight: bold; letter-spacing: 1px; text-transform: uppercase; text-decoration: none;
text-shadow: 0 1px 1px rgba(7,42,102,0.7);
}
.ibutton:hover { background: linear-gradient(to bottom, #9fcbfa 0%, #7aaeea 45%, #5689cf 55%, #6ca1e4 100%); color: #fff; }
.ibicon { display: inline-block; width: 11px; height: 14px; background: #fff; border: 1px solid #9fb3cc; position: relative; }
.ibicon::after { content: ""; position: absolute; left: 2px; right: 2px; top: 3px; height: 1px; background: #9fb3cc; box-shadow: 0 3px 0 #9fb3cc, 0 6px 0 #9fb3cc; }
.ibicon.reply::before { content: "+"; position: absolute; left: -6px; bottom: -6px; color: #ffd659; font-size: 12px; font-weight: bold; text-shadow: 0 0 1px var(--navy); }
/* --- a topic's posts */
.post { margin: 0; }
.pname { width: 175px; white-space: nowrap; }
.normalname { color: #003; font-size: 12px; font-weight: bold; text-decoration: none !important; }
.normalname.admin { color: #8b0000; }
.phead { font-size: 10px; }
.phead .postdate { float: left; color: var(--muted); }
.phead .postnum { float: right; }
.posticon { display: inline-block; width: 9px; height: 9px; margin-right: 5px; vertical-align: -1px; background: linear-gradient(to bottom, var(--title-top), var(--navy)); border: 1px solid #fff; outline: 1px solid var(--line); }
.pdetails { vertical-align: top !important; width: 175px; font-size: 10px; line-height: 140%; }
.pdetails .avatar { margin: 4px 0 8px; }
.pbody { vertical-align: top !important; padding: 8px 10px !important; }
.postcolor { font-size: 12px; line-height: 160%; min-height: 60px; word-wrap: break-word; overflow-wrap: anywhere; }
.likes { margin-top: 12px; padding-top: 6px; border-top: 1px dashed #c2cfdf; color: #5c7a2f; font-size: 10px; }
.ptop a { font-size: 10px; text-decoration: none; }
.pbuttons { text-align: right; white-space: nowrap; }
.pbutton:link, .pbutton:visited, button.pbutton {
display: inline-block; margin-left: 3px; padding: 2px 7px;
border: 1px solid var(--navy); border-radius: 0 0 3px 3px;
background: linear-gradient(to bottom, #8ec0f7, #4a7cc3);
color: #fff; font: bold 10px Verdana, Arial, sans-serif; text-transform: uppercase; text-decoration: none; cursor: pointer;
text-shadow: 0 1px 1px rgba(7,42,102,0.6);
}
button.pbutton.danger { color: #ffe08a; }
.postsep { height: 6px; background: var(--catend); border-top: 1px solid #fff; }
.topic .postsep:last-of-type { display: none; }
/* quotes: a titled box with a thick left edge */
.citation {
margin: 6px 0 0; padding: 3px 5px;
border: 1px dotted #000; border-bottom: 0; border-left: 4px solid #8394b2;
background: var(--row2);
font-size: 10px; font-weight: bold; text-transform: uppercase;
}
blockquote.quote {
margin: 0 0 8px; padding: 4px 6px;
border: 1px dotted #000; border-left: 4px solid #8394b2;
background: #fafcfe; color: #465584;
}
blockquote.quote::before { content: "Quote"; display: block; margin: -4px -6px 4px; padding: 3px 5px; border-bottom: 1px dotted #000; background: var(--row2); color: #000; font-size: 10px; font-weight: bold; text-transform: uppercase; }
.citation + blockquote.quote { border-top: 0; }
.citation + blockquote.quote::before { display: none; }
.bbc_url:link, .bbc_url:visited { color: #2c5aa0; }
/* polls */
.pollresults { width: 100%; border-collapse: collapse; margin-bottom: 6px; }
.pollresults td { padding: 4px; }
.pollresults td.answer { width: 30%; font-weight: bold; }
.pollresults tr.mine td.answer::after { content: " \2714"; color: #0b9500; }
.pollresults td.bar { width: 50%; }
meter { width: 100%; height: 11px; }
meter::-webkit-meter-bar { background: #fff; border: 1px solid var(--navy); border-radius: 0; }
meter::-webkit-meter-optimum-value { background: linear-gradient(to bottom, #8ec0f7, #4a7cc3); }
meter::-moz-meter-bar { background: linear-gradient(to bottom, #8ec0f7, #4a7cc3); }
.poll-form { display: flex; flex-direction: column; gap: 2px; }
.poll-form .formbuttonrow { margin: 6px -6px -6px; }
/* --- forms, buttons, messages */
input[type=text], input[type=password], input[type=search], textarea, select {
background: #fff; border: 1px solid #4c77b6; color: #000;
font: 11px Verdana, Helvetica, sans-serif; padding: 3px;
}
textarea { width: 100%; box-sizing: border-box; font-size: 12px; line-height: 150%; }
.button, button.button, a.button:link, a.button:visited {
display: inline-block;
padding: 2px 6px;
border: 1px solid #4c77b6;
background: var(--row1);
color: #000; font: 11px Verdana, Helvetica, sans-serif; text-decoration: none; cursor: pointer;
}
.button.important { font-weight: bold; }
.button.danger { color: #900; }
.button:hover { background: #d1dcec; }
.formbuttonrow, .editor-foot {
display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap;
padding: 5px; border-top: 1px solid var(--line); background: var(--dark3);
}
.box-body .editor-foot { margin: 10px -6px -6px; }
.ruleswrap, .message.error {
margin: 0 0 15px; padding: 6px 8px;
background: #f2dddd; border: 1px solid #992a2a; color: #992a2a;
}
.box-body .message.error { margin: 0 0 8px; }
.message { margin: 0 0 15px; padding: 6px 8px; background: #f0f5fa; border: 1px solid #c2cfdf; }
.message.good, .okwrap { background: #e1f2dc; border: 1px solid #3f7d2f; color: #2c5a20; }
.okwrap { margin: 0 0 15px; }
.okwrap h4 { margin: 0; padding: 5px; background: #c9e6bf; border-bottom: 1px solid #3f7d2f; font-size: 12px; }
.okwrap p { padding: 6px 8px; }
/* the default theme's pages that this one shows as they are: boxes as
bordered tables */
.box { background: #fff; border: 1px solid var(--navy); margin: 0 0 15px; }
.box::after { content: ""; display: block; height: 5px; background: var(--catend); }
.box-body { padding: 6px; background: var(--post1); }
.box.narrow { max-width: 520px; margin-left: auto; margin-right: auto; }
.field { display: grid; grid-template-columns: 35% 1fr; align-items: center; gap: 6px; padding: 6px; margin: 0 -6px; border-bottom: 1px solid #c2cfdf; font-weight: bold; }
.field input, .field textarea { font-weight: normal; }
.signin .desc { margin-bottom: 6px; }
.editor .field { grid-template-columns: 1fr; }
.poll-maker { margin: 8px 0; }
.poll-maker summary { cursor: pointer; font-weight: bold; color: var(--subtext); }
.searchform { display: flex; gap: 6px; }
.searchform input { flex: 1; }
table.board { width: 100%; border-collapse: separate; border-spacing: 1px; }
table.board td { padding: 5px; background: var(--row2); vertical-align: top; }
table.board tr:nth-child(even) td { background: var(--row1); }
table.board h3 { margin: 0; font-size: 11px; }
.snippet { margin-top: 3px; color: #555; }
.count { margin-left: auto; }
/* letter pictures for those without one */
.avatar {
display: inline-flex; align-items: center; justify-content: center;
color: #fff; font-family: Georgia, "Times New Roman", serif; font-weight: bold;
text-shadow: 0 1px 1px rgba(0,0,0,0.35);
border: 1px solid var(--navy);
vertical-align: middle;
}
.avatar.tiny { width: 16px; height: 16px; font-size: 10px; }
.avatar.mini { width: 26px; height: 26px; font-size: 13px; }
.avatar.large { width: 80px; height: 80px; font-size: 40px; }
.avatar.huge { width: 120px; height: 120px; font-size: 60px; }
.av0 { background: #4f7bb0; } .av1 { background: #b0574f; } .av2 { background: #4f9a6b; }
.av3 { background: #8a5fb0; } .av4 { background: #c0862d; } .av5 { background: #3e8f9e; }
.av6 { background: #a24f86; } .av7 { background: #6b7a3c; } .av8 { background: #c06a3e; }
.av9 { background: #546478; } .av10 { background: #2f7f5f; } .av11 { background: #9b4545; }
/* the profile */
.profileside { width: 150px; text-align: center; vertical-align: top !important; }
.profileside .group { margin-top: 6px; font-weight: bold; }
.profileside .group.admin { color: #8b0000; }
.online-now { color: #0b9500; font-weight: bold; }
.facts td.key { width: 30%; font-weight: bold; }
/* --- the foot */
#boardfoot { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 6px; margin: 0 0 6px; }
.themepicker, .quicksearch { display: flex; align-items: center; gap: 4px; font-size: 10px; }
.themepicker select { font-size: 10px; }
#gfooter { display: flex; justify-content: space-between; flex-wrap: wrap; background: var(--catend); color: #fff; font-size: 10px; }
#gfooter p { padding: 4px 6px; }
#gfooter a:link, #gfooter a:visited { color: #fff; }
.copyright { margin-top: 8px; padding: 8px; background: #eee; text-align: center; font-size: 11px; }
/* --- narrow screens */
@media (max-width: 760px) {
#ipbwrapper { width: auto; margin: 8px; }
.logo-name { font-size: 20px; }
.logo-sub { letter-spacing: 3px; }
#submenu { height: auto; flex-wrap: wrap; }
.ipbtable th.lastcol, .ipbtable td.lastcol { display: none; }
.starter { display: none; }
table.post, table.post tbody, table.post tr, table.post td { display: block; width: auto; }
.pdetails .avatar.large { width: 40px; height: 40px; font-size: 20px; float: left; margin: 0 8px 0 0; }
.pdetails { overflow: hidden; }
.phead { overflow: hidden; }
.ptop { display: none !important; }
.pbuttons { text-align: left; white-space: normal; }
.field { grid-template-columns: 1fr; }
.legend { display: none; }
}
@@ -117,6 +117,8 @@ button { font: inherit; }
#footer { padding: 10px 2px 30px; font-size: 11px; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 6px; }
#footer a { color: #4c5b6b; }
.copyright { color: #6f7a87; text-shadow: 0 1px 0 rgba(255,255,255,0.6); }
.themepicker { display: flex; align-items: center; gap: 6px; color: #4c5b6b; }
.themepicker select { font: inherit; font-size: 11px; padding: 1px 2px; }
/* boxes and their blue title bars */
+8 -1
View File
@@ -4,7 +4,7 @@
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{if ne .Title .BBS}}{{.Title}} - {{end}}{{.BBS}}</title>
<link rel="stylesheet" href="/forum/static/forum.css">
<link rel="stylesheet" href="/forum/static/ipb3.css">
</head>
<body>
<div id="userbar"><div class="wrap">
@@ -49,12 +49,19 @@
</div>
<div id="footer" class="wrap">
<ul class="inline"><li><a href="/forum/">Forums</a></li><li><a href="/forum/online">Online Users</a></li>{{if .Terminal}}<li><a href="/terminal">Web Terminal</a></li>{{end}}</ul>
{{template "themepicker" .}}
<p class="copyright">{{.BBS}} &middot; the forums of a BBS, powered by bbs-sec &middot; {{when .Now}}</p>
</div>
</body>
</html>
{{end}}
{{define "themepicker"}}<form method="post" action="/forum/theme" class="themepicker">
{{if .CSRF}}<input type="hidden" name="csrf" value="{{.CSRF}}">{{end}}<input type="hidden" name="back" value="{{.Path}}">
<label>Theme <select name="theme">{{range .Themes}}<option value="{{.Name}}"{{if eq .Name $.Theme}} selected{{end}}>{{.Title}}</option>{{end}}</select></label>
<button class="button small">Go</button>
</form>{{end}}
{{define "avatar"}}<span class="avatar {{avatar .Name}} {{.Size}}" aria-hidden="true">{{initial .Name}}</span>{{end}}
{{define "pages"}}{{if gt .Total 1}}<ul class="pagination">
+44
View File
@@ -0,0 +1,44 @@
{{define "area.html"}}{{template "head" .}}
{{$b := .Body}}
<div class="topbar">
{{template "pages" $b.Pages}}
<div class="tbuttons">{{if $b.CanPost}}<a href="/forum/area/{{$b.Area.ID}}/new" class="ibutton"><span class="ibicon newtopic" aria-hidden="true"></span>New Topic</a>
{{else if not .User}}<a href="/forum/login?back={{urlq (printf "/forum/area/%d" $b.Area.ID)}}" class="ibutton">Log In to Post</a>{{end}}</div>
</div>
<div class="borderwrap">
<div class="maintitle"><span class="caticon" aria-hidden="true"></span>{{$b.Area.Name}}{{if $b.Area.Description}}<span class="tdesc">{{$b.Area.Description}}</span>{{end}}</div>
<table class="ipbtable">
<thead><tr><th colspan="2">Topic Title</th><th class="num">Replies</th><th>Topic Starter</th><th class="lastcol">Last Action</th></tr></thead>
<tbody>
{{range $b.Topics}}
<tr>
<td class="row2 icon"><span class="folder {{if .Unread}}new{{else}}nonew{{end}}{{if ge .Replies 15}} hot{{end}}" title="{{if .Unread}}New replies{{else}}No new replies{{end}}"></span></td>
<td class="row2 topiccol">{{if .Unread}}<span class="newmark">NEW</span> {{end}}<a href="/forum/topic/{{.Root.ID}}" class="topictitle">{{.Root.Subject}}</a>
{{if gt .Pages 1}}<span class="minipages">( Go to page {{$root := .Root.ID}}{{range (seq .Pages)}}<a href="/forum/topic/{{$root}}{{if gt . 1}}?page={{.}}{{end}}" class="minipagelink">{{.}}</a>{{end}} )</span>{{end}}
<p class="desc">{{snippet .Root.Body 70}}</p></td>
<td class="row2 num"><a href="/forum/topic/{{.Root.ID}}">{{num .Replies}}</a></td>
<td class="row2 starter">{{.Root.From}}</td>
<td class="row1 lastcol"><span class="lastdate">{{when .Last.Created}}</span><br><a href="/forum/post/{{.Last.ID}}">Last post by:</a> <b>{{.Last.From}}</b></td>
</tr>
{{else}}
<tr><td colspan="5" class="row1 none">No topics were found. {{if $b.CanPost}}<a href="/forum/area/{{$b.Area.ID}}/new">Start the first one.</a>{{end}}</td></tr>
{{end}}
</tbody>
</table>
<div class="darkrow2">
<span class="showing">Showing {{plural $b.Count "topic" "topics"}}</span>
{{if .User}}<form method="post" action="/forum/area/{{$b.Area.ID}}/read" class="inline-form"><input type="hidden" name="csrf" value="{{.CSRF}}"><button class="linkish">Mark this forum as read</button></form>{{end}}
</div>
<div class="catend"></div>
</div>
<div class="topbar bottom">
{{template "pages" $b.Pages}}
<div class="tbuttons">{{if $b.CanPost}}<a href="/forum/area/{{$b.Area.ID}}/new" class="ibutton"><span class="ibicon newtopic" aria-hidden="true"></span>New Topic</a>{{end}}</div>
</div>
<div class="legend">
<span><span class="folder new"></span> New replies</span>
<span><span class="folder nonew"></span> No new replies</span>
<span><span class="folder new hot"></span> Hot topic (new)</span>
<span><span class="folder nonew hot"></span> Hot topic (no new)</span>
</div>
{{template "foot" .}}{{end}}
+43
View File
@@ -0,0 +1,43 @@
{{define "index.html"}}{{template "head" .}}
{{range .Body.Categories}}
<div class="borderwrap category">
<div class="maintitle"><span class="caticon" aria-hidden="true"></span>{{.Name}}</div>
<table class="ipbtable">
<thead><tr><th colspan="2">Forum</th><th class="num">Topics</th><th class="num">Replies</th><th class="lastcol">Last Post Info</th></tr></thead>
<tbody>
{{range $f := .Forums}}
<tr>
<td class="row2 icon"><span class="bf {{if $f.Unread}}new{{else}}nonew{{end}}" title="{{if $f.Unread}}New posts{{else}}No new posts{{end}}"></span></td>
<td class="row2 forumcol"><b><a href="/forum/area/{{.Area.ID}}">{{.Area.Name}}</a></b>
{{if .Area.Description}}<p class="forumdesc">{{.Area.Description}}</p>{{end}}</td>
<td class="row1 num">{{num .Topics}}</td>
<td class="row1 num">{{num .Replies}}</td>
<td class="row1 lastcol">{{with .Last}}<span class="lastdate">{{when .Created}}</span><br>
<b>In:</b> <a href="/forum/post/{{.ID}}">{{truncate $f.LastTopic.Subject 30}}</a><br>
<b>By:</b> {{.From}}{{else}}-----{{end}}</td>
</tr>
{{end}}
</tbody>
</table>
<div class="catend"></div>
</div>
{{else}}
<div class="borderwrap"><div class="maintitle"><span class="caticon" aria-hidden="true"></span>Forums</div>
<div class="tablepad">There are no forums open to you yet.{{if not .User}} <a href="/forum/login">Log in</a> to see more.{{end}}</div></div>
{{end}}
<div class="borderwrap stats">
<div class="maintitle"><span class="caticon" aria-hidden="true"></span>Board Statistics</div>
<table class="ipbtable">
<tr><th colspan="2">{{plural (len .Body.Online) "user" "users"}} online</th></tr>
<tr><td class="row1 icon"><span class="statsicon" aria-hidden="true"></span></td>
<td class="row2">{{range $i, $n := .Body.Online}}{{if $i}}, {{end}}<a href="/forum/user/{{path $n.User}}">{{$n.User}}</a> <span class="desc">({{$n.Via}})</span>{{else}}<span class="desc">No one is on just now.</span>{{end}}</td></tr>
<tr><th colspan="2">Board Statistics</th></tr>
<tr><td class="row1 icon"><span class="statsicon" aria-hidden="true"></span></td>
<td class="row2">Our members have made a total of <b>{{num .Body.Stats.Posts}}</b> posts in <b>{{num .Body.Stats.Topics}}</b> topics<br>
We have <b>{{num .Body.Stats.Members}}</b> registered members<br>
{{with .Body.Stats.Newest}}The newest member is <b><a href="/forum/user/{{path .Name}}">{{.Name}}</a></b>{{end}}</td></tr>
</table>
<div class="catend"></div>
</div>
{{template "foot" .}}{{end}}
+53
View File
@@ -0,0 +1,53 @@
{{define "head"}}<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>{{if ne .Title .BBS}}{{.Title}} - {{end}}{{.BBS}}</title>
<link rel="stylesheet" href="/forum/static/ipb2.css">
</head>
<body id="top">
<div id="ipbwrapper">
<div class="borderwrap" id="header">
<div id="logostrip"><a href="/forum/" class="logo"><span class="logo-mark" aria-hidden="true"></span><span class="logo-text"><span class="logo-name">{{.BBS}}</span><span class="logo-sub">bulletin board</span></span></a></div>
<div id="submenu">
<p class="home"><a href="/forum/">Forums</a></p>
<p class="links">{{if .Terminal}}<a href="/terminal">Terminal</a>{{end}}<a href="/forum/online">Online ({{.Online}})</a><a href="/forum/search">Search</a></p>
</div>
</div>
{{if .User}}
<div id="userlinks">
<div class="home"><b>Logged in as: <a href="/forum/user/{{path .User.Name}}">{{.User.Name}}</a></b>
( <form method="post" action="/forum/logout" class="inline-form"><input type="hidden" name="csrf" value="{{.CSRF}}"><button class="linkish">Log Out</button></form> )</div>
<div class="links"><a href="/forum/user/{{path .User.Name}}">My Profile</a> &middot; <a href="/forum/search">Search</a> &middot; <a href="/forum/online">Who's Online</a></div>
</div>
{{else}}
<div id="userlinksguest">
<div class="pcen"><b>Welcome Guest</b> ( <a href="/forum/login">Log In</a>{{if .Register}} | <a href="/forum/register">Register</a>{{end}} )</div>
</div>
{{end}}
<div id="navstrip"><span class="navhome" aria-hidden="true"></span><a href="/forum/">{{.BBS}}</a>{{range .Crumbs}} <span class="navsep">&gt;</span> {{if .URL}}<a href="{{.URL}}">{{.Name}}</a>{{else}}{{.Name}}{{end}}{{end}}</div>
{{if eq .Notice "welcome"}}<div class="okwrap"><h4>Welcome!</h4><p>Your account is made, and you are logged in.</p></div>{{end}}
{{end}}
{{define "foot"}}
<div id="boardfoot">
{{template "themepicker" .}}
<form action="/forum/search" method="get" class="quicksearch"><input type="search" name="q" placeholder="Search..." aria-label="Search"> <button class="button">Go</button></form>
</div>
<div id="gfooter">
<p class="left"><a href="/forum/online">Online Users</a>{{if .Terminal}} &middot; <a href="/terminal">Web Terminal</a>{{end}}</p>
<p class="right">Time is now: {{longdate .Now}}</p>
</div>
<div class="copyright">{{.BBS}} &middot; the forums of a BBS, powered by bbs-sec</div>
</div>
</body>
</html>
{{end}}
{{define "pages"}}{{if gt .Total 1}}<div class="pagelinks">
<span class="pagelink">Pages ({{.Total}})</span>
{{if gt .Cur 1}}<span class="pagelink"><a href="{{.URL .Prev}}" rel="prev">&lt;</a></span>{{end}}
{{$cur := .Cur}}{{$p := .}}{{range .Shown}}{{if eq . 0}}<span class="pagegap">&hellip;</span>{{else if eq . $cur}}<span class="pagecurrent">[{{.}}]</span>{{else}}<span class="pagelink"><a href="{{$p.URL .}}">{{.}}</a></span>{{end}}{{end}}
{{if .Next}}<span class="pagelinklast"><a href="{{.URL .Next}}" rel="next">&gt;</a></span>{{end}}
</div>{{end}}{{end}}
+39
View File
@@ -0,0 +1,39 @@
{{define "profile.html"}}{{template "head" .}}
{{$u := .Body.U}}
<div class="borderwrap profile">
<div class="maintitle"><span class="caticon" aria-hidden="true"></span>Viewing Profile: {{$u.Name}}</div>
<table class="ipbtable">
<tr>
<td class="row1 profileside">
{{template "avatar" (av $u.Name "huge")}}
<p class="group{{if $u.Sysop}} admin{{end}}">{{group $u}}</p>
{{if .Body.On}}<p class="online-now">&#9679; Online now</p>{{else}}<p class="desc">Offline</p>{{end}}
</td>
<td class="row2">
<table class="ipbtable facts">
<tr><th colspan="2">Active Stats</th></tr>
<tr><td class="row1 key">Joined:</td><td class="row2">{{date $u.Created}}</td></tr>
<tr><td class="row1 key">Last visit:</td><td class="row2">{{when $u.LastLogin}}</td></tr>
<tr><td class="row1 key">Total posts:</td><td class="row2">{{num $u.Posts}}</td></tr>
<tr><td class="row1 key">Calls:</td><td class="row2">{{num $u.Logins}}</td></tr>
<tr><td class="row1 key">Member No.:</td><td class="row2">{{$u.ID}}</td></tr>
{{range .Body.On}}<tr><td class="row1 key">Now:</td><td class="row2">On node {{.Num}} by {{.Via}}: {{.Activity}}</td></tr>{{end}}
<tr><th colspan="2">Information</th></tr>
<tr><td class="row1 key">Location:</td><td class="row2">{{if $u.Location}}{{$u.Location}}{{else}}<i>No Information</i>{{end}}</td></tr>
<tr><td class="row1 key">About:</td><td class="row2">{{if $u.About}}{{$u.About}}{{else}}<i>No Information</i>{{end}}</td></tr>
</table>
</td>
</tr>
</table>
<div class="catend"></div>
</div>
<div class="borderwrap">
<div class="maintitle"><span class="caticon" aria-hidden="true"></span>Recent Posts</div>
<table class="ipbtable">
{{range .Body.Recent}}
<tr><td class="row2"><b><a href="/forum/post/{{.ID}}">{{.Subject}}</a></b> <span class="desc">{{when .Created}}</span><p class="snippet">{{snippet .Body 160}}</p></td></tr>
{{else}}<tr><td class="row1 none">No posts to show.</td></tr>{{end}}
</table>
<div class="catend"></div>
</div>
{{template "foot" .}}{{end}}
+89
View File
@@ -0,0 +1,89 @@
{{define "topic.html"}}{{template "head" .}}
{{$b := .Body}}{{$csrf := .CSRF}}{{$me := .User}}
<div class="topbar">
{{template "pages" $b.Pages}}
<div class="tbuttons">{{if $b.CanPost}}<a href="#reply" class="ibutton"><span class="ibicon reply" aria-hidden="true"></span>Add Reply</a>
<a href="/forum/area/{{$b.Area.ID}}/new" class="ibutton"><span class="ibicon newtopic" aria-hidden="true"></span>New Topic</a>{{end}}</div>
</div>
{{with $b.Poll}}
<div class="borderwrap poll">
<div class="maintitle"><span class="caticon" aria-hidden="true"></span>Poll: {{$b.Root.Subject}}</div>
<div class="tablepad">
{{if or .Voted (not $me)}}
<table class="pollresults">
{{range .Answers}}<tr{{if .Mine}} class="mine"{{end}}><td class="answer">{{.Text}}</td><td class="bar"><meter min="0" max="100" value="{{.Pct}}"></meter></td><td class="desc">[ {{.Count}} ] [{{.Pct}}%]</td></tr>{{end}}
</table>
{{end}}
{{if $me}}
<form method="post" action="/forum/post/{{.ID}}/answer" class="poll-form">
<input type="hidden" name="csrf" value="{{$csrf}}">
{{range .Answers}}<label><input type="radio" name="answer" value="{{.Index}}"{{if .Mine}} checked{{end}}> {{.Text}}</label>{{end}}
<div class="formbuttonrow"><button class="button">{{if .Voted}}Change my vote{{else}}Vote!{{end}}</button></div>
</form>
{{end}}
</div>
<div class="formsubtitle">Total Votes: {{.Total}}{{if not $me}} &middot; <a href="/forum/login">Log in</a> to vote{{end}}</div>
</div>
{{end}}
<div class="borderwrap topic">
<div class="maintitle"><span class="caticon" aria-hidden="true"></span>{{$b.Root.Subject}}<span class="tdesc">{{plural $b.Count "post" "posts"}} in {{$b.Area.Name}}</span></div>
{{range $b.Posts}}
<table class="ipbtable post" id="entry{{.M.ID}}">
<tr>
<td class="row2 pname">{{if .Author}}<a href="/forum/user/{{path .Author.Name}}" class="normalname{{if .Author.Sysop}} admin{{end}}">{{.M.From}}</a>{{else}}<span class="normalname">{{.M.From}}</span>{{end}}</td>
<td class="row2 phead"><span class="postdate"><span class="posticon" aria-hidden="true"></span>{{when .M.Created}}{{if and .M.To (ne .M.To "All")}}, to {{.M.To}}{{end}}</span>
<span class="postnum">Post <a href="/forum/post/{{.M.ID}}" title="Link to this post">#{{.Num}}</a></span></td>
</tr>
<tr>
<td class="post2 pdetails">
{{template "avatar" (av .M.From "large")}}
{{if .Author}}
<p>Group: {{group .Author}}<br>Posts: {{num .Author.Posts}}<br>Joined: {{date .Author.Created}}<br>{{if .Author.Location}}From: {{.Author.Location}}<br>{{end}}Member No.: {{.Author.ID}}</p>
{{else}}
<p>{{if .Where}}Group: Visitors<br>From: {{.Where}}{{else}}Group: Members{{end}}</p>
{{end}}
</td>
<td class="post1 pbody">
<div class="postcolor">{{body .M.Body}}</div>
{{if .Likes}}<div class="likes">&#9829; {{plural .Likes "member likes" "members like"}} this post</div>{{end}}
</td>
</tr>
<tr>
<td class="darkrow3 ptop"><a href="#top">Top</a></td>
<td class="darkrow3 pbuttons">
{{if .CanLike}}<form method="post" action="/forum/post/{{.M.ID}}/like" class="inline-form"><input type="hidden" name="csrf" value="{{$csrf}}"><input type="hidden" name="like" value="{{if .Liked}}0{{else}}1{{end}}"><button class="pbutton">{{if .Liked}}Unlike{{else}}&#9829; Like{{end}}</button></form>{{end}}
{{if .CanDelete}}<form method="post" action="/forum/post/{{.M.ID}}/delete" class="inline-form"><input type="hidden" name="csrf" value="{{$csrf}}"><button class="pbutton danger">&#10006; Delete</button></form>{{end}}
{{if $b.CanPost}}<a href="/forum/topic/{{$b.Root.ID}}?quote={{.M.ID}}{{if gt $b.Pages.Cur 1}}&amp;page={{$b.Pages.Cur}}{{end}}#reply" class="pbutton">&#8220; Quote</a>{{end}}
</td>
</tr>
</table>
<div class="postsep"></div>
{{end}}
<div class="catend"></div>
</div>
<div class="topbar bottom">
{{template "pages" $b.Pages}}
<div class="tbuttons">{{if $b.CanPost}}<a href="#reply" class="ibutton"><span class="ibicon reply" aria-hidden="true"></span>Add Reply</a>
<a href="/forum/area/{{$b.Area.ID}}/new" class="ibutton"><span class="ibicon newtopic" aria-hidden="true"></span>New Topic</a>{{end}}</div>
</div>
{{if $b.CanPost}}
<div class="borderwrap reply" id="reply">
<div class="maintitle"><span class="caticon" aria-hidden="true"></span>Fast Reply</div>
<form method="post" action="/forum/topic/{{$b.Root.ID}}/reply">
<input type="hidden" name="csrf" value="{{.CSRF}}">
{{if $b.QuoteID}}<input type="hidden" name="reply_to" value="{{$b.QuoteID}}">{{end}}
<div class="tablepad"><textarea name="body" rows="9" required aria-label="Your reply">{{$b.Quote}}</textarea></div>
<div class="formbuttonrow">
{{if $b.Aliases}}<label><input type="checkbox" name="alias"> Post as {{$me.Alias}}</label>{{end}}
<button class="button important">Add Reply</button>
</div>
</form>
</div>
{{else if not .User}}
<div class="ruleswrap">You need to be a member to reply. <a href="/forum/login?back={{urlq (printf "/forum/topic/%d" $b.Root.ID)}}">Log in</a>{{if .Register}} or <a href="/forum/register">register</a>{{end}}.</div>
{{end}}
{{template "foot" .}}{{end}}
+8
View File
@@ -11,6 +11,7 @@ import (
"github.com/Neo-Desktop/bbs-sec/internal/api"
"github.com/Neo-Desktop/bbs-sec/internal/config"
"github.com/Neo-Desktop/bbs-sec/internal/forum"
)
// httpSection reads [http].
@@ -73,6 +74,13 @@ func (c *Config) httpSection(s *config.Section) error {
if h.Guests, err = s.Bool("forum_guests", true); err != nil {
return err
}
if h.Theme = s.String("forum_theme", forum.Themes[0].Name); !forum.KnownTheme(h.Theme) {
var names []string
for _, t := range forum.Themes {
names = append(names, t.Name)
}
return fmt.Errorf("forum_theme: %q is not one of %s", h.Theme, strings.Join(names, ", "))
}
c.HTTP = h
return nil
}