diff options
Diffstat (limited to 'index.php')
| -rw-r--r-- | index.php | 44 |
1 files changed, 13 insertions, 31 deletions
@@ -193,12 +193,16 @@ $entryRemailers = getRemailers('entry'); $middleRemailers = getRemailers('middle'); $exitRemailers = getRemailers('exit'); -// If no remailers loaded, try to download them -if (count($entryRemailers) <= 1 && class_exists('SecureRemailerDownloader')) { +// Refresh stale remailer data during a browser reload. The downloader only +// contacts Tor when either local file is missing or older than one day. +if ($_SERVER['REQUEST_METHOD'] === 'GET' && class_exists('SecureRemailerDownloader')) { try { $downloader = new SecureRemailerDownloader(); - $downloader->downloadRemailers(); - // Reload after download + if (!$downloader->downloadRemailers()) { + error_log('Remailer refresh failed; keeping the locally available data.'); + } + + // Reload after a successful refresh, or continue with the local list. $entryRemailers = getRemailers('entry'); $middleRemailers = getRemailers('middle'); $exitRemailers = getRemailers('exit'); @@ -237,24 +241,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { exit; } else { try { - if (isset($_POST['update_remailers'])) { - if (!class_exists('SecureRemailerDownloader')) { - throw new Exception('Remailer list updater is not available.'); - } - - set_time_limit(0); - $downloader = new SecureRemailerDownloader(); - if (!$downloader->forceUpdate()) { - throw new Exception('Remailer list update failed. The previous list was kept where possible.'); - } - - $_SESSION['flash_message'] = 'Remailer list and public keyring updated successfully.'; - $_SESSION['flash_type'] = 'success'; - $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); - header('Location: ' . $_SERVER['PHP_SELF']); - exit; - } - // Get and sanitize form data with additional validation $entryRemailer = isset($_POST['entry_remailer']) ? filter_var($_POST['entry_remailer'], FILTER_SANITIZE_STRING) : ''; $middleRemailer = isset($_POST['middle_remailer']) ? filter_var($_POST['middle_remailer'], FILTER_SANITIZE_STRING) : ''; @@ -319,7 +305,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (function_exists('fastcgi_finish_request')) { $onHandoff = static function () use (&$responseFinished): void { ignore_user_abort(true); - $_SESSION['flash_message'] = 'Message handed to the local Nym transport. The sender is completing delivery in the background; YAMN queues may take several hours, and this confirmation does not mean the message has been published or delivered yet.'; + $_SESSION['flash_message'] = 'Message accepted into the local in-memory Nym queue. Delivery continues in the background; YAMN queues may take several hours, and this confirmation does not mean the message has been published or delivered yet.'; $_SESSION['flash_type'] = 'success'; $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); session_write_close(); @@ -336,7 +322,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { if (!$result['success']) { throw new Exception($result['error'] ?? 'Nym submission failed'); } - $_SESSION['flash_message'] = 'Message accepted by the Nym transport. Delivery through the YAMN queues may take several hours; this confirmation does not mean the message has been published or delivered yet.'; + $_SESSION['flash_message'] = 'Message accepted into the local in-memory Nym queue. Delivery through the YAMN queues may take several hours; this confirmation does not mean the message has been published or delivered yet.'; $_SESSION['flash_type'] = 'success'; $_SESSION['csrf_token'] = bin2hex(random_bytes(32)); header('Location: ' . $_SERVER['PHP_SELF']); @@ -738,7 +724,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { </a> <h1>⚡ YAMN WEB INTERFACE ⚡</h1> - <div class="subtitle">YAMN composition, local encryption, send-only Nym transport</div> + <div class="subtitle">Nym before YAMN: YAMN Web encrypts first, then Nym carries only the opaque envelope</div> <?php if (!empty($message)): ?> <div class="message <?php echo $messageType; ?>"> @@ -759,12 +745,8 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') { <div class="info-box"> <strong>Remailer data</strong> - <p>The primary statistics source is Victor's YAMN pinger at <code>echolot.virebent.art</code>. Fallback pingers are tried automatically if needed.</p> - <form method="POST" action=""> - <input type="hidden" name="csrf_token" value="<?php echo htmlspecialchars($_SESSION['csrf_token']); ?>"> - <button type="submit" name="update_remailers" value="1">Update remailer list and keyring</button> - </form> - <small>This may take a few minutes because the update uses Tor and tries fallback sources if necessary.</small> + <p>Remailer statistics and public keys are checked automatically when this page loads. Local data no more than 24 hours old is reused without a network connection.</p> + <small>Missing or older data is downloaded through Tor. If a source is unavailable, the existing data remains usable and another download is not attempted until the next daily check.</small> </div> <form method="POST" action="" id="yamnForm"> |
