fix pubkey loading, captcha replies only, admin post styling, krane CSS updates

This commit is contained in:
tomoko-dev9
2026-05-11 19:43:12 +00:00
parent aee7b0a2e2
commit 4798813a76
5 changed files with 26 additions and 6 deletions
@@ -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 {
+1 -1
View File
@@ -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()
@@ -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 {
+20
View File
@@ -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;
}
+2 -2
View File
@@ -1,9 +1,9 @@
<div id="{{post.PostHash}}"
{{#post.OP}}
class="messageroot post"
class="messageroot post {{#post.Pubkey}}admin-post{{/post.Pubkey}}"
{{/post.OP}}
{{^post.OP}}
class="message post"
class="message post {{#post.Pubkey}}admin-post{{/post.Pubkey}}"
{{/post.OP}}
data-name="{{post.Name}}"
data-frontend="{{post.Frontend}}"