fix: address code review — narrow exception types, computed dkimLiveText getter
Agent-Logs-Url: https://github.com/christianlouis/dmarq/sessions/19d17518-732d-4644-889b-cc63256e19b1 Co-authored-by: christianlouis <361235+christianlouis@users.noreply.github.com>
This commit is contained in:
@@ -168,7 +168,7 @@ async def get_domains_summary(db: Session = Depends(get_db)):
|
|||||||
provider.check_domain(domain_name, selectors=combined),
|
provider.check_domain(domain_name, selectors=combined),
|
||||||
timeout=10.0,
|
timeout=10.0,
|
||||||
)
|
)
|
||||||
except (asyncio.TimeoutError, Exception) as exc: # pylint: disable=broad-exception-caught
|
except (asyncio.TimeoutError, LookupError, OSError) as exc:
|
||||||
logger.warning("DNS check failed for %s: %s", domain_name, exc)
|
logger.warning("DNS check failed for %s: %s", domain_name, exc)
|
||||||
return DomainDNSResult()
|
return DomainDNSResult()
|
||||||
|
|
||||||
|
|||||||
@@ -234,7 +234,7 @@ class CloudflareDNSProvider(BaseDNSProvider):
|
|||||||
txt = answer.get("data", "").strip('"')
|
txt = answer.get("data", "").strip('"')
|
||||||
records.append(txt)
|
records.append(txt)
|
||||||
return records
|
return records
|
||||||
except Exception as exc:
|
except (httpx.RequestError, httpx.HTTPStatusError, httpx.TimeoutException) as exc:
|
||||||
raise LookupError(f"Cloudflare DoH lookup failed for {name}: {exc}") from exc
|
raise LookupError(f"Cloudflare DoH lookup failed for {name}: {exc}") from exc
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -160,7 +160,7 @@
|
|||||||
<span x-show="!dns.dkim" class="inline-flex h-2 w-2 rounded-full bg-red-500"></span>
|
<span x-show="!dns.dkim" class="inline-flex h-2 w-2 rounded-full bg-red-500"></span>
|
||||||
</h3>
|
</h3>
|
||||||
<div class="bg-muted p-2 rounded text-sm overflow-x-auto font-mono"
|
<div class="bg-muted p-2 rounded text-sm overflow-x-auto font-mono"
|
||||||
x-text="dns.dkim ? (dns.dkimSelectors ? 'selector: ' + dns.dkimSelectors : 'Verified') : 'No DKIM record found for configured selectors'">-</div>
|
x-text="dkimLiveText">-</div>
|
||||||
</div>
|
</div>
|
||||||
<!-- DKIM Selector Management -->
|
<!-- DKIM Selector Management -->
|
||||||
<div class="border rounded-lg p-4">
|
<div class="border rounded-lg p-4">
|
||||||
@@ -421,6 +421,12 @@ function domainDetailsApp(domainId) {
|
|||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get dkimLiveText() {
|
||||||
|
if (!this.dns.dkim) return 'No DKIM record found for configured selectors';
|
||||||
|
if (this.dns.dkimSelectors) return 'selector: ' + this.dns.dkimSelectors;
|
||||||
|
return 'Verified';
|
||||||
|
},
|
||||||
|
|
||||||
async fetchDomainStats() {
|
async fetchDomainStats() {
|
||||||
try {
|
try {
|
||||||
const response = await fetch(`/api/v1/domains/${this.domainId}/stats`);
|
const response = await fetch(`/api/v1/domains/${this.domainId}/stats`);
|
||||||
|
|||||||
Reference in New Issue
Block a user