feat: v0.7.2 — portmapper (UPnP+PCP+NAT-PMP), session-relay opt-in, URL Phase 1
Network/reachability improvements + a relay-privacy fix. Wire-compatible with v0.7.0/v0.7.1; no protocol changes. - Replace hand-rolled UPnP (igd-next) with the portmapper crate. All three protocols (UPnP-IGD / NAT-PMP / PCP) run in parallel, auto-renew internally. PCP adds IPv6 firewall pinholes and works on iOS without the multicast entitlement. Pulled in transitively via iroh already, no net dep growth. - Android: UPnP/PCP/NAT-PMP attempted on WiFi/Ethernet with a WifiManager.MulticastLock acquired for the lifetime of the mapping. Cellular skipped early (no UPnP/PCP gateway, avoid 3s discovery waste). - TCP port-mapping gate removed for mobile — phones with permissive NAT can now serve HTTP for direct browser fetches. - Anchor reachability watcher (bidirectional): clears is_anchor after >5min of no port mapping; restores it when the mapping comes back. Network roams self-heal without restart. Mobile never auto-anchors. - Session relay opt-in restored. relay.session_relay_enabled setting defaults OFF (anchors included — servers shouldn't silently burn bandwidth either). Gates both serving (can_accept_relay_pipe) and using (auto-fallback in node.rs). UI toggle in Settings. Relay-style signaling (RelayIntroduce / worm_lookup / N1-N3 shares) unaffected. - URL Phase 1: share links now contain only the post ID (itsgoin.net/p/<post>). Anchor handler already supported post-ID-only URLs (author was optional); just dropped the author hex from the generator. Older URLs with author hex continue to work. - Quick app close button in header (with confirm) — useful for stopping network activity between sessions on mobile. - JNI null-pointer guards on ndk_context handles in android_wifi.rs. MEMORY rule sharpened to distinguish session relay (byte pipe, opt-in) from relay-style signaling/discovery (always on). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
069257c2d8
commit
4706e81603
16 changed files with 696 additions and 340 deletions
|
|
@ -449,6 +449,12 @@ $('#popover-overlay').addEventListener('click', (e) => {
|
|||
if (e.target === $('#popover-overlay')) closePopover();
|
||||
});
|
||||
|
||||
$('#close-app-btn').addEventListener('click', async () => {
|
||||
if (confirm('Close ItsGoin?\n\nStops all network connections to save battery. Reopen the app any time to resume.')) {
|
||||
try { await invoke('exit_app'); } catch (_) {}
|
||||
}
|
||||
});
|
||||
|
||||
function relativeTime(timestampMs) {
|
||||
const now = Date.now();
|
||||
const diff = now - timestampMs;
|
||||
|
|
@ -4245,6 +4251,20 @@ $('#import-btn').addEventListener('click', () => {
|
|||
overlay.addEventListener('click', (e) => { if (e.target === overlay) overlay.remove(); });
|
||||
});
|
||||
|
||||
(async () => {
|
||||
const toggle = $('#session-relay-toggle');
|
||||
if (!toggle) return;
|
||||
try { toggle.checked = await invoke('get_session_relay_enabled'); } catch (_) {}
|
||||
toggle.addEventListener('change', async () => {
|
||||
try {
|
||||
await invoke('set_session_relay_enabled', { enabled: toggle.checked });
|
||||
} catch (e) {
|
||||
toggle.checked = !toggle.checked;
|
||||
alert('Failed to update session relay setting: ' + e);
|
||||
}
|
||||
});
|
||||
})();
|
||||
|
||||
$('#notifications-btn').addEventListener('click', async () => {
|
||||
// Load current settings
|
||||
const msgVal = await invoke('get_setting', { key: 'notif_messages' }).catch(() => null) || 'on';
|
||||
|
|
|
|||
|
|
@ -25,6 +25,7 @@
|
|||
<span id="net-dot"></span>
|
||||
<span id="net-labels"></span>
|
||||
</div>
|
||||
<button id="close-app-btn" title="Close app (stops connections to save battery)" aria-label="Close app">⏻</button>
|
||||
</div>
|
||||
<nav id="tabs">
|
||||
<button class="tab" data-tab="feed"><span class="tab-icon">📰</span><span class="tab-label">Feed</span></button>
|
||||
|
|
@ -274,6 +275,17 @@
|
|||
<button id="notifications-btn" class="btn btn-ghost btn-full">Notifications</button>
|
||||
</div>
|
||||
|
||||
<div class="section-card">
|
||||
<h3 style="margin-bottom:0.4rem;font-size:0.85rem;color:#888">Session Relay (off by default)</h3>
|
||||
<p class="empty-hint" style="margin-bottom:0.5rem;font-size:0.72rem">
|
||||
When two peers can't connect directly through their networks, a third peer can pipe their traffic through itself. This burns the relay peer's bandwidth on someone else's connection. Off by default. Enable only if you're OK both <em>using</em> other peers as relays and <em>serving</em> as a relay for others.
|
||||
</p>
|
||||
<label style="display:flex;align-items:center;gap:0.5rem;cursor:pointer">
|
||||
<input type="checkbox" id="session-relay-toggle">
|
||||
<span>Enable session relay</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<!-- Hidden: node-info, anchors, diagnostics btn moved elsewhere -->
|
||||
<div class="hidden">
|
||||
<button id="anchors-toggle"></button>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ header h1 { font-size: clamp(1.4rem, 2.5vw, 2rem); color: #7fdbca; margin: 0; }
|
|||
#net-dot.net-green { background: #22c55e; }
|
||||
#net-labels { font-size: 0.65rem; color: #888; display: flex; gap: 0.3rem; }
|
||||
.net-label { background: #2a2a40; padding: 0.1rem 0.35rem; border-radius: 3px; color: #aab; }
|
||||
#close-app-btn { margin-left: 0.6rem; padding: 0.3rem 0.5rem; background: transparent; border: 1px solid #444; border-radius: 4px; color: #999; font-size: 1rem; line-height: 1; cursor: pointer; }
|
||||
#close-app-btn:hover { color: #e74c3c; border-color: #e74c3c; }
|
||||
#close-app-btn:active { background: #2a1a1a; }
|
||||
|
||||
/* Setup overlay */
|
||||
.overlay { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(10, 10, 20, 0.92); display: flex; align-items: center; justify-content: center; z-index: 200; }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue