Commit graph

37 commits

Author SHA1 Message Date
5ccf81173f feat(checker): add domain availability watchlist
Introduce a DomainAvailabilityWatch entity (model, storage, usecase and
REST endpoints) letting a user track a domain they do not own and get
notified the moment it becomes available for registration. A dedicated
domain_availability checker reads WHOIS/RDAP via pkg/domaininfo and inverts
the status (OK while registered, Crit once free) so the existing dispatcher
fires exactly once on the transition. The scheduler enumerates watches and
enqueues the check, carrying the watch id in CheckTarget.DomainId; autofill
and notification payloads fall back to the watch store to resolve the name.
Watches are included in per-user backup/restore. The web UI adds an
availability watchlist page and navigation entry.
2026-06-06 20:14:01 +09:00
f28cdefa8b Add user data export (GDPR/DSAR)
Refactors the admin backup usecase to share per-user collection logic
via backupOneUser(), then adds BackupUser() which filters system-wide
collections (checker configs, plans, evaluations, executions, discovery)
down to the requesting user by UserId.

Wires the backup usecase into the public API dependency graph and adds
a download button in the /me settings page near the delete-account
section.
2026-05-25 12:25:43 +08:00
5d304b6495 internal: rename packages colliding with usecase counterparts
Rename internal/{checker,service,provider,notification} to
internal/{dnschecker,serviceanalyzer,providerregistry,notifier} so
imports no longer collide with the same-named usecase subpackages and
no longer require import aliases to disambiguate.
2026-05-10 20:17:54 +08:00
8db2953e9e notification: add API endpoints for channels, preferences, history, and acknowledgement 2026-04-30 14:05:01 +00:00
513a646394 api: add Caddy on-demand TLS ask hook for autoconfig hostnames 2026-04-29 18:51:51 +07:00
9d3dabc32a api: expose Mozilla Autoconfig and Microsoft Autodiscover endpoints
Adds the public /mail/config-v1.1.xml and /Autodiscover/Autodiscover.xml
HTTP endpoints.
2026-04-29 18:51:51 +07:00
23f7af2f57 api: New route to retrieve current TLS certificate chain 2026-04-28 18:03:54 +07:00
93dd809cde resolver: POST /api/resolver/dmarc-report-auth endpoint
Adds a backend endpoint that resolves the RFC 7489 sec. 7.1 cross-domain
reporting authorization record, paired with the (incoming) DMARC async
validator on the front-end.

When a DMARC record at example.com publishes rua=mailto:dmarc@third.tld,
third-party receivers MUST refuse to deliver reports unless
example.com._report._dmarc.third.tld publishes a v=DMARC1 TXT. This is
the silent failure mode behind most "we configured DMARC but never see
any report" tickets.
2026-04-28 17:58:14 +07:00
17e272f220 resolver: POST /api/resolver/mta-sts-policy endpoint
Adds a backend endpoint that fetches and parses an MTA-STS policy
file at https://mta-sts.<domain>/.well-known/mta-sts.txt per RFC 8461
sec. 3.3, paired with the (existing) MTA-STS TXT validator on the front-end.
2026-04-28 17:57:26 +07:00
5f8862c384 resolver: POST /api/resolver/spf-flatten endpoint
Adds a recursive SPF flatten endpoint sized for the compliance UI:

- happydns.SPFFlattenRequest accepts a {domain, record?} pair so the UI
  can preview an unsaved record without persisting it first; the optional
  inline record bypasses the root TXT lookup.
- happydns.SPFFlattenResponse returns the recursive tree with per-node
  Mechanism / Domain / Record / LookupsHere / Error fields, plus the
  RFC 7208 §4.6.4 budget counters (LookupCount, VoidLookups, Exceeded,
  VoidExceeded, Truncated).
- Hard caps at 10 lookups, 2 void lookups, depth 12, 2s per query and
  10s overall. Cycle detection via the visited-domain set.
- Resolver selection mirrors ResolveQuestion (local / custom / default
  to 1.1.1.1) with the same IPv6-bracket handling.
2026-04-28 17:57:08 +07:00
a531a6ef66 domaininfo: add per-IP rate limiting on public endpoint
The /api/domaininfo/:domain route is unauthenticated and proxies
outbound RDAP/WHOIS queries, making it an abuse vector. Add a
per-IP rate limiter (10 req/min) using gin-rate-limit to mitigate
enumeration and proxy abuse while keeping the endpoint public.
2026-04-16 15:22:51 +07:00
8a546a8b41 domaininfo: add RDAP/WHOIS lookup feature
Introduces a domaininfo package with RDAP and WHOIS getters, exposed
through a new DomainInfoUsecase and /api/domaininfo/:domain route (also
mounted under domain scope). Adds a /whois frontend page and a zone
sidebar modal to display registrar, dates, nameservers and status.
2026-04-16 15:22:51 +07:00
e0dc19614f checker: enforce MaxChecksPerDay quota with interval-aware throttling
Some checks failed
continuous-integration/drone/push Build is failing
Wire UserQuota.MaxChecksPerDay field into the scheduler via the
UserGater: an in-memory daily counter per user
(reset at UTC midnight): gates scheduled executions, with a two-tier
heuristic that skips short-interval jobs first once the budget is 80%
consumed so rare/important checks are not starved by frequent
pings. Planned executions returned by ListPlannedExecutions are marked
with a new ExecutionRateLimited status when the user is over
budget. Manual API triggers bypass the quota.
2026-04-16 15:18:43 +07:00
439fe2a2e9 checkers: show worst check status badge on domain list
Add DomainWithCheckStatus model and GetWorstDomainStatuses usecase to
compute the most critical checker status per domain. The GET /domains
endpoint now returns status alongside each domain. The frontend domain
store, list components, and table row display dynamic status badges
with color and icon instead of a hardcoded "OK".

