From d8f888dffa2d7d234618a1849d88339bc36ce5e3 Mon Sep 17 00:00:00 2001 From: cathugger Date: Sat, 6 Apr 2019 20:36:54 +0300 Subject: [PATCH 01/10] srnd: saner default max message size --- contrib/backends/srndv2/src/srnd/store.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/store.go b/contrib/backends/srndv2/src/srnd/store.go index 930e885..f8c907c 100644 --- a/contrib/backends/srndv2/src/srnd/store.go +++ b/contrib/backends/srndv2/src/srnd/store.go @@ -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 +// +// ((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 From 8f39dec91b85d6210e587673ebe5cfe1a513f892 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sun, 7 Apr 2019 08:52:49 -0400 Subject: [PATCH 02/10] Update building.md --- doc/building.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/doc/building.md b/doc/building.md index 9670fbf..88ae975 100644 --- a/doc/building.md +++ b/doc/building.md @@ -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 From 40a5e9be3fcb673878220ce4fdb4beb61fbd2321 Mon Sep 17 00:00:00 2001 From: Jeff Date: Wed, 15 May 2019 07:12:00 -0400 Subject: [PATCH 03/10] don't always use lowercase --- contrib/backends/srndv2/src/srnd/frontend_http.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/contrib/backends/srndv2/src/srnd/frontend_http.go b/contrib/backends/srndv2/src/srnd/frontend_http.go index 5ef20f7..20516f1 100644 --- a/contrib/backends/srndv2/src/srnd/frontend_http.go +++ b/contrib/backends/srndv2/src/srnd/frontend_http.go @@ -736,8 +736,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) From 12709d364bc84271bbc841569642127e2595c70b Mon Sep 17 00:00:00 2001 From: Jeff Date: Fri, 30 Aug 2019 18:54:00 -0400 Subject: [PATCH 04/10] catch case --- contrib/backends/srndv2/src/srnd/frontend_http.go | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/contrib/backends/srndv2/src/srnd/frontend_http.go b/contrib/backends/srndv2/src/srnd/frontend_http.go index 798ce79..4953e48 100644 --- a/contrib/backends/srndv2/src/srnd/frontend_http.go +++ b/contrib/backends/srndv2/src/srnd/frontend_http.go @@ -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 { From 15ccb7ad50363c3d1a7cfbc23c55f42dcaecdbd1 Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 31 Aug 2019 07:56:07 -0400 Subject: [PATCH 05/10] only force overchan prefix if no . is present --- contrib/static/newboard.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/static/newboard.js b/contrib/static/newboard.js index 99b1a2f..153dc1e 100644 --- a/contrib/static/newboard.js +++ b/contrib/static/newboard.js @@ -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; From 4b08919f7511dc4e90eb3748d5731f8c0951021b Mon Sep 17 00:00:00 2001 From: Jeff Date: Sat, 31 Aug 2019 15:17:54 -0400 Subject: [PATCH 06/10] don't give out banned newsgroups in list --- contrib/backends/srndv2/src/srnd/postgres.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/contrib/backends/srndv2/src/srnd/postgres.go b/contrib/backends/srndv2/src/srnd/postgres.go index 64c7ffd..5251c8d 100644 --- a/contrib/backends/srndv2/src/srnd/postgres.go +++ b/contrib/backends/srndv2/src/srnd/postgres.go @@ -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", From 015c64139d88b47493d371b7d006b2b771ba4c6c Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 16 Sep 2019 06:51:11 -0400 Subject: [PATCH 07/10] fix mod action js --- contrib/static/overchan.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/contrib/static/overchan.js b/contrib/static/overchan.js index 5b2391a..6d8eadb 100644 --- a/contrib/static/overchan.js +++ b/contrib/static/overchan.js @@ -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) { From 5381c7b2a40db4df7a7e76b9569062b6abc04d8b Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 16 Sep 2019 06:53:53 -0400 Subject: [PATCH 08/10] hide stuff --- contrib/static/site.css | 5 +++++ contrib/templates/placebo/board.mustache | 2 +- contrib/templates/placebo/thread.mustache | 2 +- contrib/templates/placebo/ukko.mustache | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/contrib/static/site.css b/contrib/static/site.css index c7ca52f..6b9f62e 100644 --- a/contrib/static/site.css +++ b/contrib/static/site.css @@ -853,3 +853,8 @@ th > label { :target { background-color: #493769; } + + + .mod { + display: none; + } \ No newline at end of file diff --git a/contrib/templates/placebo/board.mustache b/contrib/templates/placebo/board.mustache index 80aa05b..2a2e726 100644 --- a/contrib/templates/placebo/board.mustache +++ b/contrib/templates/placebo/board.mustache @@ -38,7 +38,7 @@ Most of the rest of the wild west.
{{board.Name}}
-
+

