Merge branch 'master' of ssh://github.com/majestrate/nntpchan
This commit is contained in:
commit
2f5f84da4b
@ -553,7 +553,16 @@ func (self *httpFrontend) handle_postform(wr http.ResponseWriter, r *http.Reques
|
||||
}
|
||||
}
|
||||
|
||||
sess, _ := self.store.Get(r, self.name)
|
||||
sess, err := self.store.Get(r, self.name)
|
||||
if err != nil {
|
||||
errmsg := fmt.Sprintf("session store error: %s", err.Error())
|
||||
if sendJson {
|
||||
json.NewEncoder(wr).Encode(map[string]interface{}{"error": errmsg})
|
||||
} else {
|
||||
io.WriteString(wr, errmsg)
|
||||
}
|
||||
return
|
||||
}
|
||||
if checkCaptcha && len(captcha_id) == 0 {
|
||||
cid, ok := sess.Values["captcha_id"]
|
||||
if ok {
|
||||
@ -736,8 +745,7 @@ func (self *httpFrontend) handle_postRequest(pr *postRequest, b bannedFunc, e er
|
||||
}
|
||||
}
|
||||
|
||||
// always lower case newsgroups
|
||||
board := strings.ToLower(pr.Group)
|
||||
board := pr.Group
|
||||
|
||||
// post fail message
|
||||
banned, err = self.daemon.database.NewsgroupBanned(board)
|
||||
|
@ -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",
|
||||
|
@ -26,8 +26,17 @@ import (
|
||||
|
||||
var ErrOversizedMessage = errors.New("oversized message")
|
||||
|
||||
// ~ 10 MB unbased64'd
|
||||
const DefaultMaxMessageSize = 1024 * 1024 * 10
|
||||
// (cathugger)
|
||||
// my test showed that 8MiB of attachments split in 5 parts
|
||||
// plus some text produce something close to typhical big message
|
||||
// resulted in 11483923 bytes.
|
||||
// that's consistent with rough size calculation mentioned in
|
||||
// <https://en.wikipedia.org/wiki/Base64#MIME>
|
||||
// ((origlen * 1.37) + 814)
|
||||
// which resulted in 11493206 bytes for 8MiB of data.
|
||||
// previous default of 10MiB (10485760) was too low in practice.
|
||||
// use 11MiB (11534336) to leave some space for longer than usual texts.
|
||||
const DefaultMaxMessageSize = 11 * 1024 * 1024
|
||||
|
||||
// HARD max message size
|
||||
const MaxMessageSize = 1024 * 1024 * 1024
|
||||
|
@ -555,3 +555,7 @@ background-repeat: repeat;
|
||||
font-size: 24pt;
|
||||
float: right;
|
||||
}
|
||||
|
||||
.spam-button {
|
||||
display: none;
|
||||
}
|
@ -2,7 +2,7 @@ function createBoard() {
|
||||
var form = document.getElementById("postform");
|
||||
var e = document.getElementById("boardname");
|
||||
var board = e.value;
|
||||
if ( ! board.startsWith("overchan.") ) {
|
||||
if ( board.indexOf(".") == -1 ) {
|
||||
board = "overchan." + board;
|
||||
}
|
||||
form.action = form.action + board;
|
||||
|
@ -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) {
|
||||
|
@ -853,3 +853,8 @@ th > label {
|
||||
:target {
|
||||
background-color: #493769;
|
||||
}
|
||||
|
||||
|
||||
.mod {
|
||||
display: none;
|
||||
}
|
@ -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}}
|
||||
|
@ -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}}
|
||||
|
@ -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}}
|
||||
|
@ -15,7 +15,7 @@ Dependancies:
|
||||
* imagemagick
|
||||
* ffmpeg
|
||||
* sox
|
||||
* go 1.9
|
||||
* go
|
||||
* GNU make
|
||||
|
||||
## Debian instructions
|
||||
@ -24,7 +24,7 @@ These are installation instructions for Debian.
|
||||
|
||||
### Install Go
|
||||
|
||||
Install the Go programming language version _1.9_ from the [Go website](https://golang.org/dl/).
|
||||
Install the latest version of the Go programming language from the [Go website](https://golang.org/dl/).
|
||||
|
||||
### Install the dependancies
|
||||
|
||||
|
Reference in New Issue
Block a user