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:
28
sim/cluster0/lab-seeds/backend/scripts/ensure_auth_email_bearer.php
Executable file
28
sim/cluster0/lab-seeds/backend/scripts/ensure_auth_email_bearer.php
Executable 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";
|
||||
Reference in New Issue
Block a user