summaryrefslogtreecommitdiffstats
path: root/index.php
diff options
context:
space:
mode:
authorGab <24553253+gabrix73@users.noreply.github.com>2026-08-14 20:39:22 +0200
committerGab <24553253+gabrix73@users.noreply.github.com>2026-08-14 20:39:22 +0200
commit43fbddf016f94f4ba006d82c9a67dca61b5852a1 (patch)
tree70054d5fa8a34bb094b8c3ef8ddc9c1fcea3b3d5 /index.php
parent994071243fc80990cf09e820b671006e9bd31c76 (diff)
downloadyamnweb-43fbddf016f94f4ba006d82c9a67dca61b5852a1.tar.gz
yamnweb-43fbddf016f94f4ba006d82c9a67dca61b5852a1.tar.xz
yamnweb-43fbddf016f94f4ba006d82c9a67dca61b5852a1.zip
Complete Nym and YAMN transport integration
Diffstat (limited to 'index.php')
-rw-r--r--index.php44
1 files changed, 13 insertions, 31 deletions
diff --git a/index.php b/index.php
index 64c47d6..af646a6 100644
--- a/index.php
+++ b/index.php
@@ -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">