aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/serve.js9
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/serve.js b/lib/serve.js
index 34861bc..1206b36 100644
--- a/lib/serve.js
+++ b/lib/serve.js
@@ -75,6 +75,8 @@ Serve.prototype.go = function () {
this.res.setTimeout(0)
var conf = self.app.config.patchfoo || {}
+ this.conf = conf
+
var authtok = conf.auth || null
if (authtok) {
var auth = this.req.headers['authorization']
@@ -524,8 +526,10 @@ Serve.prototype.new = function (ext) {
var self = this
var q = self.query
var latest = (/latest=([^;]*)/.exec(self.req.headers.cookie) || [])[1]
+ var limit = Number(q.limit || self.conf.newLimit || 500)
var opts = {
gt: Number(q.gt) || Number(latest) || Date.now(),
+ limit: limit
}
if (q.catchup) self.setCookie('latest', opts.gt, {'Max-Age': 86400000})
@@ -552,6 +556,7 @@ Serve.prototype.new = function (ext) {
pull.values(msgs),
self.renderThread(),
self.wrapNew({
+ reachedLimit: msgs.length === limit && limit,
gt: isFinite(maxTS) ? maxTS : Date.now()
}),
self.wrapMessages(),
@@ -3415,10 +3420,14 @@ Serve.prototype.wrapNew = function (opts) {
cb(null, [
composer,
h('table.ssb-msgs',
+ opts.reachedLimit ? h('tr', h('td.paginate.msg-left', {colspan: 3},
+ 'Reached limit of ' + opts.reachedLimit + ' messages'
+ )) : '',
thread,
h('tr', h('td.paginate.msg-left', {colspan: 3},
h('form', {method: 'get', action: ''},
h('input', {type: 'hidden', name: 'gt', value: opts.gt}),
+ self.query.limit ? h('input', {type: 'hidden', name: 'limit', value: self.query.limit}) : '',
h('input', {type: 'hidden', name: 'catchup', value: '1'}),
h('input', {type: 'submit', value: 'catchup'})
)