Go backend for LINKa Looks activation and telemetry.
POST /requestActivationsends an activation code.POST /activateexchanges email and code for a PC hash.POST /registerEventstores telemetry only with the current versioned consent marker. Legacy requests without it return success as a no-op. New event rows always havecontent = NULL.GET /statsrenders server-side statistics. Protect this path with nginx Basic Auth.GET /healthzreturns service health.
cp .env.example .env
MAIL_DRY_RUN=true DATABASE_URL=data/metric.db go run ./cmd/metric-apicp .env.example .env
docker compose up -d --buildThe compose file binds the service to 127.0.0.1:30812 on the host. Public traffic should go through nginx.
location /stats {
auth_basic "Metric stats";
auth_basic_user_file /etc/nginx/.htpasswd-metric;
proxy_pass http://127.0.0.1:30812;
}The first production start runs compatible SQLite migrations and adds indexes. Back up the existing database before switching from Node to Go.
This maintenance command is intentionally separate from application startup. Stop the metric service before applying it.
Count rows without changing data:
go run ./cmd/sanitize-history --database data/metric.dbCreate a verified SQLite backup and then physically remove legacy Event.content:
go run ./cmd/sanitize-history \
--database data/metric.db \
--backup data/metric-before-sanitize.db \
--apply--apply refuses a missing, existing, symlink, or same-as-database backup path. It atomically creates the backup with mode 0600 and verifies it before changing the main database. The apply phase enables SQLite secure deletion, truncates the WAL, vacuums the database, truncates the WAL again, and verifies that no Event.content values remain. This command is never run automatically.