mirror of
https://github.com/tomoko-dev9/nntpchan.git
synced 2026-06-01 20:34:46 +02:00
fix pubkey loading, captcha replies only, admin post styling, krane CSS updates
This commit is contained in:
@@ -563,7 +563,7 @@ func (self *httpFrontend) handle_postform(wr http.ResponseWriter, r *http.Reques
|
|||||||
}
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if checkCaptcha && len(captcha_id) == 0 {
|
if checkCaptcha && len(pr.Reference) == 0 && len(captcha_id) == 0 {
|
||||||
cid, ok := sess.Values["captcha_id"]
|
cid, ok := sess.Values["captcha_id"]
|
||||||
if ok {
|
if ok {
|
||||||
captcha_id = cid.(string)
|
captcha_id = cid.(string)
|
||||||
@@ -573,7 +573,7 @@ func (self *httpFrontend) handle_postform(wr http.ResponseWriter, r *http.Reques
|
|||||||
sess.Values["captcha_id"] = ""
|
sess.Values["captcha_id"] = ""
|
||||||
}
|
}
|
||||||
log.Println("captcha", captcha_id, "try '", captcha_solution, "'")
|
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 is not valid
|
||||||
captcha_retry = true
|
captcha_retry = true
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -1287,7 +1287,7 @@ func (self *PostgresDatabase) GetThreadReplyPostModels(prefix, rootpost string,
|
|||||||
}
|
}
|
||||||
// get pubkey if it exists
|
// get pubkey if it exists
|
||||||
// quiet fail
|
// 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)
|
repls = append(repls, model)
|
||||||
}
|
}
|
||||||
rows.Close()
|
rows.Close()
|
||||||
|
|||||||
@@ -330,7 +330,7 @@ func (self *templateEngine) genThread(allowFiles, requireCaptcha bool, root Arti
|
|||||||
self.renderJSON(wr, t)
|
self.renderJSON(wr, t)
|
||||||
} else {
|
} else {
|
||||||
t.I18N(i18n)
|
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)
|
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 {
|
} else {
|
||||||
|
|||||||
@@ -599,3 +599,23 @@ background-repeat: repeat;
|
|||||||
background-color: #2a2a2a;
|
background-color: #2a2a2a;
|
||||||
padding: 6px 12px;
|
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;
|
||||||
|
}
|
||||||
|
|||||||
@@ -1,9 +1,9 @@
|
|||||||
<div id="{{post.PostHash}}"
|
<div id="{{post.PostHash}}"
|
||||||
{{#post.OP}}
|
{{#post.OP}}
|
||||||
class="messageroot post"
|
class="messageroot post {{#post.Pubkey}}admin-post{{/post.Pubkey}}"
|
||||||
{{/post.OP}}
|
{{/post.OP}}
|
||||||
{{^post.OP}}
|
{{^post.OP}}
|
||||||
class="message post"
|
class="message post {{#post.Pubkey}}admin-post{{/post.Pubkey}}"
|
||||||
{{/post.OP}}
|
{{/post.OP}}
|
||||||
data-name="{{post.Name}}"
|
data-name="{{post.Name}}"
|
||||||
data-frontend="{{post.Frontend}}"
|
data-frontend="{{post.Frontend}}"
|
||||||
|
|||||||
Reference in New Issue
Block a user