From 4798813a76d33adf98261eecd938ec3a1b00c2e8 Mon Sep 17 00:00:00 2001 From: tomoko-dev9 Date: Mon, 11 May 2026 19:43:12 +0000 Subject: [PATCH] fix pubkey loading, captcha replies only, admin post styling, krane CSS updates --- .../backends/srndv2/src/srnd/frontend_http.go | 4 ++-- contrib/backends/srndv2/src/srnd/postgres.go | 2 +- .../srndv2/src/srnd/templates_impl.go | 2 +- contrib/static/krane.css | 20 +++++++++++++++++++ contrib/templates/placebo/post.mustache | 4 ++-- 5 files changed, 26 insertions(+), 6 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/frontend_http.go b/contrib/backends/srndv2/src/srnd/frontend_http.go index 4953e48..bad703f 100644 --- a/contrib/backends/srndv2/src/srnd/frontend_http.go +++ b/contrib/backends/srndv2/src/srnd/frontend_http.go @@ -563,7 +563,7 @@ func (self *httpFrontend) handle_postform(wr http.ResponseWriter, r *http.Reques } return } - if checkCaptcha && len(captcha_id) == 0 { + if checkCaptcha && len(pr.Reference) == 0 && len(captcha_id) == 0 { cid, ok := sess.Values["captcha_id"] if ok { captcha_id = cid.(string) @@ -573,7 +573,7 @@ func (self *httpFrontend) handle_postform(wr http.ResponseWriter, r *http.Reques sess.Values["captcha_id"] = "" } log.Println("captcha", captcha_id, "try '", captcha_solution, "'") - if checkCaptcha && !captcha.VerifyString(captcha_id, captcha_solution) { + if checkCaptcha && len(pr.Reference) == 0 && !captcha.VerifyString(captcha_id, captcha_solution) { // captcha is not valid captcha_retry = true } else { diff --git a/contrib/backends/srndv2/src/srnd/postgres.go b/contrib/backends/srndv2/src/srnd/postgres.go index c3f4733..2fb3965 100644 --- a/contrib/backends/srndv2/src/srnd/postgres.go +++ b/contrib/backends/srndv2/src/srnd/postgres.go @@ -1287,7 +1287,7 @@ func (self *PostgresDatabase) GetThreadReplyPostModels(prefix, rootpost string, } // get pubkey if it exists // quiet fail - self.conn.QueryRow(self.stmt[GetArticlePubkey], model.Message_id).Scan(model.Key) + self.conn.QueryRow(self.stmt[GetArticlePubkey], model.Message_id).Scan(&model.Key) repls = append(repls, model) } rows.Close() diff --git a/contrib/backends/srndv2/src/srnd/templates_impl.go b/contrib/backends/srndv2/src/srnd/templates_impl.go index b0aed10..3ef2f3f 100644 --- a/contrib/backends/srndv2/src/srnd/templates_impl.go +++ b/contrib/backends/srndv2/src/srnd/templates_impl.go @@ -330,7 +330,7 @@ func (self *templateEngine) genThread(allowFiles, requireCaptcha bool, root Arti self.renderJSON(wr, t) } else { t.I18N(i18n) - form := renderPostForm(prefix, newsgroup, msgid, allowFiles, requireCaptcha, i18n) + form := renderPostForm(prefix, newsgroup, msgid, allowFiles, false, i18n) self.writeTemplate("thread", map[string]interface{}{"sfw": sfw, "thread": t, "board": map[string]interface{}{"Name": newsgroup, "Frontend": frontend, "AllowFiles": allowFiles}, "form": form, "prefix": prefix}, wr, i18n) } } else { diff --git a/contrib/static/krane.css b/contrib/static/krane.css index 2affba6..796dfd7 100644 --- a/contrib/static/krane.css +++ b/contrib/static/krane.css @@ -599,3 +599,23 @@ background-repeat: repeat; background-color: #2a2a2a; padding: 6px 12px; } + +/* admin post styling */ +.admin-post { + border: 2px solid #ff6666 !important; + background-image: url('/static/admin.png'); + background-repeat: repeat; + background-size: 50px; + opacity: 1; +} +.admin-post * { + position: relative; + z-index: 1; +} + +/* admin post styling via pubkey */ +[data-pubkey="834de9b0dc3e9e89b00de6c2c2a106e232897c5f4662a1346c3050141e0da640"] { + background-image: url('/static/admin.png'); + background-size: 25%; + background-repeat: repeat; +} diff --git a/contrib/templates/placebo/post.mustache b/contrib/templates/placebo/post.mustache index 7b3a3d4..afa85be 100644 --- a/contrib/templates/placebo/post.mustache +++ b/contrib/templates/placebo/post.mustache @@ -1,9 +1,9 @@