{{{form}}} {{#board.Threads}} diff --git a/contrib/templates/placebo/thread.mustache b/contrib/templates/placebo/thread.mustache index 5f4d118..7be9cc2 100644 --- a/contrib/templates/placebo/thread.mustache +++ b/contrib/templates/placebo/thread.mustache @@ -48,7 +48,7 @@ Most of the rest of the wild west.
{{thread.Board}}
-
+

{{{form}}} {{#thread.BumpLock}} diff --git a/contrib/templates/placebo/ukko.mustache b/contrib/templates/placebo/ukko.mustache index 8303cda..b369ab9 100644 --- a/contrib/templates/placebo/ukko.mustache +++ b/contrib/templates/placebo/ukko.mustache @@ -31,7 +31,7 @@

CHANGOLIA

Most of the rest of the wild west. -
+
{{#prev}} From 0261f260431f0e94dd86fc623f77508c054c8545 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 16 Sep 2019 06:57:41 -0400 Subject: [PATCH 09/10] fix style --- contrib/static/krane.css | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/contrib/static/krane.css b/contrib/static/krane.css index d2ced68..f97c113 100644 --- a/contrib/static/krane.css +++ b/contrib/static/krane.css @@ -555,3 +555,7 @@ background-repeat: repeat; font-size: 24pt; float: right; } + +.mod { + display: none; +} \ No newline at end of file From e2cbffea30ddef1837abee435c9bf2b3e0b45c04 Mon Sep 17 00:00:00 2001 From: jeff Date: Mon, 16 Sep 2019 07:00:50 -0400 Subject: [PATCH 10/10] meh --- contrib/static/krane.css | 2 +- contrib/templates/placebo/board.mustache | 2 +- contrib/templates/placebo/thread.mustache | 2 +- contrib/templates/placebo/ukko.mustache | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/contrib/static/krane.css b/contrib/static/krane.css index f97c113..580767c 100644 --- a/contrib/static/krane.css +++ b/contrib/static/krane.css @@ -556,6 +556,6 @@ background-repeat: repeat; float: right; } -.mod { +.spam-button { display: none; } \ No newline at end of file diff --git a/contrib/templates/placebo/board.mustache b/contrib/templates/placebo/board.mustache index 2a2e726..5501a78 100644 --- a/contrib/templates/placebo/board.mustache +++ b/contrib/templates/placebo/board.mustache @@ -38,7 +38,7 @@ Most of the rest of the wild west.
{{board.Name}}
-
+

{{{form}}} {{#board.Threads}} diff --git a/contrib/templates/placebo/thread.mustache b/contrib/templates/placebo/thread.mustache index 7be9cc2..a5c41d9 100644 --- a/contrib/templates/placebo/thread.mustache +++ b/contrib/templates/placebo/thread.mustache @@ -48,7 +48,7 @@ Most of the rest of the wild west.
{{thread.Board}}
-
+

{{{form}}} {{#thread.BumpLock}} diff --git a/contrib/templates/placebo/ukko.mustache b/contrib/templates/placebo/ukko.mustache index b369ab9..d1105ec 100644 --- a/contrib/templates/placebo/ukko.mustache +++ b/contrib/templates/placebo/ukko.mustache @@ -31,7 +31,7 @@

CHANGOLIA

Most of the rest of the wild west. -
+
{{#prev}}