Synchronet now requires the libarchive development package (e.g. libarchive-dev on Debian-based Linux distros, libarchive.org for more info) to build successfully.

Commit 0ed73e64 authored by echicken's avatar echicken 🐔

Include total count of threads when returning a subset.

parent 16a79e9f
......@@ -59,14 +59,14 @@ function listThreads(sub, offset, count) {
if (offset >= threads.order.length) return false;
var stop = Math.min(threads.order.length, offset + count);
var ret = [];
var ret = { total: threads.order.length, threads : [] };
for (var n = offset; n < stop; n++) {
var thread = threads.thread[threads.order[n]];
var msgs = Object.keys(thread.messages);
thread.first = thread.messages[msgs[0]];
thread.last = thread.messages[msgs[msgs.length - 1]];
thread.messages = msgs.length;
ret.push(thread);
ret.threads.push(thread);
}
return ret;
......@@ -1085,4 +1085,17 @@ function getMessageThreads(sub, max) {
}
function isValidRequest() {
if (Req.has_param('group')) {
const grp = Req.get_param('group');
if (typeof msg_area.grp_list[grp] == 'undefined') return false;
if (!user.compare_ars(msg_area.grp_list[grp].ars)) return false;
}
if (Req.has_param('sub')) {
const sub = Req.get_param('sub');
if (typeof msg_area.sub[sub] == 'undefined') return false;
}
return true;
}
this;
......@@ -218,7 +218,7 @@ if ((http_request.method === 'GET' || http_request.method === 'POST') &&
http_request.query.sub[0],
http_request.query.offset[0],
count || settings.page_size
);
).threads;
}
break;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment