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 {
|
if checkCaptcha && len(captcha_id) == 0 {
|
||||||
cid, ok := sess.Values["captcha_id"]
|
cid, ok := sess.Values["captcha_id"]
|
||||||
if ok {
|
if ok {
|
||||||
@ -736,8 +745,7 @@ func (self *httpFrontend) handle_postRequest(pr *postRequest, b bannedFunc, e er
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// always lower case newsgroups
|
board := pr.Group
|
||||||
board := strings.ToLower(pr.Group)
|
|
||||||
|
|
||||||
// post fail message
|
// post fail message
|
||||||
banned, err = self.daemon.database.NewsgroupBanned(board)
|
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",
|
GetMessageIDByHash: "SELECT message_id, message_newsgroup FROM Articles WHERE message_id_hash = $1 LIMIT 1",
|
||||||
CheckEncIPBanned: "SELECT 1 FROM EncIPBans WHERE encaddr = $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",
|
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",
|
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",
|
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",
|
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")
|
var ErrOversizedMessage = errors.New("oversized message")
|
||||||
|
|
||||||
// ~ 10 MB unbased64'd
|
// (cathugger)
|
||||||
const DefaultMaxMessageSize = 1024 * 1024 * 10
|
// 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
|
// HARD max message size
|
||||||
const MaxMessageSize = 1024 * 1024 * 1024
|
const MaxMessageSize = 1024 * 1024 * 1024
|
||||||
|
@ -555,3 +555,7 @@ background-repeat: repeat;
|
|||||||
font-size: 24pt;
|
font-size: 24pt;
|
||||||
float: right;
|
float: right;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spam-button {
|
||||||
|
display: none;
|
||||||
|
}
|
@ -2,7 +2,7 @@ function createBoard() {
|
|||||||
var form = document.getElementById("postform");
|
var form = document.getElementById("postform");
|
||||||
var e = document.getElementById("boardname");
|
var e = document.getElementById("boardname");
|
||||||
var board = e.value;
|
var board = e.value;
|
||||||
if ( ! board.startsWith("overchan.") ) {
|
if ( board.indexOf(".") == -1 ) {
|
||||||
board = "overchan." + board;
|
board = "overchan." + board;
|
||||||
}
|
}
|
||||||
form.action = form.action + board;
|
form.action = form.action + board;
|
||||||
|
@ -76,10 +76,6 @@ var nntpchan_mod_action = function(mod_action, elem) {
|
|||||||
// http error
|
// http error
|
||||||
elem.innerHTML = "error: HTTP "+status;
|
elem.innerHTML = "error: HTTP "+status;
|
||||||
}
|
}
|
||||||
// clear input
|
|
||||||
if (input) {
|
|
||||||
input.value = "";
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (mod_action.name) {
|
if (mod_action.name) {
|
||||||
|
@ -853,3 +853,8 @@ th > label {
|
|||||||
:target {
|
:target {
|
||||||
background-color: #493769;
|
background-color: #493769;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
.mod {
|
||||||
|
display: none;
|
||||||
|
}
|
@ -38,7 +38,7 @@
|
|||||||
<b>Most of the rest of the wild west.</b>
|
<b>Most of the rest of the wild west.</b>
|
||||||
</div>
|
</div>
|
||||||
<center><b>{{board.Name}}</b></center>
|
<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 />
|
<br />
|
||||||
{{{form}}}
|
{{{form}}}
|
||||||
{{#board.Threads}}
|
{{#board.Threads}}
|
||||||
|
@ -48,7 +48,7 @@
|
|||||||
<b>Most of the rest of the wild west.</b>
|
<b>Most of the rest of the wild west.</b>
|
||||||
</div>
|
</div>
|
||||||
<center><b><a href="{{thread.BoardURL}}">{{thread.Board}}</a></b></center>
|
<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 />
|
<br />
|
||||||
{{{form}}}
|
{{{form}}}
|
||||||
{{#thread.BumpLock}}
|
{{#thread.BumpLock}}
|
||||||
|
@ -31,7 +31,7 @@
|
|||||||
<div class="sitetitle">
|
<div class="sitetitle">
|
||||||
<h2><a href="#">CHANGOLIA</a></h2>
|
<h2><a href="#">CHANGOLIA</a></h2>
|
||||||
<b>Most of the rest of the wild west.</b>
|
<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>
|
||||||
<div id="paginator">
|
<div id="paginator">
|
||||||
{{#prev}}
|
{{#prev}}
|
||||||
|
@ -15,7 +15,7 @@ Dependancies:
|
|||||||
* imagemagick
|
* imagemagick
|
||||||
* ffmpeg
|
* ffmpeg
|
||||||
* sox
|
* sox
|
||||||
* go 1.9
|
* go
|
||||||
* GNU make
|
* GNU make
|
||||||
|
|
||||||
## Debian instructions
|
## Debian instructions
|
||||||
@ -24,7 +24,7 @@ These are installation instructions for Debian.
|
|||||||
|
|
||||||
### Install Go
|
### 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
|
### Install the dependancies
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user