mirror of
https://github.com/rr-/szurubooru.git
synced 2025-07-17 08:26:24 +00:00
client/users: add basic users listing
This commit is contained in:
@ -52,7 +52,25 @@ function formatRelativeTime(timeString) {
|
||||
return future ? 'in ' + text : text + ' ago';
|
||||
}
|
||||
|
||||
function parseSearchQuery(query) {
|
||||
let result = {};
|
||||
for (let word of (query || '').split(/;/)) {
|
||||
const [key, value] = word.split(/=/, 2);
|
||||
result[key] = value;
|
||||
}
|
||||
result.text = result.text || '';
|
||||
result.page = parseInt(result.page || '1');
|
||||
return result;
|
||||
}
|
||||
|
||||
function parseSearchQueryRoute(ctx, next) {
|
||||
ctx.searchQuery = parseSearchQuery(ctx.params.query || '');
|
||||
next();
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
range: range,
|
||||
parseSearchQuery: parseSearchQuery,
|
||||
parseSearchQueryRoute: parseSearchQueryRoute,
|
||||
formatRelativeTime: formatRelativeTime,
|
||||
};
|
||||
|
Reference in New Issue
Block a user