From 67e0f259b655e2ce95cf1cac49404b758c2d81d2 Mon Sep 17 00:00:00 2001 From: Jeff Becker Date: Sun, 10 Feb 2019 14:11:04 -0500 Subject: [PATCH] add reveal secrets in mod stream --- contrib/backends/srndv2/src/srnd/model.go | 4 +++- contrib/backends/srndv2/src/srnd/model_mem.go | 4 ++++ contrib/static/overchan.js | 23 +++++++++++++++++++ contrib/templates/placebo/post.mustache | 5 +++- 4 files changed, 34 insertions(+), 2 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/model.go b/contrib/backends/srndv2/src/srnd/model.go index d4967e0..4ae53f3 100644 --- a/contrib/backends/srndv2/src/srnd/model.go +++ b/contrib/backends/srndv2/src/srnd/model.go @@ -81,6 +81,9 @@ type PostModel interface { // returns true if this post was truncated IsTruncated() bool + // return true if this post is a mod message + IsCtl() bool + IsI2P() bool IsTor() bool IsClearnet() bool @@ -244,7 +247,6 @@ func (self boardPageRows) Swap(i, j int) { self[i], self[j] = self[j], self[i] } - type postsGraphRow struct { day time.Time Num int64 diff --git a/contrib/backends/srndv2/src/srnd/model_mem.go b/contrib/backends/srndv2/src/srnd/model_mem.go index 37ebfcd..b31b4d5 100644 --- a/contrib/backends/srndv2/src/srnd/model_mem.go +++ b/contrib/backends/srndv2/src/srnd/model_mem.go @@ -297,6 +297,10 @@ type post struct { FrontendPublicKey string } +func (p *post) IsCtl() bool { + return p.board == "ctl" +} + func (self *post) NNTPID() int { return self.nntp_id } diff --git a/contrib/static/overchan.js b/contrib/static/overchan.js index 46676fc..511601c 100644 --- a/contrib/static/overchan.js +++ b/contrib/static/overchan.js @@ -16,6 +16,29 @@ var nntpchan_mod_mark_spam = function(longhash) { elem.innerText = "spam"; }; +var nntpchan_mod_decode_ipban = function(longhash) { + var elem = document.getElementById("post_body_" + longhash); + if(!elem) return; + var lines = elem.inenrText.split("\n"); + for(var i = 0; i < lines.length; ++i) + { + if (!lines[idx].startsWith("overchan-inet-ban")) + continue; + var parts = lines[idx].split(" "); + if(parts.length != 2) continue; + parts = parts[1].split(":"); + if(parts.legngth < 2) continue; + var a1 = atob(parts[0]); + var a2 = atob(parts[1]); + var txt = ""; + for(var idx = 0; idx < a1.length; ++idx) + { + txt += String.fromCharCode(a1.charCodeAt(idx) ^ a2.charCodeAt(idx)); + } + elem.appendChild(document.createTextNode(txt + "\n")); + } +}; + var nntpchan_mod_commit_spam = function(elem) { var formdata = new FormData(); var posts = document.getElementsByClassName("post"); diff --git a/contrib/templates/placebo/post.mustache b/contrib/templates/placebo/post.mustache index 80b2838..907545a 100644 --- a/contrib/templates/placebo/post.mustache +++ b/contrib/templates/placebo/post.mustache @@ -32,10 +32,13 @@ {{/post.Attachments}} [Delete] [Spam] + {{#post.IsCtl}} + [Decode Secrets] + {{/post.IsCtl}} {{post.Subject}} {{post.Name}} {{post.Frontend}} || {{post.Date}} {{{post.Pubkey}}} [Reply] {{post.ShortHash}}

- {{{post.RenderBody}}} + {{{post.RenderBody}}}