dsh-fishpal 0.9.0 → 0.9.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +232 -0
- package/README.md +176 -16
- package/lib/bottle-ack.js +220 -0
- package/lib/bottle-crypto.js +179 -0
- package/lib/bottle-dedup.js +104 -0
- package/lib/bottle-gate.js +192 -0
- package/lib/bottle-pow.js +138 -0
- package/lib/bottle.js +358 -15
- package/lib/config.js +38 -1
- package/lib/guard.js +49 -0
- package/lib/index.js +838 -86
- package/lib/invite.js +134 -0
- package/lib/localserver.js +38 -2
- package/lib/loop.js +35 -2
- package/lib/peer.js +2 -2
- package/lib/pii.js +303 -0
- package/lib/protocol.js +65 -12
- package/lib/room.js +20 -1
- package/lib/ui.js +523 -14
- package/lib/visit.js +158 -0
- package/package.json +3 -2
- package/tests/run.mjs +176 -0
package/lib/guard.js
CHANGED
|
@@ -336,3 +336,52 @@ export function expireQuarantine({ days = 7, now = new Date() } = {}) {
|
|
|
336
336
|
fs.renameSync(tmp, file);
|
|
337
337
|
return { expired: ids.length, ids };
|
|
338
338
|
}
|
|
339
|
+
|
|
340
|
+
/**
|
|
341
|
+
* ��ҳ����һ�Ѽ�¼���г�һҳ����˵�塸���ж���û��ʾ����
|
|
342
|
+
*
|
|
343
|
+
* �� 2026-11-29 �������յ���Ʈƿ̫������ô�죿��
|
|
344
|
+
* ���������̺ͽ��涼����ƿ����һ���� 570 �ֽڡ�����ֻ�� 40 ������
|
|
345
|
+
* ������������ fishpal_review list �Ѵ���**ȫ��**�̳�����
|
|
346
|
+
* 200 �� �� 200 �� = �����֣�һ�ξͰ���������ijű���Ȼ����˭Ҳ������
|
|
347
|
+
*
|
|
348
|
+
* ��̫�ࡹ�������ݶ��ˣ���һ�θ����ˡ�
|
|
349
|
+
*
|
|
350
|
+
* �߽綼�����������ɢ�����ô���
|
|
351
|
+
* limit �Ƿ� / <= 0 �� Ĭ�� 20
|
|
352
|
+
* limit �������� �� �ⶥ��Ĭ�� 100��
|
|
353
|
+
* offset �Ƿ� / ���� �� 0
|
|
354
|
+
* offset �������� �� page Ϊ�ա�more Ϊ 0��oob=true�����÷�Ҫ˵�˻�������ɸ��ģ�
|
|
355
|
+
*
|
|
356
|
+
* @param {Array} list
|
|
357
|
+
* @param {object} opts
|
|
358
|
+
* @param {number} opts.limit
|
|
359
|
+
* @param {number} opts.offset
|
|
360
|
+
* @param {number} opts.maxLimit
|
|
361
|
+
* @returns {{page: Array, more: number, total: number, offset: number, limit: number, oob: boolean}}
|
|
362
|
+
*/
|
|
363
|
+
export function pageOf(list, { limit = 20, offset = 0, maxLimit = 100 } = {}) {
|
|
364
|
+
const all = Array.isArray(list) ? list : [];
|
|
365
|
+
const total = all.length;
|
|
366
|
+
|
|
367
|
+
const lim = Number.isFinite(Number(limit)) && Number(limit) > 0
|
|
368
|
+
? Math.min(Math.floor(Number(limit)), maxLimit)
|
|
369
|
+
: 20;
|
|
370
|
+
const off = Number.isFinite(Number(offset)) && Number(offset) > 0
|
|
371
|
+
? Math.floor(Number(offset))
|
|
372
|
+
: 0;
|
|
373
|
+
|
|
374
|
+
if (off >= total) {
|
|
375
|
+
return { page: [], more: 0, total, offset: off, limit: lim, oob: total > 0 };
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
const page = all.slice(off, off + lim);
|
|
379
|
+
return {
|
|
380
|
+
page,
|
|
381
|
+
more: total - (off + page.length),
|
|
382
|
+
total,
|
|
383
|
+
offset: off,
|
|
384
|
+
limit: lim,
|
|
385
|
+
oob: false,
|
|
386
|
+
};
|
|
387
|
+
}
|