Prefer direct copies for playback, saves and exports within verified device groups

This commit is contained in:
Jonathan Sykes
2026-10-03 20:38:51 +08:00
parent 08ff8398b5
commit 795a5aaed4
8 changed files with 125 additions and 14 deletions

View File

@@ -14,6 +14,10 @@ export function createDirectRelay({ now = Date.now } = {}) {
const r = rate && t - rate.start < 60000 ? rate : { start: t, count: 0 };
rates.set(from, r);
if (++r.count > 240) return false;
if (m.action === 'request') {
if (m.to === from || !peers.has(m.to)) return false;
send(peers.get(m.to), { type: 'direct', action: 'request', from, id: m.id }); return true;
}
if (m.action === 'invite') {
if (m.to === from || !peers.has(m.to) || transfers.size >= 64) return false;
const token = randomBytes(24).toString('base64url');