Archived
1
0

add reveal secrets in mod stream

This commit is contained in:
Jeff Becker 2019-02-10 14:11:04 -05:00
parent 59068bb961
commit 67e0f259b6
No known key found for this signature in database
GPG Key ID: F357B3B42F6F9B05
4 changed files with 34 additions and 2 deletions

View File

@ -81,6 +81,9 @@ type PostModel interface {
// returns true if this post was truncated // returns true if this post was truncated
IsTruncated() bool IsTruncated() bool
// return true if this post is a mod message
IsCtl() bool
IsI2P() bool IsI2P() bool
IsTor() bool IsTor() bool
IsClearnet() bool IsClearnet() bool
@ -244,7 +247,6 @@ func (self boardPageRows) Swap(i, j int) {
self[i], self[j] = self[j], self[i] self[i], self[j] = self[j], self[i]
} }
type postsGraphRow struct { type postsGraphRow struct {
day time.Time day time.Time
Num int64 Num int64

View File

@ -297,6 +297,10 @@ type post struct {
FrontendPublicKey string FrontendPublicKey string
} }
func (p *post) IsCtl() bool {
return p.board == "ctl"
}
func (self *post) NNTPID() int { func (self *post) NNTPID() int {
return self.nntp_id return self.nntp_id
} }

View File

@ -16,6 +16,29 @@ var nntpchan_mod_mark_spam = function(longhash) {
elem.innerText = "spam"; 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 nntpchan_mod_commit_spam = function(elem) {
var formdata = new FormData(); var formdata = new FormData();
var posts = document.getElementsByClassName("post"); var posts = document.getElementsByClassName("post");

View File

@ -32,10 +32,13 @@
{{/post.Attachments}} {{/post.Attachments}}
<a href="#" onclick="nntpchan_mod_delete('{{post.PostHash}}');">[Delete]</a> <a href="#" onclick="nntpchan_mod_delete('{{post.PostHash}}');">[Delete]</a>
<a href="#" onclick="nntpchan_mod_mark_spam('{{post.PostHash}}');">[Spam]</a> <a href="#" onclick="nntpchan_mod_mark_spam('{{post.PostHash}}');">[Spam]</a>
{{#post.IsCtl}}
<a href="#" onclick="nntpchan_mod_decode_ipban('{{post.PostHash}}');">[Decode Secrets]</a>
{{/post.IsCtl}}
<a name="{{post.PostHash}}"></a><span class="topicline"><b data-subject="{{post.Subject}}" class="subject">{{post.Subject}}</b> {{post.Name}} <span class="published">{{post.Frontend}} || {{post.Date}}</span> {{{post.Pubkey}}} <a href="{{post.PostURL}}">[Reply]</a> <a name="{{post.PostHash}}"></a><span class="topicline"><b data-subject="{{post.Subject}}" class="subject">{{post.Subject}}</b> {{post.Name}} <span class="published">{{post.Frontend}} || {{post.Date}}</span> {{{post.Pubkey}}} <a href="{{post.PostURL}}">[Reply]</a>
<a href="#" onclick="return quickreply('{{post.ShortHash}}', '{{post.PostHash}}', '{{post.PostURL}}');"> {{post.ShortHash}}</a> <a href="#" onclick="return quickreply('{{post.ShortHash}}', '{{post.PostHash}}', '{{post.PostURL}}');"> {{post.ShortHash}}</a>
</span> </span>
<br /><br /> <br /><br />
<span class="message_span">{{{post.RenderBody}}}</span> <span id="post_body_{{post.PostHash}}" class="message_span">{{{post.RenderBody}}}</span>
<br style="clear: both;" /> <br style="clear: both;" />
</div> </div>