fix(custom-domains): web-Domains nicht am alreadyGlobal-Check abweisen

Der alreadyGlobal-Pre-Check (Domain schon in der 208k-Layer-1-Blocklist →
kein Custom-Slot) gilt jetzt nur noch fuer Mail-Typen. Fuer type='web'
uebersprungen: Web-Custom-Domains speisen die Layer-2-VIP-Liste, eine separate
Schicht — eine global (Layer 1) gelistete Domain muss in die VIP koennen,
gerade weil Layer 2 das Netz ist, wenn Layer 1 aus ist.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
chahinebrini 2026-05-21 22:14:18 +02:00
parent c3390a0fed
commit ced749018b

View File

@ -168,18 +168,25 @@ export default defineEventHandler(async (event) => {
});
}
// Pre-check: domain already on the global blocklist? Don't burn a slot for
// something the 208k-domain global filter already covers. Return 200 with a
// flag so the frontend can surface "already protected, no slot needed"
// without the user paying for it. mail_domain is included in the same check
// because mail-domains land in the same blocklist set the daemon scans.
const db = usePrisma();
const globalMatch = await db.blocklistDomain.findFirst({
where: { domain: value, isActive: true },
select: { domain: true },
});
if (globalMatch) {
return { alreadyGlobal: true, domain: value };
// Pre-check NUR für Mail-Typen: ist die Domain schon in der globalen
// Blocklist? Dann keinen Slot verbrennen — der Mail-Daemon scannt dieselbe
// Blocklist, ein Custom-Slot wäre redundant.
//
// Für `web` BEWUSST NICHT: Web-Custom-Domains speisen die Layer-2-VIP-Liste
// (webContent / Family Controls) — eine SEPARATE Schicht von der globalen
// Layer-1-Blocklist (URL-Filter / VPN). Eine Domain in Layer 1 ist NICHT
// automatisch in der Layer-2-VIP-50; und Layer 2 ist gerade das Netz für den
// Fall, dass Layer 1 deaktiviert wird. Global gelistete Domains müssen also
// in die VIP aufgenommen werden können.
if (type !== "web") {
const db = usePrisma();
const globalMatch = await db.blocklistDomain.findFirst({
where: { domain: value, isActive: true },
select: { domain: true },
});
if (globalMatch) {
return { alreadyGlobal: true, domain: value };
}
}
// Per-type Slot-Limit prüfen