1
0
mirror of git://f0xx.org/ac/ac-deploy synced 2026-07-29 04:38:48 +03:00

cluster0: auth-email bearer + shorten verify URLs in outbound mail

ShortLinksRepository::shortenForOutbound; ensure-auth-email-bearer.sh;
verify-mail-lab sends shortened s.f0xx.org link in verify email body.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Anton Afanasyeu
2026-06-23 18:37:24 +02:00
parent 3d66edb405
commit aa55e03fbd
8 changed files with 111 additions and 6 deletions

View File

@@ -0,0 +1,28 @@
#!/usr/bin/env php83
<?php
declare(strict_types=1);
/** Ensure system bearer for auth-email outbound short links. Prints bearer_id on stdout. */
require __DIR__ . '/../src/bootstrap.php';
if (!UrlShortenerDatabase::enabled() || !UrlShortenerDatabase::ping()) {
fwrite(STDERR, "url_shortener unavailable\n");
exit(1);
}
foreach (ShortLinksRepository::listBearers() as $b) {
if (!empty($b['revoked_at'])) {
continue;
}
$label = strtolower((string) ($b['label'] ?? ''));
if (str_contains($label, 'auth-email') || str_contains($label, 'auth_email')) {
echo (int) ($b['id'] ?? 0), "\n";
exit(0);
}
}
$mint = ShortLinksRepository::mintBearer('auth-email-system', true, false, 5000);
if (empty($mint['ok'])) {
fwrite(STDERR, 'mint failed: ' . ($mint['error'] ?? '?') . "\n");
exit(1);
}
echo (int) $mint['bearer_id'], "\n";