| 1384 | } |
| 1385 | |
| 1386 | export function getAccountList({ view = 'full', offset = 0, limit = Infinity, filter = '' } = {}) { |
| 1387 | const now = Date.now(); |
| 1388 | let list = accounts; |
| 1389 | if (filter === 'flagged') { |
| 1390 | list = list.filter(a => a.status === 'error' || (a.errorCount || 0) > 0 || (a.rateLimitedUntil && a.rateLimitedUntil > now)); |
| 1391 | } |
| 1392 | const start = Math.max(0, Number.isFinite(offset) ? offset : 0); |
| 1393 | const end = Number.isFinite(limit) ? start + Math.max(0, limit) : undefined; |
| 1394 | return list.slice(start, end).map(a => publicAccount(a, now, { view })); |
| 1395 | } |
| 1396 | |
| 1397 | export function getAccountPublic(id, { view = 'full' } = {}) { |
| 1398 | const account = accounts.find(a => a.id === id); |