ZoneList is made generic (T extends HappydnsDomain) so the badges
snippet preserves the caller's concrete type without unsafe casts.
2026-04-16 15:18:43 +07:00
6ed3b3f6ed checkers: add metrics export in JSON format
Observation providers can now implement CheckerMetricsReporter to
extract time-series metrics from their stored data. The controller
returns the metrics as a JSON array.

Routes: user-level (/api/checkers/metrics), domain-level, per-checker,
and per-execution.
2026-04-16 15:18:43 +07:00
b37ed1d349 checkers: add HTML report rendering for observation providers
Introduce CheckerHTMLReporter interface that observation providers can
implement to render rich HTML documents from their data. The Zonemaster
provider implements it with collapsible accordions and severity badges.

Adds API endpoint GET .../observations/:obsKey/report, frontend stores
for view mode switching (HTML/JSON), and wires the sidebar toggle buttons.
2026-04-16 15:18:43 +07:00
ee8e7b322d checkers: add API controllers, routes, and app wiring
Wire up the checker system to the HTTP layer:
- API controllers for checker operations, options, plans, and results
- Scoped routes at domain and service level
- Admin controllers for checker config and scheduler management
- App initialization: create usecases, start/stop scheduler
- Zone controller updated to include per-service check status
2026-04-16 15:18:43 +07:00
e30d1a5f50 Add is_auth_user endpoint in swagger doc and remove custom client call in frontend 2026-04-04 22:05:28 +07:00
a7b225b9df Rework zone diff/apply flow: separate diff from provider API, support partial apply
Decouple diff computation from executable provider closures by fetching
provider records and computing diffs locally via DNSControlDiffByRecord.
On apply, build a target record set from user-selected corrections using
BuildTargetRecords, then ask the provider for executable corrections
against that target. A published snapshot is inserted at ZoneHistory[1]
while the WIP zone at position 0 remains unchanged.
2026-03-16 19:46:09 +07:00
07b5553369 Add public DNS record generator pages at /generator
Expose service editors publicly (no auth required) at /generator for
SEO discoverability. Each page shows an interactive editor alongside
a live DNS zone record preview powered by a new POST
/service_specs/:ssid/records backend endpoint.
2026-03-16 19:44:13 +07:00
1be73506cb Reformat long function signatures 2026-03-14 12:02:00 +07:00
64c86df9ac Support configurable BasePath for hosting at a sub-path 2026-03-01 17:41:01 +07:00
c9552fa9b2 Remove UsecaseDependancies service locator pattern
All checks were successful
continuous-integration/drone/push Build is passing
Replace the UsecaseDependancies interface with plain Dependencies structs
defined locally in each route package. DeclareRoutes acts as the sole
composition root where use cases are resolved; sub-route functions and
controllers receive only the specific interfaces they need.
2026-02-14 10:49:46 +07:00
e0d8526577 Add Altcha captcha provider support
Some checks are pending
continuous-integration/drone/push Build is running
2026-02-13 12:29:14 +07:00
0090054324 Add CAPTCHA support for login and registration
Integrates optional bot protection on the registration endpoint (always
required when a provider is configured) and the login endpoint (triggered
after N consecutive failures for the same IP or email address).

Supported providers: hCaptcha, reCAPTCHA v2, Cloudflare Turnstile.
2026-02-13 11:31:37 +07:00
30a3f7ec3e Add zone diff summary endpoint for efficient diff count retrieval 2026-01-26 12:34:55 +08:00
2d39de5eb9 Add service initialization endpoint with DNS type detection
Implement backend-driven service initialization to replace hazardous
frontend initialization logic. Services can now provide custom
initialization via ServiceInitializer interface or get sensible
defaults automatically.
2026-01-12 10:19:33 +07:00
ae0f9018bb Can add and update records in service 2026-01-09 15:01:51 +07:00
f5911cb256 Can delete a record in a service 2026-01-08 18:15:37 +07:00
4436fa1e55 New API route to parse random records 2026-01-07 22:26:19 +07:00
2f54d12d2a Correct display of service records with new services 2026-01-07 22:26:19 +07:00
99e9c4457d Readd swagger routes
All checks were successful
continuous-integration/drone/push Build is passing
2025-07-01 15:56:03 +02:00
ce91b49a73 Create a usecase from API to extract domain creation on provider
Fixes a security issue where a user can create a domain on a provider
while DisableProviders option was set
2025-06-09 15:38:11 +02:00
f63860af83 Can create domain directly on the provider if supported
All checks were successful
continuous-integration/drone/push Build is passing
Closes: https://github.com/happyDomain/happydomain/issues/24
2025-05-28 23:02:22 +02:00
b2b6467575 Refactor domain/provider/zone usecase: split in multiple files 2025-05-28 23:02:22 +02:00
356e733e76 Move config struct to model, avoid dependancy to storage 2025-05-28 22:00:02 +02:00
5ef9419072 refactor: restructure project architecture and folder hierarchy
- Moved usecases into internal/usecase
- Renamed internal/utils to internal/helpers for better naming semantics
- Clarified separation between domain model, usecases, adapters, and web/API
2025-05-28 22:00:02 +02:00