diff --git a/README.md b/README.md
index 5083e51..f063270 100644
--- a/README.md
+++ b/README.md
@@ -68,11 +68,11 @@ just proxy
# Or launch via just (starts --public --http-proxy 127.0.0.1:4444 --torrent-api 127.0.0.1:4445):
just proxy
-# Build a standalone zero-setup Firefox + moon-i2p router AppImage (insulaocculta.i2p homepage):
+# Build a standalone zero-setup Firefox + moon-i2p router AppImage (built-in Moon I2P Start Page):
just appimage
./dist/MoonI2P-Browser-x86_64.AppImage
-# Build a standalone zero-setup Android APK (arm64-v8a + x86_64, insulaocculta.i2p homepage):
+# Build a standalone zero-setup Android APK (arm64-v8a + x86_64, built-in Moon I2P Start Page):
just apk
# Install dist/MoonI2P-Browser-android.apk via `adb install -r dist/MoonI2P-Browser-android.apk`
diff --git a/android/app/src/main/assets/start.html b/android/app/src/main/assets/start.html
new file mode 100644
index 0000000..480e33d
--- /dev/null
+++ b/android/app/src/main/assets/start.html
@@ -0,0 +1,496 @@
+
+
+
+
+
+ Moon I2P Start Page
+
+
+
+
+
+
+
+
+
Moon I2P
+
Private .i2p Browser & BitTorrent/DHT Router
+
+
+ Starting...
+
+
+
+ Bootstrapping I2P router & tunnels...
+ Waiting for local moon-i2p service.
+
+
+
+
+
+
+
Tunnels
+
--
+
Building pool...
+
+
+
NetDB Peers
+
--
+
-- floodfills
+
+
+
I2P DHT
+
--
+
Proto 17 / 18
+
+
+
+
+
+
+
+
+
+
+ Built-in .i2p DestinationsReady
+
+
+
+
+ Active Torrents (0)
+
+
+
+
+
+
+
+
+
diff --git a/android/app/src/main/java/org/mooni2p/browser/MainActivity.java b/android/app/src/main/java/org/mooni2p/browser/MainActivity.java
index c688fea..9b10fa4 100644
--- a/android/app/src/main/java/org/mooni2p/browser/MainActivity.java
+++ b/android/app/src/main/java/org/mooni2p/browser/MainActivity.java
@@ -36,6 +36,7 @@ import android.widget.ScrollView;
import android.widget.TextView;
import android.widget.Toast;
+import org.json.JSONArray;
import org.json.JSONObject;
import java.io.ByteArrayInputStream;
@@ -52,23 +53,25 @@ import java.util.List;
import java.util.Locale;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
/**
- * Embedded I2P WebView browser defaulting to http://insulaocculta.i2p/ paired
- * with a same-origin Torrents & I2P DHT management dashboard tab and full
+ * Embedded I2P WebView browser defaulting to the built-in Moon I2P Start Page
+ * paired with a same-origin Torrents & I2P DHT management dashboard tab and full
* diagnostics report export.
*/
public class MainActivity extends Activity {
- private static final String HOMEPAGE = "http://insulaocculta.i2p/";
+ private static final String HOMEPAGE = "file:///android_asset/start.html";
private static final int REQ_PICK_TORRENT = 2001;
private static final int REQ_NOTIF_PERM = 2002;
private static final String[][] BOOKMARKS = new String[][] {
+ { "NotBob Directory", "http://notbob.i2p/" },
+ { "Postman Tracker", "http://tracker2.postman.i2p/" },
{ "Insula Occulta", "http://insulaocculta.i2p/" },
{ "I2P Stats", "http://stats.i2p/" },
{ "zzz.i2p", "http://zzz.i2p/" },
- { "Postman Tracker", "http://tracker2.postman.i2p/" },
- { "NotBob Directory", "http://notbob.i2p/" },
};
private LinearLayout mTopBar;
@@ -104,7 +107,7 @@ public class MainActivity extends Activity {
}
buildUi();
- mBrowserView.loadUrl(HOMEPAGE);
+ navigateBrowser(HOMEPAGE);
handleIntent(getIntent());
startStatusPoll();
}
@@ -167,7 +170,8 @@ public class MainActivity extends Activity {
mTopBar.addView(makeIconBtn("R", v -> mBrowserView.reload()));
mUrlInput = new EditText(this);
- mUrlInput.setText(HOMEPAGE);
+ mUrlInput.setHint("Enter .i2p address or magnet: URI...");
+ mUrlInput.setText("");
mUrlInput.setTextColor(Color.parseColor("#F8FAFC"));
mUrlInput.setHintTextColor(Color.parseColor("#94A3B8"));
mUrlInput.setBackgroundColor(Color.parseColor("#0B1222"));
@@ -211,6 +215,7 @@ public class MainActivity extends Activity {
mBrowserView = new WebView(this);
configureWebView(mBrowserView);
mBrowserView.addJavascriptInterface(new BrowserLinkBridge(), "MoonI2pPage");
+ mBrowserView.addJavascriptInterface(new StartPageBridge(), "MoonI2pStart");
mBrowserView.setWebViewClient(new I2pWebViewClient());
mBrowserView.setDownloadListener((dlUrl, userAgent, contentDisposition, mimetype, contentLength) -> {
if (dlUrl == null) return;
@@ -338,16 +343,25 @@ public class MainActivity extends Activity {
private void navigateBrowser(String raw) {
String s = raw == null ? "" : raw.trim();
- if (s.isEmpty()) s = HOMEPAGE;
- if (!s.contains("://") && !s.startsWith("magnet:")) {
- s = "http://" + s;
+ if (s.isEmpty() || HOMEPAGE.equals(s)) {
+ mUrlInput.setText("");
+ switchTab(false);
+ mBrowserView.loadUrl(HOMEPAGE);
+ return;
+ }
+ if (!s.contains("://") && !s.toLowerCase(Locale.ROOT).startsWith("magnet:")) {
+ if (!s.contains(".") && !s.contains("/") && !s.contains(":") && !s.contains(" ")) {
+ s = "http://" + s + ".i2p/";
+ } else {
+ s = "http://" + s;
+ }
}
- mUrlInput.setText(s);
if (s.toLowerCase(Locale.ROOT).startsWith("magnet:")) {
submitMagnetAsync(s);
switchTab(true);
return;
}
+ mUrlInput.setText(s);
switchTab(false);
mBrowserView.loadUrl(s);
}
@@ -653,11 +667,88 @@ public class MainActivity extends Activity {
}
}
+ private boolean isCurrentBrowserPageStart() {
+ if (Looper.myLooper() == Looper.getMainLooper()) {
+ return HOMEPAGE.equals(mBrowserView.getUrl());
+ }
+ final boolean[] result = new boolean[] { false };
+ final CountDownLatch latch = new CountDownLatch(1);
+ runOnUiThread(() -> {
+ try {
+ result[0] = HOMEPAGE.equals(mBrowserView.getUrl());
+ } finally {
+ latch.countDown();
+ }
+ });
+ try {
+ latch.await(250, TimeUnit.MILLISECONDS);
+ } catch (InterruptedException ignored) {
+ Thread.currentThread().interrupt();
+ }
+ return result[0];
+ }
+
+ private class StartPageBridge {
+ @JavascriptInterface
+ public String getStatusJson() {
+ if (!isCurrentBrowserPageStart()) return "{}";
+ try {
+ JSONObject out = new JSONObject();
+ boolean apiReady = RouterService.isApiReady();
+ out.put("api_ready", apiReady);
+ out.put("status_text", RouterService.getStatusText());
+ out.put("proxy_port", RouterService.getProxyPort());
+ out.put("api_port", RouterService.getApiPort());
+ if (apiReady) {
+ String stRaw = RouterService.fetchLocalApiJsonOrNull("/api/status");
+ if (stRaw != null) {
+ out.put("status", new JSONObject(stRaw));
+ }
+ String tlRaw = RouterService.fetchLocalApiJsonOrNull("/api/torrents");
+ if (tlRaw != null) {
+ JSONObject tlObj = new JSONObject(tlRaw);
+ JSONArray arr = tlObj.optJSONArray("torrents");
+ out.put("torrents", arr != null ? arr : new JSONArray());
+ }
+ }
+ return out.toString();
+ } catch (Exception e) {
+ return "{\"api_ready\":false}";
+ }
+ }
+
+ @JavascriptInterface
+ public void openUrl(String url) {
+ if (!isCurrentBrowserPageStart()) return;
+ runOnUiThread(() -> navigateBrowser(url));
+ }
+
+ @JavascriptInterface
+ public void openTorrents() {
+ if (!isCurrentBrowserPageStart()) return;
+ runOnUiThread(() -> switchTab(true));
+ }
+
+ @JavascriptInterface
+ public void openDiagnostics() {
+ if (!isCurrentBrowserPageStart()) return;
+ runOnUiThread(() -> showDiagnosticsDialog());
+ }
+
+ @JavascriptInterface
+ public void copyText(String text) {
+ if (!isCurrentBrowserPageStart()) return;
+ runOnUiThread(() -> copyToClipboard(text != null ? text : "", "Copied to clipboard"));
+ }
+ }
+
private class I2pWebViewClient extends WebViewClient {
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
- if (url != null && !url.startsWith("about:")) {
+ if (HOMEPAGE.equals(url)) {
+ mUrlInput.setText("");
+ } else if (url != null && !url.startsWith("about:")) {
mUrlInput.setText(url);
try {
Uri u = Uri.parse(url);
@@ -692,6 +783,9 @@ public class MainActivity extends Activity {
Uri uri = request.getUrl();
String url = uri.toString();
String lower = url.toLowerCase(Locale.ROOT);
+ if (lower.startsWith("file:")) {
+ return true;
+ }
if (lower.startsWith("magnet:")) {
submitMagnetAsync(url);
switchTab(true);
diff --git a/android/app/src/main/java/org/mooni2p/browser/RouterService.java b/android/app/src/main/java/org/mooni2p/browser/RouterService.java
index 734b8dc..3ad7319 100644
--- a/android/app/src/main/java/org/mooni2p/browser/RouterService.java
+++ b/android/app/src/main/java/org/mooni2p/browser/RouterService.java
@@ -177,6 +177,37 @@ public class RouterService extends Service {
}
}
+ public static String fetchLocalApiJsonOrNull(String path) {
+ int port = sApiPort;
+ if (!sApiReady || port <= 0) return null;
+ HttpURLConnection conn = null;
+ try {
+ URL u = new URL("http://127.0.0.1:" + port + path);
+ conn = (HttpURLConnection) u.openConnection();
+ conn.setConnectTimeout(1000);
+ conn.setReadTimeout(1500);
+ if (conn.getResponseCode() != 200) {
+ return null;
+ }
+ InputStream in = conn.getInputStream();
+ if (in == null) return null;
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ byte[] buf = new byte[4096];
+ int total = 0;
+ int n;
+ while (total < 128 * 1024 && (n = in.read(buf)) > 0) {
+ out.write(buf, 0, n);
+ total += n;
+ }
+ String body = new String(out.toByteArray(), StandardCharsets.UTF_8).trim();
+ return body.startsWith("{") ? body : null;
+ } catch (Exception ignored) {
+ return null;
+ } finally {
+ if (conn != null) conn.disconnect();
+ }
+ }
+
/**
* Collects device info, service state, router API snapshots, Android proxy events,
* and the verbose moon-i2p router log. Call from a background thread.
diff --git a/extensions/firefox-i2p-torrent.xpi b/extensions/firefox-i2p-torrent.xpi
index dc774c5..83cbd40 100644
Binary files a/extensions/firefox-i2p-torrent.xpi and b/extensions/firefox-i2p-torrent.xpi differ
diff --git a/extensions/firefox-i2p-torrent/background.js b/extensions/firefox-i2p-torrent/background.js
index 1c01188..91a0705 100644
--- a/extensions/firefox-i2p-torrent/background.js
+++ b/extensions/firefox-i2p-torrent/background.js
@@ -416,12 +416,14 @@ browser.runtime.onMessage.addListener(async (msg) => {
10000
);
case "openManager": {
- const url = browser.runtime.getURL("manager.html");
- const existing = await browser.tabs.query({ url });
+ const baseUrl = browser.runtime.getURL("manager.html");
+ const hash = typeof msg.hash === "string" && msg.hash ? msg.hash : "";
+ const targetUrl = hash ? `${baseUrl}${hash}` : baseUrl;
+ const existing = await browser.tabs.query({ url: `${baseUrl}*` });
if (existing.length > 0) {
- await browser.tabs.update(existing[0].id, { active: true });
+ await browser.tabs.update(existing[0].id, { active: true, url: targetUrl });
} else {
- await browser.tabs.create({ url });
+ await browser.tabs.create({ url: targetUrl });
}
return { ok: true };
}
diff --git a/extensions/firefox-i2p-torrent/manifest.json b/extensions/firefox-i2p-torrent/manifest.json
index 7e3e1f0..5342fef 100644
--- a/extensions/firefox-i2p-torrent/manifest.json
+++ b/extensions/firefox-i2p-torrent/manifest.json
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "Moon I2P Torrent & Proxy",
- "version": "0.1.4",
+ "version": "0.1.5",
"description": "Route .i2p browsing through moon-i2p and manage I2P BitTorrent + I2P DHT torrents from Firefox.",
"icons": {
"48": "icon.svg",
@@ -13,6 +13,12 @@
"strict_min_version": "109.0"
}
},
+ "chrome_settings_overrides": {
+ "homepage": "start.html"
+ },
+ "chrome_url_overrides": {
+ "newtab": "start.html"
+ },
"permissions": [
"proxy",
"storage",
diff --git a/extensions/firefox-i2p-torrent/start.css b/extensions/firefox-i2p-torrent/start.css
new file mode 100644
index 0000000..daf80de
--- /dev/null
+++ b/extensions/firefox-i2p-torrent/start.css
@@ -0,0 +1,254 @@
+body.start-page {
+ min-height: 100vh;
+ margin: 0;
+ padding: 28px 18px 40px;
+ background:
+ radial-gradient(900px 420px at 50% -80px, rgba(109, 93, 252, 0.2), transparent 70%),
+ radial-gradient(640px 320px at 85% 0%, rgba(20, 184, 166, 0.12), transparent 65%),
+ var(--bg);
+}
+
+.start-wrap {
+ max-width: 920px;
+ margin: 0 auto;
+}
+
+.start-header {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ margin-bottom: 16px;
+}
+
+.brand-sub {
+ font-size: 12px;
+ font-weight: 500;
+ color: var(--muted);
+}
+
+.pill.booting {
+ background: rgba(245, 158, 11, 0.18);
+ color: #fcd34d;
+}
+
+.warmup-banner {
+ background: var(--card);
+ border: 1px solid var(--border);
+ border-radius: 10px;
+ padding: 12px 14px;
+ margin-bottom: 14px;
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 12px;
+ flex-wrap: wrap;
+}
+
+.warmup-banner.is-booting {
+ border-color: rgba(245, 158, 11, 0.55);
+ background: linear-gradient(90deg, rgba(245, 158, 11, 0.1), var(--card) 55%);
+}
+
+.warmup-banner.is-ready {
+ border-color: rgba(20, 184, 166, 0.45);
+ background: linear-gradient(90deg, rgba(20, 184, 166, 0.1), var(--card) 55%);
+}
+
+.warmup-banner.is-offline {
+ border-color: rgba(239, 68, 68, 0.45);
+}
+
+.warmup-title {
+ font-weight: 700;
+ font-size: 13px;
+}
+
+.warmup-detail {
+ color: var(--muted);
+ font-size: 12px;
+ margin-top: 2px;
+}
+
+.nav-card {
+ padding: 14px;
+ margin-bottom: 14px;
+}
+
+.nav-form {
+ display: flex;
+ gap: 8px;
+ align-items: center;
+}
+
+.nav-form input[type="text"] {
+ padding: 10px 12px;
+ font-size: 14px;
+ border-radius: 8px;
+}
+
+.nav-form button {
+ padding: 10px 18px;
+ font-size: 14px;
+ border-radius: 8px;
+}
+
+.telemetry-grid {
+ display: grid;
+ grid-template-columns: repeat(4, minmax(0, 1fr));
+ gap: 10px;
+ margin-bottom: 14px;
+}
+
+.tile {
+ background: var(--card);
+ border: 1px solid var(--border);
+ border-radius: 10px;
+ padding: 11px 12px;
+ text-align: left;
+}
+
+.tile-btn {
+ width: 100%;
+ font: inherit;
+ color: inherit;
+ cursor: pointer;
+ transition: border-color 0.15s ease, transform 0.15s ease;
+}
+
+.tile-btn:hover {
+ border-color: var(--accent);
+}
+
+.tile-sub {
+ margin-top: 3px;
+ font-size: 11px;
+ color: var(--muted);
+}
+
+.action-strip {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ flex-wrap: wrap;
+ margin-bottom: 18px;
+}
+
+.action-buttons {
+ display: flex;
+ gap: 8px;
+ flex-wrap: wrap;
+}
+
+.section-heading {
+ margin: 0 0 10px 0;
+ font-size: 12px;
+ text-transform: uppercase;
+ letter-spacing: 0.06em;
+ color: var(--muted);
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+}
+
+.sites-grid {
+ display: grid;
+ grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
+ gap: 10px;
+ margin-bottom: 16px;
+}
+
+.site-card {
+ display: flex;
+ flex-direction: column;
+ gap: 6px;
+ background: var(--card);
+ border: 1px solid var(--border);
+ border-radius: 10px;
+ padding: 12px 14px;
+ color: var(--text);
+ text-decoration: none;
+ transition: border-color 0.15s ease, background 0.15s ease;
+}
+
+.site-card:hover,
+.site-card:focus-visible {
+ border-color: var(--accent);
+ background: #17213a;
+ outline: none;
+}
+
+.site-top {
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 8px;
+}
+
+.site-title {
+ font-weight: 700;
+ font-size: 14px;
+}
+
+.tag-pill {
+ display: inline-block;
+ padding: 2px 7px;
+ border-radius: 999px;
+ font-size: 10px;
+ font-weight: 600;
+ background: rgba(109, 93, 252, 0.18);
+ color: #c4b5fd;
+ white-space: nowrap;
+}
+
+.site-host {
+ color: #5eead4;
+}
+
+.site-desc {
+ font-size: 12px;
+ color: var(--muted);
+}
+
+.start-footer {
+ margin-top: 16px;
+ padding-top: 12px;
+ border-top: 1px solid var(--border);
+ display: flex;
+ align-items: center;
+ justify-content: space-between;
+ gap: 10px;
+ flex-wrap: wrap;
+ font-size: 12px;
+ color: var(--muted);
+}
+
+.b32-wrap {
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ flex-wrap: wrap;
+ min-width: 0;
+}
+
+.b32-text {
+ max-width: 420px;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: var(--text);
+}
+
+@media (max-width: 720px) {
+ .telemetry-grid {
+ grid-template-columns: repeat(2, minmax(0, 1fr));
+ }
+}
+
+@media (max-width: 460px) {
+ .nav-form {
+ flex-direction: column;
+ align-items: stretch;
+ }
+}
diff --git a/extensions/firefox-i2p-torrent/start.html b/extensions/firefox-i2p-torrent/start.html
new file mode 100644
index 0000000..c29e797
--- /dev/null
+++ b/extensions/firefox-i2p-torrent/start.html
@@ -0,0 +1,153 @@
+
+
+
+
+ Moon I2P Start Page
+
+
+
+
+
+
+
+
+
+
Connecting to bundled moon-i2p router...
+
+ Checking tunnel pool and NetDB readiness. .i2p browsing works automatically once tunnels are up.
+
+
+
+
+
+
+
+
+
Tunnels
+
--
+
Waiting for router
+
+
+
NetDB Peers
+
--
+
-- floodfills
+
+
+
I2P DHT
+
--
+
Proto 17 / 18
+
+
+
+
+
+
+
+
+
+ Proxy: 127.0.0.1:4444
+
+
+
+
+ Built-in .i2p Destinations
+ Zero-lookup aliases ready
+
+
+
+
+
+
+ Active Torrents (0)
+
+
+
+
+
+
+
+
+
+
+
diff --git a/extensions/firefox-i2p-torrent/start.js b/extensions/firefox-i2p-torrent/start.js
new file mode 100644
index 0000000..0feb870
--- /dev/null
+++ b/extensions/firefox-i2p-torrent/start.js
@@ -0,0 +1,281 @@
+"use strict";
+
+function normalizeNavigationInput(raw) {
+ const trimmed = String(raw || "").trim();
+ if (!trimmed) {
+ return { kind: "empty" };
+ }
+ if (/^magnet:/i.test(trimmed)) {
+ return { kind: "magnet", value: trimmed };
+ }
+ if (/\s/.test(trimmed)) {
+ return {
+ kind: "invalid",
+ error: "Enter a .i2p domain (e.g. notbob.i2p), .b32.i2p address, or magnet: link.",
+ };
+ }
+ if (/^https?:\/\//i.test(trimmed)) {
+ return { kind: "url", value: trimmed };
+ }
+ if (!/[./:]/.test(trimmed)) {
+ return { kind: "url", value: "http://" + trimmed + ".i2p/" };
+ }
+ return { kind: "url", value: "http://" + trimmed };
+}
+
+if (typeof module !== "undefined" && module.exports) {
+ module.exports = { normalizeNavigationInput };
+}
+
+if (typeof document !== "undefined" && typeof browser !== "undefined") {
+ const $ = (id) => document.getElementById(id);
+
+ function fmtBytes(n) {
+ if (!n || n <= 0) return "0 B";
+ const units = ["B", "KiB", "MiB", "GiB"];
+ let u = 0;
+ let v = n;
+ while (v >= 1024 && u < units.length - 1) {
+ v /= 1024;
+ u++;
+ }
+ return `${v.toFixed(u === 0 ? 0 : 1)} ${units[u]}`;
+ }
+
+ function escapeHtml(s) {
+ return String(s || "").replace(/[&<>"']/g, (c) => ({
+ "&": "&",
+ "<": "<",
+ ">": ">",
+ '"': """,
+ "'": "'",
+ })[c]);
+ }
+
+ function setNavMsg(text, isErr = false) {
+ const el = $("nav-msg");
+ if (!el) return;
+ el.textContent = text;
+ el.className = isErr ? "msg err" : "msg";
+ }
+
+ async function copyTextToClipboard(text) {
+ if (navigator.clipboard && navigator.clipboard.writeText) {
+ try {
+ await navigator.clipboard.writeText(text);
+ return true;
+ } catch (_e) {
+ // Fall through to textarea + execCommand fallback
+ }
+ }
+ const ta = document.createElement("textarea");
+ ta.value = text;
+ ta.setAttribute("readonly", "");
+ ta.style.position = "fixed";
+ ta.style.top = "-9999px";
+ ta.style.left = "-9999px";
+ document.body.appendChild(ta);
+ ta.select();
+ let ok = false;
+ try {
+ ok = document.execCommand("copy");
+ } finally {
+ document.body.removeChild(ta);
+ }
+ return ok;
+ }
+
+ let currentB32 = "";
+ let copyTimer = null;
+ let refreshInFlight = false;
+
+ async function refreshStatus() {
+ if (refreshInFlight || document.hidden) return;
+ refreshInFlight = true;
+ try {
+ const st = await browser.runtime.sendMessage({ type: "getState" });
+ if (!st) return;
+
+ const cfg = st.settings || {};
+ const rs = st.routerStatus || {};
+ const torrents = Array.isArray(st.torrents) ? st.torrents : [];
+ const dhtNodes = (st.dht && Array.isArray(st.dht.nodes) ? st.dht.nodes.length : 0);
+
+ const proxyAddr = `${cfg.proxyHost || "127.0.0.1"}:${cfg.proxyPort || 4444}`;
+ const proxyEnabled = cfg.proxyEnabled !== false;
+ $("proxy-pill").textContent = proxyEnabled ? `Proxy: ${proxyAddr}` : `Proxy Disabled (${proxyAddr})`;
+ $("proxy-pill").className = proxyEnabled ? "pill online" : "pill offline";
+ $("footer-proxy").textContent = `Proxy: ${proxyAddr} (${proxyEnabled ? "enabled" : "disabled"})`;
+
+ const pill = $("status-pill");
+ const startBtn = $("start-router-btn");
+ const banner = $("warmup-banner");
+ const bannerTitle = $("warmup-title");
+ const bannerDetail = $("warmup-detail");
+
+ if (!rs.ok) {
+ pill.textContent = "Offline";
+ pill.className = "pill offline";
+ startBtn.style.display = "";
+ banner.className = "warmup-banner is-offline";
+ bannerTitle.textContent = "moon-i2p router is offline or starting";
+ bannerDetail.textContent = "Click Start Router above or wait for the bundled router to finish launching.";
+
+ $("tile-tunnels-val").textContent = "--";
+ $("tile-tunnels-sub").textContent = "Router unreachable";
+ $("tile-netdb-val").textContent = "--";
+ $("tile-netdb-sub").textContent = "-- floodfills";
+ $("tile-dht-val").textContent = "--";
+ $("tile-dht-sub").textContent = "Proto 17 / 18";
+ currentB32 = "";
+ $("footer-b32").textContent = "--";
+ $("footer-b32").title = "--";
+ } else {
+ startBtn.style.display = "none";
+ const inTunnels = Number(rs.inbound_tunnels || 0);
+ const outTunnels = Number(rs.outbound_tunnels || 0);
+ const routers = Number(rs.netdb_routers || 0);
+ const floodfills = Number(rs.netdb_floodfills || 0);
+ const dhtInfo = rs.dht || {};
+ const dhtCount = Number(dhtInfo.routing_table_nodes ?? dhtNodes ?? 0);
+
+ $("tile-tunnels-val").textContent = `${inTunnels}in / ${outTunnels}out`;
+ $("tile-tunnels-sub").textContent = inTunnels > 0 && outTunnels > 0 ? "Tunnels established" : "Building client tunnels";
+ $("tile-netdb-val").textContent = `${routers}`;
+ $("tile-netdb-sub").textContent = `${floodfills} floodfills`;
+ $("tile-dht-val").textContent = `${dhtCount} nodes`;
+ $("tile-dht-sub").textContent = `${dhtInfo.queries_sent || 0} sent / ${dhtInfo.peers_discovered || 0} peers`;
+
+ currentB32 = rs.torrent_b32 || "";
+ $("footer-b32").textContent = currentB32 || "--";
+ $("footer-b32").title = currentB32 || "--";
+
+ if (inTunnels === 0 || outTunnels === 0) {
+ pill.textContent = "Bootstrapping...";
+ pill.className = "pill booting";
+ banner.className = "warmup-banner is-booting";
+ bannerTitle.textContent = "Bootstrapping I2P tunnels (typically 15–30s)...";
+ bannerDetail.textContent = `NetDB has ${routers} peers (${floodfills} floodfills), ${inTunnels}in/${outTunnels}out tunnels built. .i2p sites will load once tunnels come up.`;
+ } else {
+ pill.textContent = rs.public_mode ? "Public Online" : "I2P Ready";
+ pill.className = "pill online";
+ banner.className = "warmup-banner is-ready";
+ bannerTitle.textContent = "I2P tunnels active and ready";
+ bannerDetail.textContent = `${inTunnels} inbound / ${outTunnels} outbound tunnels · ${routers} NetDB peers · Ready to browse .i2p and download torrents.`;
+ }
+ }
+
+ const activeCount = torrents.filter((t) => !t.completed && !t.paused).length;
+ $("tile-torrents-val").textContent = `${torrents.length} total`;
+ $("tile-torrents-sub").textContent = activeCount > 0 ? `${activeCount} downloading · Open manager` : "Open manager";
+
+ const tCard = $("active-torrents-card");
+ const tList = $("active-torrents-list");
+ $("active-torrents-count").textContent = String(torrents.length);
+ if (torrents.length === 0) {
+ tCard.style.display = "none";
+ tList.innerHTML = "";
+ } else {
+ tCard.style.display = "";
+ tList.innerHTML = torrents
+ .slice(0, 6)
+ .map((t) => {
+ const pct = Math.max(0, Math.min(100, Number(t.progress_pct || 0)));
+ return `
+
+
+ ${escapeHtml(t.name)}
+ ${escapeHtml(t.state)} · ${pct}%
+
+
+
+ ${fmtBytes(t.downloaded_bytes)} / ${fmtBytes(t.total_length)} · ${t.connected_peers || 0}/${t.known_peers || 0} peers
+
+
+ `;
+ })
+ .join("");
+ }
+ } catch (_e) {
+ // Ignore transient polling errors while background wakes up
+ } finally {
+ refreshInFlight = false;
+ }
+ }
+
+ document.addEventListener("DOMContentLoaded", () => {
+ $("nav-form").addEventListener("submit", async (e) => {
+ e.preventDefault();
+ const parsed = normalizeNavigationInput($("nav-input").value);
+ if (parsed.kind === "empty") {
+ setNavMsg("");
+ return;
+ }
+ if (parsed.kind === "invalid") {
+ setNavMsg(parsed.error, true);
+ return;
+ }
+ if (parsed.kind === "magnet") {
+ setNavMsg("Submitting magnet URI to moon-i2p...");
+ const res = await browser.runtime.sendMessage({ type: "addMagnet", uri: parsed.value });
+ if (res && res.ok) {
+ $("nav-input").value = "";
+ setNavMsg(`Added magnet ${(res.info_hash || "").slice(0, 12)}...`);
+ await browser.runtime.sendMessage({ type: "openManager" });
+ } else {
+ setNavMsg(`Magnet failed: ${(res && res.error) || "router offline"}`, true);
+ }
+ return;
+ }
+ setNavMsg("");
+ window.location.href = parsed.value;
+ });
+
+ const openManager = () => browser.runtime.sendMessage({ type: "openManager" });
+ $("open-manager-btn").addEventListener("click", openManager);
+ $("torrents-tile").addEventListener("click", openManager);
+ $("open-manager-btn-2").addEventListener("click", openManager);
+ $("open-diag-btn").addEventListener("click", () =>
+ browser.runtime.sendMessage({ type: "openManager", hash: "#diagnostics-card" })
+ );
+
+ $("start-router-btn").addEventListener("click", async () => {
+ setNavMsg("Starting moon-i2p router via native host...");
+ const res = await browser.runtime.sendMessage({ type: "startRouter" });
+ if (res && res.ok) {
+ setNavMsg("Router starting (waiting for API & tunnels)...");
+ } else {
+ setNavMsg(`Failed to start router: ${(res && res.error) || "unavailable"}`, true);
+ }
+ setTimeout(() => refreshStatus(), 700);
+ });
+
+ $("copy-b32-btn").addEventListener("click", async () => {
+ if (!currentB32) {
+ setNavMsg("Router has not published a .b32.i2p address yet.", true);
+ return;
+ }
+ const btn = $("copy-b32-btn");
+ const ok = await copyTextToClipboard(currentB32);
+ if (ok) {
+ btn.textContent = "Copied!";
+ if (copyTimer) clearTimeout(copyTimer);
+ copyTimer = setTimeout(() => {
+ btn.textContent = "Copy .b32";
+ copyTimer = null;
+ }, 1500);
+ } else {
+ setNavMsg("Clipboard copy blocked by browser.", true);
+ }
+ });
+
+ document.addEventListener("visibilitychange", () => {
+ if (!document.hidden) {
+ refreshStatus();
+ }
+ });
+
+ refreshStatus();
+ setInterval(() => refreshStatus(), 2000);
+ });
+}
diff --git a/scripts/build_appimage.py b/scripts/build_appimage.py
index 811c207..cd72fee 100755
--- a/scripts/build_appimage.py
+++ b/scripts/build_appimage.py
@@ -5,7 +5,7 @@ Bundles:
- Official Mozilla Firefox ESR (x86_64)
- Native moon-i2p router (--public, HTTP proxy, BitTorrent + I2P DHT API)
- Pre-installed moon-i2p-torrent@local Firefox WebExtension & Native Messaging host
- - Pre-configured homepage http://insulaocculta.i2p/, I2P PAC routing, and HTTPS-First disabled for .i2p
+ - Pre-configured Moon I2P Start Page, I2P PAC routing, and HTTPS-First disabled for .i2p
"""
import json
@@ -105,7 +105,6 @@ def write_firefox_configs(firefox_dir: Path):
'pref("extensions.sideloadScopes", 15);\n'
'pref("extensions.startupScanScopes", 15);\n'
'pref("extensions.installDistroAddons", true);\n'
- 'defaultPref("browser.startup.homepage", "http://insulaocculta.i2p/");\n'
'defaultPref("browser.startup.page", 1);\n'
'defaultPref("dom.security.https_only_mode", false);\n'
'defaultPref("dom.security.https_only_mode_pbm", false);\n'
@@ -126,11 +125,6 @@ def write_firefox_configs(firefox_dir: Path):
dist_dir.mkdir(parents=True, exist_ok=True)
policies = {
"policies": {
- "Homepage": {
- "URL": "http://insulaocculta.i2p/",
- "StartPage": "homepage",
- "Locked": False,
- },
"OverrideFirstRunPage": "",
"OverridePostUpdatePage": "",
"DontCheckDefaultBrowser": True,
@@ -140,6 +134,16 @@ def write_firefox_configs(firefox_dir: Path):
"DisableFirefoxStudies": True,
"DNSOverHTTPS": {"Enabled": False},
"Bookmarks": [
+ {
+ "Title": "NotBob Directory",
+ "URL": "http://notbob.i2p/",
+ "Placement": "toolbar",
+ },
+ {
+ "Title": "Postman Tracker",
+ "URL": "http://tracker2.postman.i2p/",
+ "Placement": "toolbar",
+ },
{
"Title": "Insula Occulta",
"URL": "http://insulaocculta.i2p/",
@@ -155,16 +159,6 @@ def write_firefox_configs(firefox_dir: Path):
"URL": "http://zzz.i2p/",
"Placement": "toolbar",
},
- {
- "Title": "Postman Tracker",
- "URL": "http://tracker2.postman.i2p/",
- "Placement": "toolbar",
- },
- {
- "Title": "NotBob Directory",
- "URL": "http://notbob.i2p/",
- "Placement": "toolbar",
- },
],
"ExtensionSettings": {
"moon-i2p-torrent@local": {
@@ -321,7 +315,6 @@ function FindProxyForURL(url, host) {
EOF
cat > "$PROFILE_DIR/user.js" < "$PREFS_TMP" || true
+ mv -f "$PREFS_TMP" "$PROFILE_DIR/prefs.js"
+fi
+
ROUTER_BIN="$APPDIR/usr/bin/moon-i2p-router"
ROUTER_PID=""
FF_PID=""