Archived
1
0

Compare commits

..

10 Commits

Author SHA1 Message Date
Jeff Becker
f92f68c3cd
close connection 2020-03-07 09:07:23 -05:00
Jeff Becker
77fe66c330
log tls error 2020-03-07 09:05:21 -05:00
Jeff Becker
ff8c3e915a
get rootiest post 2020-03-07 08:27:45 -05:00
Jeff Becker
2f5f84da4b
Merge branch 'master' of ssh://github.com/majestrate/nntpchan 2020-02-10 17:30:17 -05:00
Jeff Becker
477acabd19
current year 2020-02-10 17:30:06 -05:00
jeff
e2cbffea30 meh 2019-09-16 07:00:50 -04:00
jeff
0261f26043 fix style 2019-09-16 06:57:41 -04:00
jeff
5381c7b2a4 hide stuff 2019-09-16 06:53:53 -04:00
jeff
015c64139d fix mod action js 2019-09-16 06:51:11 -04:00
Jeff
4b08919f75 don't give out banned newsgroups in list 2019-08-31 15:17:54 -04:00
10 changed files with 23 additions and 12 deletions

View File

@ -1,6 +1,6 @@
The MIT License (MIT)
Copyright (c) 2015-2018 Jeff Becker
Copyright (c) 2015-2020 Jeff Becker
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal

View File

@ -1240,10 +1240,14 @@ func (self *nntpConnection) handleLine(daemon *NNTPDaemon, code int, line string
log.Println(self.name, "got reply to", reference, "but we don't have it")
go daemon.askForArticle(reference)
} else {
h := daemon.store.GetMIMEHeader(reference)
if strings.Trim(h.Get("References"), " ") == "" {
hdr.Set("References", getMessageID(h))
// get rootiest post
ref := reference
var h textproto.MIMEHeader
for ref != "" {
h = daemon.store.GetMIMEHeader(ref)
ref = strings.Trim(h.Get("References"), " ")
}
hdr.Set("References", getMessageID(h))
}
} else if reference != "" {
// bad message id

View File

@ -204,7 +204,7 @@ func (self *PostgresDatabase) prepareStatements() {
GetMessageIDByHash: "SELECT message_id, message_newsgroup FROM Articles WHERE message_id_hash = $1 LIMIT 1",
CheckEncIPBanned: "SELECT 1 FROM EncIPBans WHERE encaddr = $1",
GetFirstAndLastForGroup: "WITH x(min_no, max_no) AS ( SELECT MIN(message_no) AS min_no, MAX(message_no) AS max_no FROM ArticleNumbers WHERE newsgroup = $1) SELECT CASE WHEN min_no IS NULL THEN 0 ELSE min_no END AS min_no FROM x UNION SELECT CASE WHEN max_no IS NULL THEN 1 ELSE max_no END AS max_no FROM x",
GetNewsgroupList: "SELECT newsgroup, min(message_no), max(message_no) FROM ArticleNumbers GROUP BY newsgroup ORDER BY newsgroup",
GetNewsgroupList: "SELECT newsgroup, min(message_no), max(message_no) FROM ArticleNumbers WHERE newsgroup NOT IN ( SELECT newsgroup FROM bannedgroups ) GROUP BY newsgroup ORDER BY newsgroup",
GetMessageIDForNNTPID: "SELECT message_id FROM ArticleNumbers WHERE newsgroup = $1 AND message_no = $2 LIMIT 1",
GetNNTPIDForMessageID: "SELECT message_no FROM ArticleNumbers WHERE newsgroup = $1 AND message_id = $2 LIMIT 1",
IsExpired: "WITH x(msgid) AS ( SELECT message_id FROM Articles WHERE message_id = $1 INTERSECT ( SELECT message_id FROM ArticlePosts WHERE message_id = $1 ) ) SELECT COUNT(*) FROM x",

View File

@ -42,6 +42,7 @@ func HandleStartTLS(conn net.Conn, config *tls.Config) (econn *textproto.Conn, s
econn = textproto.NewConn(tconn)
return
} else {
log.Println("tls handshake error: ", err.Error())
certs := state.PeerCertificates
if len(certs) == 0 {
log.Println("starttls failed, no peer certs provided")
@ -53,6 +54,7 @@ func HandleStartTLS(conn net.Conn, config *tls.Config) (econn *textproto.Conn, s
}
}
tconn.Close()
conn.Close()
}
}
}

View File

@ -555,3 +555,7 @@ background-repeat: repeat;
font-size: 24pt;
float: right;
}
.spam-button {
display: none;
}

View File

@ -76,10 +76,6 @@ var nntpchan_mod_action = function(mod_action, elem) {
// http error
elem.innerHTML = "error: HTTP "+status;
}
// clear input
if (input) {
input.value = "";
}
}
}
if (mod_action.name) {

View File

@ -853,3 +853,8 @@ th > label {
:target {
background-color: #493769;
}
.mod {
display: none;
}

View File

@ -38,7 +38,7 @@
<b>Most of the rest of the wild west.</b>
</div>
<center><b>{{board.Name}}</b></center>
<center><button onclick="nntpchan_mod_commit_spam(this)">Moderate</button></center>
<center><button class="spam-button" onclick="nntpchan_mod_commit_spam(this)">Moderate</button></center>
<br />
{{{form}}}
{{#board.Threads}}

View File

@ -48,7 +48,7 @@
<b>Most of the rest of the wild west.</b>
</div>
<center><b><a href="{{thread.BoardURL}}">{{thread.Board}}</a></b></center>
<center><button onclick="nntpchan_mod_commit_spam(this)">Moderate</button></center>
<center><button class="spam-button" onclick="nntpchan_mod_commit_spam(this)">Moderate</button></center>
<br />
{{{form}}}
{{#thread.BumpLock}}

View File

@ -31,7 +31,7 @@
<div class="sitetitle">
<h2><a href="#">CHANGOLIA</a></h2>
<b>Most of the rest of the wild west.</b>
<center><button onclick="nntpchan_mod_commit_spam(this)">Moderate</button></center>
<center><button class="spam-button" onclick="nntpchan_mod_commit_spam(this)">Moderate</button></center>
</div>
<div id="paginator">
{{#prev}}