fix: revert outgoing peering blocks — autoAcceptPeering only gates incoming
autoAcceptPeering means 'don't accept peering initiated by others', not 'don't initiate peering ourselves'. Two checks were incorrectly blocking outgoing peering when auto-accept was off: 1. ensurePeered() refused to auto-initiate — reverted. When a local user sends a DM, the server should initiate peering. The remote's peer/accept decides whether to accept or queue. 2. queueOutboxEvent() refused to create placeholders — reverted. The outbox needs placeholders to queue entries. Without them, DM relay silently fails.
This commit is contained in:
@@ -80,22 +80,6 @@ export async function ensurePeered(origin: string): Promise<EnsurePeeredResult>
|
||||
}
|
||||
}
|
||||
|
||||
// When autoAcceptPeering is disabled, don't auto-initiate new peering.
|
||||
// The admin's intent is "I control all peering" — both incoming (gated by
|
||||
// peer/accept) and outgoing auto-initiation (gated here). Only the admin
|
||||
// peer/initiate endpoint and the approval-request approve endpoint bypass
|
||||
// this check because those represent explicit admin action.
|
||||
if (!existing) {
|
||||
const settings = db
|
||||
.select({ autoAcceptPeering: schema.instanceSettings.autoAcceptPeering })
|
||||
.from(schema.instanceSettings)
|
||||
.where(eq(schema.instanceSettings.id, 1))
|
||||
.get();
|
||||
if ((settings?.autoAcceptPeering ?? 1) === 0) {
|
||||
return { status: 'failed', error: 'Auto-peering is disabled on this instance — an admin must initiate peering manually' };
|
||||
}
|
||||
}
|
||||
|
||||
// Deduplicate: if a handshake is already in flight, share the promise
|
||||
const inflight = inFlightPeering.get(normalized);
|
||||
if (inflight) {
|
||||
|
||||
Reference in New Issue
Block a user