commit 05ca194bef5dbdce42675941e5cdbc1219200cd9 Author: LilDosto Date: Fri Nov 6 04:29:58 2026 +0300 feat: initial LD FDPI v1.7.0 open-source repository diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..0791e52 --- /dev/null +++ b/.env.example @@ -0,0 +1,4 @@ +# Build-time environment (never commit real values) +LD_FDPI_APP_SECRET= +TAURI_SIGNING_PRIVATE_KEY= +TAURI_SIGNING_PRIVATE_KEY_PASSWORD= diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..d26fdcb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,99 @@ +name: Release + +on: + push: + tags: + - "v*" + workflow_dispatch: + inputs: + version: + description: "Release version (without v)" + required: true + default: "1.7.0" + +permissions: + contents: write + +jobs: + build: + runs-on: windows-latest + timeout-minutes: 45 + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: 20 + cache: npm + + - name: Setup Rust + uses: dtolnay/rust-toolchain@stable + + - name: Rust cache + uses: Swatinem/rust-cache@v2 + with: + workspaces: src-tauri + + - name: Install dependencies + run: npm ci + + - name: Generate version.json + shell: pwsh + run: | + $version = node -p "require('./package.json').version" + $payload = [ordered]@{ + version = $version + page_url = "https://ttmadethat.shop/ld-fdpi" + notes = "LD FDPI $version" + } + [IO.File]::WriteAllText( + (Join-Path $PWD "version.json"), + ($payload | ConvertTo-Json), + (New-Object Text.UTF8Encoding($false)) + ) + + - name: Build and publish signed release + uses: tauri-apps/tauri-action@v0 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} + TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} + LD_FDPI_APP_SECRET: ${{ secrets.LD_FDPI_APP_SECRET }} + with: + tagName: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', inputs.version) || github.ref_name }} + releaseName: "LD FDPI ${{ github.event_name == 'workflow_dispatch' && inputs.version || github.ref_name }}" + releaseBody: | + LD FDPI release. + + - Windows 10/11 x64 + - Authenticode yok; SmartScreen uyarabilir. + - Updater paketleri Minisign ile imzalıdır. + releaseDraft: false + prerelease: false + includeUpdaterJson: true + tauriScript: npm run tauri + args: --bundles nsis + + - name: Upload build artifacts + uses: actions/upload-artifact@v4 + with: + name: ld-fdpi-windows-x64 + path: | + src-tauri/target/release/bundle/nsis/*.exe + src-tauri/target/release/bundle/nsis/*.sig + version.json + if-no-files-found: error + + - name: Verify installer exists + shell: pwsh + run: | + $files = Get-ChildItem "src-tauri/target/release/bundle/nsis" -Filter "*.exe" + if (-not $files) { throw "Installer not found" } + $files | ForEach-Object { + Write-Host "$($_.Name) $((Get-FileHash $_.FullName -Algorithm SHA256).Hash)" + } diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4810b13 --- /dev/null +++ b/.gitignore @@ -0,0 +1,73 @@ +# Dependencies +node_modules/ +dist/ +dist-ssr/ +*.local + +# Rust / Tauri +src-tauri/target/ +src-tauri/gen/ +# Target dir is a sibling of the project (see scripts/target-dir.js) +.ld-fdpi-target/ +# The official SpoofDPI sidecar is pinned in the repository so a fresh clone can +# build without network access; everything else under binaries is ignored. +src-tauri/binaries/*.exe +src-tauri/binaries/*.log +!src-tauri/binaries/spoofdpi-x86_64-pc-windows-gnu.exe +!src-tauri/binaries/spoofdpi-x86_64-pc-windows-msvc.exe +!src-tauri/binaries/.gitkeep + +# Build outputs (uploaded to GitHub Releases instead) +release/ + +# Logs & OS +*.log +npm-debug.log* +yarn-debug.log* +yarn-error.log* +pnpm-debug.log* +.DS_Store +Thumbs.db +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# Personal SSH shortcut (never publish) +/baðlan.bat + +*.bat + + +# Private AmneziaWG client config (embedded locally into the installer; never publish source) +src-tauri/resources/amnezia_for_awg.conf +amnezia_for_awg.conf + +# Secrets and local signing material +.env +.env.* +!.env.example +*.key +*.pem +*.p12 +*.pfx +*.jks +*.keystore +*.sig +.tauri/ +src-tauri/.tauri/ + +# Local/runtime artifacts +*.bak +*.tmp +*.old +*.orig +*.rej +.vscode/ +.idea/ +src-tauri/binaries/*.log +src-tauri/resources/amnezia_for_awg.conf + +# Website local output +site/*.tmp diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 0000000..398a444 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,72 @@ +# Katkı Rehberi + +LD FDPI’ye katkı sağlamak istediğin için teşekkürler. + +## Geliştirme ortamı + +Gereksinimler: + +- Windows 10/11 x64 +- Node.js 20+ +- Rust stable (MSVC) +- Visual Studio Build Tools (C++ Desktop) +- WebView2 Runtime + +Kurulum: + +```powershell +npm ci +npm run check:rust +npm run dev +``` + +## Kod kuralları + +- Rust: `cargo fmt` ve `cargo check`. +- React: mevcut Tailwind/fluent tasarım dilini koru. +- Ağ/WFP değişikliklerinde geri alma ve hata yollarını da yaz. +- Kullanıcıya gösterilen metinlerde Türkçe/İngilizce karışıklığı yaratma. +- Yeni bağımlılık eklemeden önce standart kütüphane/platform çözümünü değerlendir. + +## Güvenlik kuralları + +Şunları **asla** commit etme: + +- `LD_FDPI_APP_SECRET` +- Minisign private key veya password +- `amnezia_for_awg.conf` +- Kişisel `.conf`, log, token, IP listesi +- `src-tauri/target/`, `node_modules/`, `release/` + +## Test + +```powershell +npm run check:rust +npm test +npm run tauri build +``` + +Ağ/WFP değişikliklerini izole VM veya ayrı test cihazında doğrula. Ana +makinede doğrulanmamış kernel/network değişikliği yayınlama. + +## Pull Request + +- Küçük ve tek konulu PR aç. +- Değişikliğin nedenini ve test ortamını yaz. +- UI değişikliği varsa ekran görüntüsü ekle. +- Güvenlik açığı içeren bir konu varsa PR yerine `SECURITY.md` sürecini kullan. + +## Commit mesajları + +```text +feat: ... +fix: ... +docs: ... +refactor: ... +test: ... +chore: ... +``` + +## Lisans + +Katkılar MIT lisansı altında kabul edilir. diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..06fd617 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2026 LD FDPI Contributors + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..a8ffbdf --- /dev/null +++ b/README.md @@ -0,0 +1,294 @@ +
+ LD FDPI logo +

LD FDPI

+

Zero-touch VPN + DPI bypass for Windows.
+ Tauri v2 · Rust · React · AmneziaWG · SpoofDPI

+

+ + Download + + Windows + MIT + Rust +

+
+ +**LD FDPI**, Windows 10/11 x64 için iki modlu bir ağ aracıdır: + +- **FDPI:** SpoofDPI tabanlı yerel proxy ile DPI/SNI engellerini aşar. +- **VPN:** AmneziaWG ile Almanya çıkışlı, WFP kill-switch korumalı tünel açar. + +VPN tarafı **zero-touch** çalışır: token, aktivasyon kodu, `.conf` dosyası veya +“İstemciyi Kur” adımı yoktur. İlk **BAĞLAN**’da AmneziaWG ve cihaz profili +otomatik hazırlanır. + +> Bu proje eğitim ve kişisel kullanım için geliştirilmiştir. Bulunduğun ülkenin +> yasalarına ve kullandığın hizmetlerin koşullarına uymak kullanıcının +> sorumluluğundadır. + +--- + +## Özellikler + +### Zero-touch VPN + +- AmneziaWG istemcisinin sessiz MSI kurulumu. +- MachineGuid + donanım parmak izi ile cihaz kimliği. +- Otomatik `/api/v1/auto-enroll`; token/.conf gerekmez. +- Sunucu tarafında idempotent peer tahsisi. +- Handshake ve servis sağlığı için watchdog. +- Peer düşerse WFP temizliği + otomatik yeniden kayıt + reconnect. + +### Ağ güvenliği + +- Kalıcı **WFP kill-switch**. +- Tünel DNS’i (`1.1.1.1:53`) dışındaki DNS/DoT çıkışlarının bloklanması. +- IPv6 catch-all ve WebRTC/STUN blokları. +- WFP filtreleri GUI çökse bile çekirdekte kalır; `--restore-only` temizler. +- FDPI için isteğe bağlı **QUIC (UDP/443) uyumluluk modu**. + - Yalnızca Chrome, Edge, Brave, Opera, Firefox ve Discord süreçleri. + - Ayrı WFP sublayer/GUID seti; VPN kill-switch’e dokunmaz. + - Varsayılan kapalı. +- FDPI modunda fiziksel IPv6 DNS/HTTPS sızıntısına karşı opsiyonel WFP bloğu. + +### FDPI + +- SpoofDPI 0.12.2 sidecar. +- Sistem proxy’si + WinHTTP desteği (game/eduroam modları). +- 3 kademeli otomatik strateji: + 1. Kayıtlı/standart profil + 2. Alternatif DoH + pencere boyu + 3. Turbo/parçalama + yedek DoH +- Her profil `discord.com:443` CONNECT + TLS ile doğrulanır. +- Üç profil de başarısız olursa temel profil açık bırakılır; uygulama çökmez. +- DoH sağlayıcı seçimi: Cloudflare / Google / AdGuard / otomatik. + +### Dayanıklılık + +- Elektrik kesintisi/`taskkill` sonrası açılışta kirli durum kurtarma. +- Ölü `127.0.0.1:` proxy’sinin sessizce temizlenmesi. +- Yetim `spoofdpi` süreçlerinin temizlenmesi. +- Log rotasyonu (5 MB). +- Tüm yardımcı komutlarda `CREATE_NO_WINDOW`. +- Windows Sandbox/VM testleri için ayrı ortam önerilir. + +### Güncelleme + +- Minisign imzalı Tauri updater. +- `latest.json` + `.sig` doğrulaması. +- İmza/indirme hatasında otomatik kurulum yapılmaz; kullanıcıya hata gösterilir. +- Güncelleme öncesi FDPI/VPN/proxy temizliği (dosya kilidi koruması). + +--- + +## Hızlı Başlangıç + +1. [ttmadethat.shop/ld-fdpi](https://ttmadethat.shop/ld-fdpi) veya + [Releases](https://github.com/L1lDosto/LD-FDPI/releases/latest) sayfasından + `LD-FDPI_*_x64-setup.exe` indir. +2. Kurulumu yönetici olarak çalıştır. +3. Uygulamayı aç. +4. **VPN → BAĞLAN**. +5. FDPI kullanacaksan **FDPI → BAĞLAN**. + +İlk VPN bağlantısında: + +- AmneziaWG otomatik kurulur. +- Cihaz kimliği üretilir. +- Sunucu peer’ı otomatik atanır. +- WFP kill-switch devreye girer. + +Kurulum sonrası internet erişimi kesilirse: + +```powershell +& "C:\Program Files\LD FDPI\ld-fdpi.exe" --restore-only +``` + +Bu komut kalıcı WFP filtrelerini ve proxy sentinel’ini temizler. + +--- + +## Sistem Gereksinimleri + +| Gereksinim | Değer | +|---|---| +| İşletim sistemi | Windows 10 22H2 / Windows 11 x64 | +| Yetki | Yönetici (UAC) | +| WebView2 | Installer içinde bootstrapper | +| İnternet | İlk kayıt ve VPN için | +| Desteklenmeyen | Windows 7, ARM64, Windows Sandbox | + +FDPI’nin kapsamı sistem proxy’sini kullanan uygulamalarla sınırlıdır. Oyunlar, +bazı launcher’lar ve UDP ses trafiği proxy’den geçmez; bu durumda VPN modu +kullanılmalıdır. + +--- + +## Mimari + +```text +┌──────────────────────────────┐ +│ React / Tauri WebView │ +│ BAĞLAN · Ayarlar · Durum │ +└──────────────┬───────────────┘ + │ invoke / commands +┌──────────────▼───────────────┐ +│ Rust core │ +│ supervisor · watchdog │ +│ WFP · proxy sentinel │ +│ updater · identity │ +└───────┬──────────────┬───────┘ + │ │ +┌───────▼──────┐ ┌────▼─────────────┐ +│ SpoofDPI │ │ AmneziaWG │ +│ local proxy │ │ Windows service │ +└──────────────┘ └────┬─────────────┘ + │ + ┌──────▼─────────────┐ + │ Enrollment agent │ + │ peer + /16 pool │ + └────────────────────┘ +``` + +--- + +## Kaynaktan Derleme + +### Gereksinimler + +- Node.js 20+ +- Rust stable (MSVC toolchain) +- Visual Studio Build Tools (C++ Desktop) +- WebView2 Runtime (geliştirme ortamında) + +### Komutlar + +```powershell +npm ci +npm run tauri build +``` + +Çıktı: + +```text +src-tauri/target/release/bundle/nsis/LD FDPI__x64-setup.exe +``` + +### Build-time secret + +Otomatik kayıt için `LD_FDPI_APP_SECRET` derleme sırasında verilmelidir: + +```powershell +$env:LD_FDPI_APP_SECRET = "" +npm run tauri build +``` + +Secret repoya **commit edilmez**. GitHub Actions’ta repository secret olarak +tanımlanır. Bu değer istemci binary’sinden çıkarılabilir; gerçek kullanıcı +kimlik doğrulaması değildir. Sunucu tarafında rate-limit ve cihaz bazlı kayıt +koruma sağlar. + +### Updater imzası + +```powershell +$env:TAURI_SIGNING_PRIVATE_KEY = Get-Content "$HOME\.tauri\ld-fdpi-updater.key" -Raw +$env:TAURI_SIGNING_PRIVATE_KEY_PASSWORD = "" +npm run tauri build +``` + +Private key ve password **asla repoya eklenmez**. Kaybedilirse yeni sürümler +imzalanamaz. + +--- + +## Proje Yapısı + +```text +. +├── src/ React arayüzü +├── src-tauri/ Rust çekirdeği +│ ├── src/ +│ │ ├── engine.rs SpoofDPI yönetimi + probing +│ │ ├── vpn.rs AmneziaWG + watchdog +│ │ ├── wfp_killswitch.rs WFP filtreleri +│ │ ├── identity.rs cihaz kimliği + enrollment +│ │ ├── proxy_sentinel.rs proxy kurtarma +│ │ └── updater.rs güvenli güncelleme +│ ├── capabilities/ Tauri izinleri +│ └── resources/ AmneziaWG MSI +├── deploy/ld-fdpi-enroll/ Python enrollment agent +├── scripts/ build/test yardımcıları +├── site/ tanıtım sayfası +├── docs/ teknik dokümanlar +└── .github/workflows/ CI/CD +``` + +--- + +## Geliştirme + +```powershell +npm ci +npm run dev +npm run check:rust +npm test +``` + +Faydalı komutlar: + +```text +npm run tauri dev +npm run tauri build +npm run setup:sidecar +npm run icon:make +``` + +Test bayrakları yalnızca açıkça etkinleştirildiğinde çalışır: + +```powershell +$env:LD_FDPI_TEST_CLI = "1" +``` + +--- + +## Güvenlik ve Gizlilik + +- Kaynak kod açıktır; güvenlik açıkları için [SECURITY.md](SECURITY.md) izle. +- `APP_SECRET` bir kullanıcı hesabı değildir; cihaz kaydı için abuse bariyeridir. +- Updater yalnızca Minisign imzası doğrulanan paketleri kurar. +- WFP filtreleri yönetici gerektirir; uygulama `requireAdministrator` manifestosuyla çalışır. +- VPN yapılandırması özel anahtar içerir; `%LOCALAPPDATA%\LD-FDPI` altında tutulur. +- Loglara özel anahtar veya token yazılmaz. +- Kod imzası (Authenticode) yoktur; SmartScreen “bilinmeyen yayıncı” uyarabilir. + +### Bilinen sınırlar + +- FDPI, sistem proxy’sini kullanmayan uygulamaları kapsamaz. +- Discord sesi UDP kullanır; FDPI proxy’si UDP taşımaz. +- Tek VPN endpoint’i vardır; otomatik sunucu seçimi/failover yoktur. +- IPv6 için VPN tüneli sınırlıdır; FDPI modunda IPv6 sızıntı bloğu opsiyoneldir. +- Kurumsal GPO/antivirüs, proxy veya WFP değişikliklerini engelleyebilir. + +--- + +## Katkı + +Katkı rehberi: [CONTRIBUTING.md](CONTRIBUTING.md) + +- Yeni özellikler için önce issue aç. +- Secret, anahtar, `.conf` veya kişisel log ekleme. +- `npm run check:rust` ve `npm test` çalıştır. +- PR açıklamasında test ortamını belirt. + +--- + +## Lisans + +[MIT](LICENSE) © 2026 LD FDPI Contributors + +Üçüncü taraf bileşenler: + +- [SpoofDPI](https://github.com/xvzc/SpoofDPI) — MIT +- [AmneziaWG](https://github.com/amnezia-vpn/amneziawg-windows-client) — ilgili lisans +- [Tauri](https://tauri.app) — MIT/Apache-2.0 +- [React](https://react.dev) — MIT diff --git a/SECURITY.md b/SECURITY.md new file mode 100644 index 0000000..f4f03e8 --- /dev/null +++ b/SECURITY.md @@ -0,0 +1,45 @@ +# Güvenlik Politikası + +## Desteklenen sürümler + +| Sürüm | Destek | +|---|---| +| 1.7.x | ✅ | +| 1.6.x ve öncesi | ❌ | + +## Güvenlik açığı bildirimi + +Lütfen güvenlik açıklarını **public issue olarak açma**. + +Bunun yerine GitHub’ın özel güvenlik bildirimi özelliğini kullan: + +1. Depoda **Security** sekmesine git. +2. **Report a vulnerability** seç. +3. Etkilenen sürümü, yeniden üretim adımlarını ve etkiyi yaz. + +Alternatif olarak depo sahibine GitHub üzerinden özel mesaj gönder. + +## Kapsam + +Özellikle şunlar ilgi alanına girer: + +- WFP kill-switch veya FDPI filtrelerinin atlatılması +- Proxy sentinel’in ölü proxy bırakması +- Enrollment/peer yetkisiz erişim +- Updater imza doğrulamasının atlatılması +- Path traversal, komut enjeksiyonu, ayrıcalık yükseltme +- Hassas anahtar/token sızıntısı + +## Bilinen tasarım sınırları + +- `LD_FDPI_APP_SECRET` istemci binary’sinden çıkarılabilir; gerçek kullanıcı + kimlik doğrulaması değildir. +- Authenticode yoktur; SmartScreen uyarısı beklenir. +- FDPI yalnızca sistem proxy’sini kullanan uygulamaları kapsar. +- Windows Sandbox, host proxy politikası nedeniyle desteklenmez. + +## Yanıt süreci + +- Bildirim 72 saat içinde değerlendirilir. +- Düzeltme yayınlanana kadar ayrıntılar gizli tutulur. +- Hak edilen bildirimler README/CHANGELOG’da anılır. diff --git a/app-icon.png b/app-icon.png new file mode 100644 index 0000000..fd2d2a2 Binary files /dev/null and b/app-icon.png differ diff --git a/assets/branding/ld-fdpi-logo-source.png b/assets/branding/ld-fdpi-logo-source.png new file mode 100644 index 0000000..0351bfb Binary files /dev/null and b/assets/branding/ld-fdpi-logo-source.png differ diff --git a/deploy/fix_enroll_head.py b/deploy/fix_enroll_head.py new file mode 100644 index 0000000..f8566b8 --- /dev/null +++ b/deploy/fix_enroll_head.py @@ -0,0 +1,12 @@ +from pathlib import Path +p = Path('/opt/tylorindar-safelink/main.py') +t = p.read_text(encoding='utf-8') +t = t.replace('@app.head("/{code}")\n@app.post("/api/v1/auto-enroll")', '@app.post("/api/v1/auto-enroll")', 1) +old = '@app.get("/{code}")\nasync def redirect_shortlink' +new = '@app.head("/{code}")\n@app.get("/{code}")\nasync def redirect_shortlink' +if old in t: + t = t.replace(old, new, 1) + p.write_text(t, encoding='utf-8') + print('head restored') +else: + print('redirect marker missing') diff --git a/deploy/ld-fdpi-enroll/agent.py b/deploy/ld-fdpi-enroll/agent.py new file mode 100644 index 0000000..a5a35da --- /dev/null +++ b/deploy/ld-fdpi-enroll/agent.py @@ -0,0 +1,398 @@ +#!/usr/bin/env python3 +"""Dependency-free LD FDPI enrollment agent (host, Docker access only locally).""" +import base64, hashlib, hmac, json, os, re, secrets, sqlite3, subprocess, sys +from http.server import BaseHTTPRequestHandler, ThreadingHTTPServer +from datetime import datetime, timezone + +DB = os.environ.get("LD_FDPI_ENROLL_DB", "/opt/ld-fdpi-enroll/enroll.db") +CONTAINER = os.environ.get("LD_FDPI_AWG_CONTAINER", "amnezia-awg2") +CONF = os.environ.get("LD_FDPI_AWG_CONF", "/opt/amnezia/awg/awg0.conf") +SERVER_PUB = os.environ["LD_FDPI_SERVER_PUB"] +ENDPOINT = os.environ.get("LD_FDPI_ENDPOINT", "116.202.14.171:42771") +APP_SECRET = os.environ.get("LD_FDPI_APP_SECRET", "") +AWG_JSON = os.environ.get("LD_FDPI_AWG_PARAMS_FILE", "/opt/ld-fdpi-enroll/awg.json") +try: + with open(AWG_JSON, encoding="utf-8") as fh: + AWG = json.load(fh) +except Exception: + AWG = {} +PUBKEY_RE = re.compile(r"^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=$") +DEVICE_RE = re.compile(r"^[a-f0-9]{64}$") + + +def conn(): + c = sqlite3.connect(DB, timeout=10, isolation_level=None) + c.execute("PRAGMA journal_mode=WAL") + c.execute("PRAGMA busy_timeout=10000") + c.execute("""CREATE TABLE IF NOT EXISTS tokens ( + token_hash TEXT PRIMARY KEY, used_by_device TEXT, allocated_ip TEXT, + public_key TEXT, psk TEXT, used_at TEXT)""") + c.execute("""CREATE TABLE IF NOT EXISTS devices ( + device_id TEXT PRIMARY KEY, allocated_ip TEXT UNIQUE, public_key TEXT UNIQUE, + psk TEXT NOT NULL, created_at TEXT NOT NULL, updated_at TEXT NOT NULL)""") + c.execute("""CREATE TABLE IF NOT EXISTS rate ( + bucket TEXT PRIMARY KEY, ts INTEGER NOT NULL, count INTEGER NOT NULL)""") + return c + + +def th(token): + return hashlib.sha256(token.encode()).hexdigest() + + +def rate(c, bucket, limit=5): + now = int(datetime.now(timezone.utc).timestamp()) + row = c.execute("SELECT ts,count FROM rate WHERE bucket=?", (bucket,)).fetchone() + if not row or now - row[0] > 60: + c.execute("INSERT OR REPLACE INTO rate VALUES(?,?,1)", (bucket, now)) + elif row[1] >= limit: + raise ValueError("rate") + else: + c.execute("UPDATE rate SET count=count+1 WHERE bucket=?", (bucket,)) + + +def ensure_pool_route(): + """Keep the expanded pool routed through awg0 after container restarts.""" + subprocess.run( + ["docker", "exec", CONTAINER, "ip", "route", "replace", + "10.8.0.0/16", "dev", "awg0"], + check=False, + ) + + +def candidate_ips(): + for i in range(20, 255): + yield f"10.8.1.{i}" + for third in range(2, 255): + for fourth in range(2, 255): + yield f"10.8.{third}.{fourth}" + + +def ip_alloc(c, evict=False): + def used_ips(): + return {r[0] for r in c.execute( + "SELECT allocated_ip FROM devices WHERE allocated_ip IS NOT NULL " + "UNION SELECT allocated_ip FROM tokens WHERE allocated_ip IS NOT NULL" + )} + + used = used_ips() + for ip in candidate_ips(): + if ip not in used: + if not ip.startswith("10.8.1."): + ensure_pool_route() + return ip + if evict: + evicted = evict_inactive(c) + if evicted: + used = used_ips() + for ip in candidate_ips(): + if ip not in used: + if not ip.startswith("10.8.1."): + ensure_pool_route() + return ip + raise ValueError("pool") + + +def awg_handshakes(): + result = subprocess.run( + ["docker", "exec", CONTAINER, "awg", "show", "awg0", "latest-handshakes"], + capture_output=True, text=True, check=False, + ) + if result.returncode != 0: + return None + handshakes = {} + for line in result.stdout.splitlines(): + parts = line.split() + if len(parts) >= 2 and parts[1].isdigit(): + handshakes[parts[0]] = int(parts[1]) + return handshakes + + +def evict_inactive(c): + """Free one IP from a peer with no handshake for 30+ days.""" + handshakes = awg_handshakes() + if handshakes is None: + return False + cutoff = int(datetime.now(timezone.utc).timestamp()) - 30 * 24 * 3600 + rows = list(c.execute( + "SELECT device_id, public_key, allocated_ip, updated_at FROM devices" + )) + candidates = [] + for device, pub, ip, updated in rows: + last = handshakes.get(pub, 0) + if last == 0 or last < cutoff: + candidates.append((last, updated or "", device, pub, ip)) + candidates.sort() + for last, _updated, device, pub, ip in candidates: + subprocess.run( + ["docker", "exec", CONTAINER, "awg", "set", "awg0", "peer", pub, "remove"], + check=False, + ) + awg_remove_conf(pub) + c.execute("DELETE FROM devices WHERE device_id=?", (device,)) + print(f"evicted inactive peer device={device[:8]} ip={ip} last={last}", file=sys.stderr) + return True + return False + + +def awg_remove_conf(pub): + """Drop a rotated peer block so a container restart cannot revive it.""" + script = ( + f"awk -v pub='{pub}' '" + "/^\\[Peer\\]$/ { inpeer=1; block=$0 \"\\n\"; next } " + "inpeer { block=block $0 \"\\n\"; " + "if ($0 ~ /^AllowedIPs[[:space:]]*=/) { " + "if (index(block, \"PublicKey = \" pub) == 0) printf \"%s\", block; " + "inpeer=0; block=\"\" } next } " + "{ print } END { if (inpeer) printf \"%s\", block }' " + f"{CONF} > {CONF}.tmp && mv {CONF}.tmp {CONF}" + ) + subprocess.run(["docker", "exec", CONTAINER, "sh", "-c", script], check=False) + + +def awg_set(pub, ip, psk, persist=True): + append = "" + if persist: + append = ( + f"printf '\\n[Peer]\\nPublicKey = {pub}\\nPresharedKey = ' >> {CONF}; " + f"cat /tmp/ld-fdpi.psk >> {CONF}; " + f"printf '\\nAllowedIPs = {ip}/32\\n' >> {CONF}; " + ) + script = ( + "umask 077; cat > /tmp/ld-fdpi.psk; " + f"awg set awg0 peer {pub} preshared-key /tmp/ld-fdpi.psk allowed-ips {ip}/32; " + + append + + "rm -f /tmp/ld-fdpi.psk" + ) + subprocess.run(["docker", "exec", "-i", CONTAINER, "sh", "-c", script], + input=psk.encode(), check=True) + + +def legacy_enrollment(pub, device): + c = conn() + try: + c.execute("BEGIN IMMEDIATE") + row = c.execute("SELECT used_by_device,allocated_ip,public_key,psk FROM tokens WHERE used_by_device=?", + (device,)).fetchone() + if not row: + raise ValueError("unauthorized") + used, ip, old_pub, psk = row + if old_pub == pub: + c.execute("COMMIT") + return ip, psk + token = c.execute("SELECT token_hash FROM tokens WHERE used_by_device=?", (device,)).fetchone()[0] + if old_pub: + subprocess.run(["docker", "exec", CONTAINER, "awg", "set", "awg0", "peer", old_pub, "remove"], check=False) + awg_remove_conf(old_pub) + psk = base64.b64encode(secrets.token_bytes(32)).decode() + awg_set(pub, ip, psk) + c.execute("UPDATE tokens SET public_key=?,psk=?,used_at=? WHERE token_hash=?", + (pub, psk, datetime.now(timezone.utc).isoformat(), token)) + c.execute("COMMIT") + return ip, psk + finally: + c.close() + + +def auto_enrollment(pub, device): + """Idempotent per-device enrollment. Same key returns the same peer/IP.""" + c = conn() + try: + c.execute("BEGIN IMMEDIATE") + row = c.execute("SELECT allocated_ip,public_key,psk FROM devices WHERE device_id=?", + (device,)).fetchone() + if row: + ip, old_pub, psk = row + if old_pub == pub: + # Idempotent retry: re-apply the peer, because it may have been + # removed from the container while the DB record remained. + awg_set(pub, ip, psk, persist=False) + c.execute("COMMIT") + return ip, psk + other = c.execute("SELECT device_id FROM devices WHERE public_key=? AND device_id<>?", + (pub, device)).fetchone() + if other: + c.execute("ROLLBACK") + raise ValueError("key-in-use") + if old_pub: + subprocess.run(["docker", "exec", CONTAINER, "awg", "set", "awg0", "peer", old_pub, "remove"], check=False) + awg_remove_conf(old_pub) + psk = base64.b64encode(secrets.token_bytes(32)).decode() + awg_set(pub, ip, psk, persist=True) + c.execute("UPDATE devices SET public_key=?,psk=?,updated_at=? WHERE device_id=?", + (pub, psk, datetime.now(timezone.utc).isoformat(), device)) + c.execute("COMMIT") + return ip, psk + + other = c.execute("SELECT device_id FROM devices WHERE public_key=?", (pub,)).fetchone() + if other: + c.execute("ROLLBACK") + raise ValueError("key-in-use") + ip = ip_alloc(c, evict=True) + psk = base64.b64encode(secrets.token_bytes(32)).decode() + awg_set(pub, ip, psk, persist=True) + now = datetime.now(timezone.utc).isoformat() + c.execute("INSERT INTO devices(device_id,allocated_ip,public_key,psk,created_at,updated_at) " + "VALUES(?,?,?,?,?,?)", (device, ip, pub, psk, now, now)) + c.execute("COMMIT") + return ip, psk + except Exception: + try: + c.execute("ROLLBACK") + except Exception: + pass + raise + finally: + c.close() + + +def response_for(ip, psk): + return 200, { + "address": f"{ip}/32", + "dns": ["1.1.1.1", "1.0.0.1"], + "server_public_key": SERVER_PUB, + "preshared_key": psk, + "endpoint": ENDPOINT, + "allowed_ips": ["0.0.0.0/0", "::/0"], + "awg": { + "jc": 5, "jmin": 10, "jmax": 50, + "s1": 12, "s2": 12, "s3": 12, "s4": 12, + "h1": 1, "h2": 2, "h3": 3, "h4": 4, + "header_protection_key": AWG.get("header_protection_key", ""), + "rekey_after_time": "100-120", "rekey_timeout": "3-7", + "reject_after_time": "150-180", "keepalive_timeout": "5-15", + "max_handshake_attempts": "15-20", + "random_trailers": True, "disable_cookies": True, + }, + } + + +def parse_request(handler): + length = int(handler.headers.get("Content-Length", "0")) + if length <= 0 or length > 8192: + raise ValueError("bad request") + body = json.loads(handler.rfile.read(length)) + pub = str(body.get("public_key", "")) + device = str(body.get("device_id", "")) + if not PUBKEY_RE.match(pub) or not DEVICE_RE.match(device): + raise ValueError("invalid key/device") + base64.b64decode(pub, validate=True) + return pub, device + + +def handle_enroll(handler): + try: + pub, device = parse_request(handler) + except Exception: + return 400, {"error": "bad request"} + token = handler.headers.get("Authorization", "").removeprefix("Bearer ").strip() + if not token: + return 401, {"error": "missing token"} + c = conn() + try: + c.execute("BEGIN IMMEDIATE") + rate(c, th(token)) + row = c.execute("SELECT used_by_device,allocated_ip,public_key,psk FROM tokens WHERE token_hash=?", + (th(token),)).fetchone() + if not row: + c.execute("ROLLBACK") + return 401, {"error": "invalid token"} + used, ip, old_pub, psk = row + if used is not None and used != device: + c.execute("ROLLBACK") + return 409, {"error": "token used on another device"} + if used == device and ip and psk: + if old_pub and old_pub != pub: + subprocess.run(["docker", "exec", CONTAINER, "awg", "set", "awg0", "peer", old_pub, "remove"], check=False) + psk = base64.b64encode(secrets.token_bytes(32)).decode() + awg_set(pub, ip, psk) + else: + ip = ip_alloc(c) + psk = base64.b64encode(secrets.token_bytes(32)).decode() + awg_set(pub, ip, psk) + c.execute("UPDATE tokens SET used_by_device=?,allocated_ip=?,public_key=?,psk=?,used_at=? WHERE token_hash=?", + (device, ip, pub, psk, datetime.now(timezone.utc).isoformat(), th(token))) + c.execute("COMMIT") + except ValueError as e: + c.execute("ROLLBACK") + return (429 if str(e) == "rate" else 401), {"error": str(e)} + except Exception: + c.execute("ROLLBACK") + return 500, {"error": "enrollment failed"} + finally: + c.close() + return response_for(ip, psk) + + +def handle_auto_enroll(handler): + if not APP_SECRET: + return 503, {"error": "auto-enroll disabled"} + if not hmac.compare_digest(handler.headers.get("X-App-Secret", ""), APP_SECRET): + return 401, {"error": "unauthorized"} + try: + pub, device = parse_request(handler) + except Exception: + return 400, {"error": "bad request"} + ip_hint = (handler.headers.get("X-Real-IP") or handler.headers.get("CF-Connecting-IP") + or handler.client_address[0]) + c = conn() + try: + c.execute("BEGIN IMMEDIATE") + rate(c, "ip:" + ip_hint, 20) + rate(c, "dev:" + ip_hint + ":" + device, 5) + c.execute("COMMIT") + except ValueError as e: + c.execute("ROLLBACK") + return (429 if str(e) == "rate" else 400), {"error": str(e)} + except Exception: + c.execute("ROLLBACK") + return 500, {"error": "enrollment failed"} + finally: + c.close() + try: + ip, psk = auto_enrollment(pub, device) + except ValueError as e: + if str(e) == "pool": + return 503, {"error": "pool exhausted"} + if str(e) == "key-in-use": + return 409, {"error": "public key already enrolled"} + return 400, {"error": str(e)} + except Exception: + return 502, {"error": "peer setup failed"} + return response_for(ip, psk) + + +class Handler(BaseHTTPRequestHandler): + def log_message(self, fmt, *args): + sys.stderr.write("enroll: " + fmt % args + "\n") + + def do_POST(self): + if self.path == "/api/v1/enroll": + code, payload = handle_enroll(self) + elif self.path == "/api/v1/auto-enroll": + code, payload = handle_auto_enroll(self) + else: + code, payload = 404, {"error": "not found"} + self.reply(code, payload) + + def reply(self, code, payload): + data = json.dumps(payload).encode() + self.send_response(code) + self.send_header("Content-Type", "application/json") + self.send_header("Content-Length", str(len(data))) + self.end_headers() + self.wfile.write(data) + + +if __name__ == "__main__": + if len(sys.argv) > 1 and sys.argv[1] == "--mint": + token = "LDFDPI-" + "-".join( + "".join(secrets.choice("ABCDEFGHJKLMNPQRSTUVWXYZ23456789") for _ in range(4)) + for _ in range(3) + ) + c = conn() + c.execute("INSERT INTO tokens(token_hash) VALUES(?)", (th(token),)) + c.close() + print(token) + raise SystemExit(0) + ensure_pool_route() + ThreadingHTTPServer(("172.17.0.1", 9471), Handler).serve_forever() diff --git a/deploy/ld-fdpi-enroll/ld-fdpi-enroll.service b/deploy/ld-fdpi-enroll/ld-fdpi-enroll.service new file mode 100644 index 0000000..d6a9322 --- /dev/null +++ b/deploy/ld-fdpi-enroll/ld-fdpi-enroll.service @@ -0,0 +1,19 @@ +[Unit] +Description=LD FDPI Enrollment Agent +After=network.target docker.service +Requires=docker.service + +[Service] +Type=simple +User=root +WorkingDirectory=/opt/ld-fdpi-enroll +EnvironmentFile=/opt/ld-fdpi-enroll/.env +ExecStartPre=/usr/bin/python3 /opt/ld-fdpi-enroll/sync_peers.py +ExecStart=/usr/bin/python3 /opt/ld-fdpi-enroll/agent.py +Restart=always +RestartSec=3 +NoNewPrivileges=true +PrivateTmp=true + +[Install] +WantedBy=multi-user.target diff --git a/deploy/ld-fdpi-enroll/main.py b/deploy/ld-fdpi-enroll/main.py new file mode 100644 index 0000000..9d993a2 --- /dev/null +++ b/deploy/ld-fdpi-enroll/main.py @@ -0,0 +1,209 @@ +"""LD FDPI one-time, device-bound enrollment agent. + +Run as a host systemd service (not inside the public FastAPI container) so it +can call `docker exec` without exposing the Docker socket to the web app. + +Environment: + LD_FDPI_ENROLL_DB default /opt/ld-fdpi-enroll/enroll.db + LD_FDPI_AWG_CONTAINER default amnezia-awg2 + LD_FDPI_SERVER_PUB AmneziaWG server public key (base64) + LD_FDPI_ENDPOINT default 116.202.14.171:42771 + LD_FDPI_AWG_PARAMS_JSON optional JSON object with jc/jmin/... fields + LD_FDPI_ADMIN_TOKEN token that can mint enrollment codes via /admin/token +""" + +from __future__ import annotations + +import base64 +import hashlib +import hmac +import json +import os +import re +import secrets +import sqlite3 +import subprocess +from datetime import datetime, timezone + +from fastapi import FastAPI, Header, HTTPException +from pydantic import BaseModel, Field + +DB = os.environ.get("LD_FDPI_ENROLL_DB", "/opt/ld-fdpi-enroll/enroll.db") +CONTAINER = os.environ.get("LD_FDPI_AWG_CONTAINER", "amnezia-awg2") +CONF = os.environ.get("LD_FDPI_AWG_CONF", "/opt/amnezia/awg/awg0.conf") +SERVER_PUB = os.environ["LD_FDPI_SERVER_PUB"] +ENDPOINT = os.environ.get("LD_FDPI_ENDPOINT", "116.202.14.171:42771") +ADMIN_TOKEN = os.environ.get("LD_FDPI_ADMIN_TOKEN", "") +AWG = json.loads(os.environ.get("LD_FDPI_AWG_PARAMS_JSON", "{}")) +PUBKEY_RE = re.compile(r"^[A-Za-z0-9+/]{42}[AEIMQUYcgkosw048]=$") +DEVICE_RE = re.compile(r"^[a-f0-9]{64}$") + +app = FastAPI(title="LD FDPI enrollment", docs_url=None, redoc_url=None) + + +def db() -> sqlite3.Connection: + conn = sqlite3.connect(DB, timeout=10, isolation_level=None) + conn.execute("PRAGMA journal_mode=WAL") + conn.execute("PRAGMA busy_timeout=10000") + conn.execute( + """CREATE TABLE IF NOT EXISTS tokens ( + token_hash TEXT PRIMARY KEY, + used_by_device TEXT, + allocated_ip TEXT, + public_key TEXT, + psk TEXT, + used_at TEXT + )""" + ) + conn.execute( + """CREATE TABLE IF NOT EXISTS rate ( + bucket TEXT PRIMARY KEY, + ts INTEGER NOT NULL, + count INTEGER NOT NULL + )""" + ) + return conn + + +def token_hash(token: str) -> str: + return hashlib.sha256(token.encode()).hexdigest() + + +def check_rate(conn: sqlite3.Connection, bucket: str) -> None: + now = int(datetime.now(timezone.utc).timestamp()) + row = conn.execute("SELECT ts, count FROM rate WHERE bucket=?", (bucket,)).fetchone() + if not row or now - row[0] > 60: + conn.execute("INSERT OR REPLACE INTO rate(bucket, ts, count) VALUES(?,?,1)", (bucket, now)) + return + if row[1] >= 5: + raise HTTPException(429, "rate limit") + conn.execute("UPDATE rate SET count=count+1 WHERE bucket=?", (bucket,)) + + +def allocate_ip(conn: sqlite3.Connection) -> str: + used = { + row[0] + for row in conn.execute("SELECT allocated_ip FROM tokens WHERE allocated_ip IS NOT NULL") + } + for i in range(20, 251): + ip = f"10.8.1.{i}" + if ip not in used: + return ip + raise HTTPException(503, "IP pool exhausted") + + +def awg_set(public_key: str, ip: str, psk: str) -> None: + script = ( + "umask 077; cat > /tmp/ld-fdpi.psk; " + f"awg set awg0 peer {public_key} preshared-key /tmp/ld-fdpi.psk allowed-ips {ip}/32; " + f"printf '\\n[Peer]\\nPublicKey = {public_key}\\nPresharedKey = %s\\nAllowedIPs = {ip}/32\\n' " + '"$(cat /tmp/ld-fdpi.psk)" >> ' + CONF + "; rm -f /tmp/ld-fdpi.psk" + ) + subprocess.run( + ["docker", "exec", "-i", CONTAINER, "sh", "-c", script], + input=psk.encode(), + check=True, + ) + + +class Enroll(BaseModel): + public_key: str = Field(min_length=44, max_length=44) + client_version: str = Field(max_length=32) + device_id: str = Field(min_length=64, max_length=64) + + +@app.post("/api/v1/enroll") +def enroll(req: Enroll, authorization: str = Header(default="")): + token = authorization.removeprefix("Bearer ").strip() + if not token or not PUBKEY_RE.match(req.public_key) or not DEVICE_RE.match(req.device_id): + raise HTTPException(400, "invalid request") + + base64.b64decode(req.public_key, validate=True) + th = token_hash(token) + conn = db() + try: + conn.execute("BEGIN IMMEDIATE") + check_rate(conn, th) + row = conn.execute( + "SELECT used_by_device, allocated_ip, public_key, psk FROM tokens WHERE token_hash=?", + (th,), + ).fetchone() + if not row: + raise HTTPException(401, "invalid token") + + used_by, ip, old_pub, psk = row + if used_by is not None and used_by != req.device_id: + raise HTTPException(409, "token already used on another device") + + if used_by == req.device_id and ip and psk: + # Idempotent re-install: same device gets the same IP/PSK. + if old_pub and old_pub != req.public_key: + subprocess.run( + ["docker", "exec", CONTAINER, "awg", "set", "awg0", "peer", old_pub, "remove"], + check=False, + ) + psk = base64.b64encode(secrets.token_bytes(32)).decode() + awg_set(req.public_key, ip, psk) + else: + ip = allocate_ip(conn) + psk = base64.b64encode(secrets.token_bytes(32)).decode() + awg_set(req.public_key, ip, psk) + + conn.execute( + "UPDATE tokens SET used_by_device=?, allocated_ip=?, public_key=?, psk=?, used_at=? " + "WHERE token_hash=?", + (req.device_id, ip, req.public_key, psk, datetime.now(timezone.utc).isoformat(), th), + ) + conn.execute("COMMIT") + except HTTPException: + conn.execute("ROLLBACK") + raise + except Exception as exc: + conn.execute("ROLLBACK") + raise HTTPException(500, "enrollment failed") from exc + finally: + conn.close() + + return { + "address": f"{ip}/32", + "dns": ["1.1.1.1", "1.0.0.1"], + "server_public_key": SERVER_PUB, + "preshared_key": psk, + "endpoint": ENDPOINT, + "allowed_ips": ["0.0.0.0/0", "::/0"], + "awg": { + "jc": 5, "jmin": 10, "jmax": 50, + "s1": 12, "s2": 12, "s3": 12, "s4": 12, + "h1": 1, "h2": 2, "h3": 3, "h4": 4, + "header_protection_key": AWG.get("header_protection_key", ""), + "rekey_after_time": "100-120", "rekey_timeout": "3-7", + "reject_after_time": "150-180", "keepalive_timeout": "5-15", + "max_handshake_attempts": "15-20", + "random_trailers": True, "disable_cookies": True, + }, + } + + +class TokenRequest(BaseModel): + note: str = "" + + +@app.post("/admin/token") +def mint_token(req: TokenRequest, authorization: str = Header(default="")): + if not ADMIN_TOKEN or not hmac.compare_digest( + authorization.removeprefix("Bearer ").strip(), ADMIN_TOKEN + ): + raise HTTPException(401, "unauthorized") + token = "LDFDPI-" + "-".join( + "".join(secrets.choice("ABCDEFGHJKLMNPQRSTUVWXYZ23456789") for _ in range(4)) + for _ in range(3) + ) + conn = db() + try: + conn.execute( + "INSERT INTO tokens(token_hash) VALUES(?)", + (token_hash(token),), + ) + finally: + conn.close() + return {"token": token, "note": req.note} diff --git a/deploy/ld-fdpi-enroll/sync_peers.py b/deploy/ld-fdpi-enroll/sync_peers.py new file mode 100644 index 0000000..fe9fc5e --- /dev/null +++ b/deploy/ld-fdpi-enroll/sync_peers.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 +"""Restore persisted LD FDPI peers after a container/host restart.""" +import os, sqlite3, subprocess + +DB = os.environ.get("LD_FDPI_ENROLL_DB", "/opt/ld-fdpi-enroll/enroll.db") +CONTAINER = os.environ.get("LD_FDPI_AWG_CONTAINER", "amnezia-awg2") + +conn = sqlite3.connect(DB) +conn.execute( + """CREATE TABLE IF NOT EXISTS tokens ( + token_hash TEXT PRIMARY KEY, used_by_device TEXT, allocated_ip TEXT, + public_key TEXT, psk TEXT, used_at TEXT)""" +) +conn.execute( + """CREATE TABLE IF NOT EXISTS devices ( + device_id TEXT PRIMARY KEY, allocated_ip TEXT UNIQUE, public_key TEXT UNIQUE, + psk TEXT NOT NULL, created_at TEXT NOT NULL, updated_at TEXT NOT NULL)""" +) +rows = conn.execute( + "SELECT public_key, psk, allocated_ip FROM tokens " + "WHERE public_key IS NOT NULL AND allocated_ip IS NOT NULL AND psk IS NOT NULL " + "UNION " + "SELECT public_key, psk, allocated_ip FROM devices " + "WHERE public_key IS NOT NULL AND allocated_ip IS NOT NULL AND psk IS NOT NULL" +).fetchall() +conn.close() + +for pub, psk, ip in rows: + script = ( + "umask 077; cat > /tmp/psk_sync; " + f"awg set awg0 peer {pub} preshared-key /tmp/psk_sync allowed-ips {ip}/32; " + "rm -f /tmp/psk_sync" + ) + subprocess.run( + ["docker", "exec", "-i", CONTAINER, "sh", "-c", script], + input=psk.encode(), + check=False, + ) diff --git a/deploy/update_index_card.py b/deploy/update_index_card.py new file mode 100644 index 0000000..55462d8 --- /dev/null +++ b/deploy/update_index_card.py @@ -0,0 +1,33 @@ +from pathlib import Path + +p = Path('/opt/tylorindar-safelink/static/index.html') +t = p.read_text(encoding='utf-8') +old_desc = ("Windows için yerel proxy ve DPI bypass aracı. v1.5.10: kalıcı WFP kill-switch, " + "VPN endpoint/DHCP/LAN izinleri, DNS 53-853 engeli, IPv6 catch-all ve WebRTC STUN blokları. " + "GUI veya tünel servisi çökse bile filtreler çekirdekte kalır; --restore-only temizler. " + "C1 cihaz kaydı ve C3 NetMode korunuyor. Rust/Tauri v2 + React + SpoofDPI 0.12.2.") +new_desc = ("Windows için DPI bypass + AmneziaWG VPN. Kur, BAĞLAN'a bas: cihaz profili otomatik oluşur; " + "token veya .conf gerekmez. Kalıcı WFP kill-switch, DNS/IPv6/STUN sızıntı koruması ve " + "10 saniyede kendini onaran tünel. Rust/Tauri v2 + React + SpoofDPI 0.12.2.") +if old_desc not in t: + raise SystemExit('card desc not found') +t = t.replace(old_desc, new_desc, 1) +old_actions = ('') +new_actions = ('
🧭 Detaylar' + 'Son güncelleme: —' + 'Windows 10/11 · x64
') +if old_actions not in t: + raise SystemExit('card actions not found') +t = t.replace(old_actions, new_actions, 1) +p.write_text(t, encoding='utf-8') +print('index card updated') diff --git a/deploy/update_installer_links.py b/deploy/update_installer_links.py new file mode 100644 index 0000000..a5792c7 --- /dev/null +++ b/deploy/update_installer_links.py @@ -0,0 +1,14 @@ +from pathlib import Path + +old_name = "LD-FDPI_1.5.10_44a7360_x64-setup.exe" +new_name = "LD-FDPI_1.5.10_568239d_x64-setup.exe" +old_query = "?v=44a7360" +new_query = "?v=568239d" +for path in [ + Path('/opt/tylorindar-safelink/static/index.html'), + Path('/opt/tylorindar-safelink/static/downloads/ld-fdpi.html'), +]: + text = path.read_text(encoding='utf-8') + text = text.replace(old_name, new_name).replace(old_query, new_query) + path.write_text(text, encoding='utf-8') + print('updated', path) diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md new file mode 100644 index 0000000..f435bc0 --- /dev/null +++ b/docs/ARCHITECTURE.md @@ -0,0 +1,93 @@ +# LD FDPI — Teknik Mimari + +## 1. Katmanlar + +- **Arayüz (`src/`):** React 18 + Tailwind. `src/utils/engineArgs.js` saf yardımcılar (CLI argümanları, PAC, Tauri tespiti), `src/utils/tauriBridge.js` ise `invoke` sarmalayıcısı ve DOMPurify süzgeci. Simülasyon/mock dalı yoktur; Tauri yoksa açık hata verir. +- **Ayarlar (`src-tauri/src/config.rs`):** `%LOCALAPPDATA%\LD-FDPI\config.json`; `autoStart`, `autoConnect`, `minimizeToTray` varsayılan olarak `true`. Webview yüklenmeden Rust tarafından okunur. +- **Otomatik başlatma (`src-tauri/src/autostart.rs`):** `schtasks /Create /TN LD_FDPI_AutoStart /SC ONLOGON /RL HIGHEST /DELAY 0000:20 /F`. `HKCU\...\Run` kullanılmaz; `requireAdministrator` bir exe oradan UAC'siz başlayamaz. +- **Durum & komutlar (`src-tauri/src/lib.rs`):** `AppState` → `Runtime` + `AppConfig` + `PacHandle`. Uzun işler `spawn_blocking`; UI `get_status` ile 2,5 sn'de bir hafif durum okur. +- **Motor (`src-tauri/src/engine.rs`):** SpoofDPI 0.12.2 sidecar'ı (exe dizini → `binaries/` → manifest), PE + ≥1.5 MB doğrulama, gerçek bayraklar, port bekleme, CONNECT + SChannel TLS probu. +- **Sistem proxy (`src-tauri/src/proxy_sentinel.rs`):** Tam yedek (ProxyEnable, ProxyServer, ProxyOverride, AutoConfigURL, AutoDetect), PAC/WPAD'i devre dışı bırakma, `InternetSetOptionW` + `WM_SETTINGCHANGE`, yedek yoksa no-op, dış değişiklik koruması, WinHTTP bayrağı. +- **WinHTTP (`src-tauri/src/winhttp.rs`):** Oyun Modu'nda yalnızca mevcut ayar "Direct access" ise `netsh winhttp set proxy`; geri yüklemede `reset proxy`. +- **PAC (`src-tauri/src/pac_server.rs`):** `0.0.0.0:`, tokio, `Semaphore(50)`, RFC1918 + `.local` için DIRECT. + +## 2. "Kur ve unut" akışı + +1. `run()` açılmadan önce `run_startup_sentinel_check()` + zombi temizliği. +2. `config.json` okunur, normalize edilir, yazılır. +3. `autostart::apply(auto_start)` görevi oluşturur/siler. +4. `setup`: + - `--minimized`/`--autostart` yoksa pencere gösterilir (config'te `visible:false`). + - `auto_connect` ise **React'ten önce** bir iş parçacığı `do_start` çağırır. + - `lan_sharing` ise PAC sunucusu arka planda başlatılır. + - 15 sn'lik supervisor başlatılır. +5. Supervisor her turda: `desired_connected`, `connecting`, çocuk süreç, sistem proxy yönlendirmesi ve uyanma (`sleep > 45 sn`) kontrolü. Gerekiyorsa `do_restart`/`do_start`; hata olursa 30 sn backoff. + +## 3. Bağlanma akışı + +1. Config doğrulanır; zombi `spoofdpi` süreçleri öldürülür. +2. Port boş mu? (gerçek bind testi) +3. Sidecar spawn + log; 8 sn içinde dinlemezse/çıkarsa hata (log tail'i ile). +4. Proxy üzerinden `discord.com:443` ve `www.cloudflare.com:443` TLS probu (retry'lı). +5. Başarılıysa WinINet proxy'si yazılır; Oyun Modu'nda WinHTTP de denenir. +6. State güncellenir, watchdog kurulur. + +Herhangi bir adım başarısızsa çocuk süreç öldürülür ve sistem proxy'sine dokunulmaz; kısmi yazma olduysa `restore_system_proxy(true)` ile geri alınır. + +## 4. Geri yükleme + +- Normal kesme: yalnızca `dirty_sentinel = true` ve `ProxyServer` hâlâ bizim yazdığımız değer ise geri yüklenir; başka araç değiştirdiyse dokunulmaz. +- Zorla: acil onarım / kaldırma / çökme sonrası; WinHTTP de sıfırlanır. +- Yedek yoksa veya oturum temizse: hiçbir yazma yapılmaz (`noBackup` / `alreadyClean`). + +## 5. UAC manifestosu + +- `src-tauri/windows-app-manifest.xml`: `requestedExecutionLevel level="requireAdministrator"`, Common Controls v6, DPI ve long path. +- `build.rs`: `tauri_build::WindowsAttributes::app_manifest(...)`. +- **GNU ld sorunu:** MinGW CRT kendi `asInvoker` manifestosunu gömer; iki RT_MANIFEST birleşir ve Windows asInvoker'ı uygular. `scripts/patch-manifest.mjs`, `rcedit` ile exe'nin manifest kaynağını tek `requireAdministrator` olarak değiştirir. +- `scripts/tauri.js`: `build --no-bundle` → `rcedit` → `tauri bundle`. `LD_FDPI_NO_ADMIN=1` test derlemesinde bu adım atlanır. + +## 6. Kaldırma + +`nsis/hooks.nsh` → `taskkill ld-fdpi.exe` → `ld-fdpi.exe --restore-only` → `schtasks /Delete /TN LD_FDPI_AutoStart /F` → `taskkill spoofdpi.exe`. + +## 7. Test kapsamı + +- `npm test` (21): sidecar SHA-256 + `-v`, CLI bayrak eşleşmesi, DoH listesi, CSP/IPC, simülasyon yokluğu, PAC eşliği, sentinel güvenliği, **canlı TLS**, i18n, config varsayılanları, UAC/`RL HIGHEST`, 15 sn supervisor, **hash pin + shell/unwrap yokluğu**, **PAC 4 KB/5 sn/peer filtresi**, **sıfır capability + panic hook**, **Eduroam modu**, **Smart DoH/TCP_NODELAY/LTO**, **logo entegrasyonu**, **captive portal asistanı**, **sürüm 1.5.6**. +- `npm run test:gui` (24): WebView2 IPC, sade arayüz, BAĞLAN/KES, LAN rebind, config.json, autostart uyarısı, `--minimized` + auto-connect + gizli pencere. +- `node scripts/security-e2e.mjs` (11): LAN kapalı loopback, LAN açık erişim, PAC 200/413/408, LAN kapatınca geri dönüş, Eduroam modu/status/tanılama/kapanış. +- `ld-fdpi.exe --self-test` (12): motor + registry + WinHTTP bayrağı + config round-trip. + +## 8. Güvenlik sıkılaştırması + +- **Ağ:** LAN kapalıyken `127.0.0.1`; LAN açıkken `0.0.0.0` + RFC1918 peer filtresi; PAC 4 KB/5 sn; firewall `remoteip=localsubnet`; açılışta LAN zorla kapalı. +- **Sidecar:** SHA-256 pin (`16a5c8”¦ea5e`), spawn öncesi tekrar doğrulama; uyuşmazsa hard fail. +- **Süreç:** shell yok; `netsh`/`schtasks` System32 tam yolu; `schtasks /TR` tırnaklı; katı config whitelist. +- **Dosya:** config/sentinel 64 KB + typed serde; `LOCALAPPDATA`/`System32` Win32 API'den. +- **WebView:** katı CSP + sıfır capability. +- **DNS:** yalnızca DoH (`-enable-doh`, `-dns-port` yok). +- **Fail-safe:** panic hook motoru PID ile öldürür, proxy/WinHTTP'yi geri yükler, exit(1). +- **Rust:** `.unwrap()`/`.expect()` yok; `npm audit` 0; `cargo check` temiz. + +## 9. Logo / ikon + +`assets/branding/ld-fdpi-logo-source.png` (doğru logo: şeffaf lacivert zemin, siyah cam paneller, buz mavisi tüpler) → `npm run icon:make` → `app-icon.png` (1024) + `public/logo.png` (512) → `node scripts/tauri.js icon app-icon.png` → `src-tauri/icons/*` (ico/png/icns/Store). `tauri.conf.json` `bundle.icon`, exe/installer/tepsi, arayüz ve site kartı bu logoyu kullanır. Arayüz paleti Tailwind `slate/blue/cyan` + `fluent` tokenlarında lacivert-grafit ve buz mavisi aralığına eşlenir. + +## 10. Eduroam Modu + +- **Algılama:** `netsh wlan show interfaces` → SSID / arayüz / kimlik doğrulama; `is_eduroam` = SSID içinde `eduroam`. +- **Bağlantı:** `netsh wlan connect name=eduroam` (yalnızca kayıtlı Windows profili). 802.1X kullanıcı adı/şifresi uygulamaya girmez; ilk giriş Windows Wi-Fi ayarlarından yapılır. +- **MTU:** Wi-Fi IPv4 MTU 1400; `eduroam_mtu_backup.json` ile çökme güvenli yedek; duruş/çökme/açılışta geri yükleme. +- **Proxy:** `eduroam`, WinHTTP + WinINet kapsamına girer (`is_system_wide`). PAC'ta `*.edu`, `*.edu.tr`, `*.ac.uk`, `eduroam.org` ve özel IP'ler DIRECT. +- **Tanılama:** SSID, 802.1X, MTU, `discord.com:443`, `discord.media:443/2087`, UDP/STUN. +- **Sınır:** Kurum güvenlik duvarı aşılmaz; Discord sesi UDP (19294-19344 / 50000-50100) HTTP proxy'den geçmez. + +## 11. Performans + +- Smart DoH: 3 sağlayıcı × 3 paralel TCP, medyan, 10 dk cache. +- PAC: `set_nodelay(true)`, `Cache-Control: public, max-age=3600`. +- Süreç: `ABOVE_NORMAL_PRIORITY_CLASS`. +- Derleme: `opt-level=3`, `lto="fat"`, `codegen-units=1`, `panic="abort"`, `strip=true`. +- Geçiş kilidi (`TRANSITION`), supervisor `probe_local_port`, log ring buffer 150, tepsi odağında UI timer duraklatma. + + diff --git a/docs/ZERO_TOUCH.md b/docs/ZERO_TOUCH.md new file mode 100644 index 0000000..cc318ad --- /dev/null +++ b/docs/ZERO_TOUCH.md @@ -0,0 +1,159 @@ +# Zero-touch Auto-Enrollment + +The old one-time token flow is replaced by a per-device, idempotent +auto-enrollment flow. + +## Flow + +```text +BAĞLAN + -> AmneziaWG missing? install MSI silently (app runs elevated) + -> config missing? POST /api/v1/auto-enroll + -> save %LOCALAPPDATA%\LD-FDPI\ld-fdpi.conf + -> install/start AmneziaWGTunnel$ld-fdpi + -> enable WFP kill-switch + -> wait up to 10 s for tunnel egress + -> on failure: delete config, re-enroll, retry once +``` + +## Identity + +- Windows `HKLM\SOFTWARE\Microsoft\Cryptography\MachineGuid` +- SHA-256(`ld-fdpi-hwid-v1` + lowercased MachineGuid) = 64-char hex `device_id` +- X25519 key pair remains local; private key sealed with DPAPI +- `device_id` is stable across app reinstall and `%LOCALAPPDATA%` deletion + +## API + +`POST https://ttmadethat.shop/api/v1/auto-enroll` + +Headers: + +```text +Content-Type: application/json +X-App-Secret: +``` + +Body: + +```json +{"public_key":"...","device_id":"<64 hex>","client_version":"1.5.10"} +``` + +Behavior: + +- New device -> next free `10.8.1.x/32`, new PSK, peer added. +- Existing device + same public key -> same IP/PSK, peer re-applied. +- Existing device + new public key -> old peer removed, same IP reused. +- Public key already bound to another device -> `409`. +- IP pool exhausted -> `503`. +- Per-IP rate limit: **5 requests / minute**. +- `X-App-Secret` wrong/missing -> `401`. + +## Server deployment + +`/opt/ld-fdpi-enroll/.env`: + +```text +LD_FDPI_APP_SECRET= +``` + +The FastAPI site proxies `/api/v1/auto-enroll` to `172.17.0.1:9471` and forwards +`X-App-Secret`, `X-Real-IP` (Cloudflare client IP). Backup: +`/opt/tylorindar-safelink/backups/main.py.bak-auto-enroll`. + +## Watchdog + +After a successful connect, a watchdog checks the tunnel every 3 seconds. It +does **not** use the local `latest handshake` age: WireGuard only rekeys about +every 2 minutes, and deleting the server peer does not immediately reset the +client's displayed handshake time. + +Checks: + +1. If the AWG service stopped unexpectedly, recovery starts immediately. +2. Otherwise a DNS query to `1.1.1.1:53` goes through the tunnel. WFP blocks + port 53 on the physical interface and permits only the tunnel LUID, so a + direct WAN response cannot mask a dead peer. +3. Three consecutive failed checks (~9 s) trigger WFP teardown, service + stop/delete, config removal, auto-enroll, service reinstall, and WFP re-arm. +4. Recovery is attempted at most 3 times; after that the watchdog stops and + reports an error instead of looping forever. + +If WFP teardown fails, recovery aborts instead of attempting an HTTPS request +through the catch-all block. + +## MSI installation + +The bundled MSI is copied out of `Program Files` to a plain +`%WINDIR%\Temp\ld-amneziawg.msi` path before `msiexec` runs. This avoids +extended `\\?\` paths and Program Files/MSI open failures (`1619`). The MSI log +is written to `%WINDIR%\Temp\ld-awg-msi.log` and its tail is included in the +error if installation fails. + +## Sandbox acceptance result + +Windows Sandbox (`--auto-connect-vpn`) passed: + +- WebView2 + app install +- Silent AmneziaWG MSI install via temp copy +- Automatic enrollment (new `10.8.1.x/32`) +- Service start + handshake +- Tunnel ping (8.8.8.8 through VPN, ~55 ms) +- Server peer deletion -> peer re-added, `latest handshake` refreshed in <40 s + +Not tested: forced WFP-teardown failure and reboot persistence. + +## Headless acceptance flag + +`ld-fdpi.exe --auto-connect-vpn` starts the normal zero-touch pipeline without +UI interaction and writes: + +```text +%LOCALAPPDATA%\LD-FDPI\auto-connect-result.txt +``` + +This exists for Windows Sandbox/CI acceptance testing. + +## Key rotation / stale peer blocks + +When a device re-enrolls with a new public key, the old peer is removed from +the running AWG interface **and** its `[Peer]` block is removed from +`awg0.conf`. Otherwise a container restart could revive the old key on the same +`10.8.1.x/32`, causing endpoint flapping. + +## WFP / retry ordering + +The kill-switch blocks physical egress. Re-enrolling while it is still active +would make the HTTPS request to `ttmadethat.shop` fail, so the retry path is: + +```text +handshake fail + -> disable_killswitch() with 3 attempts + -> if teardown fails: ABORT, keep the tunnel/service state, report error + -> stop service + -> delete config + -> auto-enroll over normal physical HTTPS + -> reinstall/start service +``` + +The API IP is not permanently whitelisted in WFP; that would punch a hole in the +kill-switch. The teardown result is checked instead. + +## Security warning + +`APP_SECRET` is embedded in the installer and is extractable. This is **not** +real authentication; it only stops random scanners. Anyone who extracts it can +enroll devices until the shared secret is rotated and a new client is shipped. + +The IP rate limit also means shared NAT (school/office) can hit 5/minute. +Token enrollment remains available as a legacy endpoint but is no longer used +by the UI. + +## Known limitation + +`MachineGuid` is per Windows installation, not per Windows user. Two Windows +users on the same PC share `device_id`; the last enrollment wins. Disk-cloned +Windows images without Sysprep can also share it. If that becomes common, add +the SMBIOS UUID/baseboard serial to the hash; the current audience is fine with +MachineGuid alone. diff --git a/docs/screenshot-connected.png b/docs/screenshot-connected.png new file mode 100644 index 0000000..346f3f6 Binary files /dev/null and b/docs/screenshot-connected.png differ diff --git a/docs/screenshot-home.png b/docs/screenshot-home.png new file mode 100644 index 0000000..0ad5156 Binary files /dev/null and b/docs/screenshot-home.png differ diff --git a/docs/screenshot-settings.png b/docs/screenshot-settings.png new file mode 100644 index 0000000..50260ce Binary files /dev/null and b/docs/screenshot-settings.png differ diff --git a/index.html b/index.html new file mode 100644 index 0000000..c18fdfd --- /dev/null +++ b/index.html @@ -0,0 +1,13 @@ + + + + + + + LD FDPI — Yerel Proxy & DPI Bypass + + +
+ + + diff --git a/mobile-app/.gitignore b/mobile-app/.gitignore new file mode 100644 index 0000000..a022160 --- /dev/null +++ b/mobile-app/.gitignore @@ -0,0 +1,30 @@ +# Flutter/Dart +.dart_tool/ +.packages +.pub-cache/ +.pub/ +build/ +.flutter-plugins +.flutter-plugins-dependencies + +# Android +android/.gradle/ +android/local.properties +android/app/debug/ +android/app/profile/ +android/app/release/ +android/key.properties +*.jks +*.keystore + +# IDE +.idea/ +.vscode/ +*.iml + +# OS +.DS_Store +Thumbs.db + +# Native build cache +android/app/.cxx/ diff --git a/mobile-app/BUILD.md b/mobile-app/BUILD.md new file mode 100644 index 0000000..d43cb18 --- /dev/null +++ b/mobile-app/BUILD.md @@ -0,0 +1,87 @@ +# Build + +## Prerequisites + +- Flutter 3.29+ (Dart 3.4+) +- Android SDK Platform 35 +- Android Build Tools 35.0.0 +- JDK 17 or 21 +- Windows: `JAVA_HOME` set to the JDK + +## SDK setup (Windows, no Android Studio) + +```powershell +# 1. Flutter +Expand-Archive C:\src\flutter.zip C:\src +$env:Path = "C:\src\flutter\bin;$env:Path" +flutter --version + +# 2. Android command-line tools +Expand-Archive C:\Android\cmdline-tools.zip C:\Android\cmdline-tools +# move so sdkmanager is at C:\Android\cmdline-tools\latest\bin +$env:ANDROID_HOME = "C:\Android\Sdk" +$env:Path = "C:\Android\cmdline-tools\latest\bin;$env:Path" + +sdkmanager --sdk_root=$env:ANDROID_HOME "platform-tools" "platforms;android-35" "build-tools;35.0.0" +sdkmanager --sdk_root=$env:ANDROID_HOME --licenses +flutter config --android-sdk $env:ANDROID_HOME +flutter doctor +``` + +## Project config + +Create `mobile-app/android/local.properties`: + +```properties +sdk.dir=C:\\Android\\Sdk +flutter.sdk=C:\\src\\flutter +``` + +## Build APK + +```powershell +cd mobile-app +flutter pub get +flutter build apk --release +``` + +Output: + +```text +mobile-app/build/app/outputs/flutter-apk/app-release.apk +``` + +## Signing + +The scaffold uses the debug signing config for `release` so it can be installed +for testing. Create a real keystore before distribution: + +```powershell +keytool -genkeypair -v -keystore ld-fdpi-mobile.jks -keyalg RSA -keysize 2048 -validity 10000 -alias ld-fdpi +``` + +Then replace `signingConfig = signingConfigs.debug` in +`android/app/build.gradle` with a `signingConfigs.release` block and store +credentials outside the repository. + +## Install + +```powershell +adb install -r mobile-app\build\app\outputs\flutter-apk\app-release.apk +``` + +## Important limitation + +The generated APK **will not establish a tunnel** until +`android/app/src/main/jniLibs//libawg.so` exists. See +`docs/TUNNEL_BACKEND.md`. The app intentionally refuses to connect instead of +shipping a fake WireGuard fallback that the AmneziaWG server would reject. + +## Tests before distribution + +1. Clean install on Android 10 and Android 14. +2. Activation code → enrollment succeeds. +3. Connect → TUN + handshake. +4. Kill the native process/service → traffic must not leak. +5. Enable Always-on + Block without VPN in Android settings; reboot. +6. Disconnect → internet returns; DNS/egress IP test. diff --git a/mobile-app/README.md b/mobile-app/README.md new file mode 100644 index 0000000..ee12223 --- /dev/null +++ b/mobile-app/README.md @@ -0,0 +1,77 @@ +# Mobile app + +LD FDPI Android client scaffold. + +## What is implemented + +- Flutter dark UI: connection state, assigned IP, endpoint, ping, activation code. +- X25519 key generation in Dart (`cryptography`). +- Private key and enrollment config in **Android EncryptedSharedPreferences** + via `flutter_secure_storage`. +- One-time device enrollment against `https://ttmadethat.shop/api/v1/enroll`. +- Android `VpnService` shell with: + - TUN establishment, all-IPv4/IPv6 routes, DNS 1.1.1.1/1.0.0.1. + - Foreground notification. + - `BIND_VPN_SERVICE` manifest permission. + - Native `libawg.so` JNI boundary (`NativeTunnel`). +- Settings screen with Android VPN settings deep link for Always-on/Block without VPN. + +## What is not bundled + +`android/app/src/main/jniLibs/*/libawg.so` is **not** included. The stock +WireGuard Android backend does not implement AmneziaWG obfuscation +(`Jc/Jmin/Jmax/S1-S4/H1-H4/HeaderProtectionKey`). Without that native core the +APK installs and the UI runs, but **Connect reports “AmneziaWG çekirdeği yok”** +and does not open a TUN. This is deliberate: a fake tunnel that silently leaks +or blocks all traffic is worse. + +See `docs/TUNNEL_BACKEND.md` for the required JNI contract and build steps. + +## Build + +```bash +cd mobile-app +flutter pub get +flutter build apk --release +``` + +APK output: + +```text +build/app/outputs/flutter-apk/app-release.apk +``` + +The project expects: + +- Flutter 3.29+ / Dart 3.4+ +- Android SDK platform 35, build-tools 35.0.0 +- JDK 17+ (tested with JDK 21) +- `android/local.properties`: + +```properties +sdk.dir=C:\\Users\\\\AppData\\Local\\Android\\Sdk +flutter.sdk=C:\\src\\flutter +``` + +If the Gradle wrapper jar is missing: + +```bash +cd android +gradle wrapper --gradle-version 8.10.2 +``` + +## Install / test + +```bash +adb install -r build/app/outputs/flutter-apk/app-release.apk +adb shell am start -n com.ldfdpi.mobile/.MainActivity +``` + +Then: + +1. Enter the one-time activation code. +2. Allow Android VPN consent. +3. For kill-switch, open **Settings → VPN ayarlarını aç** and enable + **Always-on VPN** + **Block connections without VPN** for LD FDPI. +4. With `libawg.so` present, Connect starts the tunnel; without it, Connect is + rejected rather than leaking traffic. diff --git a/mobile-app/analysis_options.yaml b/mobile-app/analysis_options.yaml new file mode 100644 index 0000000..8d81c20 --- /dev/null +++ b/mobile-app/analysis_options.yaml @@ -0,0 +1,5 @@ +include: package:flutter_lints/flutter.yaml + +linter: + rules: + avoid_print: false diff --git a/mobile-app/android/app/build.gradle b/mobile-app/android/app/build.gradle new file mode 100644 index 0000000..ecbcfeb --- /dev/null +++ b/mobile-app/android/app/build.gradle @@ -0,0 +1,50 @@ +plugins { + id "com.android.application" + id "kotlin-android" + id "dev.flutter.flutter-gradle-plugin" +} + +android { + namespace = "com.ldfdpi.mobile" + compileSdk = 35 + + compileOptions { + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 + } + + kotlinOptions { + jvmTarget = "17" + } + + defaultConfig { + applicationId = "com.ldfdpi.mobile" + minSdk = 26 + targetSdk = 35 + versionCode = 1 + versionName = "0.1.0" + } + + buildTypes { + release { + // Replace with a real keystore before Play/APK distribution. + signingConfig = signingConfigs.debug + minifyEnabled = false + shrinkResources = false + } + } + + packaging { + jniLibs { + useLegacyPackaging = true + } + } +} + +flutter { + source = "../.." +} + +dependencies { + implementation "androidx.core:core-ktx:1.13.1" +} diff --git a/mobile-app/android/app/src/main/AndroidManifest.xml b/mobile-app/android/app/src/main/AndroidManifest.xml new file mode 100644 index 0000000..8d721b5 --- /dev/null +++ b/mobile-app/android/app/src/main/AndroidManifest.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mobile-app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java b/mobile-app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java new file mode 100644 index 0000000..9d756ee --- /dev/null +++ b/mobile-app/android/app/src/main/java/io/flutter/plugins/GeneratedPluginRegistrant.java @@ -0,0 +1,29 @@ +package io.flutter.plugins; + +import androidx.annotation.Keep; +import androidx.annotation.NonNull; +import io.flutter.Log; + +import io.flutter.embedding.engine.FlutterEngine; + +/** + * Generated file. Do not edit. + * This file is generated by the Flutter tool based on the + * plugins that support the Android platform. + */ +@Keep +public final class GeneratedPluginRegistrant { + private static final String TAG = "GeneratedPluginRegistrant"; + public static void registerWith(@NonNull FlutterEngine flutterEngine) { + try { + flutterEngine.getPlugins().add(new com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin()); + } catch (Exception e) { + Log.e(TAG, "Error registering plugin flutter_secure_storage, com.it_nomads.fluttersecurestorage.FlutterSecureStoragePlugin", e); + } + try { + flutterEngine.getPlugins().add(new io.flutter.plugins.pathprovider.PathProviderPlugin()); + } catch (Exception e) { + Log.e(TAG, "Error registering plugin path_provider_android, io.flutter.plugins.pathprovider.PathProviderPlugin", e); + } + } +} diff --git a/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/LdFdpiVpnService.kt b/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/LdFdpiVpnService.kt new file mode 100644 index 0000000..cc81047 --- /dev/null +++ b/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/LdFdpiVpnService.kt @@ -0,0 +1,235 @@ +package com.ldfdpi.mobile + +import android.app.Notification +import android.app.NotificationChannel +import android.app.NotificationManager +import android.app.PendingIntent +import android.content.Context +import android.content.Intent +import android.net.VpnService +import android.os.Build +import android.os.ParcelFileDescriptor +import androidx.core.app.NotificationCompat +import org.json.JSONObject + +class LdFdpiVpnService : VpnService() { + private var tun: ParcelFileDescriptor? = null + private var running = false + + companion object { + const val ACTION_START = "com.ldfdpi.mobile.START" + const val ACTION_STOP = "com.ldfdpi.mobile.STOP" + const val EXTRA_CONFIG = "config" + private const val CHANNEL_ID = "ld_fdpi_tunnel" + private const val NOTIFICATION_ID = 4201 + + private val state = TunnelRuntime() + + fun start(context: Context, config: String) { + val intent = Intent(context, LdFdpiVpnService::class.java) + .setAction(ACTION_START) + .putExtra(EXTRA_CONFIG, config) + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { + context.startForegroundService(intent) + } else { + context.startService(intent) + } + } + + fun stop(context: Context) { + context.startService( + Intent(context, LdFdpiVpnService::class.java).setAction(ACTION_STOP) + ) + } + + fun snapshot(): Map = state.snapshot() + } + + override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int { + when (intent?.action) { + ACTION_START -> { + val config = intent.getStringExtra(EXTRA_CONFIG) + if (config.isNullOrBlank()) { + state.setError("Tünel yapılandırması boş.") + } else { + startTunnel(config) + } + } + ACTION_STOP -> stopTunnel() + else -> { + if (!running) stopSelf() + } + } + return START_STICKY + } + + private fun startTunnel(configJson: String) { + if (running) return + state.connecting() + createNotificationChannel() + startForeground(NOTIFICATION_ID, buildNotification("LD FDPI bağlanıyor", "Tünel hazırlanıyor")) + + try { + val config = JSONObject(configJson) + val address = config.optString("address", "10.8.1.2/32").substringBefore('/') + val dns = config.optJSONArray("dns") + val builder = Builder() + .setSession("LD FDPI") + .setMtu(1420) + .addAddress(address, 32) + .addRoute("0.0.0.0", 0) + .addRoute("::", 0) + + if (dns != null && dns.length() > 0) { + for (i in 0 until dns.length()) { + val server = dns.optString(i, "") + if (server.isNotBlank()) builder.addDnsServer(server) + } + } else { + builder.addDnsServer("1.1.1.1") + builder.addDnsServer("1.0.0.1") + } + + if (!NativeTunnel.available()) { + state.setError("AmneziaWG çekirdeği (libawg.so) APK içinde yok.") + stopForeground(STOP_FOREGROUND_REMOVE) + stopSelf() + return + } + + val descriptor = builder.establish() + if (descriptor == null) { + state.setError("Android VpnService TUN arayüzü açılamadı.") + stopSelf() + return + } + tun = descriptor + val nativeStarted = try { + NativeTunnel.start(descriptor.fd, configJson) + } catch (_: Throwable) { + false + } + if (!nativeStarted) { + descriptor.close() + tun = null + state.setError("AmneziaWG tüneli başlatılamadı.") + stopForeground(STOP_FOREGROUND_REMOVE) + stopSelf() + return + } + + running = true + state.connected(address, config.optString("endpoint", "—")) + updateNotification("LD FDPI bağlı", "Trafik tünelden geçiyor") + } catch (e: Throwable) { + closeTunnel() + state.setError(e.message ?: "Tünel başlatma hatası.") + stopForeground(STOP_FOREGROUND_REMOVE) + stopSelf() + } + } + + private fun stopTunnel() { + closeTunnel() + state.disconnected() + stopForeground(STOP_FOREGROUND_REMOVE) + stopSelf() + } + + private fun closeTunnel() { + running = false + try { + NativeTunnel.stop() + } catch (_: Throwable) { + } + try { + tun?.close() + } catch (_: Throwable) { + } + tun = null + } + + override fun onRevoke() { + closeTunnel() + state.disconnected() + stopForeground(STOP_FOREGROUND_REMOVE) + stopSelf() + super.onRevoke() + } + + override fun onDestroy() { + closeTunnel() + super.onDestroy() + } + + private fun createNotificationChannel() { + if (Build.VERSION.SDK_INT < Build.VERSION_CODES.O) return + val manager = getSystemService(NotificationManager::class.java) + val channel = NotificationChannel( + CHANNEL_ID, + "LD FDPI tüneli", + NotificationManager.IMPORTANCE_LOW + ).apply { description = "VPN tüneli durumu" } + manager.createNotificationChannel(channel) + } + + private fun buildNotification(title: String, text: String): Notification { + val open = PendingIntent.getActivity( + this, + 0, + Intent(this, MainActivity::class.java), + PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE + ) + return NotificationCompat.Builder(this, CHANNEL_ID) + .setSmallIcon(android.R.drawable.ic_lock_lock) + .setContentTitle(title) + .setContentText(text) + .setContentIntent(open) + .setOngoing(true) + .setPriority(NotificationCompat.PRIORITY_LOW) + .build() + } + + private fun updateNotification(title: String, text: String) { + val manager = getSystemService(NotificationManager::class.java) + manager.notify(NOTIFICATION_ID, buildNotification(title, text)) + } +} + +class TunnelRuntime { + @Volatile private var state = "disconnected" + @Volatile private var address: String? = null + @Volatile private var endpoint: String? = null + @Volatile private var error: String? = null + + fun connecting() { + state = "connecting" + error = null + } + + fun connected(address: String, endpoint: String) { + state = "connected" + this.address = address + this.endpoint = endpoint + error = null + } + + fun disconnected() { + state = "disconnected" + address = null + endpoint = null + error = null + } + + fun setError(message: String) { + state = "error" + error = message + } + + fun snapshot(): Map = mapOf( + "state" to state, + "address" to address, + "endpoint" to endpoint, + "error" to error + ) +} diff --git a/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/MainActivity.kt b/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/MainActivity.kt new file mode 100644 index 0000000..395424f --- /dev/null +++ b/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/MainActivity.kt @@ -0,0 +1,84 @@ +package com.ldfdpi.mobile + +import android.content.Intent +import android.net.VpnService +import android.os.Bundle +import io.flutter.embedding.android.FlutterActivity +import io.flutter.embedding.engine.FlutterEngine +import io.flutter.plugin.common.MethodChannel +import java.net.InetSocketAddress +import java.net.Socket + +class MainActivity : FlutterActivity() { + private val channelName = "ld_fdpi/native" + + override fun configureFlutterEngine(flutterEngine: FlutterEngine) { + super.configureFlutterEngine(flutterEngine) + MethodChannel(flutterEngine.dartExecutor.binaryMessenger, channelName) + .setMethodCallHandler { call, result -> + when (call.method) { + "startTunnel" -> { + val config = call.argument("config") + if (config.isNullOrBlank()) { + result.error("config", "Tunnel config is empty", null) + } else { + try { + LdFdpiVpnService.start(applicationContext, config) + result.success(null) + } catch (e: Exception) { + result.error("start", e.message, null) + } + } + } + "stopTunnel" -> { + try { + LdFdpiVpnService.stop(applicationContext) + result.success(null) + } catch (e: Exception) { + result.error("stop", e.message, null) + } + } + "status" -> result.success(LdFdpiVpnService.snapshot()) + "openVpnSettings" -> { + try { + val intent = Intent(android.provider.Settings.ACTION_VPN_SETTINGS) + intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + startActivity(intent) + result.success(null) + } catch (e: Exception) { + result.error("settings", e.message, null) + } + } + "ping" -> { + Thread { + val started = System.nanoTime() + var ms: Int? = null + try { + Socket().use { socket -> + socket.connect(InetSocketAddress("1.1.1.1", 443), 1500) + ms = ((System.nanoTime() - started) / 1_000_000).toInt() + } + } catch (_: Exception) { + ms = null + } + runOnUiThread { result.success(ms) } + }.start() + } + "prepare" -> { + val intent = VpnService.prepare(applicationContext) + result.success(intent == null) + } + "requestVpnPermission" -> { + val intent = VpnService.prepare(applicationContext) + if (intent == null) { + result.success(true) + } else { + startActivityForResult(intent, 1001) + result.success(false) + } + } + else -> result.notImplemented() + } + } + } +} diff --git a/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/NativeTunnel.kt b/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/NativeTunnel.kt new file mode 100644 index 0000000..1a11293 --- /dev/null +++ b/mobile-app/android/app/src/main/kotlin/com/ldfdpi/mobile/NativeTunnel.kt @@ -0,0 +1,28 @@ +package com.ldfdpi.mobile + +/** + * JNI contract for the AmneziaWG userspace tunnel. + * + * Implementations must: + * - accept a connected VpnService TUN fd, + * - apply Jc/Jmin/Jmax/S1-S4/H1-H4/HeaderProtectionKey parameters, + * - pump packets until nativeStop() is called, + * - never log private keys or preshared keys. + * + * The stock WireGuard Android backend does not understand AWG obfuscation, so + * libawg.so must be built from amneziawg-go with gomobile/NDK and placed under + * android/app/src/main/jniLibs//. + */ +object NativeTunnel { + private val loaded: Boolean = try { + System.loadLibrary("awg") + true + } catch (_: UnsatisfiedLinkError) { + false + } + + fun available(): Boolean = loaded + + external fun start(tunFd: Int, configJson: String): Boolean + external fun stop() +} diff --git a/mobile-app/android/app/src/main/res/drawable/ic_launcher.xml b/mobile-app/android/app/src/main/res/drawable/ic_launcher.xml new file mode 100644 index 0000000..6b62f69 --- /dev/null +++ b/mobile-app/android/app/src/main/res/drawable/ic_launcher.xml @@ -0,0 +1,15 @@ + + + + + diff --git a/mobile-app/android/app/src/main/res/drawable/launch_background.xml b/mobile-app/android/app/src/main/res/drawable/launch_background.xml new file mode 100644 index 0000000..419f620 --- /dev/null +++ b/mobile-app/android/app/src/main/res/drawable/launch_background.xml @@ -0,0 +1,4 @@ + + + + diff --git a/mobile-app/android/app/src/main/res/values-night/styles.xml b/mobile-app/android/app/src/main/res/values-night/styles.xml new file mode 100644 index 0000000..6d157c1 --- /dev/null +++ b/mobile-app/android/app/src/main/res/values-night/styles.xml @@ -0,0 +1,14 @@ + + + + diff --git a/mobile-app/android/app/src/main/res/values/colors.xml b/mobile-app/android/app/src/main/res/values/colors.xml new file mode 100644 index 0000000..00a216f --- /dev/null +++ b/mobile-app/android/app/src/main/res/values/colors.xml @@ -0,0 +1,4 @@ + + + #05080B + diff --git a/mobile-app/android/app/src/main/res/values/styles.xml b/mobile-app/android/app/src/main/res/values/styles.xml new file mode 100644 index 0000000..6d157c1 --- /dev/null +++ b/mobile-app/android/app/src/main/res/values/styles.xml @@ -0,0 +1,14 @@ + + + + diff --git a/mobile-app/android/build.gradle b/mobile-app/android/build.gradle new file mode 100644 index 0000000..66dc9f5 --- /dev/null +++ b/mobile-app/android/build.gradle @@ -0,0 +1,20 @@ +allprojects { + repositories { + google() + mavenCentral() + } +} + +rootProject.buildDir = "../build" + +subprojects { + project.buildDir = "${rootProject.buildDir}/${project.name}" +} + +subprojects { + project.evaluationDependsOn(":app") +} + +tasks.register("clean", Delete) { + delete rootProject.buildDir +} diff --git a/mobile-app/android/gradle.properties b/mobile-app/android/gradle.properties new file mode 100644 index 0000000..9650bbc --- /dev/null +++ b/mobile-app/android/gradle.properties @@ -0,0 +1,4 @@ +org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8 +android.useAndroidX=true +android.enableJetifier=true +kotlin.code.style=official diff --git a/mobile-app/android/gradle/wrapper/gradle-wrapper.jar b/mobile-app/android/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000..a4b76b9 Binary files /dev/null and b/mobile-app/android/gradle/wrapper/gradle-wrapper.jar differ diff --git a/mobile-app/android/gradle/wrapper/gradle-wrapper.properties b/mobile-app/android/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 0000000..6b74f0f --- /dev/null +++ b/mobile-app/android/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip diff --git a/mobile-app/android/gradlew b/mobile-app/android/gradlew new file mode 100644 index 0000000..2e91e85 --- /dev/null +++ b/mobile-app/android/gradlew @@ -0,0 +1,9 @@ +#!/usr/bin/env sh +DIR=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) +CLASSPATH="$DIR/gradle/wrapper/gradle-wrapper.jar" +if [ -n "$JAVA_HOME" ]; then + JAVA_EXE="$JAVA_HOME/bin/java" +else + JAVA_EXE=java +fi +exec "$JAVA_EXE" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" diff --git a/mobile-app/android/settings.gradle b/mobile-app/android/settings.gradle new file mode 100644 index 0000000..8cbd262 --- /dev/null +++ b/mobile-app/android/settings.gradle @@ -0,0 +1,25 @@ +pluginManagement { + def flutterSdkPath = { + def properties = new Properties() + file("local.properties").withInputStream { properties.load(it) } + def flutterSdkPath = properties.getProperty("flutter.sdk") + assert flutterSdkPath != null, "flutter.sdk not set in local.properties" + return flutterSdkPath + }() + + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle") + + repositories { + google() + mavenCentral() + gradlePluginPortal() + } +} + +plugins { + id "dev.flutter.flutter-plugin-loader" version "1.0.0" + id "com.android.application" version "8.7.0" apply false + id "org.jetbrains.kotlin.android" version "2.1.0" apply false +} + +include ":app" diff --git a/mobile-app/docs/TUNNEL_BACKEND.md b/mobile-app/docs/TUNNEL_BACKEND.md new file mode 100644 index 0000000..65a639d --- /dev/null +++ b/mobile-app/docs/TUNNEL_BACKEND.md @@ -0,0 +1,109 @@ +# AmneziaWG native backend + +The app deliberately does **not** fake a VPN. `LdFdpiVpnService` only calls +`Builder.establish()` when the native core is present. Without the core the UI +stays usable but Connect is rejected with: + +> AmneziaWG çekirdeği (libawg.so) APK içinde yok. + +## Why not the stock WireGuard Android library? + +`com.wireguard.android:tunnel` implements WireGuard but has no notion of +AmneziaWG's `Jc/Jmin/Jmax/S1-S4/H1-H4/HeaderProtectionKey` fields. A standard +WireGuard handshake will not be accepted by the AWG server. Shipping it and +pretending it works would create a silent leak/blackhole. + +## JNI contract + +Kotlin (`NativeTunnel.kt`): + +```kotlin +external fun start(tunFd: Int, configJson: String): Boolean +external fun stop() +``` + +C/C++/Go exports: + +```c +JNIEXPORT jboolean JNICALL +Java_com_ldfdpi_mobile_NativeTunnel_start(JNIEnv *env, jobject thiz, + jint tun_fd, jstring config_json); + +JNIEXPORT void JNICALL +Java_com_ldfdpi_mobile_NativeTunnel_stop(JNIEnv *env, jobject thiz); +``` + +`configJson` has: + +```json +{ + "address": "10.8.1.20/32", + "dns": ["1.1.1.1", "1.0.0.1"], + "endpoint": "116.202.14.171:42771", + "server_public_key": "...", + "preshared_key": "...", + "allowed_ips": ["0.0.0.0/0", "::/0"], + "private_key": "...", + "awg": { + "jc": 5, "jmin": 10, "jmax": 50, + "s1": 12, "s2": 12, "s3": 12, "s4": 12, + "h1": 1, "h2": 2, "h3": 3, "h4": 4, + "header_protection_key": "...", + "rekey_after_time": "100-120", + "rekey_timeout": "3-7", + "reject_after_time": "150-180", + "keepalive_timeout": "5-15" + } +} +``` + +The native side must: + +1. Take ownership of the TUN fd (do not close it twice). +2. Apply AWG obfuscation parameters before the first handshake. +3. Pump packets until `stop()`. +4. Never log `private_key` or `preshared_key`. +5. Return `false` on bad config/handshake failure so Kotlin closes the TUN and + reports an error. + +## Building `libawg.so` from amneziawg-go + +High-level, on Linux/WSL with Go + Android NDK: + +```bash +git clone https://github.com/amnezia-vpn/amneziawg-go +cd amneziawg-go +# Add a small JNI export file that: +# - parses configJson +# - creates awg device with TUN fd +# - applies Jc/Jmin/Jmax/S1-S4/H1-H4/HeaderProtectionKey +# - runs device.Wait() +GOOS=android GOARCH=arm64 CGO_ENABLED=1 \ +CC=$ANDROID_NDK/toolchains/llvm/prebuilt/linux-x86_64/bin/aarch64-linux-android26-clang \ +go build -buildmode=c-shared -o libawg.so ./jni +``` + +Place per ABI: + +```text +android/app/src/main/jniLibs/arm64-v8a/libawg.so +android/app/src/main/jniLibs/x86_64/libawg.so # emulator +``` + +Then rebuild: + +```bash +flutter build apk --release +``` + +## Kill-switch reality on Android + +Android does not allow an app to silently enable **Always-on VPN** or +**Block connections without VPN**. Those are user-controlled system settings. +The app deep-links to `Settings.ACTION_VPN_SETTINGS`; the UI explains that both +must be enabled manually for a true fail-closed behavior. + +`VpnService` itself captures all IPv4/IPv6 traffic while active and uses the +tunnel DNS; that prevents normal DNS leaks. If the native core dies, the TUN +remains and traffic is blackholed until Android tears the service down or the +user disconnects. This is intentionally fail-closed, not a silent fallback. diff --git a/mobile-app/lib/main.dart b/mobile-app/lib/main.dart new file mode 100644 index 0000000..3a0f689 --- /dev/null +++ b/mobile-app/lib/main.dart @@ -0,0 +1,688 @@ +import 'package:flutter/material.dart'; + +import 'src/app_state.dart'; +import 'src/models.dart'; + +const _bg = Color(0xFF05080B); +const _panel = Color(0xFF0C151D); +const _line = Color(0xFF1E303A); +const _cyan = Color(0xFF8FE3F5); +const _green = Color(0xFF8DFFAD); +const _muted = Color(0xFF91AAB7); +const _red = Color(0xFFFF8F9F); + +void main() async { + WidgetsFlutterBinding.ensureInitialized(); + final state = AppState(); + await state.initialize(); + runApp(LdFdpiApp(state: state)); +} + +class LdFdpiApp extends StatelessWidget { + final AppState state; + const LdFdpiApp({super.key, required this.state}); + + @override + Widget build(BuildContext context) { + final scheme = ColorScheme.fromSeed( + seedColor: _cyan, + brightness: Brightness.dark, + ).copyWith( + surface: _panel, + primary: _cyan, + secondary: _green, + error: _red, + ); + return MaterialApp( + title: 'LD FDPI', + debugShowCheckedModeBanner: false, + theme: ThemeData( + useMaterial3: true, + brightness: Brightness.dark, + colorScheme: scheme, + scaffoldBackgroundColor: _bg, + fontFamily: 'sans-serif', + textTheme: const TextTheme( + headlineLarge: TextStyle(fontWeight: FontWeight.w900, letterSpacing: -1.4), + headlineMedium: TextStyle(fontWeight: FontWeight.w800, letterSpacing: -0.8), + titleMedium: TextStyle(fontWeight: FontWeight.w700), + bodyMedium: TextStyle(color: _muted, height: 1.45), + bodySmall: TextStyle(color: _muted, height: 1.4), + ), + ), + home: HomeScreen(state: state), + ); + } +} + +class HomeScreen extends StatelessWidget { + final AppState state; + const HomeScreen({super.key, required this.state}); + + @override + Widget build(BuildContext context) { + return Scaffold( + body: Stack( + children: [ + const _Aurora(), + SafeArea( + child: ListenableBuilder( + listenable: state, + builder: (context, _) { + return ListView( + padding: const EdgeInsets.fromLTRB(20, 18, 20, 28), + children: [ + _Header(onSettings: () => _openSettings(context)), + const SizedBox(height: 28), + _StatusOrb(state: state), + const SizedBox(height: 18), + Center(child: _statusLabel(state)), + const SizedBox(height: 6), + Center( + child: Text( + state.connecting + ? 'El sıkışma bekleniyor...' + : state.connected + ? 'Trafik tünelden geçiyor' + : 'Bağlanmaya hazır', + style: const TextStyle(color: _muted, fontSize: 12), + ), + ), + const SizedBox(height: 24), + _ConnectButton(state: state), + if (state.error != null) ...[ + const SizedBox(height: 12), + _ErrorBox(message: state.error!), + ], + const SizedBox(height: 22), + _InfoGrid(state: state), + const SizedBox(height: 12), + _ActivationCard(state: state), + const SizedBox(height: 12), + _SecurityCard(state: state), + const SizedBox(height: 12), + _Footer(), + ], + ); + }, + ), + ), + ], + ), + ); + } + + void _openSettings(BuildContext context) { + Navigator.of(context).push( + MaterialPageRoute(builder: (_) => SettingsScreen(state: state)), + ); + } +} + +class _Header extends StatelessWidget { + final VoidCallback onSettings; + const _Header({required this.onSettings}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Container( + width: 38, + height: 38, + decoration: BoxDecoration( + borderRadius: BorderRadius.circular(11), + border: Border.all(color: _cyan.withOpacity(0.35)), + color: _cyan.withOpacity(0.08), + ), + child: const Icon(Icons.shield_outlined, color: _cyan, size: 21), + ), + const SizedBox(width: 11), + const Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text('LD FDPI', style: TextStyle(fontWeight: FontWeight.w900, fontSize: 16, letterSpacing: -0.3)), + Text('MOBILE TUNNEL', style: TextStyle(color: _muted, fontSize: 9, letterSpacing: 2)), + ], + ), + ), + IconButton( + onPressed: onSettings, + icon: const Icon(Icons.tune_rounded, color: _muted), + tooltip: 'Ayarlar', + ), + ], + ); + } +} + +class _StatusOrb extends StatelessWidget { + final AppState state; + const _StatusOrb({required this.state}); + + @override + Widget build(BuildContext context) { + final connected = state.connected; + final busy = state.connecting; + final color = connected ? _green : busy ? const Color(0xFFFFD27A) : _cyan; + return Center( + child: AnimatedContainer( + duration: const Duration(milliseconds: 450), + curve: Curves.easeOutCubic, + width: 196, + height: 196, + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: RadialGradient( + colors: [ + color.withOpacity(0.18), + color.withOpacity(0.04), + Colors.transparent, + ], + stops: const [0.0, 0.55, 1.0], + ), + border: Border.all(color: color.withOpacity(0.35), width: 1), + boxShadow: [ + BoxShadow(color: color.withOpacity(0.14), blurRadius: 50, spreadRadius: 8), + ], + ), + child: Center( + child: AnimatedContainer( + duration: const Duration(milliseconds: 350), + width: 116, + height: 116, + decoration: BoxDecoration( + shape: BoxShape.circle, + color: _panel.withOpacity(0.9), + border: Border.all(color: color.withOpacity(0.45)), + ), + child: busy + ? Padding( + padding: const EdgeInsets.all(40), + child: CircularProgressIndicator(strokeWidth: 2, color: color), + ) + : Icon( + connected ? Icons.shield_rounded : Icons.shield_outlined, + color: color, + size: 46, + ), + ), + ), + ), + ); + } +} + +Widget _statusLabel(AppState state) { + final text = state.connected + ? 'BAĞLI' + : state.connecting + ? 'BAĞLANIYOR' + : state.status.state == TunnelState.error + ? 'HATA' + : 'BAĞLI DEĞİL'; + final color = state.connected ? _green : state.connecting ? const Color(0xFFFFD27A) : _muted; + return Text( + text, + style: TextStyle(color: color, fontSize: 11, fontWeight: FontWeight.w800, letterSpacing: 3), + ); +} + +class _ConnectButton extends StatelessWidget { + final AppState state; + const _ConnectButton({required this.state}); + + @override + Widget build(BuildContext context) { + final disabled = state.busy; + if (state.connected) { + return SizedBox( + height: 54, + child: FilledButton.icon( + onPressed: disabled ? null : state.disconnect, + style: FilledButton.styleFrom( + backgroundColor: _panel, + foregroundColor: _red, + side: BorderSide(color: _red.withOpacity(0.35)), + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), + ), + icon: const Icon(Icons.power_settings_new_rounded), + label: const Text('BAĞLANTIYI KES', style: TextStyle(fontWeight: FontWeight.w800, letterSpacing: 0.6)), + ), + ); + } + return SizedBox( + height: 54, + child: FilledButton.icon( + onPressed: disabled ? null : state.connect, + style: FilledButton.styleFrom( + backgroundColor: _cyan, + foregroundColor: _bg, + shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(15)), + ), + icon: const Icon(Icons.bolt_rounded), + label: const Text('BAĞLAN', style: TextStyle(fontWeight: FontWeight.w900, letterSpacing: 0.8)), + ), + ); + } +} + +class _InfoGrid extends StatelessWidget { + final AppState state; + const _InfoGrid({required this.state}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Expanded(child: _InfoTile(label: 'ATANAN IP', value: state.address, icon: Icons.lan_outlined)), + const SizedBox(width: 10), + Expanded(child: _InfoTile(label: 'ÇIKIŞ', value: state.endpoint, icon: Icons.public_rounded)), + ], + ); + } +} + +class _InfoTile extends StatelessWidget { + final String label; + final String value; + final IconData icon; + const _InfoTile({required this.label, required this.value, required this.icon}); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(14), + decoration: BoxDecoration( + color: _panel, + borderRadius: BorderRadius.circular(14), + border: Border.all(color: _line), + ), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Row( + children: [ + Icon(icon, size: 13, color: _cyan), + const SizedBox(width: 6), + Text(label, style: const TextStyle(color: _muted, fontSize: 8, letterSpacing: 1.3)), + ], + ), + const SizedBox(height: 8), + Text( + value, + maxLines: 1, + overflow: TextOverflow.ellipsis, + style: const TextStyle(fontFamily: 'monospace', fontSize: 11, fontWeight: FontWeight.w700), + ), + ], + ), + ); + } +} + +class _ActivationCard extends StatelessWidget { + final AppState state; + const _ActivationCard({required this.state}); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: _panel, + borderRadius: BorderRadius.circular(16), + border: Border.all(color: _line), + ), + child: Row( + children: [ + const Icon(Icons.key_rounded, color: _cyan, size: 20), + const SizedBox(width: 12), + Expanded( + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(state.hasConfig ? 'Cihaz kayıtlı' : 'Etkinleştirme gerekli', + style: const TextStyle(fontWeight: FontWeight.w800, fontSize: 12)), + const SizedBox(height: 3), + Text( + state.hasConfig + ? 'Kimlik bu cihazda şifreli saklanıyor.' + : 'Tek kullanımlık kodunu gir, tüneli aç.', + style: const TextStyle(color: _muted, fontSize: 10.5), + ), + ], + ), + ), + TextButton( + onPressed: () => _showEnrollment(context), + child: Text(state.hasConfig ? 'YENİLE' : 'KOD GİR', style: const TextStyle(fontSize: 10, fontWeight: FontWeight.w800)), + ), + ], + ), + ); + } + + void _showEnrollment(BuildContext context) { + showModalBottomSheet( + context: context, + isScrollControlled: true, + backgroundColor: _panel, + shape: const RoundedRectangleBorder(borderRadius: BorderRadius.vertical(top: Radius.circular(22))), + builder: (sheetContext) => Padding( + padding: EdgeInsets.only(bottom: MediaQuery.of(sheetContext).viewInsets.bottom), + child: _EnrollmentSheet(state: state), + ), + ); + } +} + +class _EnrollmentSheet extends StatefulWidget { + final AppState state; + const _EnrollmentSheet({required this.state}); + + @override + State<_EnrollmentSheet> createState() => _EnrollmentSheetState(); +} + +class _EnrollmentSheetState extends State<_EnrollmentSheet> { + final _controller = TextEditingController(); + + @override + void dispose() { + _controller.dispose(); + super.dispose(); + } + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.fromLTRB(20, 18, 20, 24), + child: Column( + mainAxisSize: MainAxisSize.min, + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + const Text('Etkinleştirme kodu', style: TextStyle(fontSize: 20, fontWeight: FontWeight.w900)), + const SizedBox(height: 6), + const Text('Kod tek kullanımlık ve bu cihaza bağlanır.', style: TextStyle(color: _muted, fontSize: 12)), + const SizedBox(height: 18), + TextField( + controller: _controller, + autofocus: true, + textCapitalization: TextCapitalization.characters, + style: const TextStyle(fontFamily: 'monospace', letterSpacing: 1), + decoration: InputDecoration( + hintText: 'LDFDPI-XXXX-XXXX-XXXX', + filled: true, + fillColor: _bg, + border: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: const BorderSide(color: _line)), + enabledBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: const BorderSide(color: _line)), + focusedBorder: OutlineInputBorder(borderRadius: BorderRadius.circular(12), borderSide: const BorderSide(color: _cyan)), + ), + onSubmitted: (_) => _submit(), + ), + if (widget.state.error != null) ...[ + const SizedBox(height: 10), + Text(widget.state.error!, style: const TextStyle(color: _red, fontSize: 11)), + ], + const SizedBox(height: 16), + SizedBox( + width: double.infinity, + height: 48, + child: ListenableBuilder( + listenable: widget.state, + builder: (context, _) { + return FilledButton( + onPressed: widget.state.busy ? null : _submit, + style: FilledButton.styleFrom(backgroundColor: _cyan, foregroundColor: _bg, shape: RoundedRectangleBorder(borderRadius: BorderRadius.circular(12))), + child: widget.state.busy + ? const SizedBox(width: 18, height: 18, child: CircularProgressIndicator(strokeWidth: 2, color: _bg)) + : const Text('KAYDI TAMAMLA', style: TextStyle(fontWeight: FontWeight.w900, letterSpacing: 0.6)), + ); + }, + ), + ), + ], + ), + ); + } + + Future _submit() async { + await widget.state.enroll(_controller.text); + if (widget.state.hasConfig && mounted) Navigator.of(context).pop(); + } +} + +class _SecurityCard extends StatelessWidget { + final AppState state; + const _SecurityCard({required this.state}); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration( + color: _panel, + borderRadius: BorderRadius.circular(16), + border: Border.all(color: _line), + ), + child: Column( + children: [ + _SecurityRow(icon: Icons.dns_outlined, label: 'DNS', value: state.config?.dns.join(', ') ?? '1.1.1.1'), + const SizedBox(height: 10), + _SecurityRow(icon: Icons.speed_rounded, label: 'GECİKME', value: state.pingMs == null ? '—' : '${state.pingMs} ms'), + const SizedBox(height: 10), + _SecurityRow(icon: Icons.block_rounded, label: 'SIZINTI', value: state.connected ? 'KORUMALI' : 'PASİF'), + ], + ), + ); + } +} + +class _SecurityRow extends StatelessWidget { + final IconData icon; + final String label; + final String value; + const _SecurityRow({required this.icon, required this.label, required this.value}); + + @override + Widget build(BuildContext context) { + return Row( + children: [ + Icon(icon, size: 15, color: _cyan), + const SizedBox(width: 9), + Text(label, style: const TextStyle(color: _muted, fontSize: 9, letterSpacing: 1.1)), + const Spacer(), + Flexible( + child: Text( + value, + textAlign: TextAlign.right, + overflow: TextOverflow.ellipsis, + style: const TextStyle(fontFamily: 'monospace', fontSize: 10.5, color: Color(0xFFD8ECF2)), + ), + ), + ], + ); + } +} + +class _ErrorBox extends StatelessWidget { + final String message; + const _ErrorBox({required this.message}); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(12), + decoration: BoxDecoration( + color: _red.withOpacity(0.07), + border: Border.all(color: _red.withOpacity(0.3)), + borderRadius: BorderRadius.circular(11), + ), + child: Text(message, style: const TextStyle(color: _red, fontSize: 11)), + ); + } +} + +class _Footer extends StatelessWidget { + @override + Widget build(BuildContext context) { + return const Padding( + padding: EdgeInsets.only(top: 8), + child: Text( + 'LD FDPI v0.1.0 · Android VpnService · AES-GCM secure storage', + textAlign: TextAlign.center, + style: TextStyle(color: Color(0xFF536B77), fontSize: 9), + ), + ); + } +} + +class _Aurora extends StatelessWidget { + const _Aurora(); + + @override + Widget build(BuildContext context) { + return IgnorePointer( + child: Stack( + children: [ + Positioned( + top: -180, + right: -120, + child: Container( + width: 420, + height: 420, + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: RadialGradient(colors: [_cyan.withOpacity(0.13), Colors.transparent]), + ), + ), + ), + Positioned( + bottom: -220, + left: -160, + child: Container( + width: 460, + height: 460, + decoration: BoxDecoration( + shape: BoxShape.circle, + gradient: RadialGradient(colors: [_green.withOpacity(0.06), Colors.transparent]), + ), + ), + ), + ], + ), + ); + } +} + +class SettingsScreen extends StatelessWidget { + final AppState state; + const SettingsScreen({super.key, required this.state}); + + @override + Widget build(BuildContext context) { + return Scaffold( + appBar: AppBar( + backgroundColor: _bg, + title: const Text('Ayarlar', style: TextStyle(fontWeight: FontWeight.w800)), + leading: IconButton(onPressed: () => Navigator.pop(context), icon: const Icon(Icons.arrow_back_rounded)), + ), + body: ListenableBuilder( + listenable: state, + builder: (context, _) => ListView( + padding: const EdgeInsets.all(20), + children: [ + _SettingsCard( + title: 'Tünel', + rows: [ + _SettingsRow('Sunucu', state.config?.endpoint ?? '—'), + _SettingsRow('Adres', state.config?.address ?? '—'), + _SettingsRow('DNS', state.config?.dns.join(', ') ?? '1.1.1.1'), + _SettingsRow('AmneziaWG', state.config == null ? '—' : 'Jc ${state.config!.awg.jc} · S1 ${state.config!.awg.s1}'), + ], + ), + const SizedBox(height: 12), + _SettingsCard( + title: 'Sızıntı koruması', + rows: const [ + _SettingsRow('VPN', 'Android VpnService'), + _SettingsRow('DNS', 'Tünel içi 1.1.1.1 / 1.0.0.1'), + _SettingsRow('Kill-switch', 'Always-on VPN + Block without VPN'), + ], + ), + const SizedBox(height: 10), + FilledButton.tonalIcon( + onPressed: state.openVpnSettings, + icon: const Icon(Icons.open_in_new_rounded, size: 17), + label: const Text('Android VPN ayarlarını aç'), + ), + const SizedBox(height: 8), + const Text( + 'Android, “Always-on VPN” ve “Block connections without VPN” ayarlarını uygulama adına açmaya izin vermez. Ayarlar ekranından kullanıcı tarafından açılmalıdır.', + style: TextStyle(color: _muted, fontSize: 10.5, height: 1.45), + ), + const SizedBox(height: 22), + const _SettingsCard( + title: 'Uygulama', + rows: [ + _SettingsRow('Sürüm', '0.1.0'), + _SettingsRow('Depolama', 'EncryptedSharedPreferences'), + _SettingsRow('Kimlik', 'X25519 · cihaz başına'), + ], + ), + ], + ), + ), + ); + } +} + +class _SettingsCard extends StatelessWidget { + final String title; + final List rows; + const _SettingsCard({required this.title, required this.rows}); + + @override + Widget build(BuildContext context) { + return Container( + padding: const EdgeInsets.all(16), + decoration: BoxDecoration(color: _panel, borderRadius: BorderRadius.circular(16), border: Border.all(color: _line)), + child: Column( + crossAxisAlignment: CrossAxisAlignment.start, + children: [ + Text(title.toUpperCase(), style: const TextStyle(color: _muted, fontSize: 9, letterSpacing: 1.4, fontWeight: FontWeight.w700)), + const SizedBox(height: 10), + ...rows, + ], + ), + ); + } +} + +class _SettingsRow extends StatelessWidget { + final String label; + final String value; + const _SettingsRow(this.label, this.value); + + @override + Widget build(BuildContext context) { + return Padding( + padding: const EdgeInsets.symmetric(vertical: 5), + child: Row( + children: [ + Expanded(child: Text(label, style: const TextStyle(fontSize: 11.5, color: _muted))), + Flexible( + child: Text( + value, + textAlign: TextAlign.right, + overflow: TextOverflow.ellipsis, + style: const TextStyle(fontFamily: 'monospace', fontSize: 10.5, color: Color(0xFFD8ECF2)), + ), + ), + ], + ), + ); + } +} diff --git a/mobile-app/lib/src/api.dart b/mobile-app/lib/src/api.dart new file mode 100644 index 0000000..d4cf79e --- /dev/null +++ b/mobile-app/lib/src/api.dart @@ -0,0 +1,94 @@ +import 'dart:convert'; +import 'dart:io'; + +import 'package:http/http.dart' as http; + +import 'models.dart'; + +class EnrollmentException implements Exception { + final String message; + const EnrollmentException(this.message); + + @override + String toString() => message; +} + +class EnrollmentApi { + static const endpoint = 'https://ttmadethat.shop/api/v1/enroll'; + final http.Client _client; + + EnrollmentApi([http.Client? client]) : _client = client ?? http.Client(); + + Future enroll({ + required String token, + required String publicKey, + required String deviceId, + required String privateKey, + }) async { + late final http.Response response; + try { + response = await _client + .post( + Uri.parse(endpoint), + headers: { + 'Authorization': 'Bearer $token', + 'Content-Type': 'application/json', + 'Accept': 'application/json', + }, + body: jsonEncode({ + 'public_key': publicKey, + 'device_id': deviceId, + 'client_version': 'android-0.1.0', + }), + ) + .timeout(const Duration(seconds: 20)); + } on SocketException { + throw const EnrollmentException('Sunucuya ulaşılamadı. İnterneti kontrol et.'); + } on HttpException { + throw const EnrollmentException('Sunucu bağlantısı kesildi.'); + } catch (_) { + throw const EnrollmentException('Enrollment zaman aşımına uğradı.'); + } + + if (response.statusCode == 409) { + throw const EnrollmentException('Bu kod başka bir cihazda kullanılmış.'); + } + if (response.statusCode == 401) { + throw const EnrollmentException('Etkinleştirme kodu geçersiz.'); + } + if (response.statusCode == 429) { + throw const EnrollmentException('Çok fazla deneme. Bir dakika sonra tekrar dene.'); + } + if (response.statusCode != 200) { + throw EnrollmentException('Enrollment başarısız (HTTP ${response.statusCode}).'); + } + + final Object? decoded; + try { + decoded = jsonDecode(response.body); + } catch (_) { + throw const EnrollmentException('Sunucu geçersiz yanıt döndürdü.'); + } + if (decoded is! Map) { + throw const EnrollmentException('Sunucu geçersiz yanıt döndürdü.'); + } + if ((decoded['server_public_key'] ?? '').toString().isEmpty) { + throw const EnrollmentException('Sunucu public key döndürmedi.'); + } + return VpnConfig.fromEnrollment(decoded, privateKey: privateKey, deviceId: deviceId); + } + + Future ping() async { + final watch = Stopwatch()..start(); + try { + final socket = await Socket.connect('1.1.1.1', 443, timeout: const Duration(milliseconds: 1500)); + socket.destroy(); + watch.stop(); + return watch.elapsedMilliseconds; + } catch (_) { + return null; + } + } + + void close() => _client.close(); +} diff --git a/mobile-app/lib/src/app_state.dart b/mobile-app/lib/src/app_state.dart new file mode 100644 index 0000000..83dd4f8 --- /dev/null +++ b/mobile-app/lib/src/app_state.dart @@ -0,0 +1,181 @@ +import 'dart:async'; +import 'dart:convert'; + +import 'package:cryptography/cryptography.dart'; +import 'package:flutter/foundation.dart'; + +import 'api.dart'; +import 'models.dart'; +import 'secure_store.dart'; +import 'tunnel.dart'; + +class AppState extends ChangeNotifier { + final SecureStore _store = SecureStore(); + final EnrollmentApi _api = EnrollmentApi(); + final TunnelPlatform _tunnel = TunnelPlatform(); + + VpnConfig? config; + TunnelStatus status = TunnelStatus.disconnected; + bool initialized = false; + bool busy = false; + String? error; + String? publicKey; + int? pingMs; + Timer? _statusTimer; + + bool get hasConfig => config != null; + bool get connected => status.connected; + bool get connecting => status.busy || busy; + String get address => status.address ?? config?.address ?? '—'; + String get endpoint => status.endpoint ?? config?.endpoint ?? '—'; + + Future initialize() async { + try { + config = await _store.readConfig(); + publicKey = await _readPublicKey(); + if (config != null) { + status = await _tunnel.status(); + } + } catch (e) { + error = 'Yerel kimlik okunamadı: $e'; + } finally { + initialized = true; + notifyListeners(); + _startPolling(); + } + } + + Future _readPublicKey() async { + final raw = await _store.readPrivateKey(); + if (raw == null) return null; + try { + final algorithm = X25519(); + final keyPair = await algorithm.newKeyPairFromSeed(base64Decode(raw)); + final pub = await keyPair.extractPublicKey(); + return base64Encode(pub.bytes); + } catch (_) { + return null; + } + } + + Future enroll(String token) async { + final clean = token.trim(); + if (clean.isEmpty) { + error = 'Etkinleştirme kodu boş olamaz.'; + notifyListeners(); + return; + } + busy = true; + error = null; + notifyListeners(); + try { + var privateKey = await _store.readPrivateKey(); + if (privateKey == null) { + final algorithm = X25519(); + final keyPair = await algorithm.newKeyPair(); + final privateBytes = await keyPair.extractPrivateKeyBytes(); + privateKey = base64Encode(privateBytes); + await _store.writePrivateKey(privateKey); + } + final algorithm = X25519(); + final keyPair = await algorithm.newKeyPairFromSeed(base64Decode(privateKey)); + final public = await keyPair.extractPublicKey(); + publicKey = base64Encode(public.bytes); + final deviceId = await _store.deviceId(); + final enrolled = await _api.enroll( + token: clean, + publicKey: publicKey!, + deviceId: deviceId, + privateKey: privateKey, + ); + await _store.writeConfig(enrolled); + config = enrolled; + status = await _tunnel.status(); + await refreshPing(); + } on EnrollmentException catch (e) { + error = e.message; + } catch (e) { + error = 'Kayıt tamamlanamadı: $e'; + } finally { + busy = false; + notifyListeners(); + } + } + + Future connect() async { + final cfg = config; + if (cfg == null) { + error = 'Önce etkinleştirme kodunu gir.'; + notifyListeners(); + return; + } + busy = true; + error = null; + notifyListeners(); + try { + if (!await _tunnel.prepare()) { + error = 'Android VPN izni verilmedi. Tekrar dene ve sistem onayını kabul et.'; + return; + } + await _tunnel.start(cfg); + status = await _tunnel.status(); + await refreshPing(); + } catch (e) { + error = 'Tünel başlatılamadı: $e'; + status = TunnelStatus(state: TunnelState.error, error: error); + } finally { + busy = false; + notifyListeners(); + } + } + + Future disconnect() async { + busy = true; + error = null; + notifyListeners(); + try { + await _tunnel.stop(); + status = await _tunnel.status(); + } catch (e) { + error = 'Tünel kapatılamadı: $e'; + } finally { + busy = false; + notifyListeners(); + } + } + + Future refreshStatus() async { + try { + status = await _tunnel.status(); + notifyListeners(); + } catch (_) {} + } + + Future refreshPing() async { + pingMs = await _api.ping(); + notifyListeners(); + } + + Future openVpnSettings() => _tunnel.openVpnSettings(); + + void _startPolling() { + _statusTimer?.cancel(); + _statusTimer = Timer.periodic(const Duration(seconds: 2), (_) async { + if (!initialized) return; + try { + final next = await _tunnel.status(); + if (next.state != status.state || next.address != status.address) { + status = next; + notifyListeners(); + } + } catch (_) {} + }); + } + + @override + void dispose() { + _statusTimer?.cancel(); + _api.close(); + super.dispose(); + } +} diff --git a/mobile-app/lib/src/models.dart b/mobile-app/lib/src/models.dart new file mode 100644 index 0000000..fab8646 --- /dev/null +++ b/mobile-app/lib/src/models.dart @@ -0,0 +1,204 @@ +import 'dart:convert'; + +class AwgParams { + final int jc; + final int jmin; + final int jmax; + final int s1; + final int s2; + final int s3; + final int s4; + final int h1; + final int h2; + final int h3; + final int h4; + final String headerProtectionKey; + final String rekeyAfter; + final String rekeyTimeout; + final String rejectAfter; + final String keepalive; + final bool randomTrailers; + final bool disableCookies; + + const AwgParams({ + this.jc = 5, + this.jmin = 10, + this.jmax = 50, + this.s1 = 12, + this.s2 = 12, + this.s3 = 12, + this.s4 = 12, + this.h1 = 1, + this.h2 = 2, + this.h3 = 3, + this.h4 = 4, + this.headerProtectionKey = '', + this.rekeyAfter = '100-120', + this.rekeyTimeout = '3-7', + this.rejectAfter = '150-180', + this.keepalive = '5-15', + this.randomTrailers = true, + this.disableCookies = true, + }); + + factory AwgParams.fromJson(Map? json) { + final j = json ?? const {}; + int readInt(String key, int fallback) { + final value = j[key]; + if (value is num) return value.toInt(); + if (value is String) return int.tryParse(value) ?? fallback; + return fallback; + } + + return AwgParams( + jc: readInt('jc', 5), + jmin: readInt('jmin', 10), + jmax: readInt('jmax', 50), + s1: readInt('s1', 12), + s2: readInt('s2', 12), + s3: readInt('s3', 12), + s4: readInt('s4', 12), + h1: readInt('h1', 1), + h2: readInt('h2', 2), + h3: readInt('h3', 3), + h4: readInt('h4', 4), + headerProtectionKey: (j['header_protection_key'] ?? j['headerProtectionKey'] ?? '').toString(), + rekeyAfter: (j['rekey_after_time'] ?? '100-120').toString(), + rekeyTimeout: (j['rekey_timeout'] ?? '3-7').toString(), + rejectAfter: (j['reject_after_time'] ?? '150-180').toString(), + keepalive: (j['keepalive_timeout'] ?? '5-15').toString(), + randomTrailers: j['random_trailers'] != false, + disableCookies: j['disable_cookies'] != false, + ); + } + + Map toJson() => { + 'jc': jc, + 'jmin': jmin, + 'jmax': jmax, + 's1': s1, + 's2': s2, + 's3': s3, + 's4': s4, + 'h1': h1, + 'h2': h2, + 'h3': h3, + 'h4': h4, + 'header_protection_key': headerProtectionKey, + 'rekey_after_time': rekeyAfter, + 'rekey_timeout': rekeyTimeout, + 'reject_after_time': rejectAfter, + 'keepalive_timeout': keepalive, + 'random_trailers': randomTrailers, + 'disable_cookies': disableCookies, + }; +} + +class VpnConfig { + final String address; + final List dns; + final String endpoint; + final String serverPublicKey; + final String presharedKey; + final List allowedIps; + final AwgParams awg; + final String privateKey; + final String deviceId; + + const VpnConfig({ + required this.address, + required this.dns, + required this.endpoint, + required this.serverPublicKey, + required this.presharedKey, + required this.allowedIps, + required this.awg, + required this.privateKey, + required this.deviceId, + }); + + factory VpnConfig.fromEnrollment( + Map json, { + required String privateKey, + required String deviceId, + }) { + final dns = (json['dns'] as List?)?.map((e) => e.toString()).toList() ?? ['1.1.1.1']; + final allowed = (json['allowed_ips'] as List?)?.map((e) => e.toString()).toList() ?? + ['0.0.0.0/0', '::/0']; + return VpnConfig( + address: (json['address'] ?? '10.8.1.2/32').toString(), + dns: dns.isEmpty ? ['1.1.1.1'] : dns, + endpoint: (json['endpoint'] ?? '116.202.14.171:42771').toString(), + serverPublicKey: (json['server_public_key'] ?? '').toString(), + presharedKey: (json['preshared_key'] ?? '').toString(), + allowedIps: allowed, + awg: AwgParams.fromJson(json['awg'] as Map?), + privateKey: privateKey, + deviceId: deviceId, + ); + } + + Map toJson() => { + 'address': address, + 'dns': dns, + 'endpoint': endpoint, + 'server_public_key': serverPublicKey, + 'preshared_key': presharedKey, + 'allowed_ips': allowedIps, + 'awg': awg.toJson(), + 'private_key': privateKey, + 'device_id': deviceId, + }; + + factory VpnConfig.fromJson(Map json) => VpnConfig( + address: json['address'].toString(), + dns: (json['dns'] as List).map((e) => e.toString()).toList(), + endpoint: json['endpoint'].toString(), + serverPublicKey: json['server_public_key'].toString(), + presharedKey: json['preshared_key'].toString(), + allowedIps: (json['allowed_ips'] as List).map((e) => e.toString()).toList(), + awg: AwgParams.fromJson(json['awg'] as Map?), + privateKey: json['private_key'].toString(), + deviceId: json['device_id'].toString(), + ); + + String toTunnelJson() => jsonEncode(toJson()); +} + +enum TunnelState { disconnected, connecting, connected, error } + +class TunnelStatus { + final TunnelState state; + final String? address; + final String? endpoint; + final String? error; + + const TunnelStatus({ + required this.state, + this.address, + this.endpoint, + this.error, + }); + + static const disconnected = TunnelStatus(state: TunnelState.disconnected); + + bool get connected => state == TunnelState.connected; + bool get busy => state == TunnelState.connecting; + + factory TunnelStatus.fromMap(Object? value) { + if (value is! Map) return disconnected; + final raw = (value['state'] ?? 'disconnected').toString(); + final state = switch (raw) { + 'connected' => TunnelState.connected, + 'connecting' => TunnelState.connecting, + 'error' => TunnelState.error, + _ => TunnelState.disconnected, + }; + return TunnelStatus( + state: state, + address: value['address']?.toString(), + endpoint: value['endpoint']?.toString(), + error: value['error']?.toString(), + ); + } +} diff --git a/mobile-app/lib/src/secure_store.dart b/mobile-app/lib/src/secure_store.dart new file mode 100644 index 0000000..3fa58e5 --- /dev/null +++ b/mobile-app/lib/src/secure_store.dart @@ -0,0 +1,57 @@ +import 'dart:convert'; +import 'dart:math'; + +import 'package:flutter_secure_storage/flutter_secure_storage.dart'; + +import 'models.dart'; + +/// Android implementation uses EncryptedSharedPreferences through +/// flutter_secure_storage (AES-256-GCM, Keystore-backed master key). +class SecureStore { + static const _configKey = 'ld_fdpi.config.v1'; + static const _privateKey = 'ld_fdpi.private_key.v1'; + static const _deviceIdKey = 'ld_fdpi.device_id.v1'; + + final FlutterSecureStorage _storage; + SecureStore([FlutterSecureStorage? storage]) + : _storage = storage ?? + const FlutterSecureStorage( + aOptions: AndroidOptions(encryptedSharedPreferences: true), + ); + + Future readPrivateKey() => _storage.read(key: _privateKey); + + Future writePrivateKey(String value) => _storage.write(key: _privateKey, value: value); + + Future readDeviceId() => _storage.read(key: _deviceIdKey); + + Future writeDeviceId(String value) => _storage.write(key: _deviceIdKey, value: value); + + Future readConfig() async { + final raw = await _storage.read(key: _configKey); + if (raw == null || raw.isEmpty) return null; + try { + final map = jsonDecode(raw) as Map; + return VpnConfig.fromJson(map); + } catch (_) { + await clearConfig(); + return null; + } + } + + Future writeConfig(VpnConfig config) => + _storage.write(key: _configKey, value: jsonEncode(config.toJson())); + + Future clearConfig() => _storage.delete(key: _configKey); + + Future deviceId() async { + final existing = await readDeviceId(); + if (existing != null && existing.length == 64) return existing; + final random = Random.secure(); + final id = List.generate(32, (_) => random.nextInt(256)) + .map((b) => b.toRadixString(16).padLeft(2, '0')) + .join(); + await writeDeviceId(id); + return id; + } +} diff --git a/mobile-app/lib/src/tunnel.dart b/mobile-app/lib/src/tunnel.dart new file mode 100644 index 0000000..e2102a4 --- /dev/null +++ b/mobile-app/lib/src/tunnel.dart @@ -0,0 +1,36 @@ +import 'package:flutter/services.dart'; + +import 'models.dart'; + +class TunnelPlatform { + static const _channel = MethodChannel('ld_fdpi/native'); + + Future prepare() async { + final value = await _channel.invokeMethod('requestVpnPermission'); + return value == true; + } + + Future start(VpnConfig config) async { + await _channel.invokeMethod('startTunnel', { + 'config': config.toTunnelJson(), + }); + } + + Future stop() async { + await _channel.invokeMethod('stopTunnel'); + } + + Future status() async { + final value = await _channel.invokeMethod('status'); + return TunnelStatus.fromMap(value); + } + + Future openVpnSettings() async { + await _channel.invokeMethod('openVpnSettings'); + } + + Future ping() async { + final value = await _channel.invokeMethod('ping'); + return value; + } +} diff --git a/mobile-app/pubspec.lock b/mobile-app/pubspec.lock new file mode 100644 index 0000000..5d5fdb7 --- /dev/null +++ b/mobile-app/pubspec.lock @@ -0,0 +1,410 @@ +# Generated by pub +# See https://dart.dev/tools/pub/glossary#lockfile +packages: + async: + dependency: transitive + description: + name: async + sha256: d2872f9c19731c2e5f10444b14686eb7cc85c76274bd6c16e1816bff9a3bab63 + url: "https://pub.dev" + source: hosted + version: "2.12.0" + boolean_selector: + dependency: transitive + description: + name: boolean_selector + sha256: "8aab1771e1243a5063b8b0ff68042d67334e3feab9e95b9490f9a6ebf73b42ea" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + characters: + dependency: transitive + description: + name: characters + sha256: f71061c654a3380576a52b451dd5532377954cf9dbd272a78fc8479606670803 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + clock: + dependency: transitive + description: + name: clock + sha256: fddb70d9b5277016c77a80201021d40a2247104d9f4aa7bab7157b7e3f05b84b + url: "https://pub.dev" + source: hosted + version: "1.1.2" + collection: + dependency: transitive + description: + name: collection + sha256: "2f5709ae4d3d59dd8f7cd309b4e023046b57d8a6c82130785d2b0e5868084e76" + url: "https://pub.dev" + source: hosted + version: "1.19.1" + crypto: + dependency: transitive + description: + name: crypto + sha256: e3626ae6270383c9e3a549f34c9e4cd26c09ae6a9adaab2bf4737a00340efdc4 + url: "https://pub.dev" + source: hosted + version: "3.0.8" + cryptography: + dependency: "direct main" + description: + name: cryptography + sha256: "3eda3029d34ec9095a27a198ac9785630fe525c0eb6a49f3d575272f8e792ef0" + url: "https://pub.dev" + source: hosted + version: "2.9.0" + cupertino_icons: + dependency: "direct main" + description: + name: cupertino_icons + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6 + url: "https://pub.dev" + source: hosted + version: "1.0.8" + fake_async: + dependency: transitive + description: + name: fake_async + sha256: "6a95e56b2449df2273fd8c45a662d6947ce1ebb7aafe80e550a3f68297f3cacc" + url: "https://pub.dev" + source: hosted + version: "1.3.2" + ffi: + dependency: transitive + description: + name: ffi + sha256: "6d7fd89431262d8f3125e81b50d3847a091d846eafcd4fdb88dd06f36d705a45" + url: "https://pub.dev" + source: hosted + version: "2.2.0" + flutter: + dependency: "direct main" + description: flutter + source: sdk + version: "0.0.0" + flutter_lints: + dependency: "direct dev" + description: + name: flutter_lints + sha256: "3f41d009ba7172d5ff9be5f6e6e6abb4300e263aab8866d2a0842ed2a70f8f0c" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + flutter_secure_storage: + dependency: "direct main" + description: + name: flutter_secure_storage + sha256: "9cad52d75ebc511adfae3d447d5d13da15a55a92c9410e50f67335b6d21d16ea" + url: "https://pub.dev" + source: hosted + version: "9.2.4" + flutter_secure_storage_linux: + dependency: transitive + description: + name: flutter_secure_storage_linux + sha256: be76c1d24a97d0b98f8b54bce6b481a380a6590df992d0098f868ad54dc8f688 + url: "https://pub.dev" + source: hosted + version: "1.2.3" + flutter_secure_storage_macos: + dependency: transitive + description: + name: flutter_secure_storage_macos + sha256: "6c0a2795a2d1de26ae202a0d78527d163f4acbb11cde4c75c670f3a0fc064247" + url: "https://pub.dev" + source: hosted + version: "3.1.3" + flutter_secure_storage_platform_interface: + dependency: transitive + description: + name: flutter_secure_storage_platform_interface + sha256: cf91ad32ce5adef6fba4d736a542baca9daf3beac4db2d04be350b87f69ac4a8 + url: "https://pub.dev" + source: hosted + version: "1.1.2" + flutter_secure_storage_web: + dependency: transitive + description: + name: flutter_secure_storage_web + sha256: f4ebff989b4f07b2656fb16b47852c0aab9fed9b4ec1c70103368337bc1886a9 + url: "https://pub.dev" + source: hosted + version: "1.2.1" + flutter_secure_storage_windows: + dependency: transitive + description: + name: flutter_secure_storage_windows + sha256: b20b07cb5ed4ed74fc567b78a72936203f587eba460af1df11281c9326cd3709 + url: "https://pub.dev" + source: hosted + version: "3.1.2" + flutter_test: + dependency: "direct dev" + description: flutter + source: sdk + version: "0.0.0" + flutter_web_plugins: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + http: + dependency: "direct main" + description: + name: http + sha256: "87721a4a50b19c7f1d49001e51409bddc46303966ce89a65af4f4e6004896412" + url: "https://pub.dev" + source: hosted + version: "1.6.0" + http_parser: + dependency: transitive + description: + name: http_parser + sha256: "178d74305e7866013777bab2c3d8726205dc5a4dd935297175b19a23a2e66571" + url: "https://pub.dev" + source: hosted + version: "4.1.2" + js: + dependency: transitive + description: + name: js + sha256: f2c445dce49627136094980615a031419f7f3eb393237e4ecd97ac15dea343f3 + url: "https://pub.dev" + source: hosted + version: "0.6.7" + leak_tracker: + dependency: transitive + description: + name: leak_tracker + sha256: c35baad643ba394b40aac41080300150a4f08fd0fd6a10378f8f7c6bc161acec + url: "https://pub.dev" + source: hosted + version: "10.0.8" + leak_tracker_flutter_testing: + dependency: transitive + description: + name: leak_tracker_flutter_testing + sha256: f8b613e7e6a13ec79cfdc0e97638fddb3ab848452eff057653abd3edba760573 + url: "https://pub.dev" + source: hosted + version: "3.0.9" + leak_tracker_testing: + dependency: transitive + description: + name: leak_tracker_testing + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3" + url: "https://pub.dev" + source: hosted + version: "3.0.1" + lints: + dependency: transitive + description: + name: lints + sha256: "976c774dd944a42e83e2467f4cc670daef7eed6295b10b36ae8c85bcbf828235" + url: "https://pub.dev" + source: hosted + version: "4.0.0" + matcher: + dependency: transitive + description: + name: matcher + sha256: dc58c723c3c24bf8d3e2d3ad3f2f9d7bd9cf43ec6feaa64181775e60190153f2 + url: "https://pub.dev" + source: hosted + version: "0.12.17" + material_color_utilities: + dependency: transitive + description: + name: material_color_utilities + sha256: f7142bb1154231d7ea5f96bc7bde4bda2a0945d2806bb11670e30b850d56bdec + url: "https://pub.dev" + source: hosted + version: "0.11.1" + meta: + dependency: transitive + description: + name: meta + sha256: e3641ec5d63ebf0d9b41bd43201a66e3fc79a65db5f61fc181f04cd27aab950c + url: "https://pub.dev" + source: hosted + version: "1.16.0" + path: + dependency: transitive + description: + name: path + sha256: "75cca69d1490965be98c73ceaea117e8a04dd21217b37b292c9ddbec0d955bc5" + url: "https://pub.dev" + source: hosted + version: "1.9.1" + path_provider: + dependency: transitive + description: + name: path_provider + sha256: "50c5dd5b6e1aaf6fb3a78b33f6aa3afca52bf903a8a5298f53101fdaee55bbcd" + url: "https://pub.dev" + source: hosted + version: "2.1.5" + path_provider_android: + dependency: transitive + description: + name: path_provider_android + sha256: "3b4c1fc3aa55ddc9cd4aa6759984330d5c8e66aa7702a6223c61540dc6380c37" + url: "https://pub.dev" + source: hosted + version: "2.2.19" + path_provider_foundation: + dependency: transitive + description: + name: path_provider_foundation + sha256: "16eef174aacb07e09c351502740fa6254c165757638eba1e9116b0a781201bbd" + url: "https://pub.dev" + source: hosted + version: "2.4.2" + path_provider_linux: + dependency: transitive + description: + name: path_provider_linux + sha256: f7a1fe3a634fe7734c8d3f2766ad746ae2a2884abe22e241a8b301bf5cac3279 + url: "https://pub.dev" + source: hosted + version: "2.2.1" + path_provider_platform_interface: + dependency: transitive + description: + name: path_provider_platform_interface + sha256: "88f5779f72ba699763fa3a3b06aa4bf6de76c8e5de842cf6f29e2e06476c2334" + url: "https://pub.dev" + source: hosted + version: "2.1.2" + path_provider_windows: + dependency: transitive + description: + name: path_provider_windows + sha256: bd6f00dbd873bfb70d0761682da2b3a2c2fccc2b9e84c495821639601d81afe7 + url: "https://pub.dev" + source: hosted + version: "2.3.0" + platform: + dependency: transitive + description: + name: platform + sha256: "5d6b1b0036a5f331ebc77c850ebc8506cbc1e9416c27e59b439f917a902a4984" + url: "https://pub.dev" + source: hosted + version: "3.1.6" + plugin_platform_interface: + dependency: transitive + description: + name: plugin_platform_interface + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02" + url: "https://pub.dev" + source: hosted + version: "2.1.8" + sky_engine: + dependency: transitive + description: flutter + source: sdk + version: "0.0.0" + source_span: + dependency: transitive + description: + name: source_span + sha256: "254ee5351d6cb365c859e20ee823c3bb479bf4a293c22d17a9f1bf144ce86f7c" + url: "https://pub.dev" + source: hosted + version: "1.10.1" + stack_trace: + dependency: transitive + description: + name: stack_trace + sha256: "8b27215b45d22309b5cddda1aa2b19bdfec9df0e765f2de506401c071d38d1b1" + url: "https://pub.dev" + source: hosted + version: "1.12.1" + stream_channel: + dependency: transitive + description: + name: stream_channel + sha256: "969e04c80b8bcdf826f8f16579c7b14d780458bd97f56d107d3950fdbeef059d" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + string_scanner: + dependency: transitive + description: + name: string_scanner + sha256: "921cd31725b72fe181906c6a94d987c78e3b98c2e205b397ea399d4054872b43" + url: "https://pub.dev" + source: hosted + version: "1.4.1" + term_glyph: + dependency: transitive + description: + name: term_glyph + sha256: "7f554798625ea768a7518313e58f83891c7f5024f88e46e7182a4558850a4b8e" + url: "https://pub.dev" + source: hosted + version: "1.2.2" + test_api: + dependency: transitive + description: + name: test_api + sha256: fb31f383e2ee25fbbfe06b40fe21e1e458d14080e3c67e7ba0acfde4df4e0bbd + url: "https://pub.dev" + source: hosted + version: "0.7.4" + typed_data: + dependency: transitive + description: + name: typed_data + sha256: f9049c039ebfeb4cf7a7104a675823cd72dba8297f264b6637062516699fa006 + url: "https://pub.dev" + source: hosted + version: "1.4.0" + vector_math: + dependency: transitive + description: + name: vector_math + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803" + url: "https://pub.dev" + source: hosted + version: "2.1.4" + vm_service: + dependency: transitive + description: + name: vm_service + sha256: "0968250880a6c5fe7edc067ed0a13d4bae1577fe2771dcf3010d52c4a9d3ca14" + url: "https://pub.dev" + source: hosted + version: "14.3.1" + web: + dependency: transitive + description: + name: web + sha256: "868d88a33d8a87b18ffc05f9f030ba328ffefba92d6c127917a2ba740f9cfe4a" + url: "https://pub.dev" + source: hosted + version: "1.1.1" + win32: + dependency: transitive + description: + name: win32 + sha256: "329edf97fdd893e0f1e3b9e88d6a0e627128cc17cc316a8d67fda8f1451178ba" + url: "https://pub.dev" + source: hosted + version: "5.13.0" + xdg_directories: + dependency: transitive + description: + name: xdg_directories + sha256: "7a3f37b05d989967cdddcbb571f1ea834867ae2faa29725fd085180e0883aa15" + url: "https://pub.dev" + source: hosted + version: "1.1.0" +sdks: + dart: ">=3.7.0 <4.0.0" + flutter: ">=3.29.0" diff --git a/mobile-app/pubspec.yaml b/mobile-app/pubspec.yaml new file mode 100644 index 0000000..d756935 --- /dev/null +++ b/mobile-app/pubspec.yaml @@ -0,0 +1,23 @@ +name: ld_fdpi_mobile +description: LD FDPI Android client — AmneziaWG tunnel, enrollment and leak protection. +publish_to: "none" +version: 0.1.0+1 + +environment: + sdk: ">=3.4.0 <4.0.0" + +dependencies: + flutter: + sdk: flutter + cupertino_icons: ^1.0.8 + http: ^1.2.2 + cryptography: ^2.7.0 + flutter_secure_storage: ^9.2.4 + +dev_dependencies: + flutter_test: + sdk: flutter + flutter_lints: ^4.0.0 + +flutter: + uses-material-design: true diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 0000000..df25f7f --- /dev/null +++ b/package-lock.json @@ -0,0 +1,3782 @@ +{ + "name": "ld-fdpi", + "version": "1.7.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "ld-fdpi", + "version": "1.7.0", + "dependencies": { + "@tauri-apps/api": "^2.2.0", + "@tauri-apps/plugin-updater": "^2.14.1", + "dompurify": "^3.2.3", + "lucide-react": "^0.474.0", + "qrcode.react": "^4.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@tauri-apps/cli": "^2.2.0", + "@types/dompurify": "^3.0.5", + "@types/react": "^18.3.18", + "@types/react-dom": "^18.3.5", + "@vitejs/plugin-react": "^4.3.4", + "autoprefixer": "^10.4.20", + "postcss": "^8.5.1", + "sharp": "^0.35.5", + "tailwindcss": "^3.4.17", + "vite": "^6.0.7" + } + }, + "node_modules/@alloc/quick-lru": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.3.0.tgz", + "integrity": "sha512-U4+70Pc5ZS9osnCBCE5Jha/ciHM+Yp+CNMNC/7HvYbNRk1Ldd+f7qO65W5qfhu/TCv+/ozljlXXe9Nj8419DMA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@babel/code-frame": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.29.7.tgz", + "integrity": "sha512-Aup7aUOfpbAUg2ROOJN6Iw5f9DMBlzu0mIkm/malLQFN/YQgO48wCj0Kxa3sEHJvPVFg7siR+qRInwXd2qhQKw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-validator-identifier": "^7.29.7", + "js-tokens": "^4.0.0", + "picocolors": "^1.1.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/compat-data": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.29.7.tgz", + "integrity": "sha512-locTkQyKvwIEgBzVrn8693ebc97F2U8ZHjbXwDXJ5Fn2TCpNwTlKcaKLkdHop5c/icOFE7qt7Q9JC5hnKNa6Gg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/core": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.29.7.tgz", + "integrity": "sha512-RgHBCvtjbOK2gXSNBNIkNoEc9qoVEtau3hj8gEqKQuL3HZAibKarWFEI3Lfm6EYKkLalOh8eSrj9b+ch9H/VBA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.7", + "@babel/helper-compilation-targets": "^7.29.7", + "@babel/helper-module-transforms": "^7.29.7", + "@babel/helpers": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/template": "^7.29.7", + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7", + "@jridgewell/remapping": "^2.3.5", + "convert-source-map": "^2.0.0", + "debug": "^4.1.0", + "gensync": "^1.0.0-beta.2", + "json5": "^2.2.3", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/babel" + } + }, + "node_modules/@babel/generator": { + "version": "7.29.8", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.29.8.tgz", + "integrity": "sha512-gZbepsdh3WDtgZKWL+vTPh71LSBrm/Y4/QDZBVCcYfmeTEEuoOYwlSy+G1StfJg+/Zy550u/3TATbm7qDbbMtg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.29.8", + "@babel/types": "^7.29.8", + "@jridgewell/gen-mapping": "^0.3.12", + "@jridgewell/trace-mapping": "^0.3.28", + "jsesc": "^3.0.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-compilation-targets": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.29.7.tgz", + "integrity": "sha512-wem6WaBj4NaVYVdNhLPPVacES6ZJ+KBBfSkTMD3YZxbP3rm3Di85tJU5ljaUNhaOynt+Aj0xruhYuzQBt8n71g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/compat-data": "^7.29.7", + "@babel/helper-validator-option": "^7.29.7", + "browserslist": "^4.24.0", + "lru-cache": "^5.1.1", + "semver": "^6.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-globals": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-globals/-/helper-globals-7.29.7.tgz", + "integrity": "sha512-3nQVUAtvkKH9zahfWgw96Jc/uFOmjACE1kQz82E2lqWmHBgjzbNlsC22nuQTfahmWeQtTq5nQ/4Nnd2A1wj4zA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-imports": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.29.7.tgz", + "integrity": "sha512-ejHwrQQYcm9xnTivShn2IDOlIzInN34AXskvq9QicvCtEzq1Vzclu/tKF8Jq1Cg8JG2GL6/EmjgsCT7lXepE3g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/traverse": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-module-transforms": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.29.7.tgz", + "integrity": "sha512-UPUVSyXbOh627KiCIGQSgwWzGeBKLkaJ9PJEdrngIwMSzxLR4jS4+f1f1jb7VzBbg8nFLaYotvVPFCTqdrmTAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-module-imports": "^7.29.7", + "@babel/helper-validator-identifier": "^7.29.7", + "@babel/traverse": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0" + } + }, + "node_modules/@babel/helper-plugin-utils": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-plugin-utils/-/helper-plugin-utils-7.29.7.tgz", + "integrity": "sha512-G7sHYigPY17oO5SYWnfD/0MTBwVR781S/JI643e/JhUYgVgWE/61SoW3NH9KWUKyKq5LVh3npif99Wkt6j86Jw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.29.11", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.29.11.tgz", + "integrity": "sha512-snZbO7MEDOof+hvNa97EjEY7qD7h2kwvQr5AJC3ZhQudKW5dnej6k3kP9NQV88hJwaS8vDqRLFo9rivLEhle2g==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.29.7.tgz", + "integrity": "sha512-qehxGkRj55h/ff8EMaJ+cYhyaKlHIxqYDn682wQD7RNp9UujOQsHog2uS0r2vzr4pW+sXf90NeeayjcNaX3fFg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-option": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.29.7.tgz", + "integrity": "sha512-N9ZErrD+yW5geCDtBqnOoxmR8+tNKiGuxKlDpuJxfsqpa2dFcexaziGAE/qoHLiDDreVNMupxGmSoNlyvsA3gw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helpers": { + "version": "7.29.10", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.29.10.tgz", + "integrity": "sha512-EMCx3AGZ3WfAl6ht7AyQoPm2Lh+BGYEMdc4Q6Hf7uSCDOZFuLq44qNwL+iaim8VlyYhRAo4X43+weadK8ZB4Yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.8" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/parser": { + "version": "7.29.11", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.29.11.tgz", + "integrity": "sha512-OZ6+oaK7GMyg3IfCpj8JOmn8n+w2rJbDT0LLfVDTLb1ZFeKDh3AiNELgCMUw175IJHSkLl74hG0M0VLsvx+gag==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.29.11" + }, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-self": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.29.7.tgz", + "integrity": "sha512-TL0hMc9xzy86VD31nUiwzd5otRAcyEPcsegCxolO0PvcXuH1v0kECe/UIznYFihpkvU5wg/jk4v0TTEFfm53fw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/plugin-transform-react-jsx-source": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-source/-/plugin-transform-react-jsx-source-7.29.7.tgz", + "integrity": "sha512-06IyK09H3wi4cGbhDBwp5gUGo0IKtnYa8tyTiephirPCK6fbobVGiXMMI5zLQ4aKEYP3wZ3ArU44o+8KMrSG/Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-plugin-utils": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + }, + "peerDependencies": { + "@babel/core": "^7.0.0-0" + } + }, + "node_modules/@babel/template": { + "version": "7.29.7", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.29.7.tgz", + "integrity": "sha512-puq+Gf35oI24FeN11LkoUQFqv9uwNeWpxXZi/Ji3rRIoKAzKnxRaZ+Gkj0vKS9ZCiTESfng1N9LyOyXvo+m+Gg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/parser": "^7.29.7", + "@babel/types": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.29.10", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.29.10.tgz", + "integrity": "sha512-B3lYAs2nkKskbgQ1nfy8Ma9ao9Q1rntTAQHrzzyDuj+TSO+X3le6PfWwqDvodsb+OumE10eMFfuMCTQSQ5iuIQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/code-frame": "^7.29.7", + "@babel/generator": "^7.29.8", + "@babel/helper-globals": "^7.29.7", + "@babel/parser": "^7.29.9", + "@babel/template": "^7.29.7", + "@babel/types": "^7.29.8", + "debug": "^4.3.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.29.11", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.29.11.tgz", + "integrity": "sha512-WCsemW40Cpc6gouC1SrY6PBaZ+oLRlEVY9XBvZBI7il/HyUrb2nJ505wE1MHEFyDZNnrWDEuy4jL50WVHfTTSQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/helper-string-parser": "^7.29.11", + "@babel/helper-validator-identifier": "^7.29.7" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@emnapi/runtime": { + "version": "1.11.3", + "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.3.tgz", + "integrity": "sha512-Xz4Tpyki7XyrpbUK1jR1AhdAdaXyhhY4lZ3neLodmhpuWfy2PAQN5B46sAiU4liOXGLkHypn/qU+jvfWSCYYLA==", + "dev": true, + "license": "MIT", + "optional": true, + "dependencies": { + "tslib": "^2.4.0" + } + }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.25.12.tgz", + "integrity": "sha512-Hhmwd6CInZ3dwpuGTF8fJG6yoWmsToE+vYgD4nytZVxcu1ulHpUQRAB1UJ8+N1Am3Mz4+xOByoQoSZf4D+CpkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.25.12.tgz", + "integrity": "sha512-VJ+sKvNA/GE7Ccacc9Cha7bpS8nyzVv0jdVgwNDaR4gDMC/2TTRc33Ip8qrNYUcpkOHUT5OZ0bUcNNVZQ9RLlg==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.25.12.tgz", + "integrity": "sha512-6AAmLG7zwD1Z159jCKPvAxZd4y/VTO0VkprYy+3N2FtJ8+BQWFXU+OxARIwA46c5tdD9SsKGZ/1ocqBS/gAKHg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/android-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.25.12.tgz", + "integrity": "sha512-5jbb+2hhDHx5phYR2By8GTWEzn6I9UqR11Kwf22iKbNpYrsmRB18aX/9ivc5cabcUiAT/wM+YIZ6SG9QO6a8kg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.25.12.tgz", + "integrity": "sha512-N3zl+lxHCifgIlcMUP5016ESkeQjLj/959RxxNYIthIg+CQHInujFuXeWbWMgnTo4cp5XVHqFPmpyu9J65C1Yg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/darwin-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.25.12.tgz", + "integrity": "sha512-HQ9ka4Kx21qHXwtlTUVbKJOAnmG1ipXhdWTmNXiPzPfWKpXqASVcWdnf2bnL73wgjNrFXAa3yYvBSd9pzfEIpA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.25.12.tgz", + "integrity": "sha512-gA0Bx759+7Jve03K1S0vkOu5Lg/85dou3EseOGUes8flVOGxbhDDh/iZaoek11Y8mtyKPGF3vP8XhnkDEAmzeg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/freebsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.25.12.tgz", + "integrity": "sha512-TGbO26Yw2xsHzxtbVFGEXBFH0FRAP7gtcPE7P5yP7wGy7cXK2oO7RyOhL5NLiqTlBh47XhmIUXuGciXEqYFfBQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.25.12.tgz", + "integrity": "sha512-lPDGyC1JPDou8kGcywY0YILzWlhhnRjdof3UlcoqYmS9El818LLfJJc3PXXgZHrHCAKs/Z2SeZtDJr5MrkxtOw==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.25.12.tgz", + "integrity": "sha512-8bwX7a8FghIgrupcxb4aUmYDLp8pX06rGh5HqDT7bB+8Rdells6mHvrFHHW2JAOPZUbnjUpKTLg6ECyzvas2AQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.25.12.tgz", + "integrity": "sha512-0y9KrdVnbMM2/vG8KfU0byhUN+EFCny9+8g202gYqSSVMonbsCfLjUO+rCci7pM0WBEtz+oK/PIwHkzxkyharA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-loong64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.25.12.tgz", + "integrity": "sha512-h///Lr5a9rib/v1GGqXVGzjL4TMvVTv+s1DPoxQdz7l/AYv6LDSxdIwzxkrPW438oUXiDtwM10o9PmwS/6Z0Ng==", + "cpu": [ + "loong64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-mips64el": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.25.12.tgz", + "integrity": "sha512-iyRrM1Pzy9GFMDLsXn1iHUm18nhKnNMWscjmp4+hpafcZjrr2WbT//d20xaGljXDBYHqRcl8HnxbX6uaA/eGVw==", + "cpu": [ + "mips64el" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-ppc64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.25.12.tgz", + "integrity": "sha512-9meM/lRXxMi5PSUqEXRCtVjEZBGwB7P/D4yT8UG/mwIdze2aV4Vo6U5gD3+RsoHXKkHCfSxZKzmDssVlRj1QQA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-riscv64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.25.12.tgz", + "integrity": "sha512-Zr7KR4hgKUpWAwb1f3o5ygT04MzqVrGEGXGLnj15YQDJErYu/BGg+wmFlIDOdJp0PmB0lLvxFIOXZgFRrdjR0w==", + "cpu": [ + "riscv64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-s390x": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.25.12.tgz", + "integrity": "sha512-MsKncOcgTNvdtiISc/jZs/Zf8d0cl/t3gYWX8J9ubBnVOwlk65UIEEvgBORTiljloIWnBzLs4qhzPkJcitIzIg==", + "cpu": [ + "s390x" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/linux-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.25.12.tgz", + "integrity": "sha512-uqZMTLr/zR/ed4jIGnwSLkaHmPjOjJvnm6TVVitAa08SLS9Z0VM8wIRx7gWbJB5/J54YuIMInDquWyYvQLZkgw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-arm64/-/netbsd-arm64-0.25.12.tgz", + "integrity": "sha512-xXwcTq4GhRM7J9A8Gv5boanHhRa/Q9KLVmcyXHCTaM4wKfIpWkdXiMog/KsnxzJ0A1+nD+zoecuzqPmCRyBGjg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/netbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.25.12.tgz", + "integrity": "sha512-Ld5pTlzPy3YwGec4OuHh1aCVCRvOXdH8DgRjfDy/oumVovmuSzWfnSJg+VtakB9Cm0gxNO9BzWkj6mtO1FMXkQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "netbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-arm64/-/openbsd-arm64-0.25.12.tgz", + "integrity": "sha512-fF96T6KsBo/pkQI950FARU9apGNTSlZGsv1jZBAlcLL1MLjLNIWPBkj5NlSz8aAzYKg+eNqknrUJ24QBybeR5A==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openbsd-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.25.12.tgz", + "integrity": "sha512-MZyXUkZHjQxUvzK7rN8DJ3SRmrVrke8ZyRusHlP+kuwqTcfWLyqMOE3sScPPyeIXN/mDJIfGXvcMqCgYKekoQw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/openharmony-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/openharmony-arm64/-/openharmony-arm64-0.25.12.tgz", + "integrity": "sha512-rm0YWsqUSRrjncSXGA7Zv78Nbnw4XL6/dzr20cyrQf7ZmRcsovpcRBdhD43Nuk3y7XIoW2OxMVvwuRvk9XdASg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/sunos-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.25.12.tgz", + "integrity": "sha512-3wGSCDyuTHQUzt0nV7bocDy72r2lI33QL3gkDNGkod22EsYl04sMf0qLb8luNKTOmgF/eDEDP5BFNwoBKH441w==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "sunos" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-arm64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.25.12.tgz", + "integrity": "sha512-rMmLrur64A7+DKlnSuwqUdRKyd3UE7oPJZmnljqEptesKM8wx9J8gx5u0+9Pq0fQQW8vqeKebwNXdfOyP+8Bsg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-ia32": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.25.12.tgz", + "integrity": "sha512-HkqnmmBoCbCwxUKKNPBixiWDGCpQGVsrQfJoVGYLPT41XWF8lHuE5N6WhVia2n4o5QK5M4tYr21827fNhi4byQ==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@esbuild/win32-x64": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.25.12.tgz", + "integrity": "sha512-alJC0uCZpTFrSL0CCDjcgleBXPnCrEAhTBILpeAp7M/OFgoqtAetfBzX0xM00MUsVVPpVjlPuMbREqnZCXaTnA==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/colour": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@img/colour/-/colour-1.1.0.tgz", + "integrity": "sha512-Td76q7j57o/tLVdgS746cYARfSyxk8iEfRxewL9h4OMzYhbW4TAcppl0mT4eyqXddh6L/jwoM75mo7ixa/pCeQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/@img/sharp-darwin-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-arm64/-/sharp-darwin-arm64-0.35.5.tgz", + "integrity": "sha512-QRUlFQ0WxvdWyqqG/WtI3iupfD5rBzmCHXSdPsY91sAtVtTo7Q4cb6zOccZ3gqEqkr0f1As1ehLqmEpDsRf+lg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-darwin-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-darwin-x64/-/sharp-darwin-x64-0.35.5.tgz", + "integrity": "sha512-+BR255RhDlpygUpOc/Jdt1nT6DQ3XG/ERo5wbcdOf5Q320dKtPCKPLR1LJs9VGXRaMa8l1uUa0tkCNOXiAxZUw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-darwin-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-freebsd-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-freebsd-wasm32/-/sharp-freebsd-wasm32-0.35.5.tgz", + "integrity": "sha512-Y/z91nEZ4uIBX5X3nfTovjU9lHNKFYbL2lpHCLVNmXQK03VIZvXBBt0KxbPGp2SdGSF+2mQU4e+hQaWOt86iAw==", + "dev": true, + "license": "Apache-2.0", + "optional": true, + "os": [ + "freebsd" + ], + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-arm64/-/sharp-libvips-darwin-arm64-1.3.4.tgz", + "integrity": "sha512-5R89nBYiRdUlSWJxPhO+GVtaXzXSxKnRu/xqMn3KTA3L9EB9Oy/P+Nn2f2vlhPuUdy/Zusb2DarbyTpGCfEDuw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-darwin-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-darwin-x64/-/sharp-libvips-darwin-x64-1.3.4.tgz", + "integrity": "sha512-iR2OKH80yi0U+dUplyh3/xdpFvps6YkCwsXenIJxqxR1v9o+xtKTGbS9H7cps+2Vxjc8B1j96p75NmTGjIhtpQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "darwin" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm/-/sharp-libvips-linux-arm-1.3.4.tgz", + "integrity": "sha512-LmRtTsOHuvM2+wlO2Db37dx5MiZhB0FvSunciw48YjdOkZz9KAiRbm8ujeMOA1INqmei5NapFxYEK1D1ZSidmw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-arm64/-/sharp-libvips-linux-arm64-1.3.4.tgz", + "integrity": "sha512-Y3dgX/6lE2QhQb+Gxy0WZxfg9MEm/JBjamZpS2IklP7xIQoKN4hzAm7KcMVGtaVDt3neE9OKBC7vAfonA/Lr1A==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-ppc64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-ppc64/-/sharp-libvips-linux-ppc64-1.3.4.tgz", + "integrity": "sha512-Le6boB8Tai0Nis+gIxIpKx68UDVVIqdR8Tin5Yf1z2LJJQLDJvCDRqRu+jC2qCoD+eIomonmOwB4smBRxfVpYQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-riscv64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-riscv64/-/sharp-libvips-linux-riscv64-1.3.4.tgz", + "integrity": "sha512-aHkkIEHPRdQEegJN20MLmGtxYD9R2wQr3Cwpddnu5+YKMt6Uzax7S9h5gpZTo8wyrGuZSlfQ63OevL5mTyOC7Q==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-s390x": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-s390x/-/sharp-libvips-linux-s390x-1.3.4.tgz", + "integrity": "sha512-ra/mB6MikESDUO7Yg+Mi95bFBb9GsObURuhnOv3OqknjGe9sZrG8tCe9q0xSIGrtLgvgw0gKnFWcK4blSgQOuQ==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linux-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linux-x64/-/sharp-libvips-linux-x64-1.3.4.tgz", + "integrity": "sha512-GJ//SSXbnwSDes02umB3nDJLFcQzw8a18V8fyhqr6tV515tOEMdImjjxj1AoafMRz56F3PHgftnj1QEKSU1zkw==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-arm64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-arm64/-/sharp-libvips-linuxmusl-arm64-1.3.4.tgz", + "integrity": "sha512-hvulFwtjUcagsis6BBxHwGFwWoNZjgYmULGVrZcyfNbjA8hKILbRxGg15/7w5HDyXHXUos/j6baAWqnCyQ2DWA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-libvips-linuxmusl-x64": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/@img/sharp-libvips-linuxmusl-x64/-/sharp-libvips-linuxmusl-x64-1.3.4.tgz", + "integrity": "sha512-6zXKeE/p39I1AmA3cJG35eyBGNqNddLnUXjhwBnsGjFPWqf5VKkDBEqaEkPDoTEtkxwi2vv8Tcr2mDyP4So7Fg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "LGPL-3.0-or-later", + "optional": true, + "os": [ + "linux" + ], + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-linux-arm": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm/-/sharp-linux-arm-0.35.5.tgz", + "integrity": "sha512-LEaXK2WdXVK5ykcw0buWyPMsmLLL2vpHLD6yrNSW+JGEL3BZPA4tpKN6iaMc4AxTTAoaX/sU1rOL51lcIz48ZQ==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-arm64/-/sharp-linux-arm64-0.35.5.tgz", + "integrity": "sha512-LYVx5JTsOM2CBzmxreh+nl64/3H6Xb09iSLknqH47z2T2DFFxDeFLP5y4dJwe6H7uGQlHPyEEtIqyo3DYsRwdQ==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-ppc64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-ppc64/-/sharp-linux-ppc64-0.35.5.tgz", + "integrity": "sha512-QVxAAq8evVRI9ia2vqgwrmWucn5Dfv+JdWzj75pD8omHLPSP7f8p20O8jxzjCcuCEQEOtYOZUmX1hkiZ0kdevA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-ppc64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-riscv64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-riscv64/-/sharp-linux-riscv64-0.35.5.tgz", + "integrity": "sha512-LtdreXguaavKODPIfzJ4kffx7UNt1omwtK0rch4EBbbSTXPnxWmYSayXdLJw0fJzQ97kHt1gL/yh4tvU+nCyRQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-riscv64": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-s390x": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-s390x/-/sharp-linux-s390x-0.35.5.tgz", + "integrity": "sha512-UZasTOFiYzotTsGOCu42BfUzP6Tu6Do/947iRm1RsLKvlllxwGcn4RN27LibGWceix4Y+Pmw3jsnTcCQIgWjqA==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-s390x": "1.3.4" + } + }, + "node_modules/@img/sharp-linux-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linux-x64/-/sharp-linux-x64-0.35.5.tgz", + "integrity": "sha512-SxFtLTeJInhAA9Q836kux2vZNeOBQEx658qvbboZScr0wIARym3IcGmW7KpVD5sbVg0Ojy+udFQdayYIZyoNog==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linux-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-arm64/-/sharp-linuxmusl-arm64-0.35.5.tgz", + "integrity": "sha512-9HbMclmI1zlNkFRs3z9/eBtDjfD0sGlrX1z6b1qwmiFY5ElDLh4BC0LPBdVp7z1DXFiKlIcznf+ZlsuZzLxQqg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4" + } + }, + "node_modules/@img/sharp-linuxmusl-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-linuxmusl-x64/-/sharp-linuxmusl-x64-0.35.5.tgz", + "integrity": "sha512-4KOphqB035HrVdqLZfCgMzzERrQkkzOwRhl4OAkRO1YCldbaFjySXMaK534Mo0V+LndnlJk+sbUyLeU0ULyD1A==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-libvips-linuxmusl-x64": "1.3.4" + } + }, + "node_modules/@img/sharp-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-wasm32/-/sharp-wasm32-0.35.5.tgz", + "integrity": "sha512-Ptsga1su4tQx+LLF1ECS9U6nz5kmrXKo6XVbtR48Ke3ZRxxgaWBu7IDtEe1quo8hiupwm6WFqxVlXaSf7IINGQ==", + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later AND MIT", + "optional": true, + "dependencies": { + "@emnapi/runtime": "^1.11.3" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-webcontainers-wasm32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-webcontainers-wasm32/-/sharp-webcontainers-wasm32-0.35.5.tgz", + "integrity": "sha512-hfhF/FmoQyTUkA0bIKFOtw536BQSeBMe6BF6QyWlrPxT754+TFLaZ7sKKTfvvM0yJgKgaYTwnFCIZ/GuDw5SUA==", + "cpu": [ + "wasm32" + ], + "dev": true, + "license": "Apache-2.0", + "optional": true, + "dependencies": { + "@img/sharp-wasm32": "0.35.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-arm64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-arm64/-/sharp-win32-arm64-0.35.5.tgz", + "integrity": "sha512-X4t7g+7ZA5DKblCBEXGjUqqemj4vczING/5viFwAL8h4N3qYeyjwdCvRLHi4EdOUI+2Z7UFlp1VM+p/AuEtm6Q==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-ia32": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-ia32/-/sharp-win32-ia32-0.35.5.tgz", + "integrity": "sha512-5Zm82LoBc43nhwNybZlG7Y1KO//Zhsn306fQl29ZOuStHLGTo3BWL83q3cznX0poxSAMuYL1On/BHBxkBeKr6A==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": "^20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@img/sharp-win32-x64": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/@img/sharp-win32-x64/-/sharp-win32-x64-0.35.5.tgz", + "integrity": "sha512-x76eH0vEiHlcMQu8Y8IenntaACtddpT6W0wmXtWrnKcnKI7ME5DdgqhAD6SEWOEl1v2zDvkZDhFA9KnURwpfqg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 AND LGPL-3.0-or-later", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.13", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz", + "integrity": "sha512-2kkt/7niJ6MgEPxF0bYdQ6etZaA+fQvDcLKckhy1yIQOzaoKjBBjSj63/aLVjYE3qhRt5dvM+uUyfCg6UKCBbA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/sourcemap-codec": "^1.5.0", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/remapping": { + "version": "2.3.5", + "resolved": "https://registry.npmjs.org/@jridgewell/remapping/-/remapping-2.3.5.tgz", + "integrity": "sha512-LI9u/+laYG4Ds1TDKSJW2YPrIlcVYOwi2fUC6xB43lueCjgxV4lffOCZCtYFiH6TNOX+tQKXx97T4IKHbhyHEQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.5", + "@jridgewell/trace-mapping": "^0.3.24" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.2.tgz", + "integrity": "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.6.0.tgz", + "integrity": "sha512-T7jf+5zgsZHwNJ4lvQ7/aezbyk0nNX+zJVWpmHA7VYsEx7a7qr5Rg5IbtJFqkgze5Y2sruq1RUY8Q837Od7iFw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.31", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.31.tgz", + "integrity": "sha512-zzNR+SdQSDJzc8joaeP8QQoCQr8NuYx2dIIytl1QeBEZHJ9uW6hebsrYgbz8hJwUQao3TWCMtmfV8Nu1twOLAw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, + "node_modules/@napi-rs/lzma-linux-x64-gnu": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/@napi-rs/lzma-linux-x64-gnu/-/lzma-linux-x64-gnu-1.5.1.tgz", + "integrity": "sha512-oTXEIha4SsuXdTA4Iyskj0kpdx2yVXdhd75c2v3xGrHFfVMsbhTPZU/nMPL4sWKo4pBHm3aucLaqGlF696dTyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": "^22.20 || ^24.12 || >=25" + } + }, + "node_modules/@nodelib/fs.scandir": { + "version": "2.1.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", + "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "2.0.5", + "run-parallel": "^1.1.9" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.stat": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/@nodelib/fs.walk": { + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", + "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.scandir": "2.1.5", + "fastq": "^1.6.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/@rolldown/pluginutils": { + "version": "1.0.0-beta.27", + "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.0-beta.27.tgz", + "integrity": "sha512-+d0F4MKMCbeVUJwG96uQ4SgAznZNSq93I3V+9NHA4OpvqG8mRCpGdKmK8l/dl02h2CCDHwW2FqilnTyDcAnqjA==", + "dev": true, + "license": "MIT" + }, + "node_modules/@rollup/rollup-android-arm-eabi": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm-eabi/-/rollup-android-arm-eabi-4.65.1.tgz", + "integrity": "sha512-5coxNSjqOI2J3NkVhlp3u+zGcyjnowQFsU9sg7MMz4UPXY4Dv63kFGLt7ConXz9CNq2i0yuOJZAF/2RMrgI2OA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-android-arm64": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-android-arm64/-/rollup-android-arm64-4.65.1.tgz", + "integrity": "sha512-K0HFf6XMB3IYs+jDZ1/RRhZaVOwxNXrl0n4MDEyGDjuK7+B6K/nDJp8DCBitO3S1sK/fzNxAf9QZAny4AIUPtg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "android" + ] + }, + "node_modules/@rollup/rollup-darwin-arm64": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-arm64/-/rollup-darwin-arm64-4.65.1.tgz", + "integrity": "sha512-zkZrXYwNlIcSUmcwY2DpsaDHr0XjVUeQHCuSunG3eQD7/5Wn/DvI7OMUE8NRRweK87yG8ebJ1xGOzmwpMsbZQA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-darwin-x64": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-darwin-x64/-/rollup-darwin-x64-4.65.1.tgz", + "integrity": "sha512-Zaed+R3cpkkA3aiNd7NO0GV5KFh/LVf8j6bGcoRdpoXkSm/mWH8M0oX2/3u/nyGcx/bHEovD9CzX+w9/gcpI4A==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ] + }, + "node_modules/@rollup/rollup-freebsd-arm64": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-arm64/-/rollup-freebsd-arm64-4.65.1.tgz", + "integrity": "sha512-h12p3WJWhyJ9kir0zqAPr0rKNmBzOWIjoaOMT9OULs9KZQZCeOMKd+mGSvERjd9VxJYShd3zIxtrVxkYz6BEVA==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-freebsd-x64": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-freebsd-x64/-/rollup-freebsd-x64-4.65.1.tgz", + "integrity": "sha512-yRBwh/5imKY4DydDulVtrjy8Jf7h7NQJUqZbgmZ3zFsCD9QqlnWvZ7RtEF+ecO1b+IukKjXlu5Bb9fehV3tIbg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "freebsd" + ] + }, + "node_modules/@rollup/rollup-linux-arm-gnueabihf": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-gnueabihf/-/rollup-linux-arm-gnueabihf-4.65.1.tgz", + "integrity": "sha512-1XuPiWYYaLE1UDOqhbKVOfsqxvfmFS/lYPSk92U1hEX1qRfSYH0hNeAlbxFIgjp4d6+YQmL95EPRgdvjbZEddA==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm-musleabihf": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm-musleabihf/-/rollup-linux-arm-musleabihf-4.65.1.tgz", + "integrity": "sha512-Y3C5e55Yrf6p2r5rBcc4P9hFWVNi6oqWy/53I/AyCJJGlp3KRSpTP8eoUmVntchTbEnhgBgAgLO9flj9AvOdUw==", + "cpu": [ + "arm" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-gnu": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-gnu/-/rollup-linux-arm64-gnu-4.65.1.tgz", + "integrity": "sha512-Itj6coSswkYPIcVLczObXmwdplHNQQxyfnK1ppBg4czDaX8RiEzLKqU7EMc64BiBuiDZEUS+M93ktM18rv5llw==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-arm64-musl": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-arm64-musl/-/rollup-linux-arm64-musl-4.65.1.tgz", + "integrity": "sha512-KeO8jTEqdrnhvcahufbimyMoI44vedRUp1bVz2QUnRX2vDm/hxzCPt5F8fERVD5fsHyTW/vXmCElT054VOSVOA==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-gnu": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-gnu/-/rollup-linux-loong64-gnu-4.65.1.tgz", + "integrity": "sha512-dDOz5VZZ+ZGnglpmET6VJefamWXFsgaVtuhSClf2/URZBp048jprD6z1hddsIMN6n1w+oUzGZEBp9u6Mlszsfg==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-loong64-musl": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-loong64-musl/-/rollup-linux-loong64-musl-4.65.1.tgz", + "integrity": "sha512-JbfRKz8nJCuo8gn1Dqx8lQWEHw4qhZ3uRaHphw5vrSjnSptJTKTRC/bLKHh8QQMsEnhL4uq+bdg3tkiXbJ2q/A==", + "cpu": [ + "loong64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-gnu": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-gnu/-/rollup-linux-ppc64-gnu-4.65.1.tgz", + "integrity": "sha512-3oQpe1q0emSeCAssVHMQdOz5fz3PBH5my/Fr0ZekV2UMNL4ZiRa1ciikYlGQXyDkeqseYYv1InwOY8YPqY7RIQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-ppc64-musl": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-ppc64-musl/-/rollup-linux-ppc64-musl-4.65.1.tgz", + "integrity": "sha512-nNV3HHi23o1LtpGGwH+Bav4hqnc4+klQtC96tSvCfvql8bLlNFTnTFiGl/jai2nve3eEr/vT2ocuyf+h+eMnYQ==", + "cpu": [ + "ppc64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-gnu": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-gnu/-/rollup-linux-riscv64-gnu-4.65.1.tgz", + "integrity": "sha512-b5zab0FryBxuocuDeqOsYGAg2EzjKw4mKA6LjQXCyewXjGv/BXqACBsY2cO45xM4hV2weYtdjGThP2VB2ByAYg==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-riscv64-musl": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-riscv64-musl/-/rollup-linux-riscv64-musl-4.65.1.tgz", + "integrity": "sha512-Rh08xZakiUxKNgI3hbgH9mivlx478lSqckS9s+Oc3/TX1VrAH3W8z/5wpJXR/v5VjqcJ/jJNVBg64PU1+iQsTQ==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-s390x-gnu": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-s390x-gnu/-/rollup-linux-s390x-gnu-4.65.1.tgz", + "integrity": "sha512-qDgtS6juN3/k97y4kcD6XLFpXEo4f6CnG8lTOGYwlhrUYTrMyhN0WHdZCPAW5rqS0MqQG7qI7dxnjugt6QB39Q==", + "cpu": [ + "s390x" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-gnu": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-gnu/-/rollup-linux-x64-gnu-4.65.1.tgz", + "integrity": "sha512-44IKzBPqXXVm0kt1O+F5eW4juR5FyIxGNlFkpP8qwIDzucBsjM1HCbdYUQrQw8rU/g6HRl/tfBm0+Qq4H4Ro3w==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-linux-x64-musl": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-linux-x64-musl/-/rollup-linux-x64-musl-4.65.1.tgz", + "integrity": "sha512-tvYWZ/h2PCHs558Xu7B6LptuRCV8lXV2xI75ONMcldII1m2zlFwuI4BJZi9M6rSMkYqcPLLtPUPrjyqfbzLOdg==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "MIT", + "optional": true, + "os": [ + "linux" + ] + }, + "node_modules/@rollup/rollup-openbsd-x64": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openbsd-x64/-/rollup-openbsd-x64-4.65.1.tgz", + "integrity": "sha512-gdyeucgZCnei3pXwadKVTEAOgRx0B+c847DUPR/PdOMmp3olhfkYo6r0J4PzRFZB5ZICZQTxntyvgmWH5xT7rg==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openbsd" + ] + }, + "node_modules/@rollup/rollup-openharmony-arm64": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-openharmony-arm64/-/rollup-openharmony-arm64-4.65.1.tgz", + "integrity": "sha512-Wf/NEKdn2SAL4Nvt8HyDtdkseWTwiLbZEOoNYnEaHkbso0B9eHO42vKnZh+OYsn+IMhAMcWcuIwPlBOgOXsUzg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "openharmony" + ] + }, + "node_modules/@rollup/rollup-win32-arm64-msvc": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-arm64-msvc/-/rollup-win32-arm64-msvc-4.65.1.tgz", + "integrity": "sha512-x9VSsDmsMsEWy4cr/mFeaEsXnVJ6Kc4NCAU/lCnwml3s7LQbZoa9+/qwc9etWHbuuDT5mYxdyyKUwo76njtjZw==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-ia32-msvc": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-ia32-msvc/-/rollup-win32-ia32-msvc-4.65.1.tgz", + "integrity": "sha512-RIDbiVvvLkN45mOFpbo6eYMgnuiBEB62BGR/0s4QJgGg2AvVxucDDNn67kpAcUoYyfmY8iX8/RifMcmxmmnejA==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-gnu": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-gnu/-/rollup-win32-x64-gnu-4.65.1.tgz", + "integrity": "sha512-+KN8HIr88vN59JNxlrM2fMimzY43Y0lQB7+0xdVsFbvFCAA74CLKCdfzIHzzvndJryBc94Pm+MvwtukKjaS2ug==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@rollup/rollup-win32-x64-msvc": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.65.1.tgz", + "integrity": "sha512-+Y1Sd49cSDq60UOl8/U2HI0ebUvnSl/hDhMHQn+ouw17yb8fYwMWIazzJ4JFpSkjPE7sj5NTNSX9IoyEqcFfyQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "MIT", + "optional": true, + "os": [ + "win32" + ] + }, + "node_modules/@tauri-apps/api": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/api/-/api-2.12.4.tgz", + "integrity": "sha512-pVmfis+4zT8H0Qhp3xPZx9Ju7kpzvA6rr/PSJPyuwfvucTQ8sVt61NYU9KMkK703UFlYadFmjKA4HhybOtN0gg==", + "license": "Apache-2.0 OR MIT", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/tauri" + } + }, + "node_modules/@tauri-apps/cli": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli/-/cli-2.12.4.tgz", + "integrity": "sha512-JI9bHfudSRJikGOrjbXEm6RjzzvmKuLc+JixB1NE8hNzQkNlCCIC3pTES3uypkR9lxHrsbxzcnSwhI2IxBQphw==", + "dev": true, + "license": "Apache-2.0 OR MIT", + "bin": { + "tauri": "tauri.js" + }, + "engines": { + "node": ">= 10" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/tauri" + }, + "optionalDependencies": { + "@tauri-apps/cli-darwin-arm64": "2.12.4", + "@tauri-apps/cli-darwin-x64": "2.12.4", + "@tauri-apps/cli-linux-arm-gnueabihf": "2.12.4", + "@tauri-apps/cli-linux-arm64-gnu": "2.12.4", + "@tauri-apps/cli-linux-arm64-musl": "2.12.4", + "@tauri-apps/cli-linux-riscv64-gnu": "2.12.4", + "@tauri-apps/cli-linux-x64-gnu": "2.12.4", + "@tauri-apps/cli-linux-x64-musl": "2.12.4", + "@tauri-apps/cli-win32-arm64-msvc": "2.12.4", + "@tauri-apps/cli-win32-ia32-msvc": "2.12.4", + "@tauri-apps/cli-win32-x64-msvc": "2.12.4" + } + }, + "node_modules/@tauri-apps/cli-darwin-arm64": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-arm64/-/cli-darwin-arm64-2.12.4.tgz", + "integrity": "sha512-OxqKSckIkoJ6vX2AjifIJpTasFC0Hbdoo7gEiCmAjauABO3U8m2MRsLWe+QTiBwDx1mIrvgA+rvI7tvDnbnHVg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-darwin-x64": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-darwin-x64/-/cli-darwin-x64-2.12.4.tgz", + "integrity": "sha512-fz76/77wMMJOaaUN6n3CybRG0P/MTEjjqYk81mGPyhi9m6Ue5T+LWBnJP/AkPooNatBPI2vtulGqomyMJ44lCQ==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-arm-gnueabihf": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm-gnueabihf/-/cli-linux-arm-gnueabihf-2.12.4.tgz", + "integrity": "sha512-K0w8Bof6Lt8QKLAYhRy0yy36ZH5iA/35VuSOvnxyjvCUZ+A3JKsUTlALviH/sVgAlisaPzzmeJSH8XOn4Q2HBA==", + "cpu": [ + "arm" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-arm64-gnu": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-gnu/-/cli-linux-arm64-gnu-2.12.4.tgz", + "integrity": "sha512-j5rOnjmRUwWrm1oosf0zBYl4D+fqydgUROFCk0hvKZxvbTT8SOERes0QB7rBV/XWNy+kM6pCKzb3oSm2sRglzg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-arm64-musl": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-arm64-musl/-/cli-linux-arm64-musl-2.12.4.tgz", + "integrity": "sha512-aOue3Fy6Jb7+oWcfAVUsVHfeTybSCt2CZoU06aO4jv4d2Ks/KnaTPwMAK3CLEduGOvBLY1lbBBrIyomqLLH5Sg==", + "cpu": [ + "arm64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-riscv64-gnu": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-riscv64-gnu/-/cli-linux-riscv64-gnu-2.12.4.tgz", + "integrity": "sha512-Fx6GShY/RvST+t6LMlTHAwd66+1tEaAAGrnU7cysVfaiRP1BKng5Vl6rVmO6rSLOA1Sp1dRzNYM4f0OWQGb7qA==", + "cpu": [ + "riscv64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-x64-gnu": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-gnu/-/cli-linux-x64-gnu-2.12.4.tgz", + "integrity": "sha512-tNzZSa79Z1nRpHxEpQ38lsAFpKlFlYvoXzjTV+lRRn/zSf3wrdUC3wnLcq2XEadchPu4ttK0zivhYzr+XGD19Q==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "glibc" + ], + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-linux-x64-musl": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-linux-x64-musl/-/cli-linux-x64-musl-2.12.4.tgz", + "integrity": "sha512-jmZ1pr0xEqUhuEusWtt9Yt+GF6lCnGHUmIL+KIknpbjK/XQ2qkhDBhaxK/JMHM2A8dAacVXCxXJk2EXpwhQUfA==", + "cpu": [ + "x64" + ], + "dev": true, + "libc": [ + "musl" + ], + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "linux" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-win32-arm64-msvc": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-arm64-msvc/-/cli-win32-arm64-msvc-2.12.4.tgz", + "integrity": "sha512-fGo8pgEHZxdSYgZ/J98m1usJ7NHKmKbq7k6uT0x1rpOq6Bg2YVzzpaAblWk710f5LHYBJIL5QIFS5IrD+4gmTg==", + "cpu": [ + "arm64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-win32-ia32-msvc": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-ia32-msvc/-/cli-win32-ia32-msvc-2.12.4.tgz", + "integrity": "sha512-ezl8sQIcjYsye3TUnTH5VcWmWzccZASlQm7hlZt0dYyj1XD0qpVW47u2xYVrIKui0F8uQv/7QGZixdWiClBsbg==", + "cpu": [ + "ia32" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/cli-win32-x64-msvc": { + "version": "2.12.4", + "resolved": "https://registry.npmjs.org/@tauri-apps/cli-win32-x64-msvc/-/cli-win32-x64-msvc-2.12.4.tgz", + "integrity": "sha512-DJhDeCqjLDNMWYFy7ZS8cfeAHX2RK0RbQMLiA3bMVVkXRDJ4NBYiHriGqsUhsr9iG41aTb+dJGkFPmPw1gWwVw==", + "cpu": [ + "x64" + ], + "dev": true, + "license": "Apache-2.0 OR MIT", + "optional": true, + "os": [ + "win32" + ], + "engines": { + "node": ">= 10" + } + }, + "node_modules/@tauri-apps/plugin-updater": { + "version": "2.14.1", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-updater/-/plugin-updater-2.14.1.tgz", + "integrity": "sha512-Hr7nlBm1wT6xbwzjZ/S36YULazu8MNlj5vvOwMl47fXI7HTa5Bjl1PbDEwVHaZTAKzE1VZsUy35UqnbrQxmYQw==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.12.0" + } + }, + "node_modules/@types/babel__core": { + "version": "7.20.5", + "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.20.5.tgz", + "integrity": "sha512-qoQprZvz5wQFJwMDqeseRXWv3rqMvhgpbXFfVyWhbx9X47POIA6i/+dXefEmZKoAgOaTdaIgNSMqMIU61yRyzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.20.7", + "@babel/types": "^7.20.7", + "@types/babel__generator": "*", + "@types/babel__template": "*", + "@types/babel__traverse": "*" + } + }, + "node_modules/@types/babel__generator": { + "version": "7.27.0", + "resolved": "https://registry.npmjs.org/@types/babel__generator/-/babel__generator-7.27.0.tgz", + "integrity": "sha512-ufFd2Xi92OAVPYsy+P4n7/U7e68fex0+Ee8gSG9KX7eo084CWiQ4sdxktvdl0bOPupXtVJPY19zk6EwWqUQ8lg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__template": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@types/babel__template/-/babel__template-7.4.4.tgz", + "integrity": "sha512-h/NUaSyG5EyxBIp8YRxo4RMe2/qQgvyowRwVMzhYhBCONbW8PUsg4lkFMrhgZhUe5z3L3MiLDuvyJ/CaPa2A8A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/parser": "^7.1.0", + "@babel/types": "^7.0.0" + } + }, + "node_modules/@types/babel__traverse": { + "version": "7.28.0", + "resolved": "https://registry.npmjs.org/@types/babel__traverse/-/babel__traverse-7.28.0.tgz", + "integrity": "sha512-8PvcXf70gTDZBgt9ptxJ8elBeBjcLOAcOtoO/mPJjtji1+CdGbHgm77om1GrsPxsiE+uXIpNSK64UYaIwQXd4Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/types": "^7.28.2" + } + }, + "node_modules/@types/dompurify": { + "version": "3.0.5", + "resolved": "https://registry.npmjs.org/@types/dompurify/-/dompurify-3.0.5.tgz", + "integrity": "sha512-1Wg0g3BtQF7sSb27fJQAKck1HECM6zV1EB66j8JH9i3LCjYabJa0FSdiSgsD5K/RbrsR0SiraKacLB+T8ZVYAg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/trusted-types": "*" + } + }, + "node_modules/@types/estree": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@types/estree/-/estree-1.0.9.tgz", + "integrity": "sha512-GhdPgy1el4/ImP05X05Uw4cw2/M93BCUmnEvWZNStlCzEKME4Fkk+YpoA5OiHNQmoS7Cafb8Xa3Pya8m1Qrzeg==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/prop-types": { + "version": "15.7.15", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz", + "integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==", + "dev": true, + "license": "MIT" + }, + "node_modules/@types/react": { + "version": "18.3.31", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz", + "integrity": "sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/prop-types": "*", + "csstype": "^3.2.2" + } + }, + "node_modules/@types/react-dom": { + "version": "18.3.7", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz", + "integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==", + "dev": true, + "license": "MIT", + "peerDependencies": { + "@types/react": "^18.0.0" + } + }, + "node_modules/@types/trusted-types": { + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==", + "devOptional": true, + "license": "MIT" + }, + "node_modules/@vitejs/plugin-react": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/@vitejs/plugin-react/-/plugin-react-4.7.0.tgz", + "integrity": "sha512-gUu9hwfWvvEDBBmgtAowQCojwZmJ5mcLn3aufeCsitijs3+f2NsrPtlAWIR6OPiqljl96GVCUbLe0HyqIpVaoA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@babel/core": "^7.28.0", + "@babel/plugin-transform-react-jsx-self": "^7.27.1", + "@babel/plugin-transform-react-jsx-source": "^7.27.1", + "@rolldown/pluginutils": "1.0.0-beta.27", + "@types/babel__core": "^7.20.5", + "react-refresh": "^0.17.0" + }, + "engines": { + "node": "^14.18.0 || >=16.0.0" + }, + "peerDependencies": { + "vite": "^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0" + } + }, + "node_modules/any-promise": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/any-promise/-/any-promise-1.3.0.tgz", + "integrity": "sha512-7UvmKalWRt1wgjL1RrGxoSJW/0QZFIegpeGvZG9kjp8vrRu55XTHbwnqq2GpXm9uLbcuhxm3IqX9OB4MZR1b2A==", + "dev": true, + "license": "MIT" + }, + "node_modules/anymatch": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/anymatch/-/anymatch-3.1.3.tgz", + "integrity": "sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw==", + "dev": true, + "license": "ISC", + "dependencies": { + "normalize-path": "^3.0.0", + "picomatch": "^2.0.4" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/arg": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/arg/-/arg-5.0.2.tgz", + "integrity": "sha512-PYjyFOLKQ9y57JvQ6QLo8dAgNqswh8M1RMJYdQduT6xbWSgK36P/Z/v+p888pM69jMMfS8Xd8F6I1kQ/I9HUGg==", + "dev": true, + "license": "MIT" + }, + "node_modules/autoprefixer": { + "version": "10.6.2", + "resolved": "https://registry.npmjs.org/autoprefixer/-/autoprefixer-10.6.2.tgz", + "integrity": "sha512-VOw9/yGTGwPPgzFcODtcv6zhEPIeIWkRSe10L2ri2f5vZ7ID7lCt6jZzRF5/ubgOZ+szYydmEF5AYsA5jxX1tA==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/autoprefixer" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "browserslist": "^4.28.9", + "caniuse-lite": "^1.0.30001810", + "fraction.js": "^5.3.4", + "picocolors": "^1.1.1", + "postcss-value-parser": "^4.2.0" + }, + "bin": { + "autoprefixer": "bin/autoprefixer" + }, + "engines": { + "node": "^10 || ^12 || >=14" + }, + "peerDependencies": { + "postcss": "^8.1.0" + } + }, + "node_modules/baseline-browser-mapping": { + "version": "2.11.34", + "resolved": "https://registry.npmjs.org/baseline-browser-mapping/-/baseline-browser-mapping-2.11.34.tgz", + "integrity": "sha512-Aqr8mA1kIvyJ3UY5YAY7ib8LSo1DmDMbMnVqGPtsKW1LxaFQFwn9Eb3yvq2fUKJsRvaXjnAV7R5osqETapzNiA==", + "dev": true, + "license": "Apache-2.0", + "bin": { + "baseline-browser-mapping": "dist/cli.cjs" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/binary-extensions": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-2.3.0.tgz", + "integrity": "sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/braces": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/braces/-/braces-3.0.3.tgz", + "integrity": "sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA==", + "dev": true, + "license": "MIT", + "dependencies": { + "fill-range": "^7.1.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/browserslist": { + "version": "4.29.5", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.29.5.tgz", + "integrity": "sha512-khTmKu5NGYTotqcYo8Bew2k4RAE9PuXRSFRXG2lQBrCEQHyeQ/vX6gKMxfokwywBsLiXZMnHsmWMG1pnO8J7uQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "baseline-browser-mapping": "^2.11.33", + "caniuse-lite": "^1.0.30001819", + "electron-to-chromium": "^1.5.464", + "node-releases": "^2.0.60", + "update-browserslist-db": "^1.3.4" + }, + "bin": { + "browserslist": "cli.js" + }, + "engines": { + "node": "^6 || ^7 || ^8 || ^9 || ^10 || ^11 || ^12 || >=13.7" + } + }, + "node_modules/camelcase-css": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/camelcase-css/-/camelcase-css-2.0.1.tgz", + "integrity": "sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/caniuse-lite": { + "version": "1.0.30001819", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001819.tgz", + "integrity": "sha512-LFUqIIAwpzsIuevnKnsR9qnStBcgzPShTX61lBwN9uFkkf8o8zLiebEjbW8AYtZiF+1YKDWfdt/pWDtMuG8Xwg==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/caniuse-lite" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "CC-BY-4.0" + }, + "node_modules/chokidar": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/chokidar/-/chokidar-3.6.0.tgz", + "integrity": "sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==", + "dev": true, + "license": "MIT", + "dependencies": { + "anymatch": "~3.1.2", + "braces": "~3.0.2", + "glob-parent": "~5.1.2", + "is-binary-path": "~2.1.0", + "is-glob": "~4.0.1", + "normalize-path": "~3.0.0", + "readdirp": "~3.6.0" + }, + "engines": { + "node": ">= 8.10.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + }, + "optionalDependencies": { + "fsevents": "~2.3.2" + } + }, + "node_modules/chokidar/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/commander": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz", + "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/convert-source-map": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-2.0.0.tgz", + "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", + "dev": true, + "license": "MIT" + }, + "node_modules/cssesc": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", + "integrity": "sha512-/Tb/JcjK111nNScGob5MNtsntNM1aCNUDipB/TkwZFhyDrrE47SOx/18wF2bbjgc3ZzCSKW1T5nt5EbFoAz/Vg==", + "dev": true, + "license": "MIT", + "bin": { + "cssesc": "bin/cssesc" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/csstype": { + "version": "3.2.3", + "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.2.3.tgz", + "integrity": "sha512-z1HGKcYy2xA8AGQfwrn0PAy+PB7X/GSj3UVJW9qKyn43xWa+gl5nXmU4qqLMRzWVLFC8KusUX8T/0kCiOYpAIQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/debug": { + "version": "4.4.3", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", + "integrity": "sha512-RGwwWnwQvkVfavKVt22FGLw+xYSdzARwm0ru6DhTVA3umU5hZc28V3kO4stgYryrTlLpuvgI9GiijltAjNbcqA==", + "dev": true, + "license": "MIT", + "dependencies": { + "ms": "^2.1.3" + }, + "engines": { + "node": ">=6.0" + }, + "peerDependenciesMeta": { + "supports-color": { + "optional": true + } + } + }, + "node_modules/detect-libc": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", + "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", + "dev": true, + "license": "Apache-2.0", + "engines": { + "node": ">=8" + } + }, + "node_modules/didyoumean": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/didyoumean/-/didyoumean-1.2.2.tgz", + "integrity": "sha512-gxtyfqMg7GKyhQmb056K7M3xszy/myH8w+B4RT+QXBQsvAOdc3XymqDDPHx1BgPgsdAA5SIifona89YtRATDzw==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/dlv": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/dlv/-/dlv-1.1.3.tgz", + "integrity": "sha512-+HlytyjlPKnIG8XuRG8WvmBP8xs8P71y+SKKS6ZXWoEgLuePxtDoUEiH7WkdePWrQ5JBpE6aoVqfZfJUQkjXwA==", + "dev": true, + "license": "MIT" + }, + "node_modules/dompurify": { + "version": "3.4.17", + "resolved": "https://registry.npmjs.org/dompurify/-/dompurify-3.4.17.tgz", + "integrity": "sha512-B/pSlYVHQ58kqISD/yDjuJ1yfzI34m1gF4lAod2bwSRhiN4K5Cl3H8Af7hqB2PmTL911tdEudnnXn5FnhRoz0w==", + "license": "(MPL-2.0 OR Apache-2.0)", + "optionalDependencies": { + "@types/trusted-types": "^2.0.7" + } + }, + "node_modules/electron-to-chromium": { + "version": "1.5.466", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.5.466.tgz", + "integrity": "sha512-WkgFvScwZjvCPupYGfQr5qlKCv/Tu+GYELGMCGcoBOQbNb6nx/TqGwJyLMwcNAAy2kKJF2agjM7KZKest538JA==", + "dev": true, + "license": "ISC" + }, + "node_modules/es-errors": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/es-errors/-/es-errors-1.3.0.tgz", + "integrity": "sha512-Zf5H2Kxt2xjTvbJvP2ZWLEICxA6j+hAmMzIlypy4xcBg1vKVnx89Wy0GbS+kf5cwCVFFzdCFh2XSCFNULS6csw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/esbuild": { + "version": "0.25.12", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.25.12.tgz", + "integrity": "sha512-bbPBYYrtZbkt6Os6FiTLCTFxvq4tt3JKall1vRwshA3fdVztsLAatFaZobhkBC8/BrPetoa0oksYoKXoG4ryJg==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "bin": { + "esbuild": "bin/esbuild" + }, + "engines": { + "node": ">=18" + }, + "optionalDependencies": { + "@esbuild/aix-ppc64": "0.25.12", + "@esbuild/android-arm": "0.25.12", + "@esbuild/android-arm64": "0.25.12", + "@esbuild/android-x64": "0.25.12", + "@esbuild/darwin-arm64": "0.25.12", + "@esbuild/darwin-x64": "0.25.12", + "@esbuild/freebsd-arm64": "0.25.12", + "@esbuild/freebsd-x64": "0.25.12", + "@esbuild/linux-arm": "0.25.12", + "@esbuild/linux-arm64": "0.25.12", + "@esbuild/linux-ia32": "0.25.12", + "@esbuild/linux-loong64": "0.25.12", + "@esbuild/linux-mips64el": "0.25.12", + "@esbuild/linux-ppc64": "0.25.12", + "@esbuild/linux-riscv64": "0.25.12", + "@esbuild/linux-s390x": "0.25.12", + "@esbuild/linux-x64": "0.25.12", + "@esbuild/netbsd-arm64": "0.25.12", + "@esbuild/netbsd-x64": "0.25.12", + "@esbuild/openbsd-arm64": "0.25.12", + "@esbuild/openbsd-x64": "0.25.12", + "@esbuild/openharmony-arm64": "0.25.12", + "@esbuild/sunos-x64": "0.25.12", + "@esbuild/win32-arm64": "0.25.12", + "@esbuild/win32-ia32": "0.25.12", + "@esbuild/win32-x64": "0.25.12" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6" + } + }, + "node_modules/fast-glob": { + "version": "3.3.3", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.3.tgz", + "integrity": "sha512-7MptL8U0cqcFdzIzwOTHoilX9x5BrNqye7Z/LuC7kCMRio1EMSyqRK3BEAUD7sXRq4iT4AzTVuZdhgQ2TCvYLg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.8" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/fast-glob/node_modules/glob-parent": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.2.tgz", + "integrity": "sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/fastq": { + "version": "1.20.3", + "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.20.3.tgz", + "integrity": "sha512-XKv5nnLs6nLF71NgiKJLIZFLkPyIEuOselLG7ujZnGrRfQK8HpvY+WqKhAJUAdLomwVHErVS4LfxFlPq0/FTAw==", + "dev": true, + "license": "ISC", + "dependencies": { + "reusify": "^1.0.4" + } + }, + "node_modules/fill-range": { + "version": "7.1.1", + "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.1.1.tgz", + "integrity": "sha512-YsGpe3WHLK8ZYi4tWDg2Jy3ebRz2rXowDxnld4bkQB00cc/1Zw9AWnC0i9ztDJitivtQvaI9KaLyKrc+hBW0yg==", + "dev": true, + "license": "MIT", + "dependencies": { + "to-regex-range": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/fraction.js": { + "version": "5.3.4", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-5.3.4.tgz", + "integrity": "sha512-1X1NTtiJphryn/uLQz3whtY6jK3fTqoE3ohKs0tT+Ujr1W59oopxmoEh7Lu5p6vBaPbgoM0bzveAW4Qi5RyWDQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": "*" + }, + "funding": { + "type": "github", + "url": "https://github.com/sponsors/rawify" + } + }, + "node_modules/fsevents": { + "version": "2.3.3", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "dev": true, + "hasInstallScript": true, + "license": "MIT", + "optional": true, + "os": [ + "darwin" + ], + "engines": { + "node": "^8.16.0 || ^10.6.0 || >=11.0.0" + } + }, + "node_modules/function-bind": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", + "integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA==", + "dev": true, + "license": "MIT", + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/gensync": { + "version": "1.0.0-beta.2", + "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", + "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/glob-parent": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-6.0.2.tgz", + "integrity": "sha512-XxwI8EOhVQgWp6iDL+3b0r86f4d6AX6zSU55HfB4ydCEuXLXc5FcYeOu+nnGftS4TEju/11rt4KJPTMgbfmv4A==", + "dev": true, + "license": "ISC", + "dependencies": { + "is-glob": "^4.0.3" + }, + "engines": { + "node": ">=10.13.0" + } + }, + "node_modules/hasown": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.4.tgz", + "integrity": "sha512-T2UbfbBEF32wiepXIsMlTW9+dDYC6wMh/t/vYA4tuOMKqWz/n3vr1NFSxQiyP+zk2mXsoMA/i/7qV6LKut1t1A==", + "dev": true, + "license": "MIT", + "dependencies": { + "function-bind": "^1.1.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/is-binary-path": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/is-binary-path/-/is-binary-path-2.1.0.tgz", + "integrity": "sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw==", + "dev": true, + "license": "MIT", + "dependencies": { + "binary-extensions": "^2.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/is-core-module": { + "version": "2.17.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.17.0.tgz", + "integrity": "sha512-J/vG0zBCbIKOQFfufSwyXdMrsohyJIUNkrnmo6WZGzoM7tr/lsbfW5b2BvisL6zsyMzK9UxV9L6c7AoFbyXHOA==", + "dev": true, + "license": "MIT", + "dependencies": { + "hasown": "^2.0.4" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/is-extglob": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/is-extglob/-/is-extglob-2.1.1.tgz", + "integrity": "sha512-SbKbANkN603Vi4jEZv49LeVJMn4yGwsbzZworEoyEiutsN3nJYdbO36zfhGJ6QEDpOZIFkDtnq5JRxmvl3jsoQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-glob": { + "version": "4.0.3", + "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", + "integrity": "sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-extglob": "^2.1.1" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/is-number": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/is-number/-/is-number-7.0.0.tgz", + "integrity": "sha512-41Cifkg6e8TylSpdtTpeLVMqvSBEVzTttHvERD741+pnZ8ANv0004MRL43QKPDlK9cGvNp6NZWZUBlbGXYxxng==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.12.0" + } + }, + "node_modules/jiti": { + "version": "1.21.7", + "resolved": "https://registry.npmjs.org/jiti/-/jiti-1.21.7.tgz", + "integrity": "sha512-/imKNG4EbWNrVjoNC/1H5/9GFy+tqjGBHCaSsN+P2RnPqjsLmv6UD3Ej+Kj8nBWaRAwyk7kK5ZUc+OEatnTR3A==", + "dev": true, + "license": "MIT", + "bin": { + "jiti": "bin/jiti.js" + } + }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "license": "MIT" + }, + "node_modules/jsesc": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-3.1.0.tgz", + "integrity": "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA==", + "dev": true, + "license": "MIT", + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/json5": { + "version": "2.2.3", + "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.3.tgz", + "integrity": "sha512-XmOWe7eyHYH14cLdVPoyg+GOH3rYX++KpzrylJwSW98t3Nk+U8XOl8FWKOgwtzdb8lXGf6zYwDUzeHMWfxasyg==", + "dev": true, + "license": "MIT", + "bin": { + "json5": "lib/cli.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/lilconfig": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/lilconfig/-/lilconfig-3.1.4.tgz", + "integrity": "sha512-zJZyBmQhArDRefuWTypZxwDpFDIYmrj8ypSBvwGD5P13Y95s6DjzKgu4DVdGbeQa5PDEsAOCAPNk4X+QOR006w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/antonk52" + } + }, + "node_modules/lines-and-columns": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", + "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", + "dev": true, + "license": "MIT" + }, + "node_modules/loose-envify": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", + "integrity": "sha512-lyuxPGr/Wfhrlem2CL/UcnUc1zcqKAImBDzukY7Y5F/yQiNdko6+fRLevlw1HgMySw7f611UIY408EtxRSoK3Q==", + "license": "MIT", + "dependencies": { + "js-tokens": "^3.0.0 || ^4.0.0" + }, + "bin": { + "loose-envify": "cli.js" + } + }, + "node_modules/lru-cache": { + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-5.1.1.tgz", + "integrity": "sha512-KpNARQA3Iwv+jTA0utUVVbrh+Jlrr1Fv0e56GGzAFOXN7dk/FviaDW8LHmK52DlcH4WP2n6gI8vN1aesBFgo9w==", + "dev": true, + "license": "ISC", + "dependencies": { + "yallist": "^3.0.2" + } + }, + "node_modules/lucide-react": { + "version": "0.474.0", + "resolved": "https://registry.npmjs.org/lucide-react/-/lucide-react-0.474.0.tgz", + "integrity": "sha512-CmghgHkh0OJNmxGKWc0qfPJCYHASPMVSyGY8fj3xgk4v84ItqDg64JNKFZn5hC6E0vHi6gxnbCgwhyVB09wQtA==", + "license": "ISC", + "peerDependencies": { + "react": "^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/merge2": { + "version": "1.4.1", + "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 8" + } + }, + "node_modules/micromatch": { + "version": "4.0.8", + "resolved": "https://registry.npmjs.org/micromatch/-/micromatch-4.0.8.tgz", + "integrity": "sha512-PXwfBhYu0hBCPw8Dn0E+WDYb7af3dSLVWKi3HGv84IdF4TyFoC0ysxFd0Goxw7nSv4T/PzEJQxsYsEiFCKo2BA==", + "dev": true, + "license": "MIT", + "dependencies": { + "braces": "^3.0.3", + "picomatch": "^2.3.1" + }, + "engines": { + "node": ">=8.6" + } + }, + "node_modules/ms": { + "version": "2.1.3", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", + "integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA==", + "dev": true, + "license": "MIT" + }, + "node_modules/mz": { + "version": "2.7.0", + "resolved": "https://registry.npmjs.org/mz/-/mz-2.7.0.tgz", + "integrity": "sha512-z81GNO7nnYMEhrGh9LeymoE4+Yr0Wn5McHIZMK5cfQCl+NDX08sCZgUc9/6MHni9IWuFLm1Z3HTCXu2z9fN62Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0", + "object-assign": "^4.0.1", + "thenify-all": "^1.0.0" + } + }, + "node_modules/nanoid": { + "version": "3.3.20", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.20.tgz", + "integrity": "sha512-uKdg2G3GNCKQn9byYOpxbGqrT2fGO5KRt5J/8b3pok8rT6qxGWF6hxMyJiEYtAf+FVyYuD9hRaDqX5uPFYJ4ZQ==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "bin": { + "nanoid": "bin/nanoid.cjs" + }, + "engines": { + "node": "^10 || ^12 || ^13.7 || ^14 || >=15.0.1" + } + }, + "node_modules/node-releases": { + "version": "2.0.60", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.60.tgz", + "integrity": "sha512-OmO8+GM1JUZqXET720VrJCwkjUCXmCMQm0Z3UDDRbfNLHS4NEAvY60j5jiFv0tkKw2PNNlqOLhahVmwJIOLDIQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=18" + } + }, + "node_modules/normalize-path": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/normalize-path/-/normalize-path-3.0.0.tgz", + "integrity": "sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-assign": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz", + "integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==", + "dev": true, + "license": "MIT" + }, + "node_modules/picocolors": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", + "dev": true, + "license": "ISC" + }, + "node_modules/picomatch": { + "version": "2.3.2", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-2.3.2.tgz", + "integrity": "sha512-V7+vQEJ06Z+c5tSye8S+nHUfI51xoXIXjHQ99cQtKUkQqqO1kO/KCJUfZXuB47h/YBlDhah2H3hdUGXn8ie0oA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=8.6" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/pirates": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/pirates/-/pirates-4.0.7.tgz", + "integrity": "sha512-TfySrs/5nm8fQJDcBDuUng3VOUKsd7S+zqvbOTiGXHfxX4wK31ard+hoNuvkicM/2YFzlpDgABOevKSsB4G/FA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 6" + } + }, + "node_modules/postcss": { + "version": "8.5.32", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.32.tgz", + "integrity": "sha512-LJlKCCAUFKOuZxipUdYw1NzIITEsPcgyOG9LkvRJvuKj/bRzbuRY0ARXvL0pWGpsZvn8jku+LMep2eU0seHp8g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/postcss" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "nanoid": "^3.3.20", + "picocolors": "^1.1.1", + "source-map-js": "^1.2.2" + }, + "engines": { + "node": "^10 || ^12 || >=14" + } + }, + "node_modules/postcss-import": { + "version": "15.1.0", + "resolved": "https://registry.npmjs.org/postcss-import/-/postcss-import-15.1.0.tgz", + "integrity": "sha512-hpr+J05B2FVYUAXHeK1YyI267J/dDDhMU6B6civm8hSY1jYJnBXxzKDKDswzJmtLHryrjhnDjqqp/49t8FALew==", + "dev": true, + "license": "MIT", + "dependencies": { + "postcss-value-parser": "^4.0.0", + "read-cache": "^1.0.0", + "resolve": "^1.1.7" + }, + "engines": { + "node": ">=14.0.0" + }, + "peerDependencies": { + "postcss": "^8.0.0" + } + }, + "node_modules/postcss-js": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/postcss-js/-/postcss-js-4.1.0.tgz", + "integrity": "sha512-oIAOTqgIo7q2EOwbhb8UalYePMvYoIeRY2YKntdpFQXNosSu3vLrniGgmH9OKs/qAkfoj5oB3le/7mINW1LCfw==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "camelcase-css": "^2.0.1" + }, + "engines": { + "node": "^12 || ^14 || >= 16" + }, + "peerDependencies": { + "postcss": "^8.4.21" + } + }, + "node_modules/postcss-load-config": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/postcss-load-config/-/postcss-load-config-6.0.1.tgz", + "integrity": "sha512-oPtTM4oerL+UXmx+93ytZVN82RrlY/wPUV8IeDxFrzIjXOLF1pN+EmKPLbubvKHT2HC20xXsCAH2Z+CKV6Oz/g==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "lilconfig": "^3.1.1" + }, + "engines": { + "node": ">= 18" + }, + "peerDependencies": { + "jiti": ">=1.21.0", + "postcss": ">=8.0.9", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "jiti": { + "optional": true + }, + "postcss": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/postcss-nested": { + "version": "6.2.0", + "resolved": "https://registry.npmjs.org/postcss-nested/-/postcss-nested-6.2.0.tgz", + "integrity": "sha512-HQbt28KulC5AJzG+cZtj9kvKB93CFCdLvog1WFLf1D+xmMvPGlBstkpTEZfK5+AN9hfJocyBFCNiqyS48bpgzQ==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/postcss/" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "postcss-selector-parser": "^6.1.1" + }, + "engines": { + "node": ">=12.0" + }, + "peerDependencies": { + "postcss": "^8.2.14" + } + }, + "node_modules/postcss-selector-parser": { + "version": "6.1.5", + "resolved": "https://registry.npmjs.org/postcss-selector-parser/-/postcss-selector-parser-6.1.5.tgz", + "integrity": "sha512-TEHFzb5KRDKaOgJ4TYE+0jyJtFbjLvkdVOu0fZ2b6MTWzoqZd4Le+61aEppWkvTlYePgOX4ATL1wsAIPMLTw6Q==", + "dev": true, + "license": "MIT", + "dependencies": { + "cssesc": "^3.0.0", + "util-deprecate": "^1.0.2" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/postcss-value-parser": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/postcss-value-parser/-/postcss-value-parser-4.2.0.tgz", + "integrity": "sha512-1NNCs6uurfkVbeXG4S8JFT9t19m45ICnif8zWLd5oPSZ50QnwMfK+H3jv408d4jw/7Bttv5axS5IiHoLaVNHeQ==", + "dev": true, + "license": "MIT" + }, + "node_modules/qrcode.react": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/qrcode.react/-/qrcode.react-4.2.0.tgz", + "integrity": "sha512-QpgqWi8rD9DsS9EP3z7BT+5lY5SFhsqGjpgW5DY/i3mK4M9DTBNz3ErMi8BWYEfI3L0d8GIbGmcdFAS1uIRGjA==", + "license": "ISC", + "peerDependencies": { + "react": "^16.8.0 || ^17.0.0 || ^18.0.0 || ^19.0.0" + } + }, + "node_modules/queue-microtask": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz", + "integrity": "sha512-NuaNSa6flKT5JaSYQzJok04JzTL1CA6aGhv5rfLW3PgqA+M2ChpZQnAC8h8i4ZFkBS8X5RqkDBHA7r4hej3K9A==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT" + }, + "node_modules/react": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react/-/react-18.3.1.tgz", + "integrity": "sha512-wS+hAgJShR0KhEvPJArfuPVN1+Hz1t0Y6n5jLrGQbkb4urgPE/0Rve+1kMB1v/oWgHgm4WIcV+i7F2pTVj+2iQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + }, + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/react-dom": { + "version": "18.3.1", + "resolved": "https://registry.npmjs.org/react-dom/-/react-dom-18.3.1.tgz", + "integrity": "sha512-5m4nQKp+rZRb09LNH59GM4BxTh9251/ylbKIbpe7TpGxfJ+9kv6BLkLBXIjjspbgbnIBNqlI23tRnTWT0snUIw==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0", + "scheduler": "^0.23.2" + }, + "peerDependencies": { + "react": "^18.3.1" + } + }, + "node_modules/react-refresh": { + "version": "0.17.0", + "resolved": "https://registry.npmjs.org/react-refresh/-/react-refresh-0.17.0.tgz", + "integrity": "sha512-z6F7K9bV85EfseRCp2bzrpyQ0Gkw1uLoCel9XBVWPg/TjRj94SkJzUTGfOa4bs7iJvBWtQG0Wq7wnI0syw3EBQ==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/read-cache": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.2.tgz", + "integrity": "sha512-/peqiBB/n07gQGLsWaHho3WfvUyRscw0gYTsEFMhrIe/nWLkYaf5SbKYjGYqtRV3aPwykJgF2VEMo1ac4bnsGA==", + "dev": true, + "license": "MIT" + }, + "node_modules/readdirp": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/readdirp/-/readdirp-3.6.0.tgz", + "integrity": "sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA==", + "dev": true, + "license": "MIT", + "dependencies": { + "picomatch": "^2.2.1" + }, + "engines": { + "node": ">=8.10.0" + } + }, + "node_modules/resolve": { + "version": "1.22.13", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.13.tgz", + "integrity": "sha512-Dj/cW9zBV2aRj6XzCxuGIs3ESZKv02jixne3q6jFZYZ3/Tg09gHHviSMDL4kObh9pqSahdRHEnDoaP2gn8YLhA==", + "dev": true, + "license": "MIT", + "dependencies": { + "es-errors": "^1.3.0", + "is-core-module": "^2.17.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/reusify": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.1.0.tgz", + "integrity": "sha512-g6QUff04oZpHs0eG5p83rFLhHeV00ug/Yf9nZM6fLeUrPguBTkTQOdpAWWspMh55TZfVQDPaN3NQJfbVRAxdIw==", + "dev": true, + "license": "MIT", + "engines": { + "iojs": ">=1.0.0", + "node": ">=0.10.0" + } + }, + "node_modules/rollup": { + "version": "4.65.1", + "resolved": "https://registry.npmjs.org/rollup/-/rollup-4.65.1.tgz", + "integrity": "sha512-HzD4IdphaPMvuAacnL/vtoq5B8FwqewKvxTtqYibWvP6VDyZ+UsTtlw5F8HIOIIpLQAkN2NOP/0sM3puo9xN/A==", + "dev": true, + "license": "MIT", + "dependencies": { + "@types/estree": "1.0.9" + }, + "bin": { + "rollup": "dist/bin/rollup" + }, + "engines": { + "node": ">=18.0.0", + "npm": ">=8.0.0" + }, + "optionalDependencies": { + "@napi-rs/lzma-linux-x64-gnu": "1.5.1", + "@rollup/rollup-android-arm-eabi": "4.65.1", + "@rollup/rollup-android-arm64": "4.65.1", + "@rollup/rollup-darwin-arm64": "4.65.1", + "@rollup/rollup-darwin-x64": "4.65.1", + "@rollup/rollup-freebsd-arm64": "4.65.1", + "@rollup/rollup-freebsd-x64": "4.65.1", + "@rollup/rollup-linux-arm-gnueabihf": "4.65.1", + "@rollup/rollup-linux-arm-musleabihf": "4.65.1", + "@rollup/rollup-linux-arm64-gnu": "4.65.1", + "@rollup/rollup-linux-arm64-musl": "4.65.1", + "@rollup/rollup-linux-loong64-gnu": "4.65.1", + "@rollup/rollup-linux-loong64-musl": "4.65.1", + "@rollup/rollup-linux-ppc64-gnu": "4.65.1", + "@rollup/rollup-linux-ppc64-musl": "4.65.1", + "@rollup/rollup-linux-riscv64-gnu": "4.65.1", + "@rollup/rollup-linux-riscv64-musl": "4.65.1", + "@rollup/rollup-linux-s390x-gnu": "4.65.1", + "@rollup/rollup-linux-x64-gnu": "4.65.1", + "@rollup/rollup-linux-x64-musl": "4.65.1", + "@rollup/rollup-openbsd-x64": "4.65.1", + "@rollup/rollup-openharmony-arm64": "4.65.1", + "@rollup/rollup-win32-arm64-msvc": "4.65.1", + "@rollup/rollup-win32-ia32-msvc": "4.65.1", + "@rollup/rollup-win32-x64-gnu": "4.65.1", + "@rollup/rollup-win32-x64-msvc": "4.65.1", + "fsevents": "~2.3.2" + } + }, + "node_modules/run-parallel": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", + "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/feross" + }, + { + "type": "patreon", + "url": "https://www.patreon.com/feross" + }, + { + "type": "consulting", + "url": "https://feross.org/support" + } + ], + "license": "MIT", + "dependencies": { + "queue-microtask": "^1.2.2" + } + }, + "node_modules/scheduler": { + "version": "0.23.2", + "resolved": "https://registry.npmjs.org/scheduler/-/scheduler-0.23.2.tgz", + "integrity": "sha512-UOShsPwz7NrMUqhR6t0hWjFduvOzbtv7toDH1/hIrfRNIDBnnBWd0CwJTGvTpngVlmwGCdP9/Zl/tVrDqcuYzQ==", + "license": "MIT", + "dependencies": { + "loose-envify": "^1.1.0" + } + }, + "node_modules/semver": { + "version": "6.3.1", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.1.tgz", + "integrity": "sha512-BR7VvDCVHO+q2xBEWskxS6DJE1qRnb7DxzUrogb71CWoSficBxYsiAGd+Kl0mmq/MprG9yArRkyrQxTO6XjMzA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + } + }, + "node_modules/sharp": { + "version": "0.35.5", + "resolved": "https://registry.npmjs.org/sharp/-/sharp-0.35.5.tgz", + "integrity": "sha512-Ywn4OnzGukp7CDMrp08RQ50YKmuwG47brZgIVPTvBaaAfQlRlygrRqSrxdCiL9M+LlzLBiJ68IR1QqvzHyjC7g==", + "dev": true, + "license": "Apache-2.0", + "dependencies": { + "@img/colour": "^1.1.0", + "detect-libc": "^2.1.2", + "semver": "^7.8.5" + }, + "engines": { + "node": ">=20.9.0" + }, + "funding": { + "url": "https://opencollective.com/libvips" + }, + "optionalDependencies": { + "@img/sharp-darwin-arm64": "0.35.5", + "@img/sharp-darwin-x64": "0.35.5", + "@img/sharp-freebsd-wasm32": "0.35.5", + "@img/sharp-libvips-darwin-arm64": "1.3.4", + "@img/sharp-libvips-darwin-x64": "1.3.4", + "@img/sharp-libvips-linux-arm": "1.3.4", + "@img/sharp-libvips-linux-arm64": "1.3.4", + "@img/sharp-libvips-linux-ppc64": "1.3.4", + "@img/sharp-libvips-linux-riscv64": "1.3.4", + "@img/sharp-libvips-linux-s390x": "1.3.4", + "@img/sharp-libvips-linux-x64": "1.3.4", + "@img/sharp-libvips-linuxmusl-arm64": "1.3.4", + "@img/sharp-libvips-linuxmusl-x64": "1.3.4", + "@img/sharp-linux-arm": "0.35.5", + "@img/sharp-linux-arm64": "0.35.5", + "@img/sharp-linux-ppc64": "0.35.5", + "@img/sharp-linux-riscv64": "0.35.5", + "@img/sharp-linux-s390x": "0.35.5", + "@img/sharp-linux-x64": "0.35.5", + "@img/sharp-linuxmusl-arm64": "0.35.5", + "@img/sharp-linuxmusl-x64": "0.35.5", + "@img/sharp-webcontainers-wasm32": "0.35.5", + "@img/sharp-win32-arm64": "0.35.5", + "@img/sharp-win32-ia32": "0.35.5", + "@img/sharp-win32-x64": "0.35.5" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + } + } + }, + "node_modules/sharp/node_modules/semver": { + "version": "7.8.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.8.5.tgz", + "integrity": "sha512-Y7/KDsb8LjooZpwaqGyulO6DQlksgCncchHGk+sZIY4SBvUocMBEFH5Ur1fI4dV+Jvl0w6cjvucaIi40puRioA==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/source-map-js": { + "version": "1.2.2", + "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.2.tgz", + "integrity": "sha512-KGj/8Y43x35aZVDtt+J4mK1hoLGHULMYfSkODJNQjNDC3oW1PqPoxMwo0pLUsWM/UEGzON/NxeHywEfNXNP3Vw==", + "dev": true, + "license": "BSD-3-Clause", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/sucrase": { + "version": "3.35.1", + "resolved": "https://registry.npmjs.org/sucrase/-/sucrase-3.35.1.tgz", + "integrity": "sha512-DhuTmvZWux4H1UOnWMB3sk0sbaCVOoQZjv8u1rDoTV0HTdGem9hkAZtl4JZy8P2z4Bg0nT+YMeOFyVr4zcG5Tw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@jridgewell/gen-mapping": "^0.3.2", + "commander": "^4.0.0", + "lines-and-columns": "^1.1.6", + "mz": "^2.7.0", + "pirates": "^4.0.1", + "tinyglobby": "^0.2.11", + "ts-interface-checker": "^0.1.9" + }, + "bin": { + "sucrase": "bin/sucrase", + "sucrase-node": "bin/sucrase-node" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/tailwindcss": { + "version": "3.4.19", + "resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.19.tgz", + "integrity": "sha512-3ofp+LL8E+pK/JuPLPggVAIaEuhvIz4qNcf3nA1Xn2o/7fb7s/TYpHhwGDv1ZU3PkBluUVaF8PyCHcm48cKLWQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "@alloc/quick-lru": "^5.2.0", + "arg": "^5.0.2", + "chokidar": "^3.6.0", + "didyoumean": "^1.2.2", + "dlv": "^1.1.3", + "fast-glob": "^3.3.2", + "glob-parent": "^6.0.2", + "is-glob": "^4.0.3", + "jiti": "^1.21.7", + "lilconfig": "^3.1.3", + "micromatch": "^4.0.8", + "normalize-path": "^3.0.0", + "object-hash": "^3.0.0", + "picocolors": "^1.1.1", + "postcss": "^8.4.47", + "postcss-import": "^15.1.0", + "postcss-js": "^4.0.1", + "postcss-load-config": "^4.0.2 || ^5.0 || ^6.0", + "postcss-nested": "^6.2.0", + "postcss-selector-parser": "^6.1.2", + "resolve": "^1.22.8", + "sucrase": "^3.35.0" + }, + "bin": { + "tailwind": "lib/cli.js", + "tailwindcss": "lib/cli.js" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/thenify": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/thenify/-/thenify-3.3.1.tgz", + "integrity": "sha512-RVZSIV5IG10Hk3enotrhvz0T9em6cyHBLkH/YAZuKqd8hRkKhSfCGIcP2KUY0EPxndzANBmNllzWPwak+bheSw==", + "dev": true, + "license": "MIT", + "dependencies": { + "any-promise": "^1.0.0" + } + }, + "node_modules/thenify-all": { + "version": "1.6.0", + "resolved": "https://registry.npmjs.org/thenify-all/-/thenify-all-1.6.0.tgz", + "integrity": "sha512-RNxQH/qI8/t3thXJDwcstUO4zeqo64+Uy/+sNVRBx4Xn2OX+OZ9oP+iJnNFqplFra2ZUVeKCSa2oVWi3T4uVmA==", + "dev": true, + "license": "MIT", + "dependencies": { + "thenify": ">= 3.1.0 < 4" + }, + "engines": { + "node": ">=0.8" + } + }, + "node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "dev": true, + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, + "node_modules/tinyglobby/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/tinyglobby/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/to-regex-range": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", + "integrity": "sha512-65P7iz6X5yEr1cwcgvQxbbIw7Uk3gOy5dIdtZ4rDveLqhrdJP+Li/Hx6tyK0NEb+2GCyneCMJiGqrADCSNk8sQ==", + "dev": true, + "license": "MIT", + "dependencies": { + "is-number": "^7.0.0" + }, + "engines": { + "node": ">=8.0" + } + }, + "node_modules/ts-interface-checker": { + "version": "0.1.13", + "resolved": "https://registry.npmjs.org/ts-interface-checker/-/ts-interface-checker-0.1.13.tgz", + "integrity": "sha512-Y/arvbn+rrz3JCKl9C4kVNfTfSm2/mEp5FSz5EsZSANGPSlQrpRI5M4PKF+mJnE52jOO90PnPSc3Ur3bTQw0gA==", + "dev": true, + "license": "Apache-2.0" + }, + "node_modules/tslib": { + "version": "2.9.1", + "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.9.1.tgz", + "integrity": "sha512-a4Ux9VKuIMHsOS7ENbEq6hK2ZGYIT27Rtl0E4eD9KqwxhKiQeMZE/9xb3IdYwWaSOyIBQLExhQgXDTYoiCxnWA==", + "dev": true, + "license": "0BSD", + "optional": true + }, + "node_modules/update-browserslist-db": { + "version": "1.3.4", + "resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.3.4.tgz", + "integrity": "sha512-t8wonIOdQyOjtPd2VktlBu6QjTVTks6v8bSi7kd0r2Vll8TK1JYDZtRRdbmCHOAMphkZgrzK+L+vXK4pyZ8t4A==", + "dev": true, + "funding": [ + { + "type": "opencollective", + "url": "https://opencollective.com/browserslist" + }, + { + "type": "tidelift", + "url": "https://tidelift.com/funding/github/npm/browserslist" + }, + { + "type": "github", + "url": "https://github.com/sponsors/ai" + } + ], + "license": "MIT", + "dependencies": { + "escalade": "^3.2.0", + "picocolors": "^1.1.1" + }, + "bin": { + "update-browserslist-db": "cli.js" + }, + "peerDependencies": { + "browserslist": ">= 4.21.0" + } + }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==", + "dev": true, + "license": "MIT" + }, + "node_modules/vite": { + "version": "6.4.5", + "resolved": "https://registry.npmjs.org/vite/-/vite-6.4.5.tgz", + "integrity": "sha512-4enwjFfi4IwtEh0w+jPzpLVOFQiPHmmzPxcHXQOyEur47o6u0jE573DmGpjA+7irXoMLYRZD5ZaFUEneS3abPg==", + "dev": true, + "license": "MIT", + "dependencies": { + "esbuild": "^0.25.0", + "fdir": "^6.4.4", + "picomatch": "^4.0.2", + "postcss": "^8.5.3", + "rollup": "^4.34.9", + "tinyglobby": "^0.2.13" + }, + "bin": { + "vite": "bin/vite.js" + }, + "engines": { + "node": "^18.0.0 || ^20.0.0 || >=22.0.0" + }, + "funding": { + "url": "https://github.com/vitejs/vite?sponsor=1" + }, + "optionalDependencies": { + "fsevents": "~2.3.3" + }, + "peerDependencies": { + "@types/node": "^18.0.0 || ^20.0.0 || >=22.0.0", + "jiti": ">=1.21.0", + "less": "*", + "lightningcss": "^1.21.0", + "sass": "*", + "sass-embedded": "*", + "stylus": "*", + "sugarss": "*", + "terser": "^5.16.0", + "tsx": "^4.8.1", + "yaml": "^2.4.2" + }, + "peerDependenciesMeta": { + "@types/node": { + "optional": true + }, + "jiti": { + "optional": true + }, + "less": { + "optional": true + }, + "lightningcss": { + "optional": true + }, + "sass": { + "optional": true + }, + "sass-embedded": { + "optional": true + }, + "stylus": { + "optional": true + }, + "sugarss": { + "optional": true + }, + "terser": { + "optional": true + }, + "tsx": { + "optional": true + }, + "yaml": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/vite/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "dev": true, + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/yallist": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-3.1.1.tgz", + "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", + "dev": true, + "license": "ISC" + } + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000..b96579e --- /dev/null +++ b/package.json @@ -0,0 +1,39 @@ +{ + "name": "ld-fdpi", + "private": true, + "version": "1.7.0", + "description": "LD FDPI - zero-touch AmneziaWG VPN and SpoofDPI DPI bypass for Windows (Tauri v2, Rust, React)", + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "preview": "vite preview", + "tauri": "node scripts/tauri.js", + "check:rust": "node scripts/cargo.js check", + "setup:sidecar": "node scripts/download-sidecar.js", + "icon:make": "node scripts/make-icon.mjs", + "test": "node scripts/verify-all.mjs", + "test:gui": "node scripts/e2e-gui.mjs" + }, + "dependencies": { + "@tauri-apps/api": "^2.2.0", + "@tauri-apps/plugin-updater": "^2.14.1", + "dompurify": "^3.2.3", + "lucide-react": "^0.474.0", + "qrcode.react": "^4.2.0", + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@tauri-apps/cli": "^2.2.0", + "@types/dompurify": "^3.0.5", + "@types/react": "^18.3.18", + "@types/react-dom": "^18.3.5", + "@vitejs/plugin-react": "^4.3.4", + "autoprefixer": "^10.4.20", + "postcss": "^8.5.1", + "sharp": "^0.35.5", + "tailwindcss": "^3.4.17", + "vite": "^6.0.7" + } +} diff --git a/postcss.config.js b/postcss.config.js new file mode 100644 index 0000000..2e7af2b --- /dev/null +++ b/postcss.config.js @@ -0,0 +1,6 @@ +export default { + plugins: { + tailwindcss: {}, + autoprefixer: {}, + }, +} diff --git a/public/logo.png b/public/logo.png new file mode 100644 index 0000000..ec4bf01 Binary files /dev/null and b/public/logo.png differ diff --git a/scripts/cargo.js b/scripts/cargo.js new file mode 100644 index 0000000..0d94b18 --- /dev/null +++ b/scripts/cargo.js @@ -0,0 +1,18 @@ +/** + * `npm run check:rust ` / `npm run build:rust` wrapper. + * Runs Cargo inside src-tauri with a space-free CARGO_TARGET_DIR. + */ +import { spawnSync } from "node:child_process"; +import path from "node:path"; +import { ROOT, resolveTargetDir } from "./target-dir.js"; + +const cargo = process.env.CARGO || "cargo"; +const targetDir = resolveTargetDir(); + +const result = spawnSync(cargo, process.argv.slice(2), { + stdio: "inherit", + cwd: path.join(ROOT, "src-tauri"), + env: { ...process.env, CARGO_TARGET_DIR: targetDir }, +}); + +process.exit(result.status ?? 1); diff --git a/scripts/download-sidecar.js b/scripts/download-sidecar.js new file mode 100644 index 0000000..c14caa6 --- /dev/null +++ b/scripts/download-sidecar.js @@ -0,0 +1,117 @@ +/** + * LD FDPI — fetch the *real* SpoofDPI Windows x64 engine. + * + * There is no stub branch: this script either installs a verified official binary + * (SpoofDPI 0.12.2, the last release that ships a Windows build) or exits with an + * error. The old version silently wrote a 32-byte "MZ-...-STUB" file, which made + * `tauri build` succeed while the application could never bypass anything. + * + * Usage: npm run setup:sidecar [-- --force] + */ +import fs from "node:fs"; +import path from "node:path"; +import crypto from "node:crypto"; +import { execFileSync } from "node:child_process"; +import { fileURLToPath } from "node:url"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const ROOT = path.resolve(__dirname, ".."); +const BIN_DIR = path.join(ROOT, "src-tauri", "binaries"); + +const VERSION = "0.12.2"; +const ASSET_URL = `https://github.com/xvzc/spoofdpi/releases/download/v${VERSION}/spoofdpi-windows-amd64.exe`; +// SHA-256 of the official release asset (computed from the downloaded v0.12.2 exe). +const SHA256 = "16a5c81265d908d31aaf9be69d577ec91588282ae5c366cc73e8bff878a3ea5e"; +const MIN_SIZE = 1_500_000; + +const TARGETS = [ + path.join(BIN_DIR, "spoofdpi-x86_64-pc-windows-gnu.exe"), + path.join(BIN_DIR, "spoofdpi-x86_64-pc-windows-msvc.exe"), +]; + +const force = process.argv.includes("--force"); + +function sha256(file) { + return crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex"); +} + +function isValid(file) { + try { + const stat = fs.statSync(file); + if (!stat.isFile() || stat.size < MIN_SIZE) return false; + const fd = fs.openSync(file, "r"); + const header = Buffer.alloc(2); + fs.readSync(fd, header, 0, 2, 0); + fs.closeSync(fd); + return header[0] === 0x4d && header[1] === 0x5a && sha256(file) === SHA256; + } catch { + return false; + } +} + +function printVersion(file) { + try { + execFileSync(file, ["-v"], { stdio: "inherit", windowsHide: true }); + return true; + } catch (error) { + console.error("[LD FDPI] Binary could not be executed:", error.message); + return false; + } +} + +fs.mkdirSync(BIN_DIR, { recursive: true }); +fs.writeFileSync(path.join(BIN_DIR, ".gitkeep"), ""); + +if (!force && TARGETS.every(isValid)) { + console.log("[LD FDPI] Verified SpoofDPI", VERSION, "is already installed."); + printVersion(TARGETS[0]); + process.exit(0); +} + +for (const existing of TARGETS) { + if (fs.existsSync(existing) && fs.statSync(existing).size < MIN_SIZE) { + console.warn("[LD FDPI] Removing placeholder sidecar:", existing); + fs.unlinkSync(existing); + } +} + +const tempFile = path.join(BIN_DIR, `spoofdpi-${VERSION}.download.exe`); +console.log("[LD FDPI] Downloading official SpoofDPI", VERSION, "Windows x64 engine..."); +console.log(" ", ASSET_URL); + +const response = await fetch(ASSET_URL, { redirect: "follow" }); +if (!response.ok) { + console.error(`[LD FDPI] Download failed: HTTP ${response.status} ${response.statusText}`); + process.exit(1); +} +const buffer = Buffer.from(await response.arrayBuffer()); +fs.writeFileSync(tempFile, buffer); + +const digest = sha256(tempFile); +if (digest !== SHA256) { + fs.unlinkSync(tempFile); + console.error("[LD FDPI] SHA-256 mismatch — refusing to install an unverified binary."); + console.error(" expected:", SHA256); + console.error(" actual: ", digest); + process.exit(1); +} +if (buffer.length < MIN_SIZE || buffer[0] !== 0x4d || buffer[1] !== 0x5a) { + fs.unlinkSync(tempFile); + console.error("[LD FDPI] Downloaded file is not a valid Windows PE binary."); + process.exit(1); +} + +for (const target of TARGETS) { + fs.copyFileSync(tempFile, target); +} +fs.unlinkSync(tempFile); + +console.log("[LD FDPI] Installed verified engine (SHA-256 OK,", buffer.length, "bytes):"); +for (const target of TARGETS) { + console.log(" ", target); +} + +if (!printVersion(TARGETS[0])) { + process.exit(1); +} +console.log("[LD FDPI] Sidecar ready."); diff --git a/scripts/e2e-gui.mjs b/scripts/e2e-gui.mjs new file mode 100644 index 0000000..5ceb54b --- /dev/null +++ b/scripts/e2e-gui.mjs @@ -0,0 +1,531 @@ +/** + * LD FDPI — GUI end-to-end smoke test (WebView2 CDP). + * + * Covers the new "set & forget" behaviour: + * 1. Real Tauri IPC + simplified UI render + * 2. BAĞLAN / BAĞLANTIYI KES through the actual buttons + * 3. LAN sharing rebinds SpoofDPI to 0.0.0.0 and back + * 4. config.json round-trip (camelCase persistence) + * 5. `--minimized` silent start: hidden window, auto-connect before React + * 6. Task Scheduler autostart path (admin warning in an asInvoker test build) + * + * Usage: LD_FDPI_NO_ADMIN=1 npm run tauri build -- --no-bundle && npm run test:gui + */ +import { spawn, spawnSync } from "node:child_process"; +import fs from "node:fs"; +import net from "node:net"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const CONFIG_DIR = path.join(process.env.LOCALAPPDATA || os.tmpdir(), "LD-FDPI"); +const CONFIG_PATH = path.join(CONFIG_DIR, "config.json"); + +const exeCandidates = [ + process.argv[2], + path.join(ROOT, "..", ".ld-fdpi-target", "release", "ld-fdpi.exe"), + path.join(ROOT, "src-tauri", "target", "release", "ld-fdpi.exe"), +].filter(Boolean); +const exe = exeCandidates.find((p) => fs.existsSync(p)); +if (!exe) { + console.error("ld-fdpi.exe bulunamadı. Önce `npm run tauri build -- --no-bundle` çalıştırın."); + process.exit(1); +} + +const BASE_CONFIG = { + version: 1, + autoStart: false, + autoConnect: false, + minimizeToTray: true, + lanSharing: false, + connectionMode: "normal", + bypassMode: 1, + chunkSize: 8, + dohProvider: "cloudflare", + proxyPort: 18080, + pacPort: 18081, +}; + +const sleep = (ms) => new Promise((r) => setTimeout(r, ms)); + +function readConfigFile() { + try { + return JSON.parse(fs.readFileSync(CONFIG_PATH, "utf8")); + } catch { + return null; + } +} + +const originalConfig = readConfigFile(); + +// Always restore the user's config, even if a check throws. +process.on("exit", () => { + try { + restoreConfig(); + } catch { + /* ignore */ + } +}); + +function writeConfig(overrides = {}) { + fs.mkdirSync(CONFIG_DIR, { recursive: true }); + fs.writeFileSync(CONFIG_PATH, JSON.stringify({ ...BASE_CONFIG, ...overrides }, null, 2)); +} + +function restoreConfig() { + fs.mkdirSync(CONFIG_DIR, { recursive: true }); + if (originalConfig) { + fs.writeFileSync(CONFIG_PATH, JSON.stringify(originalConfig, null, 2)); + } else { + fs.writeFileSync(CONFIG_PATH, JSON.stringify(BASE_CONFIG, null, 2)); + } +} + +function freePort(start) { + return new Promise((resolve) => { + const server = net.createServer(); + server.unref(); + server.once("error", () => resolve(freePort(start + 1))); + server.listen(start, "127.0.0.1", () => { + const { port } = server.address(); + server.close(() => resolve(port)); + }); + }); +} + +/** TCP reachability (proves 0.0.0.0 vs 127.0.0.1 binding). */ +function canConnect(host, port, timeoutMs = 2500) { + return new Promise((resolve) => { + const socket = net.connect({ host, port }); + let done = false; + const finish = (ok) => { + if (done) return; + done = true; + try { + socket.destroy(); + } catch { + /* ignore */ + } + resolve(ok); + }; + socket.setTimeout(timeoutMs, () => finish(false)); + socket.once("connect", () => finish(true)); + socket.once("error", () => finish(false)); + }); +} + +class Cdp { + constructor(url) { + this.ws = new WebSocket(url); + this.nextId = 0; + this.pending = new Map(); + this.ready = new Promise((resolve, reject) => { + this.ws.onopen = resolve; + this.ws.onerror = reject; + }); + this.ws.onmessage = (event) => { + const message = JSON.parse(event.data); + if (message.id && this.pending.has(message.id)) { + this.pending.get(message.id)(message); + this.pending.delete(message.id); + } + }; + } + + async send(method, params = {}) { + await this.ready; + const id = ++this.nextId; + const promise = new Promise((resolve) => this.pending.set(id, resolve)); + this.ws.send(JSON.stringify({ id, method, params })); + return promise; + } + + async eval(expression, awaitPromise = false) { + const response = await this.send("Runtime.evaluate", { + expression, + awaitPromise, + returnByValue: true, + userGesture: true, + }); + if (response.result?.exceptionDetails) { + throw new Error( + response.result.exceptionDetails.exception?.description || + JSON.stringify(response.result.exceptionDetails) + ); + } + return response.result?.result?.value; + } + + async invoke(command, args = {}) { + const raw = await this.eval( + `window.__TAURI_INTERNALS__.invoke(${JSON.stringify(command)}, ${JSON.stringify( + args + )}).then(r => JSON.stringify({ ok: true, value: r })).catch(e => JSON.stringify({ ok: false, error: String(e) }))`, + true + ); + const parsed = JSON.parse(raw); + if (!parsed.ok) throw new Error(parsed.error); + return parsed.value; + } + + async click(label) { + return this.eval( + `(() => { const b = [...document.querySelectorAll('button')].find(x => x.innerText.trim() === ${JSON.stringify( + label + )}); if (!b) return false; b.click(); return true; })()` + ); + } + + close() { + try { + this.ws.close(); + } catch { + /* ignore */ + } + } +} + +async function waitForCdp(port, timeoutMs = 30000) { + const deadline = Date.now() + timeoutMs; + while (Date.now() < deadline) { + try { + const list = await fetch(`http://127.0.0.1:${port}/json/list`).then((r) => r.json()); + const page = list.find((t) => t.type === "page"); + if (page?.webSocketDebuggerUrl) return page; + } catch { + /* not up yet */ + } + await sleep(250); + } + throw new Error("WebView2 CDP endpoint açılmadı (başka bir örnek çalışıyor olabilir)"); +} + +async function launch({ args = [], cdpPort }) { + const child = spawn(exe, args, { + env: { + ...process.env, + WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: `--remote-debugging-port=${cdpPort}`, + }, + stdio: "ignore", + }); + + const page = await waitForCdp(cdpPort); + const cdp = new Cdp(page.webSocketDebuggerUrl); + await cdp.ready; + + for (let i = 0; i < 120; i++) { + const state = JSON.parse( + await cdp.eval( + "JSON.stringify({ ready: document.readyState, internals: typeof window.__TAURI_INTERNALS__?.invoke, body: (document.body && document.body.innerText || '').length })" + ) + ); + if (state.ready === "complete" && state.internals === "function" && state.body > 20) break; + await sleep(250); + } + + return { child, cdp }; +} + +async function stopSession(session) { + if (!session) return; + try { + if (session.cdp) { + await Promise.race([session.cdp.invoke("stop_connection"), sleep(3000)]); + } + } catch { + /* ignore */ + } + session.cdp?.close(); + if (session.child) { + session.child.kill(); + await sleep(800); + } + // Last-resort cleanup: restore a dirty proxy even if the app was killed. + try { + spawnSync(exe, ["--restore-only"], { windowsHide: true, stdio: "ignore" }); + } catch { + /* ignore */ + } +} + +let passed = 0; +let failed = 0; +function check(name, ok, detail = "") { + console.log(`${ok ? "PASS" : "FAIL"} ${name}${detail ? ` — ${detail}` : ""}`); + if (ok) passed++; + else failed++; +} + +// --------------------------------------------------------------------------- +// Session 1: normal launch, UI click-through, LAN, config persistence +// --------------------------------------------------------------------------- +writeConfig(); +let session = null; +try { + session = await launch({ cdpPort: 9333 }); + const { cdp, child } = session; + + const internals = JSON.parse( + await cdp.eval( + "JSON.stringify({ obj: typeof window.__TAURI_INTERNALS__, invoke: typeof window.__TAURI_INTERNALS__?.invoke })" + ) + ); + check( + "Tauri v2 çalışma zamanı enjekte edildi", + internals.obj === "object" && internals.invoke === "function", + JSON.stringify(internals) + ); + + const init = await cdp.invoke("get_initial_state"); + check( + "get_initial_state · gerçek motor", + init.engineFound === true && Boolean(init.engineVersion), + `${init.engineVersion} | admin=${init.isAdmin}` + ); + + let body = ""; + for (let i = 0; i < 40; i++) { + body = await cdp.eval("document.body.innerText"); + if (body.includes("BAĞLAN")) break; + await sleep(250); + } + check( + "Sadeleştirilmiş arayüz çizildi", + body.includes("BAĞLAN") && body.includes("Bağlantı") && !body.includes("ClientHello"), + `${body.length} karakter` + ); + + const status0 = await cdp.invoke("get_status"); + check("Normal başlatmada pencere görünür", status0.windowVisible === true, ""); + check("Açılışta bağlı değil (autoConnect kapalı)", status0.isConnected === false, ""); + + const diag = await cdp.invoke("run_diagnostics"); + check( + "run_diagnostics gerçek sonuçlar", + Array.isArray(diag) && diag.length >= 6, + Array.isArray(diag) ? `${diag.filter((d) => d.passed).length}/${diag.length}` : String(diag) + ); + + // LAN while disconnected + const lanPacPort = await freePort(18181); + const lan = await cdp.invoke("toggle_lan_sharing", { + enabled: true, + proxyPort: 18080, + pacPort: lanPacPort, + }); + const pacBody = await fetch(`http://127.0.0.1:${lanPacPort}/proxy.pac`) + .then((r) => r.text()) + .catch(() => ""); + check( + "LAN paylaşımı + PAC sunucusu", + lan.enabled === true && pacBody.includes("FindProxyForURL"), + lan.pacUrl + ); + await cdp.invoke("toggle_lan_sharing", { + enabled: false, + proxyPort: 18080, + pacPort: lanPacPort, + }); + + // Connect through the real button + check("BAĞLAN düğmesi bulundu", (await cdp.click("BAĞLAN")) === true, ""); + let connectedText = ""; + for (let i = 0; i < 160; i++) { + connectedText = await cdp.eval("document.body.innerText"); + if (connectedText.includes("FDPI Bağlı")) break; + await sleep(250); + } + check( + "Arayüz 'FDPI Bağlı'", + connectedText.includes("FDPI Bağlı"), + connectedText.includes("Bağlantı başlatılamadı") ? "arayüzde hata var" : "" + ); + + const status1 = await cdp.invoke("get_status"); + check( + "Motor + proxy gerçekten etkin", + status1.isConnected === true && status1.engineAlive === true && status1.proxyRouted === true, + `engine=${status1.engineAlive} proxy=${status1.proxyRouted}` + ); + + const reg = await cdp.invoke("get_initial_state"); + check( + "Windows proxy'si yazıldı", + reg.systemProxy?.proxyEnable === 1 && reg.systemProxy?.pointsToLdFdpiPort === 18080, + `ProxyEnable=${reg.systemProxy?.proxyEnable} ProxyServer=${reg.systemProxy?.proxyServer}` + ); + + const persisted = readConfigFile(); + check( + "config.json kalıcı (camelCase)", + persisted?.proxyPort === 18080 && + persisted?.connectionMode === "normal" && + persisted?.autoConnect === false, + `${CONFIG_PATH}` + ); + + // LAN while connected → 0.0.0.0 rebind + const lanIp = reg.localIp; + const lanPac2 = await freePort(18281); + const lanOn = await cdp.invoke("toggle_lan_sharing", { + enabled: true, + proxyPort: 18080, + pacPort: lanPac2, + }); + const lanReachable = await canConnect(lanIp, 18080); + check( + "LAN açıkken motor 0.0.0.0'da", + lanOn.enabled === true && lanReachable === true, + `${lanIp}:18080 reachable=${lanReachable}` + ); + await cdp.invoke("toggle_lan_sharing", { + enabled: false, + proxyPort: 18080, + pacPort: lanPac2, + }); + const lanClosed = await canConnect(lanIp, 18080); + check( + "LAN kapatınca 127.0.0.1'e döndü", + lanClosed === false, + `${lanIp}:18080 reachable=${lanClosed}` + ); + + // Settings persistence through save_config + const saved = await cdp.invoke("save_config", { + config: { + ...reg.config, + bypassMode: 2, + chunkSize: 4, + dohProvider: "google", + minimizeToTray: false, + }, + }); + const afterSave = readConfigFile(); + check( + "Ayarlar diske yazıldı", + afterSave?.bypassMode === 2 && + afterSave?.chunkSize === 4 && + afterSave?.dohProvider === "google" && + afterSave?.minimizeToTray === false, + `warning=${saved.warning || "yok"}` + ); + + if (!init.isAdmin) { + const auto = await cdp.invoke("save_config", { + config: { ...saved.config, autoStart: true }, + }); + check( + "Autostart, yönetici olmadan uyarı üretiyor", + // A pre-existing elevated task from an older install can leave the + // effective flag true even though apply() failed; the warning invariant + // is what matters in this asInvoker test build. + Boolean(auto.warning), + auto.warning || "" + ); + await cdp.invoke("save_config", { + config: { ...auto.config, autoStart: false }, + }); + } + + // Restore the test settings + await cdp.invoke("save_config", { + config: { + ...saved.config, + bypassMode: 1, + chunkSize: 8, + dohProvider: "cloudflare", + minimizeToTray: true, + }, + }); + + // Disconnect through the real button + check("BAĞLANTIYI KES düğmesi bulundu", (await cdp.click("BAĞLANTIYI KES")) === true, ""); + let disconnectedText = ""; + for (let i = 0; i < 80; i++) { + disconnectedText = await cdp.eval("document.body.innerText"); + if (disconnectedText.includes("Bağlı Değil")) break; + await sleep(250); + } + check("Arayüz 'Bağlı Değil'", disconnectedText.includes("Bağlı Değil"), ""); + + const after = await cdp.invoke("get_initial_state"); + check( + "Proxy orijinal değerine döndü", + after.systemProxy?.proxyEnable === 0 && after.systemProxy?.proxyServer === null, + `ProxyEnable=${after.systemProxy?.proxyEnable} ProxyServer=${after.systemProxy?.proxyServer}` + ); + + child.kill(); + await sleep(800); +} catch (error) { + check("GUI oturumu 1", false, error.message); +} finally { + await stopSession(session); +} + +// --------------------------------------------------------------------------- +// Session 2: --minimized + auto_connect, before React +// --------------------------------------------------------------------------- +writeConfig({ autoConnect: true, proxyPort: 18090, pacPort: 18091 }); +session = null; +try { + session = await launch({ args: ["--minimized"], cdpPort: 9334 }); + const { cdp } = session; + + let autoStatus = null; + for (let i = 0; i < 120; i++) { + autoStatus = await cdp.invoke("get_status"); + if (autoStatus.isConnected) break; + await sleep(250); + } + + check( + "--minimized otomatik bağlandı", + autoStatus?.isConnected === true && autoStatus?.proxyRouted === true, + `connected=${autoStatus?.isConnected} routed=${autoStatus?.proxyRouted}` + ); + check( + "Sessiz başlangıçta pencere gizli", + autoStatus?.windowVisible === false, + `windowVisible=${autoStatus?.windowVisible}` + ); + + const init2 = await cdp.invoke("get_initial_state"); + check( + "Otomatik bağlantı kaydedilmiş ayarları kullandı", + init2.isConnected === true && init2.config.proxyPort === 18090, + `port=${init2.config.proxyPort}` + ); + + // The hidden webview may lag behind the backend poll; stop through IPC. + const stopRes = await cdp.invoke("stop_connection"); + await sleep(1000); + check( + "Otomatik oturum bağlantıyı kesti", + stopRes.connected === false && stopRes.restoredOriginalProxy === true, + stopRes.message + ); + + const stopped = await cdp.invoke("get_initial_state"); + check( + "Otomatik oturum proxy'yi geri yükledi", + stopped.systemProxy?.proxyEnable === 0, + `ProxyEnable=${stopped.systemProxy?.proxyEnable}` + ); + + session.child.kill(); + await sleep(800); +} catch (error) { + check("GUI oturumu 2 (auto-connect)", false, error.message); +} finally { + await stopSession(session); +} + +// --------------------------------------------------------------------------- +// Restore the user's original config +// --------------------------------------------------------------------------- +restoreConfig(); + +console.log(`\nSONUÇ: ${passed} başarılı, ${failed} başarısız`); +process.exit(failed === 0 ? 0 : 1); diff --git a/scripts/make-icon.mjs b/scripts/make-icon.mjs new file mode 100644 index 0000000..6fb65e9 --- /dev/null +++ b/scripts/make-icon.mjs @@ -0,0 +1,47 @@ +/** + * Builds app-icon.png (1024) and public/logo.png (512) from the supplied + * 2048x2048 transparent PNG. Run: npm run icon:make + */ +import fs from "node:fs"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; +import sharp from "sharp"; + +const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const SOURCE = path.join(ROOT, "assets", "branding", "ld-fdpi-logo-source.png"); +const APP_ICON = path.join(ROOT, "app-icon.png"); +const PUBLIC_LOGO = path.join(ROOT, "public", "logo.png"); + +if (!fs.existsSync(SOURCE)) { + console.error("assets/branding/ld-fdpi-logo-source.png bulunamadı."); + process.exit(1); +} + +// The source already has transparent corners; trim the transparent margin so +// the mark fills the taskbar/installer icon instead of looking tiny. +const base = sharp(SOURCE) + .ensureAlpha() + .trim({ background: { r: 0, g: 0, b: 0, alpha: 0 }, threshold: 10 }); + +await base + .clone() + .resize(1024, 1024, { + fit: "contain", + background: { r: 0, g: 0, b: 0, alpha: 0 }, + }) + .png({ compressionLevel: 9, adaptiveFiltering: true }) + .toFile(APP_ICON); + +await base + .clone() + .resize(512, 512, { + fit: "contain", + background: { r: 0, g: 0, b: 0, alpha: 0 }, + }) + .png({ compressionLevel: 9, adaptiveFiltering: true }) + .toFile(PUBLIC_LOGO); + +const meta = await sharp(APP_ICON).metadata(); +console.log( + `[LD FDPI] app-icon.png ${meta.width}x${meta.height}; public/logo.png 512x512` +); diff --git a/scripts/patch-manifest.mjs b/scripts/patch-manifest.mjs new file mode 100644 index 0000000..4eb99bc --- /dev/null +++ b/scripts/patch-manifest.mjs @@ -0,0 +1,100 @@ +/** + * Replaces the Windows application manifest of the built executable. + * + * Why this is needed: with the GNU toolchain the MinGW CRT embeds its own + * `asInvoker` manifest (RT_MANIFEST id 1) in addition to the one generated by + * `tauri-winres`. GNU ld reports "multiple non-default manifests" and Windows + * ends up honouring the CRT's asInvoker manifest, so `requireAdministrator` + * never takes effect. `rcedit` rewrites the resource table with exactly one + * manifest, which makes UAC work. + * + * Runs automatically from `scripts/tauri.js` after `tauri build`; skipped for + * the `LD_FDPI_NO_ADMIN=1` test build. + */ +import crypto from "node:crypto"; +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { spawnSync } from "node:child_process"; +import { ROOT, resolveTargetDir } from "./target-dir.js"; + +const RCEDIT_VERSION = "2.0.0"; +const RCEDIT_URL = `https://github.com/electron/rcedit/releases/download/v${RCEDIT_VERSION}/rcedit-x64.exe`; +const RCEDIT_SHA256 = "3e7801db1a5edbec91b49a24a094aad776cb4515488ea5a4ca2289c400eade2a"; +const TOOLS_DIR = path.join( + process.env.LOCALAPPDATA || os.tmpdir(), + "LD-FDPI", + "build-tools" +); + +function sha256(file) { + return crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex"); +} + +async function ensureRcedit() { + const cached = path.join(TOOLS_DIR, "rcedit-x64.exe"); + if (fs.existsSync(cached) && sha256(cached) === RCEDIT_SHA256) { + return cached; + } + fs.mkdirSync(TOOLS_DIR, { recursive: true }); + console.log("[LD FDPI] Downloading rcedit (manifest patcher)..."); + const response = await fetch(RCEDIT_URL, { redirect: "follow" }); + if (!response.ok) { + throw new Error(`rcedit indirilemedi: HTTP ${response.status}`); + } + const buffer = Buffer.from(await response.arrayBuffer()); + const digest = crypto.createHash("sha256").update(buffer).digest("hex"); + if (digest !== RCEDIT_SHA256) { + throw new Error(`rcedit SHA-256 uyuşmuyor (${digest})`); + } + fs.writeFileSync(cached, buffer); + return cached; +} + +export async function patchManifest() { + const exe = path.join(resolveTargetDir(), "release", "ld-fdpi.exe"); + if (!fs.existsSync(exe)) { + throw new Error(`Derlenmiş uygulama bulunamadı: ${exe}`); + } + + const manifest = path.join(ROOT, "src-tauri", "windows-app-manifest.xml"); + if (!fs.existsSync(manifest)) { + throw new Error(`Manifest bulunamadı: ${manifest}`); + } + + const before = fs.readFileSync(exe); + if (before.includes(Buffer.from("asInvoker"))) { + const rcedit = await ensureRcedit(); + const ico = path.join(ROOT, "src-tauri", "icons", "icon.ico"); + const rceditArgs = [exe, "--application-manifest", manifest]; + if (fs.existsSync(ico)) { + rceditArgs.push("--set-icon", ico); + } + const result = spawnSync(rcedit, rceditArgs, { + stdio: "inherit", + windowsHide: true, + }); + if (result.status !== 0) { + throw new Error(`rcedit başarısız (çıkış kodu ${result.status})`); + } + } + + const after = fs.readFileSync(exe); + const hasAdmin = after.includes(Buffer.from("requireAdministrator")); + const hasInvoker = after.includes(Buffer.from("asInvoker")); + if (!hasAdmin || hasInvoker) { + throw new Error( + `Manifest doğrulanamadı (requireAdministrator=${hasAdmin}, asInvoker=${hasInvoker}).` + ); + } + console.log("[LD FDPI] UAC manifest doğrulandı: requireAdministrator"); + return exe; +} + +// Allow direct invocation: node scripts/patch-manifest.mjs +if (import.meta.url === `file://${process.argv[1].replace(/\\/g, "/")}`) { + patchManifest().catch((error) => { + console.error("[LD FDPI]", error.message); + process.exit(1); + }); +} diff --git a/scripts/security-e2e.mjs b/scripts/security-e2e.mjs new file mode 100644 index 0000000..99e7219 --- /dev/null +++ b/scripts/security-e2e.mjs @@ -0,0 +1,351 @@ +/** + * LD FDPI — network security regression test. + * + * * LAN off => SpoofDPI listens on 127.0.0.1 only (LAN IP refused). + * * LAN on => 0.0.0.0 works for private peers, PAC answers normally. + * * PAC request cap: >4096 bytes => 413. + * * PAC slowloris timeout: 5 s => 408 / close. + * * LAN off again => PAC closed, engine back to loopback. + * + * Usage: LD_FDPI_NO_ADMIN=1 npm run tauri build -- --no-bundle && node scripts/security-e2e.mjs + */ +import { spawn, spawnSync } from "node:child_process"; +import fs from "node:fs"; +import net from "node:net"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); +const CONFIG_DIR = path.join(process.env.LOCALAPPDATA || os.tmpdir(), "LD-FDPI"); +const CONFIG_PATH = path.join(CONFIG_DIR, "config.json"); +const exe = + [process.argv[2], path.join(ROOT, "..", ".ld-fdpi-target", "release", "ld-fdpi.exe")].find( + (candidate) => candidate && fs.existsSync(candidate) + ) || ""; + +const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms)); +const originalConfig = fs.existsSync(CONFIG_PATH) ? fs.readFileSync(CONFIG_PATH, "utf8") : null; + +const BASE = { + version: 1, + autoStart: false, + autoConnect: false, + minimizeToTray: true, + lanSharing: false, + connectionMode: "normal", + bypassMode: 1, + chunkSize: 8, + dohProvider: "cloudflare", + proxyPort: 18480, + pacPort: 18481, +}; + +function writeConfig() { + fs.mkdirSync(CONFIG_DIR, { recursive: true }); + fs.writeFileSync(CONFIG_PATH, JSON.stringify(BASE, null, 2)); +} + +function restoreConfig() { + if (originalConfig !== null) fs.writeFileSync(CONFIG_PATH, originalConfig); + else fs.writeFileSync(CONFIG_PATH, JSON.stringify({ ...BASE, autoStart: true, autoConnect: true }, null, 2)); +} + +function canConnect(host, port, timeout = 2000) { + return new Promise((resolve) => { + const socket = net.connect({ host, port }); + let done = false; + const finish = (ok) => { + if (done) return; + done = true; + try { + socket.destroy(); + } catch { + /* ignore */ + } + resolve(ok); + }; + socket.setTimeout(timeout, () => finish(false)); + socket.once("connect", () => finish(true)); + socket.once("error", () => finish(false)); + }); +} + +function request(port, payload, waitMs = 9000) { + return new Promise((resolve) => { + const socket = net.connect({ host: "127.0.0.1", port }); + let data = ""; + let done = false; + const finish = (value) => { + if (done) return; + done = true; + try { + socket.destroy(); + } catch { + /* ignore */ + } + resolve(value); + }; + socket.setTimeout(waitMs, () => finish(data || "TIMEOUT")); + socket.once("error", (error) => finish(data || `ERROR:${error.code}`)); + socket.once("connect", () => socket.write(payload)); + socket.on("data", (chunk) => { + data += chunk.toString("latin1"); + if (data.includes("\r\n\r\n")) { + // Wait a moment for the body, then return. + setTimeout(() => finish(data), 80); + } + }); + socket.on("end", () => finish(data)); + }); +} + +class Cdp { + constructor(url) { + this.ws = new WebSocket(url); + this.id = 0; + this.pending = new Map(); + this.ready = new Promise((resolve, reject) => { + this.ws.onopen = resolve; + this.ws.onerror = reject; + }); + this.ws.onmessage = (event) => { + const message = JSON.parse(event.data); + if (message.id && this.pending.has(message.id)) { + this.pending.get(message.id)(message); + this.pending.delete(message.id); + } + }; + } + async eval(expression, awaitPromise = false) { + await this.ready; + const id = ++this.id; + const response = new Promise((resolve) => this.pending.set(id, resolve)); + this.ws.send( + JSON.stringify({ + id, + method: "Runtime.evaluate", + params: { expression, awaitPromise, returnByValue: true, userGesture: true }, + }) + ); + const result = await response; + if (result.result?.exceptionDetails) { + throw new Error(JSON.stringify(result.result.exceptionDetails)); + } + return result.result?.result?.value; + } + async invoke(command, args = {}) { + const raw = await this.eval( + `window.__TAURI_INTERNALS__.invoke(${JSON.stringify(command)}, ${JSON.stringify( + args + )}).then(r => JSON.stringify({ ok: true, value: r })).catch(e => JSON.stringify({ ok: false, error: String(e) }))`, + true + ); + const parsed = JSON.parse(raw); + if (!parsed.ok) throw new Error(parsed.error); + return parsed.value; + } + close() { + try { + this.ws.close(); + } catch { + /* ignore */ + } + } +} + +async function waitForCdp(port) { + for (let i = 0; i < 120; i++) { + try { + const list = await fetch(`http://127.0.0.1:${port}/json/list`).then((r) => r.json()); + const page = list.find((t) => t.type === "page"); + if (page?.webSocketDebuggerUrl) return page; + } catch { + /* not up */ + } + await sleep(250); + } + throw new Error("CDP endpoint açılmadı"); +} + +let passed = 0; +let failed = 0; +const check = (name, ok, detail = "") => { + console.log(`${ok ? "PASS" : "FAIL"} ${name}${detail ? ` — ${detail}` : ""}`); + if (ok) passed++; + else failed++; +}; + +if (!exe) { + console.error("ld-fdpi.exe bulunamadı."); + process.exit(1); +} + +writeConfig(); +process.on("exit", () => { + try { + restoreConfig(); + } catch { + /* ignore */ + } +}); + +const child = spawn(exe, [], { + env: { ...process.env, WEBVIEW2_ADDITIONAL_BROWSER_ARGUMENTS: "--remote-debugging-port=9337" }, + stdio: "ignore", +}); +let cdp = null; + +try { + const page = await waitForCdp(9337); + cdp = new Cdp(page.webSocketDebuggerUrl); + await cdp.ready; + for (let i = 0; i < 100; i++) { + const ready = await cdp.eval( + "typeof window.__TAURI_INTERNALS__?.invoke === 'function' && (document.body?.innerText || '').includes('BAĞLAN')" + ); + if (ready) break; + await sleep(250); + } + + // LAN off: engine must be loopback-only + const conn = await cdp.invoke("start_connection", { + config: { + connectionMode: "normal", + bypassMode: 1, + chunkSize: 8, + dohProvider: "cloudflare", + lanSharing: true, // deliberately malicious/stale: must be ignored + proxyPort: 18480, + pacPort: 18481, + }, + }); + const init = await cdp.invoke("get_initial_state"); + const lanIp = init.localIp; + // Small wait for the engine to be fully wired. + await sleep(300); + const loopbackOnly = !(await canConnect(lanIp, 18480)); + check( + "LAN kapalıyken motor yalnızca 127.0.0.1'de", + conn.connected === true && loopbackOnly, + `${lanIp}:18480 reachable=${!loopbackOnly}` + ); + + // Enable LAN + const pacPort = 18481; + const lan = await cdp.invoke("toggle_lan_sharing", { + enabled: true, + proxyPort: 18480, + pacPort, + }); + const lanReachable = await canConnect(lanIp, 18480); + check( + "LAN açıkken özel ağdan erişilebilir", + lan.enabled === true && lanReachable === true, + `${lanIp}:18480` + ); + + const normal = await request(pacPort, "GET /proxy.pac HTTP/1.1\r\nHost: 127.0.0.1\r\nConnection: close\r\n\r\n"); + check( + "PAC normal istek 200", + normal.startsWith("HTTP/1.1 200") && normal.includes("FindProxyForURL"), + normal.split("\r\n")[0] + ); + + const oversized = await request( + pacPort, + `GET / HTTP/1.1\r\nHost: x\r\n${"A".repeat(5000)}` + ); + check( + "PAC 4096 bayt sınırı (413)", + oversized.includes("413"), + oversized.split("\r\n")[0] || oversized + ); + + const slow = await new Promise((resolve) => { + const socket = net.connect({ host: "127.0.0.1", port: pacPort }, () => socket.write("G")); + let data = ""; + socket.on("data", (chunk) => { + data += chunk.toString("latin1"); + }); + socket.on("end", () => resolve(data)); + socket.on("error", () => resolve(data)); + setTimeout(() => { + socket.destroy(); + resolve(data); + }, 7000); + }); + check( + "PAC 5 sn Slowloris zaman aşımı (408 / kapanış)", + slow.includes("408") || slow.length === 0, + slow.split("\r\n")[0] || "bağlantı kapandı" + ); + + // Disable LAN: PAC must be gone, engine loopback only + await cdp.invoke("toggle_lan_sharing", { enabled: false, proxyPort: 18480, pacPort }); + await sleep(400); + const pacClosed = !(await canConnect("127.0.0.1", pacPort)); + const loopbackAgain = !(await canConnect(lanIp, 18480)); + check( + "LAN kapatınca PAC kapanır + motor loopback'e döner", + pacClosed && loopbackAgain, + `pacClosed=${pacClosed} loopback=${loopbackAgain}` + ); + + const stop = await cdp.invoke("stop_connection"); + check("Bağlantı kesildi ve proxy geri yüklendi", stop.restoredOriginalProxy === true, stop.message); + + // Eduroam mode smoke test. On this desktop there is no Wi-Fi adapter, so the + // mode must still connect (WinHTTP + WinINet) and report an honest warning. + const eduroamPort = 18482; + const eduroamPac = 18483; + const edu = await cdp.invoke("start_connection", { + config: { + connectionMode: "eduroam", + bypassMode: 1, + chunkSize: 4, + dohProvider: "auto", + lanSharing: false, + proxyPort: eduroamPort, + pacPort: eduroamPac, + }, + }); + check( + "Eduroam Modu bağlanır (Wi-Fi yoksa dürüst uyarı)", + edu.connected === true && Boolean(edu.warning), + edu.warning || edu.message + ); + const eduStatus = await cdp.invoke("get_eduroam_status"); + check( + "Eduroam durumu SSID/MTU/802.1X alanlarını döndürür", + eduStatus?.targetMtu === 1400 && typeof eduStatus?.wifi?.available === "boolean", + `ssid=${eduStatus?.wifi?.ssid || "—"} mtu=${eduStatus?.mtu ?? "—"}` + ); + const eduDiag = await cdp.invoke("run_eduroam_diagnostics"); + check( + "Eduroam ağ testi (SSID/MTU/Discord TCP/UDP)", + Array.isArray(eduDiag) && eduDiag.length >= 6, + Array.isArray(eduDiag) ? `${eduDiag.filter((item) => item.passed).length}/${eduDiag.length}` : "—" + ); + const eduStop = await cdp.invoke("stop_connection"); + check( + "Eduroam modu kapanınca proxy/MTU geri yüklenir", + eduStop.restoredOriginalProxy === true, + eduStop.message + ); +} catch (error) { + check("Güvenlik E2E", false, error.message); +} finally { + cdp?.close(); + child.kill(); + await sleep(800); + try { + spawnSync(exe, ["--restore-only"], { windowsHide: true, stdio: "ignore" }); + } catch { + /* ignore */ + } +} + +restoreConfig(); +console.log(`\nSONUÇ: ${passed} başarılı, ${failed} başarısız`); +process.exit(failed === 0 ? 0 : 1); diff --git a/scripts/target-dir.js b/scripts/target-dir.js new file mode 100644 index 0000000..8d12df9 --- /dev/null +++ b/scripts/target-dir.js @@ -0,0 +1,28 @@ +/** + * Resolves a space-free Cargo target directory. + * + * Why this exists: on Windows with the `x86_64-pc-windows-gnu` toolchain, + * `tauri-winres` → `embed-resource` → GNU `windres` passes the output/include + * directory to `cc1` without quoting. A project path containing a space + * (e.g. "...\LD FDPI\...") therefore aborts the build with: + * cc1.exe: fatal error: FDPI\src-tauri\target\...: No such file or directory + * + * We keep the target directory as a sibling of the project when that path is + * space-free, and fall back to %LOCALAPPDATA% otherwise. Fully relative and + * machine-independent. + */ +import fs from "node:fs"; +import os from "node:os"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +export const ROOT = path.resolve(path.dirname(fileURLToPath(import.meta.url)), ".."); + +export function resolveTargetDir() { + let dir = path.resolve(ROOT, "..", ".ld-fdpi-target"); + if (dir.includes(" ")) { + dir = path.join(process.env.LOCALAPPDATA || os.tmpdir(), "ld-fdpi-build", "target"); + } + fs.mkdirSync(dir, { recursive: true }); + return dir; +} diff --git a/scripts/tauri.js b/scripts/tauri.js new file mode 100644 index 0000000..bc05d2c --- /dev/null +++ b/scripts/tauri.js @@ -0,0 +1,67 @@ +/** + * `npm run tauri ` wrapper. + * + * 1. Sets CARGO_TARGET_DIR to a space-free path so GNU windres does not break on + * spaces in the project path (see target-dir.js). + * 2. After `build`, replaces the executable's manifest with the single + * `requireAdministrator` one (GNU ld otherwise keeps the CRT's asInvoker + * manifest and UAC never triggers). + * 3. Re-runs `tauri bundle` so the installer contains the patched executable. + * + * Set LD_FDPI_NO_ADMIN=1 for an asInvoker test build (skips the manifest patch). + */ +import { spawnSync } from "node:child_process"; +import path from "node:path"; +import { ROOT, resolveTargetDir } from "./target-dir.js"; +import { patchManifest } from "./patch-manifest.mjs"; + +const cli = path.join(ROOT, "node_modules", "@tauri-apps", "cli", "tauri.js"); +const targetDir = resolveTargetDir(); +const env = { ...process.env, CARGO_TARGET_DIR: targetDir }; +const args = process.argv.slice(2); + +const noAdmin = Boolean(process.env.LD_FDPI_NO_ADMIN); +const command = args[0]; +const isBuild = command === "build"; +const isBundle = command === "bundle"; +const noBundle = args.includes("--no-bundle"); + +console.log(`[LD FDPI] CARGO_TARGET_DIR=${targetDir}`); + +function run(list) { + const result = spawnSync(process.execPath, [cli, ...list], { + stdio: "inherit", + cwd: ROOT, + env, + }); + return result.status ?? 1; +} + +(async () => { + // Test builds stay asInvoker so they can be launched without UAC. + if (noAdmin) { + process.exit(run(args)); + } + + if (isBundle) { + await patchManifest(); + process.exit(run(args)); + } + + if (isBuild && !noBundle) { + const buildStatus = run([...args, "--no-bundle"]); + if (buildStatus !== 0) process.exit(buildStatus); + await patchManifest(); + // Package the already-patched binary into the NSIS installer. + process.exit(run(["bundle"])); + } + + const status = run(args); + if (status === 0 && isBuild) { + await patchManifest(); + } + process.exit(status); +})().catch((error) => { + console.error("[LD FDPI]", error.message); + process.exit(1); +}); diff --git a/scripts/verify-all.mjs b/scripts/verify-all.mjs new file mode 100644 index 0000000..0c5023b --- /dev/null +++ b/scripts/verify-all.mjs @@ -0,0 +1,543 @@ +/** + * LD FDPI — real end-to-end verification suite. + * + * Unlike the previous suite (which asserted that fabricated flags and simulation + * branches existed), every check here validates behaviour that actually ships: + * the official binary hash, the real SpoofDPI 0.12.2 argv, the absence of mock + * fallbacks, and a live TLS handshake through the spawned proxy. + * + * Run with: npm test + */ +import assert from "node:assert/strict"; +import crypto from "node:crypto"; +import { spawn } from "node:child_process"; +import fs from "node:fs"; +import net from "node:net"; +import path from "node:path"; +import { fileURLToPath } from "node:url"; + +import { + SPOOFDPI_VERSION, + DOH_PROVIDERS, + buildSpoofDpiArgs, + generatePacScript, + getDohIpv4, + windowSizeFor, +} from "../src/utils/engineArgs.js"; + +const __dirname = path.dirname(fileURLToPath(import.meta.url)); +const ROOT = path.resolve(__dirname, ".."); +const BIN_DIR = path.join(ROOT, "src-tauri", "binaries"); +const SIDECAR = path.join(BIN_DIR, "spoofdpi-x86_64-pc-windows-gnu.exe"); +const SIDECAR_SHA256 = + "16a5c81265d908d31aaf9be69d577ec91588282ae5c366cc73e8bff878a3ea5e"; + +let passed = 0; +let failed = 0; + +async function runTest(name, fn) { + try { + await fn(); + console.log(`PASS ${name}`); + passed++; + } catch (error) { + console.error(`FAIL ${name}\n ${error.message}`); + failed++; + } +} + +const read = (rel) => fs.readFileSync(path.join(ROOT, rel), "utf8"); +const sha256 = (file) => + crypto.createHash("sha256").update(fs.readFileSync(file)).digest("hex"); + +function freePort() { + return new Promise((resolve, reject) => { + const server = net.createServer(); + server.unref(); + server.on("error", reject); + server.listen(0, "127.0.0.1", () => { + const { port } = server.address(); + server.close(() => resolve(port)); + }); + }); +} + +function waitForPort(port, timeoutMs = 8000) { + const deadline = Date.now() + timeoutMs; + return new Promise((resolve, reject) => { + const attempt = () => { + const socket = net.connect({ host: "127.0.0.1", port }); + socket.setTimeout(400); + socket.once("connect", () => { + socket.destroy(); + resolve(); + }); + socket.once("timeout", () => { + socket.destroy(); + retry(); + }); + socket.once("error", () => { + socket.destroy(); + retry(); + }); + }; + const retry = () => { + if (Date.now() > deadline) reject(new Error(`${port} dinlenmeye başlamadı`)); + else setTimeout(attempt, 120); + }; + attempt(); + }); +} + +import tls from "node:tls"; + +/** CONNECT + full TLS handshake (certificate validated) through the local proxy. */ +function probeThroughProxy(port, host = "discord.com", timeoutMs = 10000) { + return new Promise((resolve) => { + const socket = net.connect({ host: "127.0.0.1", port }); + let settled = false; + const finish = (result) => { + if (settled) return; + settled = true; + try { + socket.destroy(); + } catch { + /* ignore */ + } + resolve(result); + }; + + socket.setTimeout(timeoutMs, () => + finish({ connect: false, tls: false, detail: "timeout" }) + ); + socket.once("error", (error) => + finish({ connect: false, tls: false, detail: error.code || error.message }) + ); + socket.once("connect", () => + socket.write(`CONNECT ${host}:443 HTTP/1.1\r\nHost: ${host}:443\r\n\r\n`, "ascii") + ); + + let head = Buffer.alloc(0); + const onData = (chunk) => { + head = Buffer.concat([head, chunk]); + const end = head.indexOf("\r\n\r\n"); + if (end === -1) return; + socket.removeListener("data", onData); + const status = head.subarray(0, end).toString("ascii").split("\r\n")[0]; + if (!status.includes("200")) { + finish({ connect: false, tls: false, detail: status }); + return; + } + + const leftover = head.subarray(end + 4); + socket.pause(); + if (leftover.length > 0) socket.unshift(leftover); + + const tlsSocket = tls.connect( + { socket, servername: host, rejectUnauthorized: true }, + () => { + tlsSocket.write( + `HEAD / HTTP/1.1\r\nHost: ${host}\r\nConnection: close\r\n\r\n` + ); + tlsSocket.once("data", (response) => { + const line = response.toString("ascii").split("\r\n")[0]; + finish({ + connect: true, + tls: line.startsWith("HTTP/"), + detail: `TLS ${tlsSocket.getProtocol()} — ${line}`, + }); + }); + } + ); + tlsSocket.once("error", (error) => + finish({ connect: true, tls: false, detail: `TLS: ${error.message}` }) + ); + tlsSocket.setTimeout(timeoutMs, () => + finish({ connect: true, tls: false, detail: "TLS timeout" }) + ); + }; + socket.on("data", onData); + }); +} + +console.log("=============================================================="); +console.log("LD FDPI — gerçek uçtan uca doğrulama (SpoofDPI " + SPOOFDPI_VERSION + ")"); +console.log("==============================================================\n"); + +await runTest("1. Sidecar gerçek SpoofDPI ikilisi (boyut + PE + SHA-256 + sürüm)", async () => { + assert.ok(fs.existsSync(SIDECAR), `Eksik: ${SIDECAR}`); + const stat = fs.statSync(SIDECAR); + assert.ok(stat.size > 1_500_000, `Sahte/eksik ikili: ${stat.size} bayt`); + const header = fs.readFileSync(SIDECAR).subarray(0, 2).toString("latin1"); + assert.equal(header, "MZ", "PE başlığı yok"); + assert.equal(sha256(SIDECAR), SIDECAR_SHA256, "Resmi sürümle SHA-256 uyuşmuyor"); + const { spawnSync } = await import("node:child_process"); + const run = spawnSync(SIDECAR, ["-v"], { encoding: "utf8", windowsHide: true }); + const out = `${run.stdout || ""}${run.stderr || ""}`; + assert.ok(out.includes(`spoofdpi v${SPOOFDPI_VERSION}`), `Beklenmeyen sürüm: ${out}`); +}); + +await runTest("2. CLI argümanları gerçek SpoofDPI 0.12.2 bayraklarıyla uyumlu", async () => { + const rust = read("src-tauri/src/engine.rs"); + assert.ok(rust.includes('"-listen-addr"'), "Rust -listen-addr göndermiyor"); + assert.ok(rust.includes('"-listen-port"'), "Rust -listen-port göndermiyor"); + assert.ok(rust.includes('"-system-proxy=false"'), "SpoofDPI kendi system proxy'sini yönetmemeli"); + assert.ok(rust.includes('"-enable-doh"'), "DoH kapalı"); + assert.ok(!rust.includes('"-addr"'), "Var olmayan -addr bayrağı hâlâ kodda"); + assert.ok(!rust.includes('"-port"'), "Var olmayan -port bayrağı hâlâ kodda"); + assert.ok(!rust.includes("--mode"), "Uydurma --mode bayrağı"); + assert.ok(!rust.includes("--chunk-size"), "Uydurma --chunk-size bayrağı"); + assert.ok(!rust.includes("--disorder"), "Uydurma --disorder bayrağı"); + + const args = buildSpoofDpiArgs({ proxyPort: 8080, bypassMode: 1, chunkSize: 8, dohProvider: "cloudflare" }); + assert.deepEqual(args, [ + "-listen-addr", "127.0.0.1", + "-listen-port", "8080", + "-dns-addr", "1.1.1.1", + "-enable-doh", + "-system-proxy=false", + "-window-size", "8", + "-timeout", "8000", + "-silent", + ]); + assert.equal(windowSizeFor({ bypassMode: 0 }), 1); + assert.equal(windowSizeFor({ bypassMode: 1, chunkSize: 16 }), 16); + assert.equal(windowSizeFor({ bypassMode: 2, chunkSize: 16 }), 2); +}); + +await runTest("3. DoH sağlayıcıları yalnızca IP sertifikası geçerli olanlar", async () => { + assert.deepEqual(DOH_PROVIDERS.map((p) => p.id), ["cloudflare", "google", "adguard"]); + assert.equal(getDohIpv4("google"), "8.8.8.8"); + assert.equal(getDohIpv4("adguard"), "94.140.14.14"); + assert.equal(getDohIpv4("quad9"), "1.1.1.1", "Desteklenmeyen sağlayıcı güvenli varsayılana düşmeli"); + const i18n = read("src/i18n.js"); + assert.ok(!i18n.includes("quad9"), "Kaldırılan Quad9 seçeneği arayüzde duruyor"); +}); + +await runTest("4. Tauri v2 yapılandırması: externalBin, CSP/IPC, shell yetkisi yok", async () => { + const conf = JSON.parse(read("src-tauri/tauri.conf.json")); + assert.deepEqual(conf.bundle.externalBin, ["binaries/spoofdpi"]); + assert.ok(conf.app.security.csp.includes("ipc:"), "CSP ipc: şemasına izin vermiyor"); + assert.ok( + conf.app.security.csp.includes("http://ipc.localhost"), + "CSP http://ipc.localhost adresine izin vermiyor" + ); + const cap = JSON.parse(read("src-tauri/capabilities/default.json")); + const flat = JSON.stringify(cap.permissions); + assert.ok(!flat.includes("shell:"), "Webview'e shell yetkisi verilmiş"); + assert.ok(cap.windows.includes("main"), "Capability ana pencereye bağlı değil"); +}); + +await runTest("5. Frontend sahte/simülasyon modu içermiyor", async () => { + const bridge = read("src/utils/tauriBridge.js"); + const args = read("src/utils/engineArgs.js"); + assert.ok(args.includes("window.__TAURI_INTERNALS__"), "Tauri tespiti yok"); + assert.ok(bridge.includes("isTauriRuntime"), "Köprü Tauri tespitini kullanmıyor"); + assert.ok(!bridge.includes("simulate"), "Simülasyon kodu hâlâ mevcut"); + assert.ok(!bridge.includes("setTimeout"), "Gecikmeli sahte yanıt üretimi mevcut"); + assert.ok(bridge.includes("Tauri v2 çalışma zamanı bulunamadı"), "Tauri dışında sessiz kalmamalı"); + const app = read("src/App.jsx"); + assert.ok(!app.includes("simulateWintunMissing"), "Wintun simülasyonu hâlâ UI'da"); + const appVersion = JSON.parse(read("package.json")).version; + assert.ok( + app.includes(`useState("${appVersion}")`), + `UI sürümü package.json (${appVersion}) ile uyuşmuyor` + ); +}); + +await runTest("6. PAC betiği Rust ve JS tarafında birebir aynı kuralları kullanıyor", async () => { + const rust = read("src-tauri/src/pac_server.rs"); + const js = generatePacScript("192.168.1.42", 8080); + for (const token of [ + "FindProxyForURL", + "a === 127", + "a === 10", + "a === 192", + "a === 172", + "*.edu", + "eduroam.org", + "DIRECT", + "PROXY", + ]) { + assert.ok(rust.includes(token), `Rust PAC'inde eksik: ${token}`); + assert.ok(js.includes(token), `JS PAC'inde eksik: ${token}`); + } + assert.ok(js.includes("PROXY 192.168.1.42:8080; DIRECT")); + assert.ok(rust.includes("PROXY {local_ip}:{proxy_port}; DIRECT")); +}); + +await runTest("7. Sentinel: yedek yoksa kayıt defterine dokunmuyor", async () => { + const rust = read("src-tauri/src/proxy_sentinel.rs"); + assert.ok(rust.includes("InternetSetOptionW"), "WinInet bildirimi yok"); + assert.ok(rust.includes("INTERNET_OPTION_SETTINGS_CHANGED")); + assert.ok(rust.includes("INTERNET_OPTION_REFRESH")); + assert.ok(rust.includes("noBackup"), "Yedek yoksa no-op koruması yok"); + assert.ok(!rust.includes("ProxyBackupSnapshot"), "Eski varsayılan-yedek (yıkıcı) tipi kaldı"); + assert.ok(rust.includes('delete_value("AutoConfigURL")'), "PAC bağlantısı temizlenmiyor"); + assert.ok(rust.includes("dirty_sentinel"), "Kirli oturum bayrağı yok"); +}); + +await runTest("8. Engelleyici süreç yok + canlı proxy üzerinden TLS el sıkışması", async () => { + const port = await freePort(); + const args = buildSpoofDpiArgs({ + proxyPort: port, + bypassMode: 1, + chunkSize: 8, + dohProvider: "cloudflare", + lanSharing: false, + }); + const logPath = path.join(ROOT, "src-tauri", "binaries", "verify-engine.log"); + const logFd = fs.openSync(logPath, "w"); + const child = spawn(SIDECAR, args, { + windowsHide: true, + stdio: ["ignore", logFd, logFd], + }); + + try { + await waitForPort(port); + const discord = await probeThroughProxy(port, "discord.com"); + assert.ok(discord.connect, `CONNECT başarısız: ${discord.detail}`); + assert.ok(discord.tls, `TLS yanıtı yok: ${discord.detail}`); + + const control = await probeThroughProxy(port, "www.cloudflare.com"); + assert.ok(control.tls, `Kontrol sitesi TLS başarısız: ${control.detail}`); + } finally { + child.kill(); + await new Promise((resolve) => { + if (child.exitCode !== null) resolve(); + else child.once("exit", resolve); + setTimeout(resolve, 2000); + }); + fs.closeSync(logFd); + } +}); + +await runTest("9. TR/EN sözlük anahtarları eşleşiyor", async () => { + const { TEXT } = await import("../src/i18n.js"); + assert.deepEqual(Object.keys(TEXT.tr), Object.keys(TEXT.en)); + for (const section of ["nav", "status", "actions", "mode", "power", "settings", "advanced", "logs"]) { + assert.deepEqual( + Object.keys(TEXT.tr[section]), + Object.keys(TEXT.en[section]), + `${section} anahtarları eşleşmiyor` + ); + } +}); + +await runTest("10. package.json scriptleri doğru", async () => { + const pkg = JSON.parse(read("package.json")); + assert.ok(pkg.scripts["setup:sidecar"].includes("download-sidecar")); + assert.ok(pkg.scripts.test.includes("verify-all")); + assert.ok(pkg.scripts["test:gui"].includes("e2e-gui")); + assert.ok(!pkg.dependencies["@tauri-apps/plugin-shell"], "Kullanılmayan shell eklentisi kaldırılmalı"); + assert.ok( + !pkg.dependencies["@tauri-apps/plugin-autostart"], + "Autostart artık Görev Zamanlayıcı ile Rust'ta yönetiliyor" + ); +}); + +await runTest("11. Manuel başlangıç: varsayılanlar ve config.json kalıcılığı", async () => { + const configRs = read("src-tauri/src/config.rs"); + assert.ok(configRs.includes("auto_start: true"), "auto_start varsayılanı açık olmalı"); + assert.ok(configRs.includes("auto_connect: false"), "auto_connect varsayılanı kapalı olmalı (manuel mod)"); + assert.ok(configRs.includes("minimize_to_tray: true"), "minimize_to_tray varsayılanı açık olmalı"); + assert.ok(configRs.includes("config.json"), "config.json yolu tanımlı olmalı"); + assert.ok(configRs.includes("pub fn save"), "config kaydetme fonksiyonu yok"); +}); + +await runTest("12. Yönetici UAC manifestosu + RL HIGHEST Görev Zamanlayıcı", async () => { + const manifest = read("src-tauri/windows-app-manifest.xml"); + assert.ok(manifest.includes('level="requireAdministrator"'), "UAC requireAdministrator yok"); + const build = read("src-tauri/build.rs"); + assert.ok(build.includes("app_manifest"), "build.rs özel manifesti gömmüyor"); + assert.ok(build.includes("LD_FDPI_NO_ADMIN"), "Test için asInvoker anahtarı yok"); + const auto = read("src-tauri/src/autostart.rs"); + assert.ok(auto.includes('"HIGHEST"'), "RL HIGHEST eksik"); + assert.ok(auto.includes('"ONLOGON"'), "ONLOGON tetikleyicisi eksik"); + assert.ok(auto.includes("schtasks"), "schtasks kullanılmıyor"); + assert.ok(auto.includes("--minimized"), "--minimized argümanı görevde yok"); + const conf = JSON.parse(read("src-tauri/tauri.conf.json")); + assert.equal(conf.app.windows[0].visible, false, "Pencere gizli başlamalı (sessiz tray)"); +}); + +await runTest("13. Otomatik bağlantı + 15 sn kendi kendini onarma döngüsü", async () => { + const lib = read("src-tauri/src/lib.rs"); + assert.ok(lib.includes("auto_connect"), "auto_connect okunmuyor"); + assert.ok(lib.includes("start_supervisor"), "supervisor başlatılmıyor"); + assert.ok(lib.includes("Duration::from_secs(15)"), "15 saniyelik sağlık kontrolü yok"); + assert.ok(lib.includes("woke"), "uyku sonrası uyanma tespiti yok"); + assert.ok(lib.includes("get_status"), "hafif durum komutu yok"); + const app = read("src/App.jsx"); + assert.ok(app.includes("get_status"), "arayüz durum yoklaması yapmıyor"); + assert.ok(app.includes("save_config"), "arayüz ayarları kaydetmiyor"); + assert.ok(!app.includes("ClientHello"), "teknik paket şeması ana ekranda kalmış"); +}); + +await runTest("14. Sidecar SHA-256 pin + shell/unsafe çağrı yok", async () => { + const engine = read("src-tauri/src/engine.rs"); + assert.ok(engine.includes("SIDECAR_SHA256"), "SHA-256 pin sabiti yok"); + assert.ok(engine.includes("GÜVENLİK HATASI"), "Hash uyuşmazlığı güvenlik hatası üretmiyor"); + assert.ok(engine.includes("sha256_file"), "Hash hesaplama fonksiyonu yok"); + assert.ok( + engine.indexOf("sha256_file(&path)") < engine.indexOf("let args = build_spoofdpi_args"), + "Spawn öncesi tekrar doğrulama yok" + ); + + const rustFiles = []; + const walk = (dir) => { + for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + const full = path.join(dir, entry.name); + if (entry.isDirectory()) walk(full); + else if (entry.name.endsWith(".rs")) rustFiles.push(full); + } + }; + walk(path.join(ROOT, "src-tauri", "src")); + rustFiles.push(path.join(ROOT, "src-tauri", "build.rs")); + for (const file of rustFiles) { + const source = fs.readFileSync(file, "utf8"); + assert.ok(!/\.unwrap\(\)/.test(source), `${path.basename(file)}: .unwrap() kaldı`); + assert.ok(!/\.expect\(/.test(source), `${path.basename(file)}: .expect() kaldı`); + assert.ok(!/cmd\.exe|powershell(\.exe)?\s/i.test(source), `${path.basename(file)}: shell çağrısı var`); + } +}); + +await runTest("15. PAC istek limiti + peer filtresi + loopback", async () => { + const pac = read("src-tauri/src/pac_server.rs"); + assert.ok(pac.includes("MAX_REQUEST_BYTES: usize = 4096"), "4 KB istek sınırı yok"); + assert.ok(pac.includes("READ_TIMEOUT: Duration = Duration::from_secs(5)"), "5 sn okuma zaman aşımı yok"); + assert.ok(pac.includes("is_allowed_peer"), "RFC1918 peer filtresi yok"); + assert.ok(pac.includes("413"), "Aşırı istek 413 döndürmüyor"); + assert.ok(pac.includes("408"), "Zaman aşımı 408 döndürmüyor"); + assert.ok(pac.includes('if allow_lan { "0.0.0.0" } else { "127.0.0.1" }'), "Koşullu LAN bind yok"); + const lib = read("src-tauri/src/lib.rs"); + assert.ok(lib.includes("app_config.lan_sharing = false"), "Açılışta LAN zorla kapatılmıyor"); + assert.ok(lib.includes("if !lan_allowed"), "LAN izin parametresi doğrulanmıyor"); + assert.ok(lib.includes("0.0.0.0"), "LAN bind mantığı yok"); +}); + +await runTest("16. CSP, sıfır capability ve panic fail-safe", async () => { + const conf = JSON.parse(read("src-tauri/tauri.conf.json")); + assert.equal( + conf.app.security.csp, + "default-src 'self'; script-src 'self'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; connect-src 'self' ipc: http://ipc.localhost" + ); + const cap = JSON.parse(read("src-tauri/capabilities/default.json")); + assert.deepEqual(cap.permissions, [], "Webview'e gereksiz izin verilmiş"); + const lib = read("src-tauri/src/lib.rs"); + assert.ok(lib.includes("set_hook"), "Panic hook yok"); + assert.ok(lib.includes("restore_system_proxy(true)"), "Panikte proxy geri yükleme yok"); + assert.ok(lib.includes("CHILD_PID"), "Panikte motor PID takibi yok"); + const config = read("src-tauri/src/config.rs"); + assert.ok(config.includes("deny_unknown_fields"), "Config şema doğrulaması yok"); + assert.ok(config.includes("64 * 1024"), "Config boyut sınırı yok"); +}); + +await runTest("17. Eduroam modu: SSID, 802.1X, MTU 1400, PAC DIRECT", async () => { + const eduroam = read("src-tauri/src/eduroam.rs"); + assert.ok(eduroam.includes("wlan"), "Wi-Fi SSID tespiti yok"); + assert.ok(eduroam.includes("eduroam"), "eduroam eşleşmesi yok"); + assert.ok(eduroam.includes("EDUROAM_MTU: u16 = 1400"), "MTU 1400 sabiti yok"); + assert.ok(eduroam.includes("current_mtu"), "MTU okuma yok"); + assert.ok(eduroam.includes("restore_mtu"), "MTU geri yükleme yok"); + assert.ok(eduroam.includes("ms-settings:network-wifi"), "Wi-Fi ayarları açılmıyor"); + assert.ok(eduroam.includes("udp_stun_probe"), "UDP/Ses tanılaması yok"); + + const lib = read("src-tauri/src/lib.rs"); + assert.ok(lib.includes("pub mod eduroam"), "Eduroam modülü bağlı değil"); + assert.ok(lib.includes("get_eduroam_status"), "Eduroam durum komutu yok"); + assert.ok(lib.includes("run_eduroam_diagnostics"), "Eduroam tanılama komutu yok"); + assert.ok(lib.includes("spawn_blocking(eduroam::status)"), "SSID/MTU komutu UI'yı blokluyor"); + assert.ok(lib.includes("spawn_blocking(eduroam::connect_wifi)"), "Wi-Fi bağlanma komutu UI'yı blokluyor"); + assert.ok(lib.includes('"eduroam"'), "Eduroam çalışma modu doğrulanmıyor"); + assert.ok(lib.includes("is_system_wide"), "Eduroam WinHTTP kapsamına alınmamış"); + assert.ok(lib.includes("restore_from_backup"), "MTU çökme kurtarması yok"); + + const config = read("src-tauri/src/config.rs"); + assert.ok(config.includes('"eduroam"'), "Config eduroam modunu normalize etmiyor"); + + const app = read("src/App.jsx"); + assert.ok(app.includes("GraduationCap"), "Eduroam ikonu arayüzde yok"); + assert.ok(app.includes("get_eduroam_status"), "Arayüz Eduroam durumunu okumuyor"); + assert.ok(app.includes("run_eduroam_diagnostics"), "Arayüz ağ testini çalıştırmıyor"); + assert.ok(app.includes("voiceWarning"), "Ses UDP uyarısı yok"); + assert.ok(app.includes("!uiActive"), "Gizli pencerede Eduroam yoklaması durmuyor"); + const i18n = read("src/i18n.js"); + assert.ok(i18n.includes("Eduroam Modu"), "Türkçe Eduroam metni yok"); +}); + +await runTest("18. Ultra-low latency: Smart DoH, TCP_NODELAY, öncelik, LTO", async () => { + const cargo = read("src-tauri/Cargo.toml"); + assert.ok(cargo.includes("lto = \"fat\""), "LTO fat yok"); + assert.ok(cargo.includes("codegen-units = 1"), "codegen-units=1 yok"); + assert.ok(cargo.includes("panic = \"abort\""), "panic=abort yok"); + assert.ok(cargo.includes("strip = true"), "strip=true yok"); + + const engine = read("src-tauri/src/engine.rs"); + assert.ok(engine.includes("select_fastest_doh"), "Smart DoH seçici yok"); + assert.ok(engine.includes("probe_median"), "3'lü medyan ölçümü yok"); + assert.ok(engine.includes("ABOVE_NORMAL_PRIORITY_CLASS"), "Süreç önceliği yok"); + assert.ok(engine.includes("probe_local_port"), "Yerel soket canlılık testi yok"); + + const pac = read("src-tauri/src/pac_server.rs"); + assert.ok(pac.includes("set_nodelay(true)"), "PAC TCP_NODELAY yok"); + assert.ok(pac.includes("Cache-Control: public, max-age=3600"), "PAC önbellek başlığı yok"); + + const lib = read("src-tauri/src/lib.rs"); + assert.ok(lib.includes("transition_guard"), "Race-condition geçiş kilidi yok"); + assert.ok(lib.includes("probe_local_port"), "Supervisor soket yoklaması yok"); + assert.ok(lib.includes("resolve_engine_doh"), "Auto DoH çözümlemesi bağlı değil"); + + const app = read("src/App.jsx"); + assert.ok(app.includes("slice(-149)"), "Log ring buffer 150 değil"); + assert.ok(app.includes("uiActive"), "Tray gizliyken zamanlayıcı duraklatılmıyor"); + assert.ok(app.includes("setInterval"), "Durum zamanlayıcısı yok"); +}); + +await runTest("19. Sürüm 1.5.10 tutarlı", async () => { + const pkg = JSON.parse(read("package.json")); + const cargo = read("src-tauri/Cargo.toml"); + const conf = JSON.parse(read("src-tauri/tauri.conf.json")); + assert.equal(pkg.version, "1.5.10"); + assert.equal(conf.version, "1.5.10"); + assert.match(cargo, /^version = "1\.5\.10"/m); +}); + +await runTest("20. Yeni logo: app-icon, public logo, favicon ve arayüz", async () => { + const pngSize = (file) => { + const buffer = fs.readFileSync(file); + assert.equal(buffer.subarray(0, 8).toString("hex"), "89504e470d0a1a0a"); + return { width: buffer.readUInt32BE(16), height: buffer.readUInt32BE(20) }; + }; + assert.ok(fs.existsSync(path.join(ROOT, "assets", "branding", "ld-fdpi-logo-source.png"))); + const appIcon = pngSize(path.join(ROOT, "app-icon.png")); + assert.deepEqual(appIcon, { width: 1024, height: 1024 }); + const uiLogo = pngSize(path.join(ROOT, "public", "logo.png")); + assert.deepEqual(uiLogo, { width: 512, height: 512 }); + const app = read("src/App.jsx"); + assert.ok(app.includes('src="/logo.png"'), "Arayüz yeni PNG logoyu kullanmıyor"); + assert.ok(!app.includes("logo.svg"), "Arayüz eski SVG logoyu kullanıyor"); + const html = read("index.html"); + assert.ok(html.includes('href="/logo.png"'), "Favicon yeni logoyu kullanmıyor"); + assert.ok(fs.statSync(path.join(ROOT, "src-tauri", "icons", "icon.ico")).size > 1000); +}); + +await runTest("21. Captive portal asistanı bağlı", async () => { + const captive = read("src-tauri/src/captive.rs"); + assert.match(captive, /pub fn connect_without_login/); + assert.match(captive, /discover_portal/); + assert.match(captive, /valid_portal_url/); + const lib = read("src-tauri/src/lib.rs"); + assert.match(lib, /pub mod captive;/); + assert.match(lib, /connect_without_login/); + const app = read("src/App.jsx"); + assert.match(app, /handleCaptiveConnect/); + assert.match(app, /connect_without_login/); + const i18n = read("src/i18n.js"); + assert.match(i18n, /Oturum Açmadan Bağlantı/); + assert.match(i18n, /Connect Without Login/); +}); + +console.log("\n=============================================================="); +console.log(`SONUÇ: ${passed} başarılı, ${failed} başarısız`); +console.log("=============================================================="); +if (failed > 0) process.exit(1); diff --git a/site/add_fdpi_command.py b/site/add_fdpi_command.py new file mode 100644 index 0000000..becd7d0 --- /dev/null +++ b/site/add_fdpi_command.py @@ -0,0 +1,35 @@ +from pathlib import Path +import shutil + +p = Path('/opt/kick-duel/server.js') +t = p.read_text(encoding='utf-8') +if "handleFdpi" in t: + print('FDPI command already present') + raise SystemExit(0) + +needle = " handleWebsite (name) {" +handler = ''' handleFdpi (name) { + const message = `⚡ @${name}, LD FDPI: DPI bypass + AmneziaWG VPN, WFP kill-switch, DNS/IPv6 koruması. https://ttmadethat.shop/ld-fdpi`; + if (this.bot && typeof this.bot.queue === 'function') { + this.bot.queue(message).catch((err) => log('FDPI mesaji hatasi:', err.message)); + } else { + this.notice(message, 'fdpi'); + } + log(`FDPI linki gonderildi: ${name}`); + return true; + } + +''' +if needle not in t: + raise SystemExit('handleWebsite anchor not found') +t = t.replace(needle, handler + needle, 1) + +branch_needle = " if (command === 'website') {\n this.handleWebsite(name);\n return;\n }\n" +branch = branch_needle + "\n if (command === 'fdpi' || command === 'ldfdpi') {\n this.handleFdpi(name);\n return;\n }\n" +if branch_needle not in t: + raise SystemExit('website branch not found') +t = t.replace(branch_needle, branch, 1) + +shutil.copy2(p, '/opt/kick-duel/server.js.bak-fdpi-command') +p.write_text(t, encoding='utf-8') +print('FDPI command added') diff --git a/site/add_ld_fdpi_route.py b/site/add_ld_fdpi_route.py new file mode 100644 index 0000000..0c55473 --- /dev/null +++ b/site/add_ld_fdpi_route.py @@ -0,0 +1,29 @@ +from pathlib import Path +import shutil + +p = Path('/opt/tylorindar-safelink/main.py') +t = p.read_text(encoding='utf-8') +if 'async def ld_fdpi_page' in t: + print('route already present') + raise SystemExit(0) + +needle = '@app.get("/{code}")\nasync def redirect_shortlink' +insert = '''@app.get("/ld-fdpi", include_in_schema=False) +@app.get("/ld-fdpi/", include_in_schema=False) +async def ld_fdpi_page(): + page = os.path.join(static_dir, "ld-fdpi.html") + if os.path.exists(page): + return FileResponse( + page, + media_type="text/html", + headers={"Cache-Control": "no-store, max-age=0"}, + ) + raise HTTPException(status_code=404, detail="LD FDPI sayfası bulunamadı.") + +''' +if needle not in t: + raise SystemExit('catch-all route not found') +shutil.copy2(p, '/opt/tylorindar-safelink/backups/main.py.bak-ld-fdpi-page') +t = t.replace(needle, insert + needle, 1) +p.write_text(t, encoding='utf-8') +print('route added') diff --git a/site/fix_page_path.py b/site/fix_page_path.py new file mode 100644 index 0000000..520891c --- /dev/null +++ b/site/fix_page_path.py @@ -0,0 +1,10 @@ +from pathlib import Path + +p = Path('/opt/tylorindar-safelink/main.py') +t = p.read_text(encoding='utf-8') +t = t.replace( + 'page = os.path.join(static_dir, "ld-fdpi.html")', + 'page = os.path.join(static_dir, "downloads", "ld-fdpi.html")', +) +p.write_text(t, encoding='utf-8') +print('page path fixed') diff --git a/site/ld-fdpi.html b/site/ld-fdpi.html new file mode 100644 index 0000000..47b81d9 --- /dev/null +++ b/site/ld-fdpi.html @@ -0,0 +1,446 @@ + + + + + + LD FDPI — Discord, oyun ve Almanya çıkışı | v1.7.0 + + + + + + + + + + + + + + + + + + + + + +
+
+
+
Windows 10/11 · tek tık · 7 MB
+

Discord açık.
Ping düşük.

+

DPI engelini tek tıkla geç; Discord, Kick ve tarayıcı çalışsın. Oyun trafiğin doğrudan kalsın, ping'in şişmesin. İstersen Almanya çıkışına geç, farklı kataloglara bak.

+ +
+ v1.7.0 + Kurulum ~1 dk + Reklamsız + SpoofDPI 0.12.2 + AmneziaWG + Win 10/11 x64 +
+
+ +
+
+
LD-FDPI://connection
+
+
+
◈
+

DPI bağlı

SpoofDPI 0.12.2 · 127.0.0.1:18080

+
+
+
modeDPI ACTIVE
+
discordTLS OK · hazır
+
wfpVPN modunda devreye girer
+
dns1.1.1.1 · DoH
+
ipv6 / stunVPN'de bloklu
+
latency1.1.1.1 · 10 ms
+
+ +
+
+
+
+ +
+
1 dkkurulum süresi
+
2mod: DPI + VPN
+
7 MBkurulum boyutu
+
Win 10/11x64 destek
+
+ +
+
Hangi mod?

İki mod. Tek uygulama.

Oyun için düşük ping, bölgesel içerik için Almanya. İkisini aynı anda açmaya çalışmazsın; uygulama seni doğru moda yönlendirir.

+
+
+ DPI MODU +

Takıl, oyna, izle.

+

Discord, Kick ve tarayıcı açılır. Oyun istemcisi doğrudan hatta kalır; tüm trafiği VPN'e sokmadığın için ping'in artmaz.

+
DiscordKickTarayıcıRekabetçi oyun
+
Kime göre: “Discord açılsın, oyunuma dokunma” diyenler.
+
+
+ AMNEZIAWG VPN +

Almanya'ya bağlan.

+

Tek tıkla tam tünel. Almanya çıkışıyla bölgesel kataloglara ve yurt dışı servislere göz at; IP'n değişsin, trafiğin şifrelensin.

+
AlmanyaTam tünelBölgesel içerikGizlilik
+
Kime göre: “Farklı katalog görmek istiyorum” diyenler. Netflix/Prime içeriği ülke ve platform kurallarına bağlıdır; garanti değil.
+
+
+
+ + + + + + + + + +
KararDPI moduAmneziaWG VPN
RotaYalnız proxy kullanan uygulamalarTüm cihaz trafiği
GecikmeDoğrudan hat · düşük ek yükAlmanya'ya göre + gecikme
KullanımDiscord, Kick, tarayıcı, günlük akışBölgesel katalog, yurt dışı servis, tam gizlilik
KorumaProxy + sentinelKalıcı WFP kill-switch + DNS/IPv6/STUN
En uygunRekabetçi oyun + düşük pingAlmanya çıkışı + tam tünel
+
+
AmneziaWG nedir? WireGuard tabanlı, paket imzasını gizleyen ve DPI filtrelerine karşı daha dayanıklı bir tünel protokolü. LD FDPI'da özel anahtar cihazda kalır; sunucu yalnızca açık anahtarı görür.
+
+ +
+
+
Neden LD FDPI?

Tek tık. Arkana bakma.

+

Kur, bağlan, işine dön. Teknik detayları merak edenler için altında anlattık.

+
+
+
◈

Çökse bile korur.

Kalıcı WFP filtreleri: GUI veya tünel servisi çökse bile çıkışın kapanır. --restore-only tek komutla temizler.

+
⚡

Tek tıkla Discord.

SpoofDPI 0.12.2 · SNI parçalama · normal/dengeli/güçlü mod · DoH.

+
🛡️

Almanya'ya bağlan.

AmneziaWG tam tünel, özel .conf ve cihaz başına X25519 kimlik.

+
🔐

Anahtar sende kalır.

Özel anahtar identity.dat içinde DPAPI ile şifreli; düz metin key yok.

+
🌐

Sızıntı bırakmaz.

Fiziksel DNS 53/853 engeli, IPv6 catch-all ve WebRTC STUN blokları.

+
🧭

Modları karıştırmaz.

DPI ve VPN aynı anda açılamaz; hata olursa önceki moda döner.

+
📡

Ev ağını da bağla.

LAN paylaşımı ve PAC; kapalıyken motor yalnızca loopback dinler.

+
🎓

Okul / oyun modu.

Eduroam Wi-Fi için MTU/802.1X farkındalığı; WinHTTP + WinINet.

+
🧪

Sorunu gösterir.

Proxy TLS, DNS sızıntısı, WFP ve egress IP kontrolleri tek ekranda.

+
+
+ +
+
Güvenlik

Sadece hızlı değil, sağlam.

DPI modu günlük akışı açar; VPN modu tüm tüneli WFP ile mühürler. İkisi ayrı çalışır.

+
+
01 / CONNECT

Tünel açılır

AmneziaWG servisi başlar, LUID doğrulanır.

+
02 / ARM

WFP yüklenir

Tek transaction: endpoint, DNS, LAN, STUN, IPv6.

+
03 / SEAL

Filtreler kalır

Persistent bayrak; GUI çökse bile kural aktif.

+
04 / RESTORE

Temiz çıkış

Disconnect veya --restore-only filtreleri siler.

+
+
+
+

Kural matrisi

+ + + + + + + + + + +
KatmanDavranış
LoopbackPERMIT
VPN endpointPERMIT · UDP
DHCP + LANPERMIT / kontrollü
Diğer DNS 53/853BLOCK
IPv6 catch-allBLOCK
STUN / WebRTCBLOCK
+
+
+

Güvenlik duruşu

+
    +
  • Sidecar SHA-256 pin; değiştirilmiş spoofdpi.exe çalışmaz.
  • +
  • Kabuk/PowerShell çağrısı yok; System32 yolları, sabit argümanlar.
  • +
  • Katı CSP + sıfır webview capability.
  • +
  • Atomik config ve proxy sentinel; çökme sonrası geri dönüş.
  • +
  • Kurulumda statik VPN anahtarı taşınmaz.
  • +
+
+
+
+ +
+
Kurulum

Kur, BAĞLAN'a bas.

Yönetici izni gerekir. Aktivasyon kodu yok; cihaz profili ilk bağlantıda otomatik oluşur.

+
+
+
Setup'ı çalıştırUAC onayı ver; Windows 10/11 x64.
+
Uygulamayı açMasaüstü kısayolu veya Başlat menüsü.
+
VPN'i seçVPN sekmesinde yalnızca BAĞLAN / BAĞLANTIYI KES var.
+
BAĞLAN'a basAmneziaWG ve cihaz profili arka planda otomatik kurulur.
+
HazırWFP kill-switch ve DNS/IPv6 koruması otomatik devreye girer.
+
+
+
İndir
+
LD FDPI v1.7.0
+

NSIS kurulum · Windows 10/11 x64 · yaklaşık 7.5 MB

+ +
SHA-256 · 6D6D7FC9DA84E92D53FFD9E84E38EF36A5AF0CE518F063B47F1582F88070AB09
+
Not: Kod imzası yoktur; SmartScreen “bilinmeyen yayıncı” uyarısı verebilir. Aktivasyon kodu gerekmez.
+
+
+
+ +
+
+

Gereksinimler

  • Windows 10 22H2 / Windows 11 x64
  • Yönetici yetkisi (UAC)
  • WebView2 Runtime
  • İnternet + ttmadethat.shop
  • Etkinleştirme kodu gerekmez
+

Hangi durumda uygun değil?

  • Windows 7 / ARM64
  • Kurumsal politikalarla WFP kısıtlanmış makineler
  • Başka VPN/firewall ile aynı anda kullanım
+
+
+ +
+
SSS

Kısa cevaplar.

+
Oyunlarda ping düşer mi?

DPI modu oyun trafiğini VPN'e sokmaz; bu yüzden rekabetçi oyunlarda doğrudan hattın gecikmesi korunur. VPN modunda tüm trafik Almanya üzerinden gider; oyun ping'i artabilir. Oyun için DPI modunu seç.

+
Netflix / bölgesel içerik garantili mi?

Hayır. Almanya çıkışı bölgesel katalogları görmeni sağlayabilir; ancak platformlar VPN algılayabilir, içerik lisansı ülkeye/hesaba göre değişir. Garanti vermiyoruz; platformun kullanım koşullarına uy.

+
Aktivasyon kodu gerekiyor mu?

Hayır. Cihaz kimliği ve VPN profili ilk BAĞLAN’da otomatik oluşturulur. Kod, eski sürümlerden kalan bir yöntemdir.

+
VPN açıkken DPI başlatılabilir mi?

Hayır. Mod yöneticisi iki modun aynı anda çalışmasını engeller.

+
WFP kilidi interneti keserse?

Uygulamayı yeniden aç (boot cleanup) veya ld-fdpi.exe --restore-only çalıştır. VPN servisi çökse bile filtreler bilerek kalır.

+
Neden SmartScreen uyarıyor?

Kurulum dosyası kod imzalı değil. “More info → Run anyway” ile devam edebilirsin.

+
Hangi Windows sürümleri?

Windows 10/11 x64. ARM64 ve Windows 7 desteklenmez.

+
+ +
+
+
Hazır mısın?

Discord açık, ping düşük.

Windows için indir; kur, bağlan, işine dön. İstersen Almanya çıkışına geç.

+ +
+
+
+ + + + + + diff --git a/site/make_card_clickable.py b/site/make_card_clickable.py new file mode 100644 index 0000000..caf0b58 --- /dev/null +++ b/site/make_card_clickable.py @@ -0,0 +1,36 @@ +from pathlib import Path + +p = Path('/opt/tylorindar-safelink/static/index.html') +t = p.read_text(encoding='utf-8') + +css = ''' + /* LD FDPI detail card */ + .ld-app-card { cursor: pointer; transition: border-color .18s ease, box-shadow .18s ease; } + .ld-app-card:hover { border-color: rgba(143,227,245,.45); box-shadow: 0 16px 40px rgba(0,0,0,.28); } + .ld-app-stretch { position: absolute; inset: 0; z-index: 1; border-radius: 16px; } + .ld-app-card .ld-app-btn, .ld-app-card .ld-app-actions { position: relative; z-index: 2; } + .ld-app-btn-detail { background: rgba(143,227,245,.08); border-color: rgba(143,227,245,.28); color: #bdeff8; } + .ld-app-btn-detail:hover { background: rgba(143,227,245,.14); } +''' + +if '.ld-app-stretch' not in t: + t = t.replace('', css + '', 1) + +needle = '
' +if needle in t and 'class="ld-app-stretch"' not in t: + t = t.replace( + needle, + needle + '\n ', + 1, + ) + +needle2 = '' +if needle2 in t and 'ld-app-btn-detail' not in t: + t = t.replace( + needle2, + 'Detayları Gör →' + needle2, + 1, + ) + +p.write_text(t, encoding='utf-8') +print('card clickable/detail link added') diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock new file mode 100644 index 0000000..f072d00 --- /dev/null +++ b/src-tauri/Cargo.lock @@ -0,0 +1,5767 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "adler2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "320119579fcad9c21884f5c4861d16174d0e06250625266f50fe6898340abefa" + +[[package]] +name = "aho-corasick" +version = "1.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c982642fa9e8606056828ee9a8505737230110bb1099153c79efe865c59d12ba" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloc-no-stdlib" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2fb6cfd47bf496ff64095c20eaba0c201404ee38714d4142fcfa1dc334fcc7a" + +[[package]] +name = "alloc-stdlib" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b5c1865780388bfa186411ab5f247819487fc4864c6e9c3106611fa347586e1" +dependencies = [ + "alloc-no-stdlib", +] + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "anyhow" +version = "1.0.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "330a5ed07fa54e4702c9d6c4174f74427fc0ef6e214bbd677ae50a5099946470" + +[[package]] +name = "async-broadcast" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "435a87a52755b8f27fcf321ac4f04b2802e337c8c4872923137471ec39c37532" +dependencies = [ + "event-listener", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-channel" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "924ed96dd52d1b75e9c1a3e6275715fd320f5f9439fb5a4a11fa51f4221158d2" +dependencies = [ + "concurrent-queue", + "event-listener-strategy", + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "async-executor" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c96bf972d85afc50bf5ab8fe2d54d1586b4e0b46c97c50a0c9e71e2f7bcd812a" +dependencies = [ + "async-task", + "concurrent-queue", + "fastrand", + "futures-lite", + "pin-project-lite", + "slab", +] + +[[package]] +name = "async-io" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "456b8a8feb6f42d237746d4b3e9a178494627745c3c56c6ea55d92ba50d026fc" +dependencies = [ + "autocfg", + "cfg-if", + "concurrent-queue", + "futures-io", + "futures-lite", + "parking", + "polling", + "rustix", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-lock" +version = "3.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "290f7f2596bd5b78a9fec8088ccd89180d7f9f55b94b0576823bbbdc72ee8311" +dependencies = [ + "event-listener", + "event-listener-strategy", + "pin-project-lite", +] + +[[package]] +name = "async-process" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc50921ec0055cdd8a16de48773bfeec5c972598674347252c0399676be7da75" +dependencies = [ + "async-channel", + "async-io", + "async-lock", + "async-signal", + "async-task", + "blocking", + "cfg-if", + "event-listener", + "futures-lite", + "rustix", +] + +[[package]] +name = "async-recursion" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f8abc12baad266b1c8cec146854c195b5864b4221d4b2ca7296a7ae82d9e451" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "async-signal" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52b5aaafa020cf5053a01f2a60e8ff5dccf550f0f77ec54a4e47285ac2bab485" +dependencies = [ + "async-io", + "async-lock", + "atomic-waker", + "cfg-if", + "futures-core", + "futures-io", + "rustix", + "signal-hook-registry", + "slab", + "windows-sys 0.61.2", +] + +[[package]] +name = "async-task" +version = "4.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b75356056920673b02621b35afd0f7dda9306d03c79a30f5c56c44cf256e3de" + +[[package]] +name = "async-trait" +version = "0.1.92" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f6aeea286b8eb4dd3431a1be1b59d290ace00f5bfd8e2a159bc2a05e2c1667" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "atk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "241b621213072e993be4f6f3a9e4b45f65b7e6faad43001be957184b7bb1824b" +dependencies = [ + "atk-sys", + "glib", + "libc", +] + +[[package]] +name = "atk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e48b684b0ca77d2bbadeef17424c2ea3c897d44d566a1617e7e8f30614d086" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac07cdecf99051d9a5238b80f35af32cdeba5b336e55d957b318b50137e18da5" + +[[package]] +name = "bit-set" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08807e080ed7f9d5433fa9b275196cfc35414f66a0c79d864dc51a0d825231a3" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e764a1d40d510daf35e07be9eb06e75770908c27d411ee6c92109c9840eaaf7" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdeb9d870516001442e364c5220d3574d2da8dc765554b4a617230d33fa58ef5" +dependencies = [ + "objc2", +] + +[[package]] +name = "blocking" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a70e4329df6cb94385eed412ec92375c3cdd8a6e502493d1229b6414e4036dfa" +dependencies = [ + "async-channel", + "async-task", + "futures-io", + "futures-lite", + "piper", +] + +[[package]] +name = "brotli" +version = "9.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "627b7cfb0578f0eafce087a90fcd40add1231900b69e4d4de2d456260a4f5d81" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", + "brotli-decompressor", +] + +[[package]] +name = "brotli-decompressor" +version = "6.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34c6783f42c21c952ad7112b354f0ba2f10760e9decea5b1b60523d6e270faaf" +dependencies = [ + "alloc-no-stdlib", + "alloc-stdlib", +] + +[[package]] +name = "bs58" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf88ba1141d185c399bee5288d850d63b8369520c1eafc32a0430b5b6c287bf4" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "bumpalo" +version = "3.20.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72f5acc6cb2ba439de613abc23857ec3d78374d8ed5ac84e9d11336e87da8649" + +[[package]] +name = "bytemuck" +version = "1.25.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95832e849adfb21180ccb6826a99da14e5d266ae5c2e668e1602cf234f153797" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc652a48c352aef3ea3aed32080501cf3ef6ed5da78602a020c991775b0aff04" +dependencies = [ + "serde", +] + +[[package]] +name = "cairo-rs" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ca26ef0159422fb77631dc9d17b102f253b876fe1586b03b803e63a309b4ee2" +dependencies = [ + "bitflags 2.13.2", + "cairo-sys-rs", + "glib", + "libc", + "once_cell", + "thiserror 1.0.69", +] + +[[package]] +name = "cairo-sys-rs" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "685c9fa8e590b8b3d678873528d83411db17242a73fccaed827770ea0fedda51" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "camino" +version = "1.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbad30e4b4c14a39e3cc8aed085a12a327257c316619c93581e017bc52be591" +dependencies = [ + "serde_core", +] + +[[package]] +name = "cargo-platform" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35af189006b9c0f00a064685c727031e3ed2d8020f7ba284d78cc2671bd36ea" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.19.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd5eb614ed4c27c5d706420e4320fbe3216ab31fa1c33cd8246ac36dae4479ba" +dependencies = [ + "camino", + "cargo-platform", + "semver", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "cargo_toml" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "82f4b26e751e711a5302649417f2da046dce6391b2ea30a4820f37462314f0b9" +dependencies = [ + "semver", + "serde", + "toml 1.1.8+spec-1.1.0", +] + +[[package]] +name = "cc" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86e055fa6e3e40ad6187ba25b6855eeb635d5271f8e0f0e1e9a5826b8d75bea0" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cesu8" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" + +[[package]] +name = "cfb" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a347dcabdae9c31b0825fd6a8bed285ec9c2acb89c47827126d52fa4f59cece3" +dependencies = [ + "fnv", + "uuid", + "web-time", +] + +[[package]] +name = "cfg-expr" +version = "0.15.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d067ad48b8650848b989a59a86c6c36a995d02d2bf778d45c3c5d57bc2718f02" +dependencies = [ + "smallvec", + "target-lexicon", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "cfg_aliases" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f079e83a288787bcd14a6aea84cee5c87a67c5a3e660c30f557a3d24761b3527" + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "combine" +version = "4.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4356eba6976435498d05a311ee9fc486da3bc81c200d3f0d7dd9703b41913f92" +dependencies = [ + "bytes", + "memchr", +] + +[[package]] +name = "concurrent-queue" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ca0197aee26d1ae37445ee532fefce43251d24cc7c166799f4d46817f1d3973" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "cookie" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a373e3602691c3cdea496d2f0ee5935151e6168fe87739483c463db1b2f2f87" +dependencies = [ + "time", + "version_check", +] + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2a6cd9ae233e7f62ba4e9353e81a88df7fc8a5987b8d445b4d90c879bd156f6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics" +version = "0.25.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "064badf302c3194842cf2c5d61f56cc88e54a759313879cdf03abdd27d0c3b97" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-graphics-types", + "foreign-types 0.5.0", + "libc", +] + +[[package]] +name = "core-graphics-types" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d44a101f213f6c4cdc1853d4b78aef6db6bdfa3468798cc1d9912f4735013eb" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ba106e844045ddc02c20768ac4b0b7cb45f2cc2ecbd833ac9f5dacb183c2055" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crossbeam-channel" +version = "0.5.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "98b0cc327b5bc766e7fda9c9260cc0fa81b43a8e240440422dff70788e3f9ef1" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "622f3fc73690be383c7214310406f28a90e6edeadc3cea882f9d71e495b9711a" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc74980687109a3b14c72fd458107bf0baa1da1a1a805e178d15501ba9b86d9d" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "cssparser" +version = "0.37.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c9cdaae01d5ed7882b04d795e7f752f46ff52d2fa3b50a20d28c464510bba98" +dependencies = [ + "cssparser-macros", + "dtoa-short", + "itoa", + "phf", + "smallvec", +] + +[[package]] +name = "cssparser-macros" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d045de693cb712d0b22c6a64be5b953f67b3ce00ab5ad3dd5d8b441886ab8e1a" +dependencies = [ + "quote", + "syn 3.0.9", +] + +[[package]] +name = "ctor" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "914a755b7c2d4af2bdcff7ce1739e2db9a1b81a9b07123d8015786ae03c0980d" + +[[package]] +name = "curve25519-dalek" +version = "4.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97fb8b7c4503de7d6ae7b42ab72a5a59857b4c937ec27a3d4539dba95b5ab2be" +dependencies = [ + "cfg-if", + "cpufeatures", + "curve25519-dalek-derive", + "fiat-crypto", + "rustc_version", + "subtle", + "zeroize", +] + +[[package]] +name = "curve25519-dalek-derive" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f46882e17999c6cc590af592290432be3bce0428cb0d5f8b6715e4dc7b383eb3" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc7f46116c46ff9ab3eb1597a45688b6715c6e628b5c133e288e709a29bcb4ee" +dependencies = [ + "darling_core 0.20.11", + "darling_macro 0.20.11", +] + +[[package]] +name = "darling" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed17f5901b6630b993ca003def43f2f8ef4014fc13b047b57aad617ff32bc2ec" +dependencies = [ + "darling_core 0.24.1", + "darling_macro 0.24.1", +] + +[[package]] +name = "darling_core" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d00b9596d185e565c2207a0b01f8bd1a135483d02d9b7b0a54b11da8d53412e" +dependencies = [ + "fnv", + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 2.0.119", +] + +[[package]] +name = "darling_core" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6837e2cf7485aaae18f86181d2f0e9a7ed297a025e220aeabf63fdebd3a2ddff" +dependencies = [ + "ident_case", + "proc-macro2", + "quote", + "strsim", + "syn 3.0.9", +] + +[[package]] +name = "darling_macro" +version = "0.20.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fc34b93ccb385b40dc71c6fceac4b2ad23662c7eeb248cf10d529b7e055b6ead" +dependencies = [ + "darling_core 0.20.11", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "darling_macro" +version = "0.24.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ac7135c3ef02b2f7833bbeb1be5ba7f966dcde8a87c6b87f65a778d71a02785" +dependencies = [ + "darling_core 0.24.1", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "dbus" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ab69f03cc8c4340c9c8e315114e1658e6775a9b16a04357973aa21cec22b32e" +dependencies = [ + "libc", + "libdbus-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "defmt" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4a0795ac740cb54d7b3775c9c17345f6aaecf884c01733b39d6017738e0e3e1" +dependencies = [ + "bitflags 1.3.2", + "defmt-macros", +] + +[[package]] +name = "defmt-macros" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "840bb056bd99c495c9188198a258ab787c79f306d864db3e6e8451442d6d8366" +dependencies = [ + "defmt-parser", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "defmt-parser" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "71958f69fb2de856c5dd51ac9377e986ca1aa5919f931bf5395a807277f889a0" +dependencies = [ + "thiserror 2.0.21", +] + +[[package]] +name = "deranged" +version = "0.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e9de72ce2ad1f90dc62fa25f0f430ef85eb4b0d8fa0be4f30373bc40a21d28e" +dependencies = [ + "serde_core", +] + +[[package]] +name = "derive_builder" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "507dfb09ea8b7fa618fcf76e953f4f5e192547945816d5358edffe39f6f94947" +dependencies = [ + "derive_builder_macro", +] + +[[package]] +name = "derive_builder_core" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d5bcf7b024d6835cfb3d473887cd966994907effbe9227e8c8219824d06c4e8" +dependencies = [ + "darling 0.20.11", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "derive_builder_macro" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab63b0e2bf4d5928aff72e83a7dace85d7bba5fe12dcc3c5a572d78caffd3f3c" +dependencies = [ + "derive_builder_core", + "syn 2.0.119", +] + +[[package]] +name = "derive_more" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d751e9e49156b02b44f9c1815bcb94b984cdcc4396ecc32521c739452808b134" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "799a97264921d8623a957f6c3b9011f3b5492f557bbb7a5a19b7fa6d06ba8dcb" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "syn 2.0.119", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", +] + +[[package]] +name = "dirs" +version = "7.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d57d423b3c82e89b9a24ca3091fee61f456a26edbd28d26c65906f4bc1dcd8f" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.61.2", +] + +[[package]] +name = "dispatch2" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0e367e4e7da84520dedcac1901e4da967309406d1e51017ae1abfb97adbd38" +dependencies = [ + "bitflags 2.13.2", + "block2", + "libc", + "objc2", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "dlopen2" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e2c5bd4158e66d1e215c49b837e11d62f3267b30c92f1d171c4d3105e3dc4d4" +dependencies = [ + "dlopen2_derive", + "libc", + "once_cell", + "winapi", +] + +[[package]] +name = "dlopen2_derive" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbbb781877580993a8707ec48672673ec7b81eeba04cfd2310bd28c08e47c8f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "dom_query" +version = "0.28.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fac5fca71e65e94cc718a6e2af65d6e0f9c6027751c2aa562fbb5087fda639bc" +dependencies = [ + "bit-set", + "cssparser", + "foldhash", + "html5ever", + "precomputed-hash", + "selectors", + "tendril", +] + +[[package]] +name = "dpi" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d8b14ccef22fc6f5a8f4d7d768562a182c04ce9a3b3157b91390b52ddfdf1a76" +dependencies = [ + "serde", +] + +[[package]] +name = "dtoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c3cf4824e2d5f025c7b531afcb2325364084a16806f6d47fbc1f5fbd9960590" + +[[package]] +name = "dtoa-short" +version = "0.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd1511a7b6a56299bd043a9c167a6d2bfb37bf84a6dfceaba651168adfb43c87" +dependencies = [ + "dtoa", +] + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "dyn-clone" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0881ea181b1df73ff77ffaaf9c7544ecc11e82fba9b5f27b262a3c73a332555" + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" + +[[package]] +name = "embed-resource" +version = "3.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6168487b5e7eb2673e6efe1200b1848016e436a6ca0b8031bf04bd9d493a249f" +dependencies = [ + "cc", + "memchr", + "rustc_version", + "toml 1.1.8+spec-1.1.0", + "vswhom", + "winreg 0.56.0", +] + +[[package]] +name = "embed_plist" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7" + +[[package]] +name = "endi" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66b7e2430c6dff6a955451e2cfc438f09cea1965a9d6f87f7e3b90decc014099" + +[[package]] +name = "enumflags2" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1027f7680c853e056ebcec683615fb6fbbc07dbaa13b4d5d9442b146ded4ecef" +dependencies = [ + "enumflags2_derive", + "serde", +] + +[[package]] +name = "enumflags2_derive" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67c78a4d8fdf9953a5c9d458f9efe940fd97a0cab0941c075a813ac594733827" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "erased-serde" +version = "0.4.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e59b668157f32d3459d4bd634861a06ffa2503a461ca5f0916b9f0252605e66" +dependencies = [ + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "errno" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "39cab71617ae0d63f51a36d69f866391735b51691dbda63cf6f96d042b63efeb" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "event-listener-strategy" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8be9f3dfaaffdae2972880079a491a1a8bb7cbed0b8dd7a347f668b4150a3b93" +dependencies = [ + "event-listener", + "pin-project-lite", +] + +[[package]] +name = "fastrand" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da7c62ceae207dd37ea5b845da6a0696c799f85e97da1ab5b7910be3c1c80223" + +[[package]] +name = "fdeflate" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e6853b52649d4ac5c0bd02320cddc5ba956bdb407c4b75a2c6b75bf51500f8c" +dependencies = [ + "simd-adler32", +] + +[[package]] +name = "fiat-crypto" +version = "0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "28dea519a9695b9977216879a3ebfddf92f1c08c05d984f8996aecd6ecdc811d" + +[[package]] +name = "field-offset" +version = "0.3.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38e2275cc4e4fc009b0669731a1e5ab7ebf11f469eaede2bab9309a5b4d6057f" +dependencies = [ + "memoffset", + "rustc_version", +] + +[[package]] +name = "filetime" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c287a33c7f0a620c38e641e7f60827713987b3c0f26e8ddc9462cc69cf75759" +dependencies = [ + "cfg-if", + "libc", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c66915cc5391097de7a2b0b972e8505aa33c0df401fd3a6811dbdb32881ba48" + +[[package]] +name = "flate2" +version = "1.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e634e2e0ebac1ee034020da1ca582e17ffe4e0f5e985823721e168928136dcb" +dependencies = [ + "crc32fast", + "miniz_oxide 0.9.1", + "zlib-rs", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea5190182e6915eb873ddbc16e23b711b6eb1f9c00a0d0a3a91b5f6228475225" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-lite" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f78e10609fe0e0b3f4157ffab1876319b5b0db102a2c60dc4626306dc46b44ad" +dependencies = [ + "fastrand", + "futures-core", + "futures-io", + "parking", + "pin-project-lite", +] + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "gdk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9f245958c627ac99d8e529166f9823fb3b838d1d41fd2b297af3075093c2691" +dependencies = [ + "cairo-rs", + "gdk-pixbuf", + "gdk-sys", + "gio", + "glib", + "libc", + "pango", +] + +[[package]] +name = "gdk-pixbuf" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50e1f5f1b0bfb830d6ccc8066d18db35c487b1b2b1e8589b5dfe9f07e8defaec" +dependencies = [ + "gdk-pixbuf-sys", + "gio", + "glib", + "libc", + "once_cell", +] + +[[package]] +name = "gdk-pixbuf-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9839ea644ed9c97a34d129ad56d38a25e6756f99f3a88e15cd39c20629caf7" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gdk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c2d13f38594ac1e66619e188c6d5a1adb98d11b2fcf7894fc416ad76aa2f3f7" +dependencies = [ + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkwayland-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "140071d506d223f7572b9f09b5e155afbd77428cd5cc7af8f2694c41d98dfe69" +dependencies = [ + "gdk-sys", + "glib-sys", + "gobject-sys", + "libc", + "pkg-config", + "system-deps", +] + +[[package]] +name = "gdkx11" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3caa00e14351bebbc8183b3c36690327eb77c49abc2268dd4bd36b856db3fbfe" +dependencies = [ + "gdk", + "gdkx11-sys", + "gio", + "glib", + "libc", + "x11", +] + +[[package]] +name = "gdkx11-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e7445fe01ac26f11601db260dd8608fe172514eb63b3b5e261ea6b0f4428d" +dependencies = [ + "gdk-sys", + "glib-sys", + "libc", + "system-deps", + "x11", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi 6.0.0", + "wasm-bindgen", +] + +[[package]] +name = "getset" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cf442baaabe4213ce7d1239afc26c039180b6456da2cededa316ae2c8a77a77" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "gio" +version = "0.18.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4fc8f532f87b79cbc51a79748f16a6828fb784be93145a322fa14d06d354c73" +dependencies = [ + "futures-channel", + "futures-core", + "futures-io", + "futures-util", + "gio-sys", + "glib", + "libc", + "once_cell", + "pin-project-lite", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "gio-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37566df850baf5e4cb0dfb78af2e4b9898d817ed9263d1090a2df958c64737d2" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", + "winapi", +] + +[[package]] +name = "glib" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "233daaf6e83ae6a12a52055f568f9d7cf4671dabb78ff9560ab6da230ce00ee5" +dependencies = [ + "bitflags 2.13.2", + "futures-channel", + "futures-core", + "futures-executor", + "futures-task", + "futures-util", + "gio-sys", + "glib-macros", + "glib-sys", + "gobject-sys", + "libc", + "memchr", + "once_cell", + "smallvec", + "thiserror 1.0.69", +] + +[[package]] +name = "glib-macros" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bb0228f477c0900c880fd78c8759b95c7636dbd7842707f49e132378aa2acdc" +dependencies = [ + "heck 0.4.1", + "proc-macro-crate 2.0.2", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "glib-sys" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "063ce2eb6a8d0ea93d2bf8ba1957e78dbab6be1c2220dd3daca57d5a9d869898" +dependencies = [ + "libc", + "system-deps", +] + +[[package]] +name = "glob" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4eba85ea1d0a966a983acd07deee566e67395d2d96b6fb39e62b5a833f1eb0b" + +[[package]] +name = "gobject-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0850127b514d1c4a4654ead6dedadb18198999985908e6ffe4436f53c785ce44" +dependencies = [ + "glib-sys", + "libc", + "system-deps", +] + +[[package]] +name = "gtk" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd56fb197bfc42bd5d2751f4f017d44ff59fbb58140c6b49f9b3b2bdab08506a" +dependencies = [ + "atk", + "cairo-rs", + "field-offset", + "futures-channel", + "gdk", + "gdk-pixbuf", + "gio", + "glib", + "gtk-sys", + "gtk3-macros", + "libc", + "pango", + "pkg-config", +] + +[[package]] +name = "gtk-sys" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f29a1c21c59553eb7dd40e918be54dccd60c52b049b75119d5d96ce6b624414" +dependencies = [ + "atk-sys", + "cairo-sys-rs", + "gdk-pixbuf-sys", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "pango-sys", + "system-deps", +] + +[[package]] +name = "gtk3-macros" +version = "0.18.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52ff3c5b21f14f0736fed6dcfc0bfb4225ebf5725f3c0209edeec181e4d73e9d" +dependencies = [ + "proc-macro-crate 1.3.1", + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "hashbrown" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" + +[[package]] +name = "hashbrown" +version = "0.17.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed5909b6e89a2db4456e54cd5f673791d7eca6732202bbf2a9cc504fe2f9b84a" + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e17592d60ebacc7d5e169f4663c5f84f9161cc90328abcfe8456f41e4dfcb284" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "html5ever" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46a1761807faccc9a19e86944bbf40610014066306f96edcdedc2fb714bcb7b8" +dependencies = [ + "log", + "markup5ever", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca2a8f2913ee65f60facd6a5905613afaa448497a0230cc41ce022d93290bc2c" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23169fe34a5fbcdd3f3862e78fb9b6fccd5f02a6dc6f732547005d45631ce71c" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hyper" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3e324da4c95177d6291d4c8730197c0d1822f8a9766814a4a44fa5ab797c9c" +dependencies = [ + "atomic-waker", + "bytes", + "futures-core", + "http", + "http-body", + "httparse", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfa8e654703247911e29c23fbeaa261834bd9bb74efba2f9acddc37bfb127f53" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "tokio", + "tokio-rustls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc03d96684f9226b8a787cdb71488417b53ab5ea8fdb1dac946cb9431cc8bff" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "httparse", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "system-configuration", + "tokio", + "tower-service", + "tracing", + "windows-registry", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core 0.62.2", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "ico" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d75e94d66081e4d8dcd098bd8dc5254800fea14a26389b298410158d834de167" +dependencies = [ + "byteorder", + "png", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "ident_case" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "1.9.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" +dependencies = [ + "autocfg", + "hashbrown 0.12.3", + "serde", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.1", + "serde", + "serde_core", +] + +[[package]] +name = "infer" +version = "0.22.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4200d433cbd5178df7797c9c2e75b348b728e39631cf14520d1e2fc424201f4" +dependencies = [ + "cfb", +] + +[[package]] +name = "ipnet" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "791930b43c0d5973160d90a8f3894509f2b273430f5c5c73b668636d0287c5c0" + +[[package]] +name = "itoa" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" + +[[package]] +name = "javascriptcore-rs" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca5671e9ffce8ffba57afc24070e906da7fc4b1ba66f2cabebf61bf2ea257fcc" +dependencies = [ + "bitflags 1.3.2", + "glib", + "javascriptcore-rs-sys", +] + +[[package]] +name = "javascriptcore-rs-sys" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af1be78d14ffa4b75b66df31840478fef72b51f8c2465d4ca7c194da9f7a5124" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "jiff" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b005715dcbeb0089a3c0dab99f2ff1cc3b2525323552703d648585d342a383" +dependencies = [ + "defmt", + "jiff-core", + "jiff-static", + "jiff-tzdb-platform", + "log", + "portable-atomic", + "portable-atomic-util", + "serde_core", + "windows-link", +] + +[[package]] +name = "jiff-core" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e52fe76043ccecc9005d2305ebaadf7d7fc0cc89ca6baa10a94d6bc68c7128c" +dependencies = [ + "defmt", + "log", +] + +[[package]] +name = "jiff-static" +version = "0.2.38" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2cc9817253cf7c7ee4684451bd327e88d6f3658014e54a29198625590650695c" +dependencies = [ + "jiff-core", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "jiff-tzdb" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa8377070c6bae868759445e5a77f66d84f0b72f3a054bfb00e6d038b8282da7" + +[[package]] +name = "jiff-tzdb-platform" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "875a5a69ac2bab1a891711cf5eccbec1ce0341ea805560dcd90b7a2e925132e8" +dependencies = [ + "jiff-tzdb", +] + +[[package]] +name = "jni" +version = "0.21.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" +dependencies = [ + "cesu8", + "cfg-if", + "combine", + "jni-sys 0.3.1", + "log", + "thiserror 1.0.69", + "walkdir", + "windows-sys 0.45.0", +] + +[[package]] +name = "jni" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5efd9a482cf3a427f00d6b35f14332adc7902ce91efb778580e180ff90fa3498" +dependencies = [ + "cfg-if", + "combine", + "jni-macros", + "jni-sys 0.4.1", + "log", + "simd_cesu8", + "thiserror 2.0.21", + "walkdir", + "windows-link", +] + +[[package]] +name = "jni-macros" +version = "0.22.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a00109accc170f0bdb141fed3e393c565b6f5e072365c3bd58f5b062591560a3" +dependencies = [ + "proc-macro2", + "quote", + "rustc_version", + "simd_cesu8", + "syn 2.0.119", +] + +[[package]] +name = "jni-sys" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41a652e1f9b6e0275df1f15b32661cf0d4b78d4d87ddec5e0c3c20f097433258" +dependencies = [ + "jni-sys 0.4.1", +] + +[[package]] +name = "jni-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6377a88cb3910bee9b0fa88d4f42e1d2da8e79915598f65fb0c7ee14c878af2" +dependencies = [ + "jni-sys-macros", +] + +[[package]] +name = "jni-sys-macros" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38c0b942f458fe50cdac086d2f946512305e5631e720728f2a61aabcd47a6264" +dependencies = [ + "quote", + "syn 2.0.119", +] + +[[package]] +name = "js-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7883d941dae510fb2d978fc3fe018c71c9e2892fd38854de3e8b92c2e5ad9cc5" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "json-patch" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7421438de105a0827e44fadd05377727847d717c80ce29a229f85fd04c427b72" +dependencies = [ + "jsonptr", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "jsonptr" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5a3cc660ba5d72bce0b3bb295bf20847ccbb40fd423f3f05b61273672e561fe" +dependencies = [ + "serde", + "serde_json", +] + +[[package]] +name = "keyboard-types" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fbe853b403ae61a04233030ae8a79d94975281ed9770a1f9e246732b534b28d" +dependencies = [ + "bitflags 2.13.2", + "serde", +] + +[[package]] +name = "ld-fdpi" +version = "1.7.0" +dependencies = [ + "base64 0.22.1", + "local-ip-address", + "native-tls", + "rand_core", + "serde", + "serde_json", + "sha2", + "sysinfo", + "tauri", + "tauri-build", + "tauri-plugin-single-instance", + "tauri-plugin-updater", + "tokio", + "windows-sys 0.59.0", + "winreg 0.52.0", + "x25519-dalek", +] + +[[package]] +name = "libappindicator" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03589b9607c868cc7ae54c0b2a22c8dc03dd41692d48f2d7df73615c6a95dc0a" +dependencies = [ + "glib", + "gtk", + "gtk-sys", + "libappindicator-sys", + "log", +] + +[[package]] +name = "libappindicator-sys" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e9ec52138abedcc58dc17a7c6c0c00a2bdb4f3427c7f63fa97fd0d859155caf" +dependencies = [ + "gtk-sys", + "libloading", + "once_cell", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libdbus-sys" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "328c4789d42200f1eeec05bd86c9c13c7f091d2ba9a6ea35acdf51f31bc0f043" +dependencies = [ + "pkg-config", +] + +[[package]] +name = "libloading" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" +dependencies = [ + "cfg-if", + "winapi", +] + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "libc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a66949e030da00e8c7d4434b251670a91556f4144941d37452769c25d58a53" + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "local-ip-address" +version = "0.6.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa08fb2b1ec3ea84575e94b489d06d4ce0cbf052d12acd515838f50e3c3d63e3" +dependencies = [ + "libc", + "neli", + "windows-sys 0.61.2", +] + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9f8bd3e56ce4dfc153cf470fffbfa98c7620958b312ca5c3a4b8d5181fd13c6" + +[[package]] +name = "markup5ever" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7122d987ec5f704ee56f6e5b41a7d93722e9aae27ae07cafa4036c4d3f9757de" +dependencies = [ + "log", + "tendril", + "web_atoms", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "memoffset" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "488016bfae457b036d996092f6cb448677611ce4449e970ceaf42695203f218a" +dependencies = [ + "autocfg", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minisign-verify" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "871285dc19d8d0ebe0eef3d0e99a205f2a71363b122632cbbfa4a6c370a960ce" + +[[package]] +name = "miniz_oxide" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fa76a2c86f704bdb222d66965fb3d63269ce38518b83cb0575fca855ebb6316" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "miniz_oxide" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b63fbc4a50860e98e7b2aa7804ded1db5cbc3aff9193adaff57a6931bf7c4b4c" +dependencies = [ + "adler2", + "simd-adler32", +] + +[[package]] +name = "mio" +version = "1.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1788edb87fdc09c7e26304471e2f5be8cdefb1b6930d6e3985fc02ff53bf86ee" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "muda" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cca139e57da4383727f189e43e66e84fa372347027fc996f9f1a007ec0a37996" +dependencies = [ + "crossbeam-channel", + "dpi", + "gtk", + "keyboard-types", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "once_cell", + "png", + "serde", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "native-tls" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "465500e14ea162429d264d44189adc38b199b62b1c21eea9f69e4b73cb03bbf2" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "ndk" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3f42e7bbe13d351b6bead8286a43aac9534b82bd3cc43e47037f012ebfd62d4" +dependencies = [ + "bitflags 2.13.2", + "jni-sys 0.3.1", + "log", + "ndk-sys", + "num_enum", + "raw-window-handle", + "thiserror 1.0.69", +] + +[[package]] +name = "ndk-context" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" + +[[package]] +name = "ndk-sys" +version = "0.6.0+11769913" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee6cda3051665f1fb8d9e08fc35c96d5a244fb1be711a03b71118828afc9a873" +dependencies = [ + "jni-sys 0.3.1", +] + +[[package]] +name = "neli" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b152f4f18819e638ea350a740b16de75099302b5ec3a58f4f8766ef2fcf695d" +dependencies = [ + "bitflags 2.13.2", + "byteorder", + "derive_builder", + "getset", + "libc", + "linux-raw-sys", + "log", + "neli-proc-macros", + "parking_lot", +] + +[[package]] +name = "neli-proc-macros" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05d8d08c6e98f20a62417478ebf7be8e1425ec9acecc6f63e22da633f6b71609" +dependencies = [ + "either", + "proc-macro2", + "quote", + "serde", + "syn 2.0.119", +] + +[[package]] +name = "new_debug_unreachable" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "650eef8c711430f1a879fdd01d4745a7deea475becfb90269c06775983bbf086" + +[[package]] +name = "nix" +version = "0.31.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf20d2fde8ff38632c426f1165ed7436270b44f199fc55284c38276f9db47c3d" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "cfg_aliases", + "libc", +] + +[[package]] +name = "ntapi" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3b335231dfd352ffb0f8017f3b6027a4917f7df785ea2143d8af2adc66980ae" +dependencies = [ + "winapi", +] + +[[package]] +name = "num-conv" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521739c6d2bac4aa25192232afe6841231376b2b26d4d9fae5ecf8ca5772e441" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "num_enum" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0bca838442ec211fa11de3a8b0e0e8f3a4522575b5c4c06ed722e005036f26" +dependencies = [ + "num_enum_derive", + "rustversion", +] + +[[package]] +name = "num_enum_derive" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "680998035259dcfcafe653688bf2aa6d3e2dc05e98be6ab46afb089dc84f1df8" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "objc2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08849bbd4767dfae9457696856ae1c84fe4e0281bbe4a7abff2d0e06fb7981f8" +dependencies = [ + "objc2-encode", + "objc2-exception-helper", +] + +[[package]] +name = "objc2-app-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d49e936b501e5c5bf01fda3a9452ff86dc3ea98ad5f283e1455153142d97518c" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", +] + +[[package]] +name = "objc2-cloud-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73ad74d880bb43877038da939b7427bba67e9dd42004a18b809ba7d87cee241c" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-data" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b402a653efbb5e82ce4df10683b6b28027616a2715e90009947d50b8dd298fa" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2", +] + +[[package]] +name = "objc2-core-graphics" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e022c9d066895efa1345f8e33e584b9f958da2fd4cd116792e15e07e4720a807" +dependencies = [ + "bitflags 2.13.2", + "dispatch2", + "objc2", + "objc2-core-foundation", + "objc2-io-surface", +] + +[[package]] +name = "objc2-core-image" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5d563b38d2b97209f8e861173de434bd0214cf020e3423a52624cd1d989f006" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-location" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ca347214e24bc973fc025fd0d36ebb179ff30536ed1f80252706db19ee452009" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-core-text" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cde0dfb48d25d2b4862161a4d5fcc0e3c24367869ad306b0c9ec0073bfed92d" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", +] + +[[package]] +name = "objc2-encode" +version = "4.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef25abbcd74fb2609453eb695bd2f860d389e457f67dc17cafc8b8cbc89d0c33" + +[[package]] +name = "objc2-exception-helper" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7a1c5fbb72d7735b076bb47b578523aedc40f3c439bea6dfd595c089d79d98a" +dependencies = [ + "cc", +] + +[[package]] +name = "objc2-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" +dependencies = [ + "bitflags 2.13.2", + "block2", + "libc", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-io-surface" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "180788110936d59bab6bd83b6060ffdfffb3b922ba1396b312ae795e1de9d81d" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", +] + +[[package]] +name = "objc2-osa-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f112d1746737b0da274ef79a23aac283376f335f4095a083a267a082f21db0c0" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-app-kit", + "objc2-foundation", +] + +[[package]] +name = "objc2-quartz-core" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96c1358452b371bf9f104e21ec536d37a650eb10f7ee379fff67d2e08d537f1f" +dependencies = [ + "bitflags 2.13.2", + "objc2", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "objc2-ui-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d87d638e33c06f577498cbcc50491496a3ed4246998a7fbba7ccb98b1e7eab22" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", + "objc2-cloud-kit", + "objc2-core-data", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-core-image", + "objc2-core-location", + "objc2-core-text", + "objc2-foundation", + "objc2-quartz-core", + "objc2-user-notifications", +] + +[[package]] +name = "objc2-user-notifications" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9df9128cbbfef73cda168416ccf7f837b62737d748333bfe9ab71c245d76613e" +dependencies = [ + "objc2", + "objc2-foundation", +] + +[[package]] +name = "objc2-web-kit" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2e5aaab980c433cf470df9d7af96a7b46a9d892d521a2cbbb2f8a4c16751e7f" +dependencies = [ + "bitflags 2.13.2", + "block2", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "openssl" +version = "0.10.81" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77823a27f0babb03091cb9ed9ef80af3b39dbc82f97e8fa530374b7dafd87a45" +dependencies = [ + "bitflags 2.13.2", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "openssl-probe" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e036b411754132fd6b74e94b74e9a13c5cf606fa93d1885c35860d3060820b1" + +[[package]] +name = "openssl-sys" +version = "0.9.117" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b47e7e6bb2c38cd930d25a23b40fa52e068c10e85f3e03a7f5ba5aaca5713695" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "ordered-stream" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aa2b01e1d916879f73a53d01d1d6cee68adbb31d6d9177a8cfce093cced1d50" +dependencies = [ + "futures-core", + "pin-project-lite", +] + +[[package]] +name = "osakit" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "732c71caeaa72c065bb69d7ea08717bd3f4863a4f451402fc9513e29dbd5261b" +dependencies = [ + "objc2", + "objc2-foundation", + "objc2-osa-kit", + "serde", + "serde_json", + "thiserror 2.0.21", +] + +[[package]] +name = "pango" +version = "0.18.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ca27ec1eb0457ab26f3036ea52229edbdb74dee1edd29063f5b9b010e7ebee4" +dependencies = [ + "gio", + "glib", + "libc", + "once_cell", + "pango-sys", +] + +[[package]] +name = "pango-sys" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436737e391a843e5933d6d9aa102cb126d501e815b83601365a948a518555dc5" +dependencies = [ + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_macros", + "phf_shared", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49aa7f9d80421bca176ca8dbfebe668cc7a2684708594ec9f3c0db0805d5d6e1" +dependencies = [ + "phf_generator", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "135ace3a761e564ec88c03a77317a7c6b80bb7f7135ef2544dbe054243b89737" +dependencies = [ + "fastrand", + "phf_shared", +] + +[[package]] +name = "phf_macros" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812f032b54b1e759ccd5f8b6677695d5268c588701effba24601f6932f8269ef" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "piper" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c835479a4443ded371d6c535cbfd8d31ad92c5d23ae9770a61bc155e4992a3c1" +dependencies = [ + "atomic-waker", + "fastrand", + "futures-io", +] + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "plist" +version = "1.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "327a4cb2ad49dc48adfdc9da89e22c64d488b508c67a044d71ba729e4521a285" +dependencies = [ + "base64 0.23.1", + "indexmap 2.14.2", + "quick-xml", + "serde", + "time", +] + +[[package]] +name = "png" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60769b8b31b2a9f263dae2776c37b1b28ae246943cf719eb6946a1db05128a61" +dependencies = [ + "bitflags 2.13.2", + "crc32fast", + "fdeflate", + "flate2", + "miniz_oxide 0.8.9", +] + +[[package]] +name = "polling" +version = "3.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d0e4f59085d47d8241c88ead0f274e8a0cb551f3625263c05eb8dd897c34218" +dependencies = [ + "cfg-if", + "concurrent-queue", + "hermit-abi", + "pin-project-lite", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "portable-atomic" +version = "1.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05c8b63e8d9609db387f0324918f81d68fe27748f084ef092fb35954d0539a85" + +[[package]] +name = "portable-atomic-util" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10ab3eb7f3becc3a1cbc4f2c6f20267996cfc1a6467a873763411b136a122715" +dependencies = [ + "portable-atomic", +] + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a6394b9e965e73d0a289ee54f589087e2c676aedf60885baf52c76b771e4958" + +[[package]] +name = "precomputed-hash" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "925383efa346730478fb4838dbe9137d2a47675ad789c546d150a6e1dd4ab31c" + +[[package]] +name = "proc-macro-crate" +version = "1.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" +dependencies = [ + "once_cell", + "toml_edit 0.19.15", +] + +[[package]] +name = "proc-macro-crate" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b00f26d3400549137f92511a46ac1cd8ce37cb5598a96d382381458b992a5d24" +dependencies = [ + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "proc-macro-crate" +version = "3.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e67ba7e9b2b56446f1d419b1d807906278ffa1a658a8a5d8a39dcb1f5a78614f" +dependencies = [ + "toml_edit 0.25.17+spec-1.1.0", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quick-xml" +version = "0.42.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41b1177fdf999d2321d3fb46ff47159d9c1fb9ad66a4879f8c50a0b504615e9b" +dependencies = [ + "memchr", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "raw-window-handle" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20675572f6f24e9e76ef639bc5552774ed45f1c30e2951e1e99c59888861c539" + +[[package]] +name = "rayon" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb39b166781f92d482534ef4b4b1b2568f42613b53e5b6c160e24cfbfa30926d" +dependencies = [ + "either", + "rayon-core", +] + +[[package]] +name = "rayon-core" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0f0062d30d4230b2e85ff77fdfe4326feb054b9783a3460d8435c8ab91" +dependencies = [ + "crossbeam-deque", + "crossbeam-utils", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags 2.13.2", +] + +[[package]] +name = "redox_users" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60dc65c0ff1a7ae1294b0c67b9f14baf70b644404010370171787bfac1038fc0" +dependencies = [ + "libredox", + "thiserror 2.0.21", +] + +[[package]] +name = "ref-cast" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e440fb4e4b4147295338efb76001ab9e4efc0e5839df2c47fc5ac2381d365c3" +dependencies = [ + "ref-cast-impl", +] + +[[package]] +name = "ref-cast-impl" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecd8964f8453721699a1ed72037b0db49ce2f5a5138486ee89bed6f67cdf3a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "regex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f020237b6c8eed93db2e2cb53c00c60a8e1bc73da7d073199a1180401450218d" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad8553b9b26413251cbf30e620595c7a41b3887f03da04579c0e6b0d6a06b4b2" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6f6ff9a378485b298a5286656da665ba74413d36db0979633275d2e708145d4" + +[[package]] +name = "reqwest" +version = "0.13.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16a1cfa75cc186dd73d5818e510e042e40927bccc9c236b061cea97e1eb08029" +dependencies = [ + "base64 0.23.1", + "bytes", + "futures-core", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "rustls", + "rustls-pki-types", + "rustls-platform-verifier", + "serde", + "serde_json", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tokio-util", + "tower", + "tower-http", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustc-hash" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b1e7f9a428571be2dc5bc0505c13fb6bf936822b894ec87abf8a08a4e51742d" + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver", +] + +[[package]] +name = "rustix" +version = "1.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5e76742e5294153d4dde1207dbec5bdd81eef6fabdc0d2118babadabfd858aa" +dependencies = [ + "bitflags 2.13.2", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-native-certs" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a073f5dc7469f984c52ad2752b63b0807745133b6de880b7b64c1ac4c48aec4" +dependencies = [ + "openssl-probe", + "rustls-pki-types", + "schannel", + "security-framework", +] + +[[package]] +name = "rustls-pki-types" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f4925028c7eb5d1fcdaf196971378ed9d2c1c4efc7dc5d011256f76c99c0a96" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-platform-verifier" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1167586491e2b18b8bfbb293e8180ec17c201c4f076d7cb3070ca964e7598f98" +dependencies = [ + "core-foundation 0.10.1", + "core-foundation-sys", + "jni 0.22.4", + "log", + "once_cell", + "rustls", + "rustls-native-certs", + "rustls-platform-verifier-android", + "rustls-webpki", + "security-framework", + "security-framework-sys", + "webpki-root-certs", + "windows-sys 0.61.2", +] + +[[package]] +name = "rustls-platform-verifier-android" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eec689c0bc40ff2458a5977b6619cb718087084a18e02a131c599b62d05e1a5f" + +[[package]] +name = "rustls-webpki" +version = "0.103.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443b1b6d39d7c663139942cc4558262562d2c84123bb6282ef177009ca8b281" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "schannel" +version = "0.1.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9cb23c424d8ee841bb4d813677ca237e2a610067d594fec130f87d6093495ab5" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "schemars" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3fbf2ae1b8bc8e02df939598064d22402220cd5bbcca1c76f7d6a310974d5615" +dependencies = [ + "dyn-clone", + "indexmap 1.9.3", + "schemars_derive", + "serde", + "serde_json", + "url", + "uuid", +] + +[[package]] +name = "schemars" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd191f9397d57d581cddd31014772520aa448f65ef991055d7f61582c65165f" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ab508826f74a77ca9d5aba6ff19b522583ee3eaf28a19384ff3d0e5835fadf6e" +dependencies = [ + "dyn-clone", + "ref-cast", + "serde", + "serde_json", +] + +[[package]] +name = "schemars_derive" +version = "0.8.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32e265784ad618884abaea0600a9adf15393368d840e0222d101a072f3f7534d" +dependencies = [ + "proc-macro2", + "quote", + "serde_derive_internals", + "syn 2.0.119", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "security-framework" +version = "3.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b7f4bc775c73d9a02cde8bf7b2ec4c9d12743edf609006c7facc23998404cd1d" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.10.1", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2691df843ecc5d231c0b14ece2acc3efb62c0a398c7e1d875f3983ce020e3" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "selectors" +version = "0.38.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8adfa1c298912827b8a28b223b3b874357397ae706e6190acd9bf28cee99114d" +dependencies = [ + "bitflags 2.13.2", + "cssparser", + "derive_more", + "log", + "new_debug_unreachable", + "phf", + "phf_codegen", + "precomputed-hash", + "rustc-hash", + "servo_arc", + "smallvec", +] + +[[package]] +name = "semver" +version = "1.0.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a7852d02fc848982e0c167ef163aaff9cd91dc640ba85e263cb1ce46fae51cd" +dependencies = [ + "serde", + "serde_core", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde-untagged" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f9faf48a4a2d2693be24c6289dbe26552776eb7737074e6722891fadbe6c5058" +dependencies = [ + "erased-serde", + "serde", + "serde_core", + "typeid", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_derive_internals" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18d26a20a969b9e3fdf2fc2d9f21eda6c40e2de84c9408bb5d3b05d499aae711" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_repr" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d3b1629de253c70a0508c3899572da79ca359fdab27c7920ff00406df418906" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_spanned" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7523beb55eece201a2356bee0bbca0d1ab466c14c07703b2e0ee6d42cb0c2c" +dependencies = [ + "serde_core", +] + +[[package]] +name = "serde_with" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df9adc193c780ef8f159aee8b61e2d5801aaa555e6eb0947fe45530ec506296f" +dependencies = [ + "base64 0.23.1", + "bs58", + "chrono", + "hex", + "indexmap 1.9.3", + "indexmap 2.14.2", + "jiff", + "schemars 0.9.0", + "schemars 1.2.3", + "serde_core", + "serde_json", + "serde_with_macros", + "time", +] + +[[package]] +name = "serde_with_macros" +version = "3.24.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e17bbc68e28663bbbb90df47e058aa7eda4fb445b89fe70457bb94fbccf6e49" +dependencies = [ + "darling 0.24.1", + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "serialize-to-javascript" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04f3666a07a197cdb77cdf306c32be9b7f598d7060d50cfd4d5aa04bfd92f6c5" +dependencies = [ + "serde", + "serde_json", + "serialize-to-javascript-impl", +] + +[[package]] +name = "serialize-to-javascript-impl" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "772ee033c0916d670af7860b6e1ef7d658a4629a6d0b4c8c3e67f09b3765b75d" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "servo_arc" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "170fb83ab34de17dc69aa7c67482b22218ddb85da56546f9bd6b929e32a05930" +dependencies = [ + "stable_deref_trait", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "simd-adler32" +version = "0.3.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a219298ac11a56ea9a6d2120044824d6f01aeb034955e7af7bc16858527deea" + +[[package]] +name = "simd_cesu8" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11031e251abf8611c80f460e19dbdeb54a66db918e49c65a7065b46ac7aec520" +dependencies = [ + "rustc_version", + "simdutf8", +] + +[[package]] +name = "simdutf8" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0d5d4b1981b8bbbb7aed204cae5726d683d5d6ac7e74ec54122ea28f315e7c8" + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "softbuffer" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac18da81ebbf05109ab275b157c22a653bb3c12cf884450179942f81bcbf6c3" +dependencies = [ + "bytemuck", + "js-sys", + "ndk", + "objc2", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "redox_syscall", + "tracing", + "wasm-bindgen", + "web-sys", + "windows-sys 0.61.2", +] + +[[package]] +name = "soup3" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "471f924a40f31251afc77450e781cb26d55c0b650842efafc9c6cbd2f7cc4f9f" +dependencies = [ + "futures-channel", + "gio", + "glib", + "libc", + "soup3-sys", +] + +[[package]] +name = "soup3-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ebe8950a680a12f24f15ebe1bf70db7af98ad242d9db43596ad3108aab86c27" +dependencies = [ + "gio-sys", + "glib-sys", + "gobject-sys", + "libc", + "system-deps", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "static_vcruntime" +version = "3.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff7589a1859b09232522bb9edf076ca7fcf14ded96685d3fa629db73023ffbb7" + +[[package]] +name = "string_cache" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a18596f8c785a729f2819c0f6a7eae6ebeebdfffbfe4214ae6b087f690e31901" +dependencies = [ + "new_debug_unreachable", + "parking_lot", + "phf_shared", + "precomputed-hash", +] + +[[package]] +name = "string_cache_codegen" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "585635e46db231059f76c5849798146164652513eb9e8ab2685939dd90f29b69" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", +] + +[[package]] +name = "strsim" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "swift-rs" +version = "1.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cefd87076fd385308ee4aff597256c902f1fbb4d031de1558efc12f8ffefadd9" +dependencies = [ + "base64 0.21.7", + "serde", + "serde_json", +] + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d78c8dee4c7bf0e14673097256fed6142ce9d3b85a408189d07482442145823b" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "sysinfo" +version = "0.33.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fc858248ea01b66f19d8e8a6d55f41deaf91e9d495246fd01368d99935c6c01" +dependencies = [ + "core-foundation-sys", + "libc", + "memchr", + "ntapi", + "rayon", + "windows 0.57.0", +] + +[[package]] +name = "system-configuration" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a13f3d0daba03132c0aa9767f98351b3488edc2c100cda2d2ec2b04f3d8d3c8b" +dependencies = [ + "bitflags 2.13.2", + "core-foundation 0.9.4", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "system-deps" +version = "6.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3e535eb8dded36d55ec13eddacd30dec501792ff23a0b1682c38601b8cf2349" +dependencies = [ + "cfg-expr", + "heck 0.5.0", + "pkg-config", + "toml 0.8.2", + "version-compare", +] + +[[package]] +name = "tao" +version = "0.37.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5777b06fe6435126ae8d816eba269e050e1e10d302cf5461e9c49eccabc3548" +dependencies = [ + "bitflags 2.13.2", + "block2", + "core-foundation 0.10.1", + "core-graphics", + "crossbeam-channel", + "dbus", + "dispatch2", + "dlopen2", + "dpi", + "gdkwayland-sys", + "gdkx11-sys", + "gtk", + "jni 0.21.1", + "libc", + "log", + "ndk", + "ndk-context", + "ndk-sys", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "parking_lot", + "percent-encoding", + "raw-window-handle", + "tao-macros", + "unicode-segmentation", + "url", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "tao-macros" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f7eeb6d99155545da6150a1795945f16ac9c178deb2a5f2e74d776107bd5849" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tar" +version = "0.4.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f6221d9a6003c78398e3b239969f352578258df48c8eb051caadae0015bc840" +dependencies = [ + "filetime", + "libc", + "xattr", +] + +[[package]] +name = "target-lexicon" +version = "0.12.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" + +[[package]] +name = "tauri" +version = "2.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fb0244332cfb9cee7e2a568bf5da29a36ed8fdbd717f6f47a66b6b7b358c072" +dependencies = [ + "anyhow", + "bytes", + "cookie", + "dirs", + "dunce", + "embed_plist", + "getrandom 0.3.4", + "glob", + "gtk", + "heck 0.5.0", + "http", + "jni 0.21.1", + "libc", + "log", + "mime", + "muda", + "objc2", + "objc2-app-kit", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "plist", + "raw-window-handle", + "reqwest", + "serde", + "serde_json", + "serde_repr", + "serialize-to-javascript", + "swift-rs", + "tauri-build", + "tauri-macros", + "tauri-runtime", + "tauri-runtime-wry", + "tauri-utils", + "thiserror 2.0.21", + "tokio", + "tray-icon", + "url", + "webkit2gtk", + "webview2-com", + "window-vibrancy", + "windows 0.62.2", +] + +[[package]] +name = "tauri-build" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adddb0e648752aaac5da9c3c3c6a68e1e87cab55e3b757b18a9441ef8c3ac614" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs", + "glob", + "heck 0.5.0", + "json-patch", + "schemars 0.8.22", + "semver", + "serde", + "serde_json", + "static_vcruntime", + "strsim", + "tauri-utils", + "tauri-winres", + "walkdir", +] + +[[package]] +name = "tauri-codegen" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb37631cf71dab5e8ab55e1bdd701e18a52653d90b78e71d0e5598b1e0a61316" +dependencies = [ + "base64 0.23.1", + "brotli", + "ico", + "json-patch", + "plist", + "png", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "sha2", + "syn 2.0.119", + "tauri-utils", + "thiserror 2.0.21", + "time", + "url", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-macros" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0cc38db58854c10fb5f91a887ed8bf82d3239bb92b5d8db86eda09e96d9963d1" +dependencies = [ + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.119", + "tauri-codegen", + "tauri-utils", +] + +[[package]] +name = "tauri-plugin" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67fb21a77e8f94e8beb3325e583102488659365af0a3948b7ea244c5b779c291" +dependencies = [ + "anyhow", + "glob", + "plist", + "schemars 0.8.22", + "serde", + "serde_json", + "tauri-utils", + "walkdir", +] + +[[package]] +name = "tauri-plugin-single-instance" +version = "2.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "561cd99484561bc39c954768e7b41a66cebbe1ac3d9d081c34361f740c489e2c" +dependencies = [ + "serde", + "serde_json", + "tauri", + "thiserror 2.0.21", + "tokio", + "tracing", + "windows-sys 0.61.2", + "zbus", +] + +[[package]] +name = "tauri-plugin-updater" +version = "2.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d957abbcb3f9f6c76d22a3a0f012f30880640d0bccb5634d2b12a9937e4c872b" +dependencies = [ + "base64 0.23.1", + "dirs", + "flate2", + "futures-util", + "http", + "infer", + "libc", + "log", + "minisign-verify", + "osakit", + "percent-encoding", + "reqwest", + "rustls", + "semver", + "serde", + "serde_json", + "tar", + "tauri", + "tauri-plugin", + "tempfile", + "thiserror 2.0.21", + "time", + "tokio", + "url", + "windows-sys 0.61.2", + "zip", +] + +[[package]] +name = "tauri-runtime" +version = "2.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c55766d99cea69055904d1735b93c2049302b2e09effd462120deb5581d78e9" +dependencies = [ + "cookie", + "dpi", + "gtk", + "http", + "jni 0.21.1", + "objc2", + "objc2-ui-kit", + "objc2-web-kit", + "raw-window-handle", + "serde", + "serde_json", + "tauri-utils", + "thiserror 2.0.21", + "url", + "webkit2gtk", + "webview2-com", + "windows 0.62.2", +] + +[[package]] +name = "tauri-runtime-wry" +version = "2.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f" +dependencies = [ + "gtk", + "http", + "jni 0.21.1", + "log", + "objc2", + "objc2-app-kit", + "percent-encoding", + "raw-window-handle", + "softbuffer", + "tao", + "tauri-runtime", + "tauri-utils", + "url", + "webkit2gtk", + "webview2-com", + "windows 0.62.2", + "wry", +] + +[[package]] +name = "tauri-utils" +version = "2.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "362ab21cd4cc713f2a02b1a9b5688198b1541cfb6907c4281e9190e0f0ef4aa3" +dependencies = [ + "anyhow", + "brotli", + "cargo_metadata", + "ctor", + "dom_query", + "dunce", + "glob", + "http", + "infer", + "json-patch", + "log", + "memchr", + "phf", + "plist", + "proc-macro2", + "quote", + "regex", + "schemars 0.8.22", + "semver", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "swift-rs", + "thiserror 2.0.21", + "toml 1.1.8+spec-1.1.0", + "url", + "urlpattern", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-winres" +version = "0.3.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c52bb6904475a6ca662f15ef787f18ade61d5740a1ee12c45d3b748efdb6f796" +dependencies = [ + "dunce", + "embed-resource", + "toml 1.1.8+spec-1.1.0", +] + +[[package]] +name = "tempfile" +version = "3.27.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32497e9a4c7b38532efcdebeef879707aa9f794296a4f0244f6f69e9bc8574bd" +dependencies = [ + "fastrand", + "getrandom 0.4.3", + "once_cell", + "rustix", + "windows-sys 0.61.2", +] + +[[package]] +name = "tendril" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fed54709c5b3a53d09bb1c113ea4f5ceafd1e772ddcb0030a82e1d56c087b08" +dependencies = [ + "new_debug_unreachable", +] + +[[package]] +name = "thiserror" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6aaf5339b578ea85b50e080feb250a3e8ae8cfcdff9a461c9ec2904bc923f52" +dependencies = [ + "thiserror-impl 1.0.69", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl 2.0.21", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.69" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fee6c4efc90059e10f81e6d42c60a18f76588c3d74cb83a0b242a2b6c7504c1" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "time" +version = "0.3.55" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cdb87b95ec50ddfa440816d227a17b2ccbdda963a316a727fda0fc4334f7d134" +dependencies = [ + "deranged", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1c906769ad99c88eaa54e728060edef082f8e358ff32030cb7c7d315e81109" + +[[package]] +name = "time-macros" +version = "0.2.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e689342a48d2ea927c87ea50cabf8594854bf940e9310208848d680d668ed85" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e464cf451ba96ebfc6f9b6542f17ee8b8956e33f1e40d9690624e59d7a7f8a4b" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +dependencies = [ + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "toml_edit 0.20.2", +] + +[[package]] +name = "toml" +version = "1.1.8+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20489e00e4d8741d6be680764cc12e270655e375a20d1011e844a9c3379e678d" +dependencies = [ + "indexmap 2.14.2", + "serde_core", + "serde_spanned 1.1.2", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "toml_writer", + "winnow 1.0.4", +] + +[[package]] +name = "toml_datetime" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_datetime" +version = "1.1.2+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b86d767906c6c42421dcba507eb9d203e779497710a47782a224bb871653053" +dependencies = [ + "serde_core", +] + +[[package]] +name = "toml_edit" +version = "0.19.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" +dependencies = [ + "indexmap 2.14.2", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +dependencies = [ + "indexmap 2.14.2", + "serde", + "serde_spanned 0.6.9", + "toml_datetime 0.6.3", + "winnow 0.5.40", +] + +[[package]] +name = "toml_edit" +version = "0.25.17+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3641d5bbb5349a79e1020a242d251efbc546ad8048d133958323ce9c40a9c9c" +dependencies = [ + "indexmap 2.14.2", + "toml_datetime 1.1.2+spec-1.1.0", + "toml_parser", + "winnow 1.0.4", +] + +[[package]] +name = "toml_parser" +version = "1.1.5+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baa693a8032d7e1cada7d0041e96126df243179ff061456783ac7f12bda4744c" +dependencies = [ + "winnow 1.0.4", +] + +[[package]] +name = "toml_writer" +version = "1.1.3+spec-1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06bdbd8cfc056b8d2e2e85f29b56a3bdbecb527cef81eb39e3e7b98af4652770" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-http" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cfcf7e2740e6fc6d4d688b4ef00650406bb94adf4731e43c096c3a19fe40840" +dependencies = [ + "bitflags 2.13.2", + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", + "url", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tray-icon" +version = "0.25.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2b9c52859a94554803ccd4a24b98f74148ebc73b90676d783f3490b1bff9d72" +dependencies = [ + "crossbeam-channel", + "dirs", + "libappindicator", + "muda", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-core-graphics", + "objc2-foundation", + "once_cell", + "png", + "serde", + "thiserror 2.0.21", + "windows-sys 0.61.2", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typed-path" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce898823d8cd0f028662d2f349694b1af0a5cc9be83f1d213a00d3147445e1e" + +[[package]] +name = "typeid" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bc7d623258602320d5c55d1bc22793b57daff0ec7efc270ea7d55ce1d5f5471c" + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "uds_windows" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f6fb2847f6742cd76af783a2a2c49e9375d0a111c7bef6f71cd9e738c72d6e" +dependencies = [ + "memoffset", + "tempfile", + "windows-sys 0.61.2", +] + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-segmentation" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6f5d3c3b1bf09027a88a6bc961fc00497d651009560b5463668dc81b0fa87a8" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", + "serde_derive", +] + +[[package]] +name = "urlpattern" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df16f50ef4cc145211879a3867ba757076b25dfee812040dcb0658bd9ae7904b" +dependencies = [ + "icu_properties", + "regex", + "serde", + "url", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "uuid" +version = "1.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a0e2d11620c50695fe12bbbfde96b3477fe606e7284c22d505c12ce51214514" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "serde_core", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version-compare" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03c2856837ef78f57382f06b2b8563a2f512f7185d732608fd9176cb3b8edf0e" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "vswhom" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be979b7f07507105799e854203b470ff7c78a1639e330a58f183b5fea574608b" +dependencies = [ + "libc", + "vswhom-sys", +] + +[[package]] +name = "vswhom-sys" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fb067e4cbd1ff067d1df46c9194b5de0e98efd2810bbc95c5d5e5f25a3231150" +dependencies = [ + "cc", + "libc", +] + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec4cdd0dd910afe868b7ef477227d8d538b46b3075031afee8a9f2acb0a2ed0b" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9bb54f33acc68fd454578d9820b0bde1a1a3d17aa17bb7b6595806d02886d409" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.79" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cbab34de2d982e9b48e18d216d04c4a6f641066ff19ffb699980f591ee3610e" +dependencies = [ + "js-sys", + "tokio", + "wasm-bindgen", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e29d0c35b16e224a7eeb5cd2d25e3e1968fbd65604117b44d3b789d00ee8535" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f501a8bc3719dba86ef8ae4728879c08001bea749eb1333ac5b91e040e2a6b7" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.9", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.129" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23f0c9c52aa7cd7d77769a4cfe2a9adb1b331f489a41d912ce14513d5ab995c6" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "wasm-streams" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d1ec4f6517c9e11ae630e200b2b65d193279042e28edd4a2cda233e46670bbb" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88261b9deccee56594c11a3460c462c41f58d148598fe70ad77070126a68aba4" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web_atoms" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba8b815c1b593dc0baf78dd0f4fc8fdb2de53198fb1163738093e9a311c33fb3" +dependencies = [ + "phf", + "phf_codegen", + "string_cache", + "string_cache_codegen", +] + +[[package]] +name = "webkit2gtk" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1027150013530fb2eaf806408df88461ae4815a45c541c8975e61d6f2fc4793" +dependencies = [ + "bitflags 1.3.2", + "cairo-rs", + "gdk", + "gdk-sys", + "gio", + "gio-sys", + "glib", + "glib-sys", + "gobject-sys", + "gtk", + "gtk-sys", + "javascriptcore-rs", + "libc", + "once_cell", + "soup3", + "webkit2gtk-sys", +] + +[[package]] +name = "webkit2gtk-sys" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "916a5f65c2ef0dfe12fff695960a2ec3d4565359fdbb2e9943c974e06c734ea5" +dependencies = [ + "bitflags 1.3.2", + "cairo-sys-rs", + "gdk-sys", + "gio-sys", + "glib-sys", + "gobject-sys", + "gtk-sys", + "javascriptcore-rs-sys", + "libc", + "pkg-config", + "soup3-sys", + "system-deps", +] + +[[package]] +name = "webpki-root-certs" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e49d0e65abc00c142e8f9428da991da9f1a250c39be97459901eb12b9b49f62a" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "webview2-com" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f89fca7a704cee10dcb3654c1dbb8941d1783132f1917358af75bec37a7d7e6" +dependencies = [ + "webview2-com-macros", + "webview2-com-sys", + "windows 0.62.2", + "windows-core 0.62.2", +] + +[[package]] +name = "webview2-com-macros" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67a921c1b6914c367b2b823cd4cde6f96beec77d30a939c8199bb377cf9b9b54" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "webview2-com-sys" +version = "0.39.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b3a07132775117d6065853d9d1178157b8c90e228de47129d6bce2c7edebedfb" +dependencies = [ + "thiserror 2.0.21", + "windows 0.62.2", + "windows-core 0.62.2", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "window-vibrancy" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111e51caca442cafd9bab396628ac4d814880eaea4e63dfd76a12e9f342b5580" +dependencies = [ + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-quartz-core", + "raw-window-handle", + "windows-sys 0.61.2", + "windows-version", +] + +[[package]] +name = "windows" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12342cb4d8e3b046f3d80effd474a7a02447231330ef77d71daa6fbc40681143" +dependencies = [ + "windows-core 0.57.0", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "527fadee13e0c05939a6a05d5bd6eec6cd2e3dbd648b9f8e447c6518133d8580" +dependencies = [ + "windows-collections", + "windows-core 0.62.2", + "windows-future", + "windows-numerics", +] + +[[package]] +name = "windows-collections" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b2d95af1a8a14a3c7367e1ed4fc9c20e0a26e79551b1454d72583c97cc6610" +dependencies = [ + "windows-core 0.62.2", +] + +[[package]] +name = "windows-core" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2ed2439a290666cd67ecce2b0ffaad89c2a56b976b736e6ece670297897832d" +dependencies = [ + "windows-implement 0.57.0", + "windows-interface 0.57.0", + "windows-result 0.1.2", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement 0.60.2", + "windows-interface 0.59.3", + "windows-link", + "windows-result 0.4.1", + "windows-strings", +] + +[[package]] +name = "windows-future" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e1d6f90251fe18a279739e78025bd6ddc52a7e22f921070ccdc67dde84c605cb" +dependencies = [ + "windows-core 0.62.2", + "windows-link", + "windows-threading", +] + +[[package]] +name = "windows-implement" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9107ddc059d5b6fbfbffdfa7a7fe3e22a226def0b2608f72e9d552763d3e1ad7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.57.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29bee4b38ea3cde66011baa44dba677c432a78593e202392d1e9070cf2a7fca7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-numerics" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e2e40844ac143cdb44aead537bbf727de9b044e107a0f1220392177d15b0f26" +dependencies = [ + "windows-core 0.62.2", + "windows-link", +] + +[[package]] +name = "windows-registry" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02752bf7fbdcce7f2a27a742f798510f3e5ad88dbe84871e5168e2120c3d5720" +dependencies = [ + "windows-link", + "windows-result 0.4.1", + "windows-strings", +] + +[[package]] +name = "windows-result" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e383302e8ec8515204254685643de10811af0ed97ea37210dc26fb0032647f8" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets 0.42.2", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" +dependencies = [ + "windows_aarch64_gnullvm 0.42.2", + "windows_aarch64_msvc 0.42.2", + "windows_i686_gnu 0.42.2", + "windows_i686_msvc 0.42.2", + "windows_x86_64_gnu 0.42.2", + "windows_x86_64_gnullvm 0.42.2", + "windows_x86_64_msvc 0.42.2", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-threading" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3949bd5b99cafdf1c7ca86b43ca564028dfe27d66958f2470940f73d86d75b37" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-version" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e4060a1da109b9d0326b7262c8e12c84df67cc0dbc9e33cf49e01ccc2eb63631" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.42.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.5.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f593a95398737aeed53e489c785df13f3618e41dbcd6718c6addbf1395aa6876" +dependencies = [ + "memchr", +] + +[[package]] +name = "winnow" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23b97319f7b8343df12cc98938e5c3eb436064524c8d2b4e30a1d3a36eecdf81" +dependencies = [ + "memchr", +] + +[[package]] +name = "winreg" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" +dependencies = [ + "cfg-if", + "windows-sys 0.48.0", +] + +[[package]] +name = "winreg" +version = "0.56.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d6f32a0ff4a9f6f01231eb2059cc85479330739333e0e58cadf03b6af2cca10" +dependencies = [ + "cfg-if", + "windows-sys 0.61.2", +] + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "wry" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "759c50ddad0ef9913bb5496cb9d509a50433a3b78cb0238d61105526589cf0e9" +dependencies = [ + "base64 0.23.1", + "block2", + "cookie", + "crossbeam-channel", + "dirs", + "dom_query", + "dpi", + "dunce", + "gdkx11", + "gtk", + "http", + "javascriptcore-rs", + "jni 0.21.1", + "libc", + "ndk", + "objc2", + "objc2-app-kit", + "objc2-core-foundation", + "objc2-foundation", + "objc2-ui-kit", + "objc2-web-kit", + "percent-encoding", + "raw-window-handle", + "sha2", + "soup3", + "tao-macros", + "thiserror 2.0.21", + "url", + "webkit2gtk", + "webkit2gtk-sys", + "webview2-com", + "windows 0.62.2", + "windows-core 0.62.2", + "windows-version", + "x11-dl", +] + +[[package]] +name = "x11" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "502da5464ccd04011667b11c435cb992822c2c0dbde1770c988480d312a0db2e" +dependencies = [ + "libc", + "pkg-config", +] + +[[package]] +name = "x11-dl" +version = "2.21.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" +dependencies = [ + "libc", + "once_cell", + "pkg-config", +] + +[[package]] +name = "x25519-dalek" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7e468321c81fb07fa7f4c636c3972b9100f0346e5b6a9f2bd0603a52f7ed277" +dependencies = [ + "curve25519-dalek", + "rand_core", + "serde", + "zeroize", +] + +[[package]] +name = "xattr" +version = "1.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "963d6fab92d5504b971dc8bd90ca743c2575e590bc8071ea5bc571598667ae08" +dependencies = [ + "libc", + "rustix", +] + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zbus" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5db4be7c075cb421e4b7ee645541604239bd243ba7c357511f4ff3a74b555907" +dependencies = [ + "async-broadcast", + "async-executor", + "async-io", + "async-lock", + "async-process", + "async-recursion", + "async-task", + "async-trait", + "blocking", + "enumflags2", + "event-listener", + "futures-core", + "futures-lite", + "hex", + "libc", + "ordered-stream", + "rustix", + "serde", + "serde_repr", + "tracing", + "uds_windows", + "uuid", + "windows-sys 0.61.2", + "winnow 1.0.4", + "zbus_macros", + "zbus_names", + "zvariant", +] + +[[package]] +name = "zbus_macros" +version = "5.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2990635d09ade6df1868f72f8cac69a876a90981e8bd3c40b1be413f8dc88f40" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 3.0.9", + "zbus_names", + "zvariant", + "zvariant_utils", +] + +[[package]] +name = "zbus_names" +version = "4.3.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "812a12be4ead7a59e18ea8f047d08add0066b73bc62fc1467066a2472ae088dd" +dependencies = [ + "serde", + "winnow 1.0.4", + "zvariant", +] + +[[package]] +name = "zcheapstr" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1afec51604565183aeb5c54c20aeab286120d4e4460f7f76e3e8bb8c0d99473" +dependencies = [ + "serde", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13084392c5e4bc371903e2935a5eaeed24905a7511356b883835e18a78f6879" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c50655cbb0fe3fc43170059e702f1ce5e19b84cec58dc87b037a09935c2f328" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.9", +] + +[[package]] +name = "zip" +version = "9.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3cec733c9820347a592f6375c3c0089b479ba0a0b1cbf3dd1958b02959b7c033" +dependencies = [ + "crc32fast", + "getrandom 0.4.3", + "indexmap 2.14.2", + "libc", + "memchr", + "nix", + "typed-path", + "windows-sys 0.61.2", +] + +[[package]] +name = "zlib-rs" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b268e58e7c693d7c271f93ffc4ba3b380412554231c85bf61ca7af91042a4112" + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" + +[[package]] +name = "zvariant" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80bf6d6cd6a4b601acb64cfb8284cdc643fcfa75ef26ae3c46ec8aa4e8a1fbb7" +dependencies = [ + "endi", + "enumflags2", + "serde", + "winnow 1.0.4", + "zcheapstr", + "zvariant_derive", + "zvariant_utils", +] + +[[package]] +name = "zvariant_derive" +version = "5.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef2672456ba1cb54b5eaec136e63135b3c7495fb938e53b28a62e633496d486d" +dependencies = [ + "proc-macro-crate 3.5.0", + "proc-macro2", + "quote", + "syn 3.0.9", + "zvariant_utils", +] + +[[package]] +name = "zvariant_utils" +version = "4.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bad0294361a320b694a328460dc73add56c306150f5cb6bfafc44446120008a3" +dependencies = [ + "proc-macro2", + "quote", + "serde", + "syn 3.0.9", + "winnow 1.0.4", +] diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml new file mode 100644 index 0000000..aaf28bf --- /dev/null +++ b/src-tauri/Cargo.toml @@ -0,0 +1,61 @@ +[package] +name = "ld-fdpi" +version = "1.7.0" +description = "LD FDPI — Zor aÄŸlar için yerel proxy ve DPI bypass aracı (Rust, Tauri v2, SpoofDPI 0.12.2)" +authors = ["LD FDPI Team"] +license = "MIT" +repository = "https://github.com/lildosto/LD-FDPI" +edition = "2021" + +[lib] +name = "ld_fdpi_lib" +crate-type = ["staticlib", "cdylib", "rlib"] + +[build-dependencies] +tauri-build = { version = "2.0.5", features = [] } + +[dependencies] +tauri = { version = "2.2.0", features = ["tray-icon"] } +tauri-plugin-single-instance = "2.2.0" +serde = { version = "1.0", features = ["derive"] } +serde_json = "1.0" +sha2 = "0.10" +tokio = { version = "1.42", features = ["full"] } +sysinfo = "0.33" +local-ip-address = "0.6" +native-tls = "0.2" +x25519-dalek = { version = "2.0", features = ["static_secrets"] } +rand_core = { version = "0.6", features = ["std", "getrandom"] } +base64 = "0.22" +tauri-plugin-updater = "2" + +[target.'cfg(windows)'.dependencies] +winreg = "0.52" +windows-sys = { version = "0.59", features = [ + "Win32_Foundation", + "Win32_Networking_WinInet", + "Win32_Security_Cryptography", + "Win32_Storage_FileSystem", + "Win32_System_Memory", + "Win32_System_SystemInformation", + "Win32_System_Threading", + "Win32_UI_Shell", + "Win32_UI_WindowsAndMessaging", + "Win32_NetworkManagement_WindowsFilteringPlatform", + "Win32_NetworkManagement_IpHelper", + "Win32_NetworkManagement_Ndis", + "Win32_Networking_WinSock", + "Win32_System_Rpc", + "Win32_Security" +] } + +# Maximum runtime speed / minimum size. panic=abort is safe because the panic +# hook in lib.rs restores the proxy and kills the engine before exiting. +[profile.release] +opt-level = 3 +lto = "fat" +codegen-units = 1 +panic = "abort" +strip = true + + diff --git a/src-tauri/binaries/.gitkeep b/src-tauri/binaries/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/src-tauri/binaries/spoofdpi-x86_64-pc-windows-gnu.exe b/src-tauri/binaries/spoofdpi-x86_64-pc-windows-gnu.exe new file mode 100644 index 0000000..b44a9e8 Binary files /dev/null and b/src-tauri/binaries/spoofdpi-x86_64-pc-windows-gnu.exe differ diff --git a/src-tauri/binaries/spoofdpi-x86_64-pc-windows-msvc.exe b/src-tauri/binaries/spoofdpi-x86_64-pc-windows-msvc.exe new file mode 100644 index 0000000..b44a9e8 Binary files /dev/null and b/src-tauri/binaries/spoofdpi-x86_64-pc-windows-msvc.exe differ diff --git a/src-tauri/build.rs b/src-tauri/build.rs new file mode 100644 index 0000000..14e9749 --- /dev/null +++ b/src-tauri/build.rs @@ -0,0 +1,32 @@ +fn main() { + // `LD_FDPI_NO_ADMIN=1` builds an asInvoker variant for automated tests on + // machines where a UAC prompt cannot be accepted. The shipped build always + // embeds requireAdministrator. + println!("cargo:rerun-if-env-changed=LD_FDPI_NO_ADMIN"); + println!("cargo:rerun-if-changed=windows-app-manifest.xml"); + + let manifest = include_str!("windows-app-manifest.xml"); + let no_admin = std::env::var_os("LD_FDPI_NO_ADMIN").is_some(); + let manifest = if no_admin { + manifest.replace("requireAdministrator", "asInvoker") + } else { + manifest.to_string() + }; + + // Changing this value changes the crate fingerprint, forcing a relink when + // switching between the test (asInvoker) and shipped (requireAdministrator) builds. + println!( + "cargo:rustc-env=LD_FDPI_MANIFEST_LEVEL={}", + if no_admin { "asInvoker" } else { "requireAdministrator" } + ); + + let windows = tauri_build::WindowsAttributes::new() + .app_manifest(manifest) + .window_icon_path("icons/icon.ico"); + let attributes = tauri_build::Attributes::new().windows_attributes(windows); + + if let Err(error) = tauri_build::try_build(attributes) { + eprintln!("tauri-build başarısız: {error}"); + std::process::exit(1); + } +} diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json new file mode 100644 index 0000000..a262e9c --- /dev/null +++ b/src-tauri/capabilities/default.json @@ -0,0 +1,11 @@ +{ + "$schema": "../gen/schemas/desktop-schema.json", + "identifier": "default", + "description": "LD FDPI minimum capability. No filesystem, shell, process, notification or opener permissions are exposed to the webview; all privileged work runs in Rust custom commands.", + "windows": [ + "main" + ], + "permissions": [ + "updater:default" + ] +} \ No newline at end of file diff --git a/src-tauri/icons/128x128.png b/src-tauri/icons/128x128.png new file mode 100644 index 0000000..7521eeb Binary files /dev/null and b/src-tauri/icons/128x128.png differ diff --git a/src-tauri/icons/128x128@2x.png b/src-tauri/icons/128x128@2x.png new file mode 100644 index 0000000..13c1643 Binary files /dev/null and b/src-tauri/icons/128x128@2x.png differ diff --git a/src-tauri/icons/32x32.png b/src-tauri/icons/32x32.png new file mode 100644 index 0000000..24bdae2 Binary files /dev/null and b/src-tauri/icons/32x32.png differ diff --git a/src-tauri/icons/64x64.png b/src-tauri/icons/64x64.png new file mode 100644 index 0000000..4f4f365 Binary files /dev/null and b/src-tauri/icons/64x64.png differ diff --git a/src-tauri/icons/Square107x107Logo.png b/src-tauri/icons/Square107x107Logo.png new file mode 100644 index 0000000..ff84a8b Binary files /dev/null and b/src-tauri/icons/Square107x107Logo.png differ diff --git a/src-tauri/icons/Square142x142Logo.png b/src-tauri/icons/Square142x142Logo.png new file mode 100644 index 0000000..6964360 Binary files /dev/null and b/src-tauri/icons/Square142x142Logo.png differ diff --git a/src-tauri/icons/Square150x150Logo.png b/src-tauri/icons/Square150x150Logo.png new file mode 100644 index 0000000..22bec41 Binary files /dev/null and b/src-tauri/icons/Square150x150Logo.png differ diff --git a/src-tauri/icons/Square284x284Logo.png b/src-tauri/icons/Square284x284Logo.png new file mode 100644 index 0000000..44c9ab9 Binary files /dev/null and b/src-tauri/icons/Square284x284Logo.png differ diff --git a/src-tauri/icons/Square30x30Logo.png b/src-tauri/icons/Square30x30Logo.png new file mode 100644 index 0000000..2eaf720 Binary files /dev/null and b/src-tauri/icons/Square30x30Logo.png differ diff --git a/src-tauri/icons/Square310x310Logo.png b/src-tauri/icons/Square310x310Logo.png new file mode 100644 index 0000000..bf6563c Binary files /dev/null and b/src-tauri/icons/Square310x310Logo.png differ diff --git a/src-tauri/icons/Square44x44Logo.png b/src-tauri/icons/Square44x44Logo.png new file mode 100644 index 0000000..3ee97f8 Binary files /dev/null and b/src-tauri/icons/Square44x44Logo.png differ diff --git a/src-tauri/icons/Square71x71Logo.png b/src-tauri/icons/Square71x71Logo.png new file mode 100644 index 0000000..1de6b16 Binary files /dev/null and b/src-tauri/icons/Square71x71Logo.png differ diff --git a/src-tauri/icons/Square89x89Logo.png b/src-tauri/icons/Square89x89Logo.png new file mode 100644 index 0000000..1f291ac Binary files /dev/null and b/src-tauri/icons/Square89x89Logo.png differ diff --git a/src-tauri/icons/StoreLogo.png b/src-tauri/icons/StoreLogo.png new file mode 100644 index 0000000..07c9e09 Binary files /dev/null and b/src-tauri/icons/StoreLogo.png differ diff --git a/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml b/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml new file mode 100644 index 0000000..2ffbf24 --- /dev/null +++ b/src-tauri/icons/android/mipmap-anydpi-v26/ic_launcher.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png b/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png new file mode 100644 index 0000000..feace30 Binary files /dev/null and b/src-tauri/icons/android/mipmap-hdpi/ic_launcher.png differ diff --git a/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png b/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..0d95e44 Binary files /dev/null and b/src-tauri/icons/android/mipmap-hdpi/ic_launcher_foreground.png differ diff --git a/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png b/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png new file mode 100644 index 0000000..d9a98f8 Binary files /dev/null and b/src-tauri/icons/android/mipmap-hdpi/ic_launcher_round.png differ diff --git a/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png b/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png new file mode 100644 index 0000000..52f6156 Binary files /dev/null and b/src-tauri/icons/android/mipmap-mdpi/ic_launcher.png differ diff --git a/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png b/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..63f27bd Binary files /dev/null and b/src-tauri/icons/android/mipmap-mdpi/ic_launcher_foreground.png differ diff --git a/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png b/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png new file mode 100644 index 0000000..68d8c7e Binary files /dev/null and b/src-tauri/icons/android/mipmap-mdpi/ic_launcher_round.png differ diff --git a/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png b/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png new file mode 100644 index 0000000..f037ec9 Binary files /dev/null and b/src-tauri/icons/android/mipmap-xhdpi/ic_launcher.png differ diff --git a/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png b/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..e63fb0c Binary files /dev/null and b/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_foreground.png differ diff --git a/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png b/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png new file mode 100644 index 0000000..ef442ff Binary files /dev/null and b/src-tauri/icons/android/mipmap-xhdpi/ic_launcher_round.png differ diff --git a/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png b/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png new file mode 100644 index 0000000..bee8a94 Binary files /dev/null and b/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher.png differ diff --git a/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png b/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..872d2bb Binary files /dev/null and b/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_foreground.png differ diff --git a/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png b/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..49f78a7 Binary files /dev/null and b/src-tauri/icons/android/mipmap-xxhdpi/ic_launcher_round.png differ diff --git a/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png b/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png new file mode 100644 index 0000000..0884274 Binary files /dev/null and b/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher.png differ diff --git a/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png b/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png new file mode 100644 index 0000000..c907034 Binary files /dev/null and b/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_foreground.png differ diff --git a/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png b/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png new file mode 100644 index 0000000..e52659a Binary files /dev/null and b/src-tauri/icons/android/mipmap-xxxhdpi/ic_launcher_round.png differ diff --git a/src-tauri/icons/android/values/ic_launcher_background.xml b/src-tauri/icons/android/values/ic_launcher_background.xml new file mode 100644 index 0000000..16cdd5a --- /dev/null +++ b/src-tauri/icons/android/values/ic_launcher_background.xml @@ -0,0 +1,4 @@ + + + #FFFFFF + \ No newline at end of file diff --git a/src-tauri/icons/icon.icns b/src-tauri/icons/icon.icns new file mode 100644 index 0000000..aca0369 Binary files /dev/null and b/src-tauri/icons/icon.icns differ diff --git a/src-tauri/icons/icon.ico b/src-tauri/icons/icon.ico new file mode 100644 index 0000000..dfcfeec Binary files /dev/null and b/src-tauri/icons/icon.ico differ diff --git a/src-tauri/icons/icon.png b/src-tauri/icons/icon.png new file mode 100644 index 0000000..38a3020 Binary files /dev/null and b/src-tauri/icons/icon.png differ diff --git a/src-tauri/icons/ios/AppIcon-20x20@1x.png b/src-tauri/icons/ios/AppIcon-20x20@1x.png new file mode 100644 index 0000000..0d7e083 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-20x20@1x.png differ diff --git a/src-tauri/icons/ios/AppIcon-20x20@2x-1.png b/src-tauri/icons/ios/AppIcon-20x20@2x-1.png new file mode 100644 index 0000000..4d0dc29 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-20x20@2x-1.png differ diff --git a/src-tauri/icons/ios/AppIcon-20x20@2x.png b/src-tauri/icons/ios/AppIcon-20x20@2x.png new file mode 100644 index 0000000..4d0dc29 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-20x20@2x.png differ diff --git a/src-tauri/icons/ios/AppIcon-20x20@3x.png b/src-tauri/icons/ios/AppIcon-20x20@3x.png new file mode 100644 index 0000000..b5f4fe7 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-20x20@3x.png differ diff --git a/src-tauri/icons/ios/AppIcon-29x29@1x.png b/src-tauri/icons/ios/AppIcon-29x29@1x.png new file mode 100644 index 0000000..ad06c5c Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-29x29@1x.png differ diff --git a/src-tauri/icons/ios/AppIcon-29x29@2x-1.png b/src-tauri/icons/ios/AppIcon-29x29@2x-1.png new file mode 100644 index 0000000..ac8db87 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-29x29@2x-1.png differ diff --git a/src-tauri/icons/ios/AppIcon-29x29@2x.png b/src-tauri/icons/ios/AppIcon-29x29@2x.png new file mode 100644 index 0000000..ac8db87 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-29x29@2x.png differ diff --git a/src-tauri/icons/ios/AppIcon-29x29@3x.png b/src-tauri/icons/ios/AppIcon-29x29@3x.png new file mode 100644 index 0000000..6d3fa6a Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-29x29@3x.png differ diff --git a/src-tauri/icons/ios/AppIcon-40x40@1x.png b/src-tauri/icons/ios/AppIcon-40x40@1x.png new file mode 100644 index 0000000..4d0dc29 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-40x40@1x.png differ diff --git a/src-tauri/icons/ios/AppIcon-40x40@2x-1.png b/src-tauri/icons/ios/AppIcon-40x40@2x-1.png new file mode 100644 index 0000000..228d2d6 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-40x40@2x-1.png differ diff --git a/src-tauri/icons/ios/AppIcon-40x40@2x.png b/src-tauri/icons/ios/AppIcon-40x40@2x.png new file mode 100644 index 0000000..228d2d6 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-40x40@2x.png differ diff --git a/src-tauri/icons/ios/AppIcon-40x40@3x.png b/src-tauri/icons/ios/AppIcon-40x40@3x.png new file mode 100644 index 0000000..d26b337 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-40x40@3x.png differ diff --git a/src-tauri/icons/ios/AppIcon-512@2x.png b/src-tauri/icons/ios/AppIcon-512@2x.png new file mode 100644 index 0000000..77556cd Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-512@2x.png differ diff --git a/src-tauri/icons/ios/AppIcon-60x60@2x.png b/src-tauri/icons/ios/AppIcon-60x60@2x.png new file mode 100644 index 0000000..d26b337 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-60x60@2x.png differ diff --git a/src-tauri/icons/ios/AppIcon-60x60@3x.png b/src-tauri/icons/ios/AppIcon-60x60@3x.png new file mode 100644 index 0000000..44bea9e Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-60x60@3x.png differ diff --git a/src-tauri/icons/ios/AppIcon-76x76@1x.png b/src-tauri/icons/ios/AppIcon-76x76@1x.png new file mode 100644 index 0000000..3459281 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-76x76@1x.png differ diff --git a/src-tauri/icons/ios/AppIcon-76x76@2x.png b/src-tauri/icons/ios/AppIcon-76x76@2x.png new file mode 100644 index 0000000..ac25593 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-76x76@2x.png differ diff --git a/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png b/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png new file mode 100644 index 0000000..1986198 Binary files /dev/null and b/src-tauri/icons/ios/AppIcon-83.5x83.5@2x.png differ diff --git a/src-tauri/nsis/hooks.nsh b/src-tauri/nsis/hooks.nsh new file mode 100644 index 0000000..64b877c --- /dev/null +++ b/src-tauri/nsis/hooks.nsh @@ -0,0 +1,26 @@ +; LD FDPI NSIS uninstall hook. +; Restores the user's original proxy (WinINet + WinHTTP) from the crash-safe +; backup and removes the elevated logon task, instead of blindly zeroing +; ProxyEnable / deleting AutoConfigURL. + +!macro NSIS_HOOK_PREUNINSTALL + DetailPrint "LD FDPI: Uygulama kapatiliyor..." + nsExec::ExecToLog '"$SYSDIR\taskkill.exe" /F /IM ld-fdpi.exe /T' + + DetailPrint "LD FDPI: Sistem proxy ayarlari yedekten geri yukleniyor..." + ; --restore-only reads %LOCALAPPDATA%\LD-FDPI\sentinel_proxy_backup.json, + ; restores ProxyEnable / ProxyServer / ProxyOverride / AutoConfigURL / AutoDetect + ; (and WinHTTP if it was changed) but only when a dirty session exists. + nsExec::ExecToLog '"$INSTDIR\ld-fdpi.exe" --restore-only' + + DetailPrint "LD FDPI: Yonetici otomatik baslatma gorevi kaldiriliyor..." + nsExec::ExecToLog '"$SYSDIR\schtasks.exe" /Delete /TN "LD_FDPI_AutoStart" /F' + + DetailPrint "LD FDPI: VPN tuneli ve servisi kaldiriliyor..." + nsExec::ExecToLog '"$SYSDIR\sc.exe" stop "AmneziaWGTunnel$ld-fdpi"' + nsExec::ExecToLog '"$SYSDIR\sc.exe" delete "AmneziaWGTunnel$ld-fdpi"' + nsExec::ExecToLog '"$SYSDIR\cmd.exe" /C del /q "%LOCALAPPDATA%\LD-FDPI\ld-fdpi.conf"' + + DetailPrint "LD FDPI: LAN firewall kurali kaldiriliyor..." + nsExec::ExecToLog '"$SYSDIR\netsh.exe" advfirewall firewall delete rule name="LD_FDPI_LAN_Share"' +!macroend diff --git a/src-tauri/resources/amneziawg.msi b/src-tauri/resources/amneziawg.msi new file mode 100644 index 0000000..0bdf969 Binary files /dev/null and b/src-tauri/resources/amneziawg.msi differ diff --git a/src-tauri/src/auto_bypass.rs b/src-tauri/src/auto_bypass.rs new file mode 100644 index 0000000..01a07f6 --- /dev/null +++ b/src-tauri/src/auto_bypass.rs @@ -0,0 +1,141 @@ +//! One-shot bypass-mode selector. +//! +//! Spawns the pinned SpoofDPI sidecar on a temporary loopback port for each +//! window size, probes a full Discord TLS handshake through it, and returns the +//! fastest working mode. It never changes the system proxy and never touches the +//! currently running engine. + +use serde::Serialize; +use std::net::TcpListener; +use std::time::Duration; + +use crate::engine::{self, EngineConfig}; + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct AutoBypassTest { + pub mode: u8, + pub name: String, + pub reachable: bool, + pub latency_ms: u64, + pub detail: String, +} + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct AutoBypassResult { + pub mode: u8, + pub name: String, + pub latency_ms: u64, + pub success: bool, + pub tested: Vec, +} + +fn free_loopback_port() -> Option { + TcpListener::bind("127.0.0.1:0") + .ok()? + .local_addr() + .ok() + .map(|address| address.port()) +} + +/// Tests Turbo/Balanced/Strong in order and picks the lowest-latency successful +/// Discord TLS handshake. Balanced is the safe fallback when every probe fails. +pub fn select() -> Result { + let modes = [(0u8, "Turbo"), (1u8, "Dengeli"), (2u8, "Güçlü")]; + let mut tested = Vec::with_capacity(modes.len()); + let mut best: Option<(u8, String, u64)> = None; + + for (mode, name) in modes { + let Some(port) = free_loopback_port() else { + tested.push(AutoBypassTest { + mode, + name: name.to_string(), + reachable: false, + latency_ms: 0, + detail: "Boş loopback portu bulunamadı.".to_string(), + }); + continue; + }; + let config = EngineConfig { + bypass_mode: mode, + chunk_size: 4, + proxy_port: port, + pac_port: port, + ..EngineConfig::default() + }; + + let (mut child, _log, _args) = match engine::spawn_sidecar(&config) { + Ok(result) => result, + Err(error) => { + tested.push(AutoBypassTest { + mode, + name: name.to_string(), + reachable: false, + latency_ms: 0, + detail: error, + }); + continue; + } + }; + + let listening = engine::wait_until_listening(port, Duration::from_secs(8), &mut child); + let (reachable, latency_ms, detail) = match listening { + Ok(_) => { + let (_connect, mut tls, mut ms, mut detail) = + engine::probe_host_through_proxy(port, "discord.com", Duration::from_secs(6)); + if !tls { + // Fresh DoH resolver can return a one-off 502 on the first CONNECT. + std::thread::sleep(Duration::from_millis(350)); + let (_connect, retry_tls, retry_ms, retry_detail) = + engine::probe_host_through_proxy(port, "discord.com", Duration::from_secs(6)); + if retry_tls { + tls = true; + ms = retry_ms; + detail = retry_detail; + } + } + (tls, ms, detail) + } + Err(error) => (false, 0, error), + }; + engine::terminate_child(child); + std::thread::sleep(Duration::from_millis(250)); + + tested.push(AutoBypassTest { + mode, + name: name.to_string(), + reachable, + latency_ms, + detail, + }); + if reachable && best.as_ref().is_none_or(|(_, _, best_ms)| latency_ms < *best_ms) { + best = Some((mode, name.to_string(), latency_ms)); + } + } + + let (mode, name, latency_ms, success) = match best { + Some((mode, name, latency_ms)) => (mode, name, latency_ms, true), + None => (1, "Dengeli".to_string(), 0, false), + }; + + Ok(AutoBypassResult { + mode, + name, + latency_ms, + success, + tested, + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn free_port_is_loopback() { + if let Some(port) = free_loopback_port() { + assert!(port > 0); + } + } +} diff --git a/src-tauri/src/autostart.rs b/src-tauri/src/autostart.rs new file mode 100644 index 0000000..7d878f8 --- /dev/null +++ b/src-tauri/src/autostart.rs @@ -0,0 +1,111 @@ +//! Elevated logon autostart through Windows Task Scheduler. +//! +//! An executable whose manifest requests `requireAdministrator` cannot be started +//! from `HKCU\...\Run` at logon: Windows blocks it (or pops UAC). A Task Scheduler +//! task with `RunLevel = HighestAvailable` starts the app elevated at logon without +//! a UAC prompt, which is exactly what "set & forget" needs. + +use std::process::{Command, Stdio}; + +pub const TASK_NAME: &str = "LD_FDPI_AutoStart"; + +fn run_schtasks(args: &[&str]) -> Result { + // Absolute System32 path: never resolve schtasks through PATH/CWD (binary planting). + let schtasks = crate::engine::system32_binary("schtasks.exe")?; + let mut cmd = Command::new(schtasks); + cmd.args(args).stdin(Stdio::null()); + + #[cfg(target_os = "windows")] + { + use std::os::windows::process::CommandExt; + const CREATE_NO_WINDOW: u32 = 0x0800_0000; + cmd.creation_flags(CREATE_NO_WINDOW); + } + + let output = cmd + .output() + .map_err(|e| format!("schtasks çalıştırılamadı: {e}"))?; + + let stdout = String::from_utf8_lossy(&output.stdout).trim().to_string(); + + if output.status.success() { + Ok(stdout) + } else { + // schtasks writes OEM-encoded (localized) text; do not surface mojibake + // to the UI. The exit code is enough to explain the usual cause. + Err(format!( + "Görev Zamanlayıcı komutu başarısız (çıkış kodu {:?}). Yönetici izni gerekli olabilir.", + output.status.code() + )) + } +} + +/// `"C:\path\ld-fdpi.exe" --minimized` +/// +/// The path is always quoted (unquoted task/service paths are an EoP vector) and +/// validated to be an existing absolute path without characters that could break +/// the Task Scheduler command line. +pub fn task_command() -> Result { + let exe = std::env::current_exe().map_err(|e| format!("Uygulama yolu alınamadı: {e}"))?; + if !exe.is_absolute() || !exe.is_file() { + return Err("Geçersiz uygulama yolu; otomatik başlatma görevi oluşturulmadı.".to_string()); + } + let path = exe.to_string_lossy(); + if path.contains('"') || path.contains('\r') || path.contains('\n') { + return Err("Uygulama yolunda geçersiz karakter var.".to_string()); + } + Ok(format!("\"{path}\" --minimized")) +} + +pub fn is_enabled() -> bool { + run_schtasks(&["/Query", "/TN", TASK_NAME]).is_ok() +} + +/// Creates (or refreshes) the logon task with highest privileges. +pub fn enable() -> Result<(), String> { + let tr = task_command()?; + run_schtasks(&[ + "/Create", + "/TN", + TASK_NAME, + "/TR", + &tr, + "/SC", + "ONLOGON", + "/RL", + "HIGHEST", + "/DELAY", + "0000:20", + "/F", + ]) + .map(|_| ()) +} + +pub fn disable() -> Result<(), String> { + if !is_enabled() { + return Ok(()); + } + run_schtasks(&["/Delete", "/TN", TASK_NAME, "/F"]).map(|_| ()) +} + +/// Applies the desired state and reports the *effective* result. +pub fn apply(enabled: bool) -> Result { + if enabled { + enable()?; + } else { + disable()?; + } + Ok(is_enabled()) +} + +/// Human-readable command used in logs and diagnostics. +pub fn printable_command(enabled: bool) -> String { + if enabled { + let tr = task_command().unwrap_or_else(|_| "\"\" --minimized".to_string()); + format!( + "schtasks /Create /TN {TASK_NAME} /TR {tr} /SC ONLOGON /RL HIGHEST /DELAY 0000:20 /F" + ) + } else { + format!("schtasks /Delete /TN {TASK_NAME} /F") + } +} diff --git a/src-tauri/src/captive.rs b/src-tauri/src/captive.rs new file mode 100644 index 0000000..c230ce9 --- /dev/null +++ b/src-tauri/src/captive.rs @@ -0,0 +1,332 @@ +//! Captive-portal assistant. +//! +//! Public Wi-Fi portals are login walls. There is no universal way to bypass an +//! authenticated or paid portal, and MAC cloning would be unauthorized and +//! disruptive. This module does the part that is safe and useful: +//! * tests direct HTTPS (no local proxy) to see whether internet is already open, +//! * probes the OS/browser captive-portal endpoints over plain HTTP, +//! * returns the portal URL and opens it in the default browser. +//! +//! It never sends credentials, never clones a MAC address and never changes the +//! selected Normal/Game/Eduroam engine configuration. + +use serde::Serialize; +use std::io::{Read, Write}; +use std::net::{TcpStream, ToSocketAddrs}; +use std::time::Duration; + +const PROBE_TIMEOUT: Duration = Duration::from_millis(1800); +const MAX_BODY: usize = 16 * 1024; + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct CaptiveResult { + /// online | portal | eduroam | blocked + pub state: String, + pub internet: bool, + pub ssid: String, + pub is_eduroam: bool, + pub portal_url: Option, + pub opened: bool, + pub detail: String, +} + +struct HttpProbe { + status: u16, + location: Option, + body: String, +} + +fn valid_portal_url(url: &str) -> bool { + let lower = url.to_ascii_lowercase(); + let Some(authority) = lower + .strip_prefix("http://") + .or_else(|| lower.strip_prefix("https://")) + .and_then(|rest| rest.split(['/', '?', '#']).next()) + else { + return false; + }; + (lower.starts_with("http://") || lower.starts_with("https://")) + && url.len() <= 2048 + && !authority.contains('@') + && !url + .chars() + .any(|ch| ch.is_control() || ch.is_whitespace() || ch == '"') +} + +fn normalize_portal(location: &str, host: &str) -> Option { + let location = location.trim(); + if valid_portal_url(location) { + return Some(location.to_string()); + } + if location.starts_with('/') && !location.contains('\\') { + let url = format!("http://{host}{location}"); + return valid_portal_url(&url).then_some(url); + } + None +} + +fn http_get(host: &str, path: &str) -> Option { + let addresses: Vec<_> = (host, 80).to_socket_addrs().ok()?.collect(); + for address in addresses { + let mut stream = match TcpStream::connect_timeout(&address, PROBE_TIMEOUT) { + Ok(stream) => stream, + Err(_) => continue, + }; + let _ = stream.set_read_timeout(Some(PROBE_TIMEOUT)); + let _ = stream.set_write_timeout(Some(PROBE_TIMEOUT)); + let request = format!( + "GET {path} HTTP/1.1\r\nHost: {host}\r\nUser-Agent: LD-FDPI-Captive/1.0\r\nAccept: text/html,*/*\r\nConnection: close\r\n\r\n" + ); + if stream.write_all(request.as_bytes()).is_err() { + continue; + } + + let mut bytes = Vec::with_capacity(1024); + let mut buffer = [0u8; 1024]; + loop { + match stream.read(&mut buffer) { + Ok(0) => break, + Ok(read) => { + let remaining = MAX_BODY.saturating_sub(bytes.len()); + if remaining == 0 { + break; + } + bytes.extend_from_slice(&buffer[..read.min(remaining)]); + } + Err(_) => break, + } + } + if bytes.is_empty() { + continue; + } + + let text = String::from_utf8_lossy(&bytes); + let (head, body) = text.split_once("\r\n\r\n").unwrap_or((&text, "")); + let status = head + .lines() + .next() + .and_then(|line| line.split_whitespace().nth(1)) + .and_then(|value| value.parse::().ok()) + .unwrap_or(0); + let location = head.lines().find_map(|line| { + let (key, value) = line.split_once(':')?; + key.eq_ignore_ascii_case("location") + .then(|| value.trim().to_string()) + .filter(|value| !value.is_empty()) + }); + return Some(HttpProbe { + status, + location, + body: body.to_string(), + }); + } + None +} + +fn probe_matches(host: &str, path: &str, probe: &HttpProbe) -> bool { + match (host, path) { + ("www.msftconnecttest.com", "/connecttest.txt") => { + probe.status == 200 && probe.body.contains("Microsoft Connect Test") + } + ("detectportal.firefox.com", "/canonical.html") => { + probe.status == 200 && probe.body.contains("success") + } + ("connectivitycheck.gstatic.com", "/generate_204") => probe.status == 204, + ("captive.apple.com", "/hotspot-detect.html") => { + probe.status == 200 && probe.body.contains("Success") + } + _ => false, + } +} + +fn discover_portal() -> Option { + let probes = [ + ("www.msftconnecttest.com", "/connecttest.txt"), + ("detectportal.firefox.com", "/canonical.html"), + ("connectivitycheck.gstatic.com", "/generate_204"), + ("captive.apple.com", "/hotspot-detect.html"), + ]; + + for (host, path) in probes { + let Some(probe) = http_get(host, path) else { + continue; + }; + if probe_matches(host, path, &probe) { + continue; + } + if let Some(location) = probe + .location + .as_deref() + .and_then(|value| normalize_portal(value, host)) + { + return Some(location); + } + // A portal commonly rewrites the probe with 200/302/511. If the response + // is not the probe's expected payload it is treated as a portal wall. + let body = probe.body.to_ascii_lowercase(); + if probe.status != 204 + && (probe.status == 511 + || probe.status >= 300 + || body.contains(" bool { + let Ok(addresses) = (host, 443).to_socket_addrs() else { + return false; + }; + let connector = match native_tls::TlsConnector::builder().build() { + Ok(connector) => connector, + Err(_) => return false, + }; + for address in addresses { + let stream = match TcpStream::connect_timeout(&address, PROBE_TIMEOUT) { + Ok(stream) => stream, + Err(_) => continue, + }; + let _ = stream.set_read_timeout(Some(PROBE_TIMEOUT)); + let _ = stream.set_write_timeout(Some(PROBE_TIMEOUT)); + let Ok(mut tls) = connector.connect(host, stream) else { + continue; + }; + let request = format!( + "GET {path} HTTP/1.1\r\nHost: {host}\r\nUser-Agent: LD-FDPI-Captive/1.0\r\nConnection: close\r\n\r\n" + ); + if tls.write_all(request.as_bytes()).is_ok() { + let mut byte = [0u8; 1]; + if tls.read(&mut byte).is_ok() { + return true; + } + } + } + false +} + +fn internet_open() -> bool { + https_ok("discord.com", "/") || https_ok("www.cloudflare.com", "/") +} + +fn open_url(url: &str) -> Result<(), String> { + if !valid_portal_url(url) { + return Err("Geçersiz portal adresi.".to_string()); + } + + #[cfg(target_os = "windows")] + { + // Launch through the medium-integrity shell, not the elevated process. + let explorer = std::env::var_os("WINDIR") + .map(std::path::PathBuf::from) + .unwrap_or_else(|| std::path::PathBuf::from(r"C:\Windows")) + .join("explorer.exe"); + std::process::Command::new(explorer) + .arg(url) + .stdin(std::process::Stdio::null()) + .spawn() + .map(|_| ()) + .map_err(|e| format!("Portal tarayıcıda açılamadı: {e}")) + } + #[cfg(not(target_os = "windows"))] + { + let _ = url; + Err("Bu özellik yalnızca Windows'ta kullanılabilir.".to_string()) + } +} + +pub fn connect_without_login() -> Result { + let wifi = crate::eduroam::wifi_status(); + let internet = internet_open(); + if internet { + return Ok(CaptiveResult { + state: "online".to_string(), + internet: true, + ssid: wifi.ssid, + is_eduroam: wifi.is_eduroam, + portal_url: None, + opened: false, + detail: "Doğrudan HTTPS erişimi var; oturum açmadan internet kullanılabilir." + .to_string(), + }); + } + + if wifi.is_eduroam { + return Ok(CaptiveResult { + state: "eduroam".to_string(), + internet: false, + ssid: wifi.ssid, + is_eduroam: true, + portal_url: None, + opened: false, + detail: "eduroam 802.1X kullanır; kurum hesabıyla Windows oturumu gerekir. \ + Oturum açmadan bu ağın kimlik doğrulaması atlanamaz." + .to_string(), + }); + } + + if let Some(portal_url) = discover_portal() { + let opened = open_url(&portal_url).is_ok(); + return Ok(CaptiveResult { + state: "portal".to_string(), + internet: false, + ssid: wifi.ssid, + is_eduroam: false, + portal_url: Some(portal_url), + opened, + detail: if opened { + "Captive portal algılandı ve tarayıcıda açıldı. Ücretsiz/açık portalda \ + Devam/Accept'a basın; şifre veya ücret isteyen duvar oturum açmadan atlanamaz." + .to_string() + } else { + "Captive portal algılandı ancak tarayıcıda açılamadı. Adresi kopyalayıp \ + tarayıcıda açın." + .to_string() + }, + }); + } + + Ok(CaptiveResult { + state: "blocked".to_string(), + internet: false, + ssid: wifi.ssid, + is_eduroam: false, + portal_url: None, + opened: false, + detail: "Doğrudan HTTPS yok ve bilinen captive-portal yoklamaları yanıt vermedi. \ + Wi-Fi bağlantısını, DNS'i veya ağın proxy'sini kontrol edin." + .to_string(), + }) +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn portal_url_validation() { + assert!(valid_portal_url("http://portal.example/login")); + assert!(valid_portal_url("https://portal.example/")); + assert!(!valid_portal_url("file:///etc/passwd")); + assert!(!valid_portal_url("javascript:alert(1)")); + assert!(!valid_portal_url("http://portal.example/a b")); + } + + #[test] + fn relative_portal_location() { + assert_eq!( + normalize_portal("/login", "portal.example").as_deref(), + Some("http://portal.example/login") + ); + assert_eq!(normalize_portal("https://x.example/a", "h"), Some("https://x.example/a".to_string())); + assert_eq!(normalize_portal("\\\\evil", "h"), None); + } +} diff --git a/src-tauri/src/config.rs b/src-tauri/src/config.rs new file mode 100644 index 0000000..545077b --- /dev/null +++ b/src-tauri/src/config.rs @@ -0,0 +1,193 @@ +//! Persistent application configuration (`%LOCALAPPDATA%\LD-FDPI\config.json`). +//! +//! This file is the source of truth for the "set & forget" behaviour: it is read +//! before the webview loads so Rust can auto-connect on boot, and it is written +//! whenever the user changes a setting. + +use crate::engine::EngineConfig; +use serde::{Deserialize, Serialize}; +use std::fs; +use std::path::PathBuf; + +fn default_captive_assistant() -> bool { + true +} + +fn default_auto_optimize() -> bool { + true +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default, deny_unknown_fields, rename_all = "camelCase")] +pub struct AppConfig { + pub version: u32, + /// Create the elevated Task Scheduler entry at logon (no UAC prompt). + pub auto_start: bool, + /// Connect automatically when the app starts. + pub auto_connect: bool, + /// Hide to the system tray instead of quitting when the window is closed. + pub minimize_to_tray: bool, + pub lan_sharing: bool, + /// Show the "connect without login" helper in Settings. + #[serde(default = "default_captive_assistant")] + pub captive_assistant: bool, + /// Benchmark DNS + bypass modes before every manual connect. + #[serde(default = "default_auto_optimize")] + pub auto_optimize: bool, + /// "normal" | "game" + pub connection_mode: String, + /// 0 = SNI split, 1 = balanced, 2 = strong + pub bypass_mode: u8, + pub chunk_size: u16, + pub doh_provider: String, + /// Optional FDPI compatibility mode: block QUIC only for known browsers/Discord. + #[serde(default)] + pub quic_block: bool, + /// Last successful FDPI strategy profile (0..2). + #[serde(default)] + pub last_dpi_profile: u8, + pub proxy_port: u16, + pub pac_port: u16, +} + +impl Default for AppConfig { + fn default() -> Self { + Self { + version: 2, + // Manual-first: only auto-start/minimize are on by default. + auto_start: true, + auto_connect: false, + minimize_to_tray: true, + lan_sharing: false, + captive_assistant: true, + auto_optimize: true, + connection_mode: "normal".to_string(), + bypass_mode: 1, + chunk_size: 4, + doh_provider: "auto".to_string(), + quic_block: false, + last_dpi_profile: 0, + proxy_port: 18080, + pac_port: 18081, + } + } +} + +impl AppConfig { + pub fn path() -> PathBuf { + crate::engine::app_data_dir().join("config.json") + } + + pub fn load() -> Self { + let path = Self::path(); + let read = |p: &std::path::Path| { + fs::metadata(p) + .ok() + .filter(|meta| meta.is_file() && meta.len() <= 64 * 1024) + .and_then(|_| fs::read_to_string(p).ok()) + .and_then(|raw| serde_json::from_str::(&raw).ok()) + }; + let parsed = read(&path).or_else(|| read(&path.with_extension("json.bak"))); + let existed = path.exists(); + let mut cfg = parsed.unwrap_or_else(|| { + let mut fallback = Self::default(); + // A corrupt/foreign config must not silently auto-connect on boot. + if existed { + fallback.auto_connect = false; + } + fallback + }); + // One-time manual-first migration: old configs defaulted auto-connect on. + if cfg.version < 2 { + cfg.auto_connect = false; + cfg.version = 2; + } + cfg.normalize(); + cfg + } + + pub fn save(&self) -> Result<(), String> { + let path = Self::path(); + if let Some(parent) = path.parent() { + fs::create_dir_all(parent) + .map_err(|e| format!("Ayar klasörü oluşturulamadı ({}): {e}", parent.display()))?; + } + let json = serde_json::to_string_pretty(self) + .map_err(|e| format!("Ayarlar serileştirilemedi: {e}"))?; + // Atomic replace: a crash mid-write must never truncate config.json. + let tmp = path.with_extension("json.tmp"); + fs::write(&tmp, json) + .map_err(|e| format!("Ayarlar yazılamadı ({}): {e}", tmp.display()))?; + if path.exists() { + let _ = fs::copy(&path, path.with_extension("json.bak")); + } + #[cfg(target_os = "windows")] + if path.exists() { + fs::remove_file(&path) + .map_err(|e| format!("Eski ayar dosyası silinemedi ({}): {e}", path.display()))?; + } + if let Err(e) = fs::rename(&tmp, &path) { + let _ = fs::remove_file(&tmp); + return Err(format!("Ayarlar taşınamadı ({}): {e}", path.display())); + } + Ok(()) + } + + pub fn normalize(&mut self) { + if self.proxy_port < 1024 { + self.proxy_port = 18080; + } + if self.pac_port < 1024 || self.pac_port == self.proxy_port { + self.pac_port = self.proxy_port.saturating_add(1).max(1025); + if self.pac_port > u16::MAX - 1 { + self.pac_port = 18081; + } + } + if self.bypass_mode > 2 { + self.bypass_mode = 1; + } + if !matches!(self.chunk_size, 4 | 8 | 16) { + self.chunk_size = 4; + } + if !matches!( + self.doh_provider.as_str(), + "auto" | "cloudflare" | "google" | "adguard" + ) { + self.doh_provider = "auto".to_string(); + } + if self.last_dpi_profile > 2 { + self.last_dpi_profile = 0; + } + if !matches!(self.connection_mode.as_str(), "normal" | "game" | "eduroam") { + self.connection_mode = "normal".to_string(); + } + if self.version == 0 { + self.version = 1; + } + } + + pub fn engine_config(&self) -> EngineConfig { + EngineConfig { + connection_mode: self.connection_mode.clone(), + bypass_mode: self.bypass_mode, + chunk_size: self.chunk_size, + doh_provider: self.doh_provider.clone(), + quic_block: self.quic_block, + lan_sharing: self.lan_sharing, + proxy_port: self.proxy_port, + pac_port: self.pac_port, + } + } + + /// Copies the engine-facing selection back into the persisted config. + pub fn update_from_engine(&mut self, cfg: &EngineConfig) { + self.connection_mode = cfg.connection_mode.clone(); + self.bypass_mode = cfg.bypass_mode; + self.chunk_size = cfg.chunk_size; + self.doh_provider = cfg.doh_provider.clone(); + self.quic_block = cfg.quic_block; + self.proxy_port = cfg.proxy_port; + self.pac_port = cfg.pac_port; + self.normalize(); + } +} diff --git a/src-tauri/src/eduroam.rs b/src-tauri/src/eduroam.rs new file mode 100644 index 0000000..813b6e9 --- /dev/null +++ b/src-tauri/src/eduroam.rs @@ -0,0 +1,409 @@ +//! Eduroam / enterprise-Wi-Fi helpers. +//! +//! Eduroam itself is a federated 802.1X roaming service: authentication is done by +//! Windows with the user's institution credentials, and the visited institution +//! decides which destinations/ports are reachable. This module never handles +//! credentials and never bypasses authentication. It only: +//! * detects the current SSID and whether it is `eduroam`, +//! * can ask Windows to connect to an existing `eduroam` profile, +//! * clamps the Wi-Fi MTU (1400) for enterprise/WPA2-Enterprise paths and restores it, +//! * runs TCP/UDP reachability diagnostics (Discord text vs. voice). + +use serde::{Deserialize, Serialize}; +use std::fs; +use std::net::{TcpStream, ToSocketAddrs, UdpSocket}; +use std::path::PathBuf; +use std::process::{Command, Stdio}; +use std::time::{Duration, Instant}; + +pub const EDUROAM_MTU: u16 = 1400; +const MAX_MTU: u16 = 9000; +const MIN_MTU: u16 = 576; + +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct WifiStatus { + pub available: bool, + pub connected: bool, + pub ssid: String, + pub interface: String, + pub authentication: String, + pub is_eduroam: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct EduroamStatus { + pub wifi: WifiStatus, + pub mtu: Option, + pub target_mtu: u16, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct MtuApply { + pub interface: String, + pub original_mtu: u16, + pub applied_mtu: u16, + pub changed: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +struct MtuBackup { + interface: String, + original_mtu: u16, + applied_mtu: u16, +} + +fn run_netsh(args: &[&str]) -> Result { + let exe = crate::engine::system32_binary("netsh.exe")?; + let mut command = Command::new(exe); + command.args(args).stdin(Stdio::null()); + + #[cfg(target_os = "windows")] + { + use std::os::windows::process::CommandExt; + const CREATE_NO_WINDOW: u32 = 0x0800_0000; + command.creation_flags(CREATE_NO_WINDOW); + } + + let output = command + .output() + .map_err(|e| format!("netsh çalıştırılamadı: {e}"))?; + let stdout = String::from_utf8_lossy(&output.stdout); + let stderr = String::from_utf8_lossy(&output.stderr); + let combined = format!("{stdout}{stderr}"); + + if output.status.success() { + Ok(combined) + } else { + Err(format!( + "netsh {} başarısız (çıkış {:?}): {}", + args.join(" "), + output.status.code(), + combined.trim() + )) + } +} + +fn valid_interface(name: &str) -> bool { + !name.is_empty() + && name.len() <= 128 + && !name.contains('"') + && !name.contains('\r') + && !name.contains('\n') +} + +/// Parses `netsh wlan show interfaces`. +/// +/// SSID/BSSID tokens are language-independent on localized Windows builds; the +/// adapter name and authentication label are localized, so the parser is tolerant. +pub fn wifi_status() -> WifiStatus { + let output = match run_netsh(&["wlan", "show", "interfaces"]) { + Ok(text) => text, + Err(_) => return WifiStatus::default(), + }; + + let mut status = WifiStatus::default(); + for line in output.lines() { + let Some((key, value)) = line.split_once(':') else { + continue; + }; + let key = key.trim(); + let value = value.trim(); + if value.is_empty() { + continue; + } + + let lower_key = key.to_lowercase(); + if key.eq_ignore_ascii_case("SSID") { + status.ssid = value.to_string(); + } else if key.eq_ignore_ascii_case("BSSID") { + // ignored + } else if lower_key.contains("kimlik") || lower_key.contains("authentication") { + status.authentication = value.to_string(); + } else if status.interface.is_empty() + && (key.eq_ignore_ascii_case("name") || key.eq_ignore_ascii_case("ad")) + { + status.interface = value.to_string(); + } + } + + if status.interface.is_empty() && !status.ssid.is_empty() { + status.interface = "Wi-Fi".to_string(); + } + if !valid_interface(&status.interface) { + status.interface.clear(); + } + + status.available = !status.interface.is_empty() || !status.ssid.is_empty(); + status.connected = !status.ssid.is_empty(); + status.is_eduroam = status.ssid.to_lowercase().contains("eduroam"); + status +} + +pub fn status() -> EduroamStatus { + let wifi = wifi_status(); + let mtu = if valid_interface(&wifi.interface) { + current_mtu(&wifi.interface) + } else { + None + }; + EduroamStatus { + wifi, + mtu, + target_mtu: EDUROAM_MTU, + } +} + +/// Current IPv4 MTU for an interface, parsed from `netsh interface ipv4 show subinterfaces`. +pub fn current_mtu(interface: &str) -> Option { + if !valid_interface(interface) { + return None; + } + let output = run_netsh(&["interface", "ipv4", "show", "subinterfaces"]).ok()?; + for line in output.lines() { + if !line.contains(interface) { + continue; + } + for token in line.split_whitespace() { + if let Ok(mtu) = token.parse::() { + if (MIN_MTU..=MAX_MTU).contains(&mtu) { + return Some(mtu); + } + } + } + } + None +} + +fn backup_path() -> PathBuf { + crate::engine::app_data_dir().join("eduroam_mtu_backup.json") +} + +fn write_backup(backup: &MtuBackup) -> Result<(), String> { + let path = backup_path(); + let json = serde_json::to_string_pretty(backup) + .map_err(|e| format!("Eduroam MTU yedeği serileştirilemedi: {e}"))?; + fs::write(&path, json).map_err(|e| format!("Eduroam MTU yedeği yazılamadı: {e}")) +} + +fn clear_backup() { + let _ = fs::remove_file(backup_path()); +} + +/// Clamps the interface MTU to 1400 (only if it is currently higher). +/// Writes a crash-safe backup before touching the adapter. +pub fn apply_mtu(interface: &str) -> Result { + if !valid_interface(interface) { + return Err("Geçersiz Wi-Fi arayüz adı.".to_string()); + } + let original = current_mtu(interface) + .ok_or_else(|| format!("{interface} için IPv4 MTU okunamadı."))?; + + if original <= EDUROAM_MTU { + return Ok(MtuApply { + interface: interface.to_string(), + original_mtu: original, + applied_mtu: original, + changed: false, + }); + } + + let backup = MtuBackup { + interface: interface.to_string(), + original_mtu: original, + applied_mtu: EDUROAM_MTU, + }; + write_backup(&backup)?; + + let mtu_arg = format!("mtu={EDUROAM_MTU}"); + if let Err(error) = run_netsh(&[ + "interface", + "ipv4", + "set", + "subinterface", + interface, + &mtu_arg, + "store=active", + ]) { + clear_backup(); + return Err(format!("Eduroam MTU 1400 uygulanamadı: {error}")); + } + + let actual = current_mtu(interface).unwrap_or(EDUROAM_MTU); + Ok(MtuApply { + interface: interface.to_string(), + original_mtu: original, + applied_mtu: actual, + changed: actual != original, + }) +} + +/// Restores the original MTU and removes the crash backup. +pub fn restore_mtu(interface: &str, original_mtu: u16) -> Result<(), String> { + if !valid_interface(interface) { + return Err("Geçersiz Wi-Fi arayüz adı.".to_string()); + } + let mtu_arg = format!("mtu={original_mtu}"); + run_netsh(&[ + "interface", + "ipv4", + "set", + "subinterface", + interface, + &mtu_arg, + "store=active", + ])?; + clear_backup(); + Ok(()) +} + +/// Startup/panic recovery: restores an MTU left behind by a crash. +pub fn restore_from_backup() -> Option { + let path = backup_path(); + let meta = fs::metadata(&path).ok()?; + if !meta.is_file() || meta.len() > 16 * 1024 { + let _ = fs::remove_file(&path); + return None; + } + let raw = fs::read_to_string(&path).ok()?; + let backup: MtuBackup = serde_json::from_str(&raw).ok()?; + if !valid_interface(&backup.interface) + || !(MIN_MTU..=MAX_MTU).contains(&backup.original_mtu) + { + let _ = fs::remove_file(&path); + return None; + } + match restore_mtu(&backup.interface, backup.original_mtu) { + Ok(()) => Some(format!( + "Eduroam MTU geri yüklendi: {} -> {}", + backup.applied_mtu, backup.original_mtu + )), + Err(_) => None, + } +} + +/// Connects to an existing Windows `eduroam` profile. It never asks for or stores +/// credentials; Windows handles 802.1X/EAP authentication. +pub fn connect_wifi() -> Result { + let before = wifi_status(); + if before.is_eduroam { + return Ok(format!("Zaten eduroam ağındasınız ({}).", before.ssid)); + } + if !before.available { + return Err( + "Kablosuz ağ arabirimi bulunamadı. Wi-Fi açık mı? Windows Ayarları > Ağ ve Internet > Wi-Fi." + .to_string(), + ); + } + + run_netsh(&["wlan", "connect", "name=eduroam"]).map_err(|error| { + format!( + "eduroam profili bulunamadı veya bağlantı başlatılamadı. Windows Ayarları > Wi-Fi \ + bölümünden eduroam'a bağlanın (kullanıcı adı/şifre Windows tarafından istenir).\n{error}" + ) + })?; + + for _ in 0..30 { + std::thread::sleep(Duration::from_millis(500)); + let current = wifi_status(); + if current.is_eduroam { + return Ok(format!( + "eduroam bağlantısı kuruldu: {} ({})", + current.ssid, current.authentication + )); + } + } + Err( + "eduroam bağlantısı 15 saniye içinde doğrulanamadı. Windows Wi-Fi ayarlarından profili \ + kontrol edin." + .to_string(), + ) +} + +/// Opens the Windows Wi-Fi settings page (for first-time 802.1X login). +pub fn open_wifi_settings() -> Result<(), String> { + #[cfg(target_os = "windows")] + { + use windows_sys::Win32::UI::Shell::ShellExecuteW; + let operation: Vec = "open\0".encode_utf16().collect(); + let target: Vec = "ms-settings:network-wifi\0".encode_utf16().collect(); + let result = unsafe { + ShellExecuteW( + std::ptr::null_mut(), + operation.as_ptr(), + target.as_ptr(), + std::ptr::null(), + std::ptr::null(), + 1, + ) + }; + if result as isize > 32 { + Ok(()) + } else { + Err("Windows Wi-Fi ayarları açılamadı.".to_string()) + } + } + #[cfg(not(target_os = "windows"))] + { + Err("Bu özellik yalnızca Windows'ta kullanılabilir.".to_string()) + } +} + +/// TCP handshake latency; tries every resolved address (IPv4 and IPv6). +pub fn tcp_probe(host: &str, port: u16, timeout: Duration) -> Option { + let addresses: Vec<_> = (host, port).to_socket_addrs().ok()?.collect(); + for address in addresses { + let start = Instant::now(); + if TcpStream::connect_timeout(&address, timeout).is_ok() { + return Some(start.elapsed().as_millis() as u64); + } + } + None +} + +/// STUN binding request: proves outbound UDP works. Discord voice additionally +/// uses UDP 19294-19344 and 50000-50100, which this probe cannot guarantee. +pub fn udp_stun_probe(host: &str, port: u16, timeout: Duration) -> bool { + let Ok(addresses) = (host, port).to_socket_addrs() else { + return false; + }; + let Some(address) = addresses.into_iter().next() else { + return false; + }; + let Ok(socket) = UdpSocket::bind("0.0.0.0:0") else { + return false; + }; + let _ = socket.set_read_timeout(Some(timeout)); + + let mut request = [0u8; 20]; + request[0] = 0x00; + request[1] = 0x01; // Binding Request + request[4..8].copy_from_slice(&[0x21, 0x12, 0xA4, 0x42]); // magic cookie + request[8..20].copy_from_slice(&[ + 0x4C, 0x44, 0x46, 0x44, 0x50, 0x49, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, + ]); + + if socket.send_to(&request, address).is_err() { + return false; + } + let mut buffer = [0u8; 128]; + match socket.recv_from(&mut buffer) { + Ok((length, _)) => length >= 20 && buffer[0] == 0x01 && buffer[1] == 0x01, + Err(_) => false, + } +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn interface_validation() { + assert!(valid_interface("Wi-Fi")); + assert!(!valid_interface("")); + assert!(!valid_interface("bad\"name")); + } +} diff --git a/src-tauri/src/engine.rs b/src-tauri/src/engine.rs new file mode 100644 index 0000000..af7deb4 --- /dev/null +++ b/src-tauri/src/engine.rs @@ -0,0 +1,1004 @@ +//! LD FDPI — SpoofDPI sidecar manager, process hygiene, and *real* connectivity probes. +//! +//! Ground truth (SpoofDPI v0.12.2, the last official Windows x64 build): +//! +//! ```text +//! -listen-addr string IP address to listen on (default "127.0.0.1") +//! -listen-port uint port number to listen on (default 8080) +//! -dns-addr string dns address (default "8.8.8.8") +//! -dns-port uint port number for dns (default 53) +//! -enable-doh enable 'dns-over-https' +//! -window-size uint chunk size (0 => legacy 1-byte SNI split) +//! -timeout uint dial timeout in ms (0 => none) +//! -system-proxy enable system-wide proxy (default TRUE) +//! -silent do not print banner +//! -debug verbose logs +//! -pattern regex only bypass matching hosts +//! -dns-ipv4-only resolve only A records +//! -cache-shards uint dns cache shards +//! -v print version +//! ``` +//! +//! The previous implementation passed `-addr` and `-port`, which do **not** exist: +//! the engine exits immediately with `flag provided but not defined: -addr` (exit code 2). +//! It also mapped Quad9 / OpenDNS to `https:///dns-query`, which returns 502 +//! because those resolvers have no certificate for the bare IP, so DNS died. + +use serde::{Deserialize, Serialize}; +use sha2::{Digest, Sha256}; +use std::fs::{self, File}; +use std::io::{Read, Write}; +use std::net::{IpAddr, SocketAddr, TcpListener, TcpStream}; +use std::path::{Path, PathBuf}; +use std::process::{Child, Command, Stdio}; +use std::sync::{Mutex, OnceLock}; +use std::time::{Duration, Instant}; +use sysinfo::System; + +/// Version of the bundled sidecar. Keep in sync with `scripts/download-sidecar.js`. +pub const ENGINE_VERSION: &str = "0.12.2"; +/// SHA-256 of the official SpoofDPI 0.12.2 Windows x64 release asset. +/// The sidecar is **never** executed unless the on-disk file matches this pin. +pub const SIDECAR_SHA256: &str = + "16a5c81265d908d31aaf9be69d577ec91588282ae5c366cc73e8bff878a3ea5e"; +/// A real SpoofDPI build is ~6 MB. Anything smaller is a placeholder and must never be executed. +pub const MIN_SIDECAR_BYTES: u64 = 1_500_000; + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase", default)] +pub struct EngineConfig { + /// "normal" | "game" | "eduroam" (game/eduroam also route WinHTTP, best effort). + pub connection_mode: String, + /// 0 = legacy SNI split, 1 = chunk split, 2 = aggressive small chunks. + pub bypass_mode: u8, + /// Chunk size in bytes (4 / 8 / 16 in the UI). + pub chunk_size: u16, + /// "auto" | "cloudflare" | "google" | "adguard" + pub doh_provider: String, + /// FDPI compatibility: block app-scoped QUIC/UDP-443. + pub quic_block: bool, + pub lan_sharing: bool, + pub proxy_port: u16, + pub pac_port: u16, +} + +impl Default for EngineConfig { + fn default() -> Self { + Self { + connection_mode: "normal".to_string(), + bypass_mode: 1, + chunk_size: 4, + doh_provider: "auto".to_string(), + quic_block: false, + lan_sharing: false, + proxy_port: 18080, + pac_port: 18081, + } + } +} + +impl EngineConfig { + pub fn is_game_mode(&self) -> bool { + self.connection_mode == "game" + } + + pub fn is_eduroam(&self) -> bool { + self.connection_mode == "eduroam" + } + + /// Modes that also program WinHTTP (services/launchers that ignore WinINet). + pub fn is_system_wide(&self) -> bool { + self.is_game_mode() || self.is_eduroam() + } +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct ResolverBenchmark { + pub id: String, + pub name: String, + pub ipv4: String, + pub reachable: bool, + pub latency_ms: u64, +} + +/// Winner of the parallel Smart-DoH probe. +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(rename_all = "camelCase")] +pub struct DohSelection { + pub id: String, + pub ipv4: String, + pub median_ms: u64, +} + +/// Result of a real end-to-end probe performed *through* the local proxy. +#[derive(Debug, Clone, Serialize, Deserialize, Default)] +#[serde(rename_all = "camelCase")] +pub struct ProbeSummary { + pub proxy_ok: bool, + pub discord_ok: bool, + pub web_ok: bool, + pub connect_ms: u64, + pub tls_ms: u64, + pub detail: String, +} + +/// Only resolvers that actually answer on `https:///dns-query` are offered. +/// Quad9 (9.9.9.9) and Cisco OpenDNS (208.67.222.222) do not present an IP SAN +/// certificate, so SpoofDPI's IP-only DoH client gets a 502 for them. +pub fn doh_ipv4_for_provider(provider: &str) -> &'static str { + match provider { + "google" => "8.8.8.8", + "adguard" => "94.140.14.14", + _ => "1.1.1.1", // cloudflare (default) + } +} + +pub fn supported_doh_providers() -> [(&'static str, &'static str, &'static str); 3] { + [ + ("cloudflare", "Cloudflare", "1.1.1.1"), + ("google", "Google", "8.8.8.8"), + ("adguard", "AdGuard", "94.140.14.14"), + ] +} + +/// `-window-size` mapping. Minimal fragmentation keeps CPU/socket overhead low: +/// Turbo = 1 byte, Balanced = the chosen chunk (default 4), Strong = 2 bytes. +pub fn window_size_for(cfg: &EngineConfig) -> u16 { + match cfg.bypass_mode { + 0 => 1, + 1 => cfg.chunk_size.clamp(1, 64), + _ => cfg.chunk_size.min(2).max(1), + } +} + +/// Builds the exact argv SpoofDPI 0.12.2 understands. +/// +/// `-enable-doh` is mandatory: plain port-53 DNS is never used, so the ISP cannot +/// poison or MITM the resolution. `-dns-port` is deliberately omitted (it only +/// applies to plain DNS). +pub fn build_spoofdpi_args(cfg: &EngineConfig) -> Vec { + let bind_addr = if cfg.lan_sharing { "0.0.0.0" } else { "127.0.0.1" }; + let dns_addr = doh_ipv4_for_provider(&cfg.doh_provider); + + vec![ + "-listen-addr".to_string(), + bind_addr.to_string(), + "-listen-port".to_string(), + cfg.proxy_port.to_string(), + "-dns-addr".to_string(), + dns_addr.to_string(), + "-enable-doh".to_string(), + "-system-proxy=false".to_string(), // LD FDPI owns the registry + WinInet refresh + "-window-size".to_string(), + window_size_for(cfg).to_string(), + "-timeout".to_string(), + "8000".to_string(), + "-silent".to_string(), + ] +} + +pub fn app_data_dir() -> PathBuf { + let dir = local_app_data_dir().join("LD-FDPI"); + let _ = fs::create_dir_all(&dir); + dir +} + +/// Real per-user local app data directory from the Win32 API. +/// +/// `LOCALAPPDATA` is an environment variable; a manipulated environment must not be +/// able to redirect files written by this elevated process. Fallback is ProgramData +/// (admin-only), never a user-writable temp directory. +#[cfg(target_os = "windows")] +fn local_app_data_dir() -> PathBuf { + use windows_sys::Win32::UI::Shell::{SHGetFolderPathW, CSIDL_LOCAL_APPDATA}; + + let mut buffer = [0u16; 260]; + let result = unsafe { + SHGetFolderPathW( + std::ptr::null_mut(), + CSIDL_LOCAL_APPDATA as i32, + std::ptr::null_mut(), + 0, + buffer.as_mut_ptr(), + ) + }; + if result == 0 { + let length = buffer + .iter() + .position(|value| *value == 0) + .unwrap_or(buffer.len()); + return PathBuf::from(String::from_utf16_lossy(&buffer[..length])); + } + PathBuf::from("C:\\ProgramData") +} + +#[cfg(not(target_os = "windows"))] +fn local_app_data_dir() -> PathBuf { + std::env::temp_dir() +} + +/// Absolute path to a Windows system binary. +/// +/// The application runs elevated; resolving `netsh`/`schtasks` through PATH or the +/// current directory would allow a user-writable `netsh.exe` to be executed with +/// administrator rights (binary planting / EoP). Never fall back to PATH. +pub fn system32_binary(name: &str) -> Result { + let path = windows_system32_dir().join(name); + if path.is_file() { + Ok(path) + } else { + Err(format!( + "Sistem ikilisi bulunamadı: {} (PATH üzerinden çağrı yapılmaz).", + path.display() + )) + } +} + +/// Real system directory from the Win32 API (not the mutable `SystemRoot` env var). +#[cfg(target_os = "windows")] +fn windows_system32_dir() -> PathBuf { + use windows_sys::Win32::System::SystemInformation::GetSystemDirectoryW; + + let mut buffer = [0u16; 260]; + let length = unsafe { GetSystemDirectoryW(buffer.as_mut_ptr(), buffer.len() as u32) }; + if length > 0 && (length as usize) < buffer.len() { + return PathBuf::from(String::from_utf16_lossy(&buffer[..length as usize])); + } + PathBuf::from("C:\\Windows\\System32") +} + +#[cfg(not(target_os = "windows"))] +fn windows_system32_dir() -> PathBuf { + PathBuf::from("/usr/bin") +} + +pub fn engine_log_path() -> PathBuf { + app_data_dir().join("spoofdpi.log") +} + +/// Keep the app data directory bounded across months of use. Runs before the +/// sidecar starts, while no writer has the log open. +pub fn rotate_logs() { + const MAX_BYTES: u64 = 5 * 1024 * 1024; + for name in ["spoofdpi.log", "auto-recovery.log"] { + let path = app_data_dir().join(name); + let Ok(meta) = fs::metadata(&path) else { + continue; + }; + if meta.len() <= MAX_BYTES { + continue; + } + let old = path.with_extension("log.old"); + let _ = fs::remove_file(&old); + let _ = fs::rename(&path, old); + } +} + +fn exe_dir() -> Option { + std::env::current_exe() + .ok() + .and_then(|p| p.parent().map(Path::to_path_buf)) +} + +fn candidate_paths() -> Vec { + let mut out: Vec = Vec::new(); + let mut push = |p: PathBuf| { + if !out.contains(&p) { + out.push(p); + } + }; + + if let Some(dir) = exe_dir() { + // Bundled layout (Tauri strips the target triple): /spoofdpi.exe + push(dir.join("spoofdpi.exe")); + push(dir.join("spoofdpi-x86_64-pc-windows-gnu.exe")); + push(dir.join("spoofdpi-x86_64-pc-windows-msvc.exe")); + push(dir.join("binaries").join("spoofdpi-x86_64-pc-windows-gnu.exe")); + push(dir.join("binaries").join("spoofdpi-x86_64-pc-windows-msvc.exe")); + } + + // Dev layout: `cargo tauri dev` runs the binary from target/{debug,release}. + let manifest = PathBuf::from(env!("CARGO_MANIFEST_DIR")); + push(manifest.join("binaries").join("spoofdpi-x86_64-pc-windows-gnu.exe")); + push(manifest.join("binaries").join("spoofdpi-x86_64-pc-windows-msvc.exe")); + + // Never search the process CWD in a release build: an elevated process can + // be launched from a user-writable directory. The digest pin prevents + // execution, but a planted file would still be a denial-of-service. + #[cfg(debug_assertions)] + if let Ok(cwd) = std::env::current_dir() { + push(cwd.join("spoofdpi.exe")); + push(cwd.join("binaries").join("spoofdpi-x86_64-pc-windows-gnu.exe")); + push(cwd.join("src-tauri").join("binaries").join("spoofdpi-x86_64-pc-windows-gnu.exe")); + } + + out +} + +fn is_real_pe(path: &Path) -> bool { + let meta = match fs::metadata(path) { + Ok(m) => m, + Err(_) => return false, + }; + if !meta.is_file() || meta.len() < MIN_SIDECAR_BYTES { + return false; + } + let mut header = [0u8; 2]; + match File::open(path).and_then(|mut f| f.read_exact(&mut header)) { + Ok(()) => header == *b"MZ", + Err(_) => false, + } +} + +/// Streaming SHA-256 of a file (6 MB sidecar, ~15 ms). +pub fn sha256_file(path: &Path) -> Result { + let mut file = File::open(path) + .map_err(|e| format!("Dosya açılamadı ({}): {e}", path.display()))?; + let mut hasher = Sha256::new(); + let mut buffer = [0u8; 64 * 1024]; + loop { + let read = file + .read(&mut buffer) + .map_err(|e| format!("Dosya okunamadı ({}): {e}", path.display()))?; + if read == 0 { + break; + } + hasher.update(&buffer[..read]); + } + let digest = hasher.finalize(); + Ok(digest.iter().map(|byte| format!("{byte:02x}")).collect()) +} + +/// Locates the real engine and verifies its SHA-256 pin. +/// +/// A file that exists but does not match the pin is treated as a **tampering +/// attempt**, not as a fallback candidate. Returns a detailed, user-facing error +/// instead of `Ok(None)` so the UI can never report a fake "connected" state. +pub fn resolve_sidecar() -> Result { + let candidates = candidate_paths(); + + // Candidate order is authoritative: the first *real* PE (installed sidecar, + // then dev fallbacks) must match the pin. A tampered installed sidecar is a + // hard failure — we never fall back to a different copy after a mismatch. + for path in &candidates { + if !is_real_pe(path) { + continue; + } + match sha256_file(path) { + Ok(hash) if hash == SIDECAR_SHA256 => return Ok(path.clone()), + Ok(hash) => { + return Err(format!( + "GÜVENLİK HATASI: SpoofDPI ikilisinin SHA-256 özeti doğrulanamadı; motor \ + başlatılmadı.\nYol: {}\nBeklenen: {}\nBulunan: {}\n\ + Dosya değiştirilmiş olabilir. `npm run setup:sidecar` ile resmî ikiliyi geri yükleyin.", + path.display(), + SIDECAR_SHA256, + hash + )); + } + Err(e) => { + return Err(format!( + "GÜVENLİK HATASI: SpoofDPI ikilisi okunamadı ({}): {e}", + path.display() + )); + } + } + } + + let mut report = String::from( + "SpoofDPI motoru bulunamadı. `src-tauri/binaries/spoofdpi-x86_64-pc-windows-gnu.exe` \ + dosyası gerçek SpoofDPI 0.12.2 ikilisi olmalı (yaklaşık 6 MB).\n\ + Denenen yollar:\n", + ); + for path in &candidates { + let note = match fs::metadata(path) { + Ok(m) if m.is_file() => format!("{} bayt (sahte/eksik)", m.len()), + Ok(_) => "dizin".to_string(), + Err(_) => "yok".to_string(), + }; + report.push_str(&format!(" - {} [{note}]\n", path.display())); + } + report.push_str("Düzeltmek için: `npm run setup:sidecar`"); + Err(report) +} + +/// Reads `spoofdpi -v` once and caches it, for honest version reporting in the UI. +pub fn engine_version_string() -> String { + static CACHE: OnceLock = OnceLock::new(); + CACHE + .get_or_init(|| { + if let Ok(path) = resolve_sidecar() { + let mut cmd = Command::new(&path); + cmd.arg("-v").stdin(Stdio::null()); + #[cfg(target_os = "windows")] + { + use std::os::windows::process::CommandExt; + cmd.creation_flags(0x0800_0000); // CREATE_NO_WINDOW + } + if let Ok(out) = cmd.output() { + let text = String::from_utf8_lossy(&out.stdout).to_string() + + &String::from_utf8_lossy(&out.stderr); + if let Some(line) = text.lines().find(|l| l.to_lowercase().contains("spoofdpi v")) { + return line.trim().to_string(); + } + } + } + format!("SpoofDPI {ENGINE_VERSION} (ikili doğrulanamadı)") + }) + .clone() +} + +/// Kills orphaned engine processes left behind by a crashed session or a hard kill. +pub fn hunt_zombie_processes() -> usize { + let mut sys = System::new_all(); + sys.refresh_all(); + let own = std::process::id(); + let allowed_dirs: Vec = [exe_dir(), Some(app_data_dir())] + .into_iter() + .flatten() + .collect(); + let mut killed = 0usize; + + for (pid, process) in sys.processes() { + if pid.as_u32() == own { + continue; + } + let name = process.name().to_string_lossy().to_lowercase(); + if !name.contains("spoofdpi") { + continue; + } + // Never kill a third-party/portable SpoofDPI by image name alone. + let Some(exe) = process.exe() else { + continue; + }; + if exe.as_os_str().is_empty() || !allowed_dirs.iter().any(|dir| exe.starts_with(dir)) { + continue; + } + if process.kill() { + killed += 1; + } + } + killed +} + +/// True when nothing is listening on the port. +/// +/// LAN off => bind to loopback only, so the probe can never create a public +/// listener and matches the actual (loopback) engine binding. +pub fn port_is_free(port: u16, lan: bool) -> bool { + let address = if lan { ("0.0.0.0", port) } else { ("127.0.0.1", port) }; + match TcpListener::bind(address) { + Ok(listener) => { + drop(listener); + true + } + Err(_) => false, + } +} + +/// Spawns the sidecar with a hidden console and its own log file. +/// +/// The SHA-256 pin is checked again immediately before `spawn` (the path was +/// already verified by `resolve_sidecar`) to narrow the replacement window. +pub fn spawn_sidecar(cfg: &EngineConfig) -> Result<(Child, PathBuf, Vec), String> { + let path = resolve_sidecar()?; + let integrity = sha256_file(&path)?; + if integrity != SIDECAR_SHA256 { + return Err(format!( + "GÜVENLİK HATASI: Motor başlatılmadan hemen önce SHA-256 doğrulaması başarısız \ + oldu ({}). Süreç başlatılmadı.", + path.display() + )); + } + let args = build_spoofdpi_args(cfg); + let log_path = engine_log_path(); + let log = File::create(&log_path) + .map_err(|e| format!("Motor log dosyası oluşturulamadı ({}): {e}", log_path.display()))?; + let log_err = log + .try_clone() + .map_err(|e| format!("Motor log dosyası çoğaltılamadı: {e}"))?; + + let mut cmd = Command::new(&path); + cmd.args(&args) + .stdin(Stdio::null()) + .stdout(Stdio::from(log)) + .stderr(Stdio::from(log_err)); + + #[cfg(target_os = "windows")] + { + use std::os::windows::process::CommandExt; + const CREATE_NO_WINDOW: u32 = 0x0800_0000; + cmd.creation_flags(CREATE_NO_WINDOW); + } + + let child = cmd.spawn().map_err(|e| { + format!( + "SpoofDPI başlatılamadı.\nYol: {}\nArgümanlar: {}\nHata: {e}", + path.display(), + args.join(" ") + ) + })?; + + // One notch above normal: keeps proxy packets responsive under CPU load. + set_above_normal_priority(child.id()); + + Ok((child, path, args)) +} + +/// A real local socket probe (not just a PID check) used by the supervisor. +pub fn probe_local_port(port: u16) -> bool { + TcpStream::connect_timeout( + &SocketAddr::from(([127, 0, 0, 1], port)), + Duration::from_millis(500), + ) + .is_ok() +} + +/// `ABOVE_NORMAL_PRIORITY_CLASS` for the sidecar (reduces jitter under load). +#[cfg(target_os = "windows")] +pub fn set_above_normal_priority(pid: u32) { + use windows_sys::Win32::System::Threading::{ + OpenProcess, SetPriorityClass, ABOVE_NORMAL_PRIORITY_CLASS, PROCESS_SET_INFORMATION, + }; + unsafe { + let handle = OpenProcess(PROCESS_SET_INFORMATION, 0, pid); + if !handle.is_null() { + let _ = SetPriorityClass(handle, ABOVE_NORMAL_PRIORITY_CLASS); + let _ = windows_sys::Win32::Foundation::CloseHandle(handle); + } + } +} + +#[cfg(not(target_os = "windows"))] +pub fn set_above_normal_priority(_pid: u32) {} + +fn tail_engine_log(max_lines: usize) -> String { + let raw = fs::read_to_string(engine_log_path()).unwrap_or_default(); + let lines: Vec<&str> = raw.lines().filter(|l| !l.trim().is_empty()).collect(); + let start = lines.len().saturating_sub(max_lines); + lines[start..].join(" | ") +} + +/// Waits until the engine is actually listening *and* still alive. +/// Detects the "wrong flag / port busy" crash instead of blindly reporting success. +pub fn wait_until_listening( + port: u16, + timeout: Duration, + child: &mut Child, +) -> Result { + let started = Instant::now(); + let addr = SocketAddr::from(([127, 0, 0, 1], port)); + + loop { + if let Ok(Some(status)) = child.try_wait() { + let log = tail_engine_log(6); + return Err(format!( + "SpoofDPI başlatıldıktan hemen sonra kapandı (çıkış kodu {:?}).\n\ + Port {} kullanımda olabilir veya motor argümanları reddetti.\nMotor logu: {}", + status.code(), + port, + if log.is_empty() { "(boş)" } else { &log } + )); + } + + if TcpStream::connect_timeout(&addr, Duration::from_millis(300)).is_ok() { + return Ok(started.elapsed().as_millis() as u64); + } + + if started.elapsed() > timeout { + let log = tail_engine_log(6); + return Err(format!( + "SpoofDPI {} saniye içinde {} portunu dinlemeye başlamadı.\nMotor logu: {}", + timeout.as_secs(), + port, + if log.is_empty() { "(boş)" } else { &log } + )); + } + + std::thread::sleep(Duration::from_millis(100)); + } +} + +fn read_http_head(stream: &mut TcpStream, max: usize) -> Result { + let mut buf = Vec::with_capacity(256); + let mut byte = [0u8; 1]; + while buf.len() < max { + match stream.read(&mut byte) { + Ok(0) => break, + Ok(_) => { + buf.push(byte[0]); + if buf.len() >= 4 && &buf[buf.len() - 4..] == b"\r\n\r\n" { + break; + } + } + Err(e) => return Err(format!("Proxy yanıtı okunamadı: {e}")), + } + } + Ok(String::from_utf8_lossy(&buf).to_string()) +} + +/// Connects to the local proxy, performs a CONNECT handshake and a full TLS +/// handshake (SChannel, certificate validated). Returns `(connect_ok, tls_ok, ms, detail)`. +pub fn probe_host_through_proxy( + proxy_port: u16, + host: &str, + timeout: Duration, +) -> (bool, bool, u64, String) { + let started = Instant::now(); + let addr = SocketAddr::from(([127, 0, 0, 1], proxy_port)); + let mut stream = match TcpStream::connect_timeout(&addr, timeout) { + Ok(s) => s, + Err(e) => { + return ( + false, + false, + 0, + format!("Yerel proxy {proxy_port} portunda kabul etmiyor: {e}"), + ) + } + }; + + let _ = stream.set_read_timeout(Some(timeout)); + let _ = stream.set_write_timeout(Some(timeout)); + + let request = format!("CONNECT {host}:443 HTTP/1.1\r\nHost: {host}:443\r\n\r\n"); + if let Err(e) = stream.write_all(request.as_bytes()) { + return (false, false, 0, format!("CONNECT isteği yazılamadı: {e}")); + } + + let head = match read_http_head(&mut stream, 1024) { + Ok(h) => h, + Err(e) => return (false, false, 0, e), + }; + if !head.starts_with("HTTP/1.1 200") && !head.starts_with("HTTP/1.0 200") { + let line = head.lines().next().unwrap_or("(boş yanıt)").trim().to_string(); + return ( + false, + false, + 0, + format!("Proxy {host}:443 için tünel açmadı: {line}"), + ); + } + let connect_ms = started.elapsed().as_millis() as u64; + + // Full TLS handshake through the tunnel using Windows SChannel. This validates + // the certificate chain and proves the fragmented ClientHello is relayed intact. + let tls_started = Instant::now(); + let connector = match native_tls::TlsConnector::builder().build() { + Ok(c) => c, + Err(e) => { + return ( + true, + false, + connect_ms, + format!("{host}: TLS istemcisi kurulamadı: {e}"), + ) + } + }; + + match connector.connect(host, stream) { + Ok(mut tls) => { + let request = format!( + "HEAD / HTTP/1.1\r\nHost: {host}\r\nUser-Agent: LD-FDPI-HealthCheck\r\nConnection: close\r\n\r\n" + ); + let _ = tls.write_all(request.as_bytes()); + let mut buf = [0u8; 128]; + let n = tls.read(&mut buf).unwrap_or(0); + let status = String::from_utf8_lossy(&buf[..n]) + .lines() + .next() + .unwrap_or("(HTTP yanıtı yok)") + .trim() + .to_string(); + let tls_ms = tls_started.elapsed().as_millis() as u64; + let ok = status.starts_with("HTTP/"); + ( + true, + ok, + connect_ms + tls_ms, + format!("{host}: TLS el sıkışması tamam — {status}"), + ) + } + Err(e) => { + let tls_ms = tls_started.elapsed().as_millis() as u64; + ( + true, + false, + connect_ms + tls_ms, + format!("{host}: TLS el sıkışması başarısız: {e} — DPI engelliyor olabilir"), + ) + } + } +} + +/// A freshly spawned engine can answer the very first CONNECT with 502 while its +/// DoH resolver warms up. Retry once before declaring the tunnel broken. +fn probe_with_retry( + proxy_port: u16, + host: &str, + timeout: Duration, +) -> (bool, bool, u64, String) { + let first = probe_host_through_proxy(proxy_port, host, timeout); + if first.1 { + return first; + } + std::thread::sleep(Duration::from_millis(350)); + let second = probe_host_through_proxy(proxy_port, host, timeout); + if second.1 { + second + } else { + first + } +} + +/// TCP handshake latency to a literal IP. This is the UI's "ping" value: it +/// measures the network path, not the local proxy CONNECT time. +pub fn tcp_latency(host: &str, port: u16) -> Option { + let addr: SocketAddr = format!("{host}:{port}").parse().ok()?; + let started = Instant::now(); + TcpStream::connect_timeout(&addr, Duration::from_millis(1200)) + .ok() + .map(|_| started.elapsed().as_millis() as u64) +} + +/// ICMP echo through the active tunnel. Used by the VPN watchdog because +/// WireGuard only refreshes `latest handshake` on rekey (about every 2 min); +/// handshake age is not a liveness signal. The AWG gateway is 10.8.1.1. +#[cfg(windows)] +pub fn icmp_ping(host: &str, timeout_ms: u32) -> bool { + use std::net::Ipv4Addr; + use windows_sys::Win32::Foundation::{HANDLE, INVALID_HANDLE_VALUE}; + use windows_sys::Win32::NetworkManagement::IpHelper::{ + IcmpCloseHandle, IcmpCreateFile, IcmpSendEcho, + }; + + let Ok(ip) = host.parse::() else { + return false; + }; + let handle: HANDLE = unsafe { IcmpCreateFile() }; + if handle == INVALID_HANDLE_VALUE { + return false; + } + let request = [0u8; 32]; + let mut reply = [0u8; 1024]; + let sent = unsafe { + IcmpSendEcho( + handle, + u32::from_be_bytes(ip.octets()), + request.as_ptr().cast(), + request.len() as u16, + std::ptr::null(), + reply.as_mut_ptr().cast(), + reply.len() as u32, + timeout_ms, + ) + }; + unsafe { IcmpCloseHandle(handle) }; + sent > 0 +} + +#[cfg(not(windows))] +pub fn icmp_ping(_host: &str, _timeout_ms: u32) -> bool { + false +} + +/// DNS through the tunnel. WFP blocks port 53 on the physical interface and +/// only permits the tunnel LUID, so a direct WAN fallback cannot mask a dead +/// peer. This is the watchdog's tunnel-specific liveness signal. +pub fn dns_probe(server: &str, timeout_ms: u64) -> bool { + use std::net::UdpSocket; + let Ok(addr) = format!("{server}:53").parse::() else { + return false; + }; + let Ok(socket) = UdpSocket::bind("0.0.0.0:0") else { + return false; + }; + let _ = socket.set_read_timeout(Some(Duration::from_millis(timeout_ms))); + let _ = socket.set_write_timeout(Some(Duration::from_millis(timeout_ms))); + let _ = socket.connect(addr); + // Minimal DNS A query for example.com. + let query: [u8; 29] = [ + 0x12, 0x34, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e', 0x03, b'c', b'o', b'm', + 0x00, 0x00, 0x01, 0x00, 0x01, + ]; + if socket.send(&query).is_err() { + return false; + } + let mut reply = [0u8; 512]; + matches!(socket.recv(&mut reply), Ok(size) if size > 12) +} + +/// Probes the host the app exists for (Discord) plus a neutral control host. +pub fn probe_connectivity(proxy_port: u16) -> ProbeSummary { + let (proxy_ok, discord_ok, connect_ms, discord_detail) = + probe_with_retry(proxy_port, "discord.com", Duration::from_secs(6)); + let (_, web_ok, _, web_detail) = if proxy_ok { + probe_with_retry(proxy_port, "example.com", Duration::from_secs(5)) + } else { + (false, false, 0, String::new()) + }; + + // Use direct 1.1.1.1 TCP handshake for the number shown in the UI. + let ping_ms = if proxy_ok { + tcp_latency("1.1.1.1", 443).unwrap_or(connect_ms) + } else { + 0 + }; + + let detail = if discord_ok { + discord_detail + } else if web_ok { + format!("{discord_detail} | Kontrol: {web_detail}") + } else { + format!("{discord_detail} | Kontrol: {web_detail}") + }; + + ProbeSummary { + proxy_ok, + discord_ok, + web_ok, + connect_ms: ping_ms, + tls_ms: 0, + detail, + } +} + +/// Median of 3 parallel TCP:443 handshakes to a DoH endpoint. +fn probe_median(ip: &str) -> Option { + let mut handles = Vec::with_capacity(3); + for _ in 0..3 { + let ip = ip.to_string(); + handles.push(std::thread::spawn(move || { + let addr: SocketAddr = format!("{ip}:443").parse().ok()?; + let start = Instant::now(); + TcpStream::connect_timeout(&addr, Duration::from_millis(700)) + .ok() + .map(|_| start.elapsed().as_millis() as u64) + })); + } + let mut values: Vec = handles + .into_iter() + .filter_map(|handle| handle.join().ok().flatten()) + .collect(); + if values.len() < 2 { + return None; + } + values.sort_unstable(); + Some(values[values.len() / 2]) +} + +/// Parallel Smart-DoH selection (3 handshakes per provider, median latency, +/// 10-minute cache). Only the fixed, IP-certificate-valid providers are eligible. +pub fn select_fastest_doh() -> Option { + static CACHE: Mutex> = Mutex::new(None); + + { + let guard = CACHE.lock().unwrap_or_else(|poisoned| poisoned.into_inner()); + if let Some((selection, at)) = guard.as_ref() { + if at.elapsed() < Duration::from_secs(600) { + return Some(selection.clone()); + } + } + } + + let mut handles = Vec::new(); + for (id, _name, ip) in supported_doh_providers() { + let id = id.to_string(); + let ip = ip.to_string(); + handles.push(std::thread::spawn(move || { + probe_median(&ip).map(|median_ms| DohSelection { + id, + ipv4: ip, + median_ms, + }) + })); + } + + let mut results: Vec = handles + .into_iter() + .filter_map(|handle| handle.join().ok().flatten()) + .collect(); + results.sort_by_key(|selection| selection.median_ms); + let best = results.into_iter().next(); + + if let Some(selection) = &best { + let mut guard = CACHE.lock().unwrap_or_else(|poisoned| poisoned.into_inner()); + *guard = Some((selection.clone(), Instant::now())); + } + best +} + +/// Median-latency benchmark for the UI's "pick fastest" button. +pub fn benchmark_all_doh_resolvers() -> Vec { + let mut handles = Vec::new(); + for (id, name, ip) in supported_doh_providers() { + handles.push(std::thread::spawn(move || { + let median = probe_median(ip); + ResolverBenchmark { + id: id.to_string(), + name: format!("{name} ({ip})"), + ipv4: ip.to_string(), + reachable: median.is_some(), + latency_ms: median.unwrap_or(9999), + } + })); + } + + let mut results: Vec = handles + .into_iter() + .filter_map(|handle| handle.join().ok()) + .collect(); + results.sort_by_key(|benchmark| benchmark.latency_ms); + results +} + +/// Local IPv4 used for LAN sharing. Falls back to loopback when offline. +pub fn detect_lan_ip() -> String { + match local_ip_address::local_ip() { + Ok(IpAddr::V4(v4)) if !v4.is_loopback() => v4.to_string(), + Ok(ip) => ip.to_string(), + Err(_) => "127.0.0.1".to_string(), + } +} + +/// `netsh` rule scoped to the local subnet only. Returns whether the rule was +/// actually applied (it needs an elevated process; the UI reports the truth). +pub fn configure_lan_firewall_rule(enable: bool, proxy_port: u16, pac_port: u16) -> bool { + #[cfg(target_os = "windows")] + { + use std::os::windows::process::CommandExt; + const CREATE_NO_WINDOW: u32 = 0x0800_0000; + + let netsh = match system32_binary("netsh.exe") { + Ok(path) => path, + Err(_) => return false, + }; + + let _ = Command::new(&netsh) + .args([ + "advfirewall", + "firewall", + "delete", + "rule", + "name=LD_FDPI_LAN_Share", + ]) + .creation_flags(CREATE_NO_WINDOW) + .output(); + + if !enable { + return true; + } + + let ports = format!("{proxy_port},{pac_port}"); + let status = Command::new(&netsh) + .args([ + "advfirewall", + "firewall", + "add", + "rule", + "name=LD_FDPI_LAN_Share", + "dir=in", + "action=allow", + "protocol=TCP", + &format!("localport={ports}"), + "remoteip=localsubnet", + ]) + .creation_flags(CREATE_NO_WINDOW) + .status(); + + status.map(|s| s.success()).unwrap_or(false) + } + #[cfg(not(target_os = "windows"))] + { + let _ = (enable, proxy_port, pac_port); + false + } +} + +/// Terminates a child process and reaps it (avoids Windows zombie handles). +pub fn terminate_child(mut child: Child) { + let _ = child.kill(); + let _ = child.wait(); +} diff --git a/src-tauri/src/identity.rs b/src-tauri/src/identity.rs new file mode 100644 index 0000000..d6026d8 --- /dev/null +++ b/src-tauri/src/identity.rs @@ -0,0 +1,452 @@ +//! Per-installation WireGuard identity. +//! +//! The private key is generated locally and sealed with Windows DPAPI +//! (CurrentUser). Enrollment sends only the public key; the server returns the +//! peer parameters. No private key is shipped in the installer. + +use base64::{engine::general_purpose::STANDARD as B64, Engine}; +use rand_core::OsRng; +use serde::{Deserialize, Serialize}; +use std::fs; +use std::path::PathBuf; +use x25519_dalek::{PublicKey, StaticSecret}; + +#[cfg(windows)] +use windows_sys::Win32::Foundation::LocalFree; +#[cfg(windows)] +use windows_sys::Win32::Security::Cryptography::{ + CryptProtectData, CryptUnprotectData, CRYPTPROTECT_UI_FORBIDDEN, CRYPT_INTEGER_BLOB, +}; + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct AwgParams { + pub jc: u16, + pub jmin: u16, + pub jmax: u16, + pub s1: u16, + pub s2: u16, + pub s3: u16, + pub s4: u16, + pub h1: u32, + pub h2: u32, + pub h3: u32, + pub h4: u32, + #[serde(default)] + pub i1: Option, + pub header_protection_key: String, + pub rekey_after_time: String, + pub rekey_timeout: String, + pub reject_after_time: String, + pub keepalive_timeout: String, + pub max_handshake_attempts: String, + pub random_trailers: bool, + pub disable_cookies: bool, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +pub struct EnrollmentResponse { + pub address: String, + pub dns: Vec, + pub server_public_key: String, + pub endpoint: String, + pub allowed_ips: Vec, + pub preshared_key: String, + pub awg: AwgParams, +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +struct EnrollmentRequest { + public_key: String, + client_version: String, + device_id: String, +} + +pub struct ClientIdentity { + pub private_key_b64: String, + pub public_key_b64: String, +} + +fn identity_path() -> PathBuf { + crate::engine::app_data_dir().join("identity.dat") +} + +fn token_path() -> PathBuf { + crate::engine::app_data_dir().join("enrollment.dat") +} + +fn atomic_write(path: &std::path::Path, bytes: &[u8]) -> Result<(), String> { + let tmp = path.with_extension("tmp"); + fs::write(&tmp, bytes).map_err(|e| format!("Dosya yazılamadı: {e}"))?; + #[cfg(windows)] + if path.exists() { + fs::remove_file(path).map_err(|e| format!("Eski dosya silinemedi: {e}"))?; + } + fs::rename(&tmp, path).map_err(|e| format!("Dosya taşınamadı: {e}")) +} + +#[cfg(windows)] +fn protect(bytes: &[u8]) -> Result, String> { + let mut input = bytes.to_vec(); + let mut in_blob = CRYPT_INTEGER_BLOB { + cbData: input.len() as u32, + pbData: input.as_mut_ptr(), + }; + let mut out_blob = CRYPT_INTEGER_BLOB { + cbData: 0, + pbData: std::ptr::null_mut(), + }; + let ok = unsafe { + CryptProtectData( + &mut in_blob, + std::ptr::null(), + std::ptr::null_mut(), + std::ptr::null_mut(), + std::ptr::null(), + CRYPTPROTECT_UI_FORBIDDEN, + &mut out_blob, + ) + }; + if ok == 0 { + return Err("DPAPI şifreleme başarısız.".to_string()); + } + let output = + unsafe { std::slice::from_raw_parts(out_blob.pbData, out_blob.cbData as usize).to_vec() }; + unsafe { + LocalFree(out_blob.pbData as _); + } + Ok(output) +} + +#[cfg(windows)] +fn unprotect(bytes: &[u8]) -> Result, String> { + let mut input = bytes.to_vec(); + let mut in_blob = CRYPT_INTEGER_BLOB { + cbData: input.len() as u32, + pbData: input.as_mut_ptr(), + }; + let mut out_blob = CRYPT_INTEGER_BLOB { + cbData: 0, + pbData: std::ptr::null_mut(), + }; + let ok = unsafe { + CryptUnprotectData( + &mut in_blob, + std::ptr::null_mut(), + std::ptr::null_mut(), + std::ptr::null_mut(), + std::ptr::null(), + CRYPTPROTECT_UI_FORBIDDEN, + &mut out_blob, + ) + }; + if ok == 0 { + return Err("DPAPI çözme başarısız.".to_string()); + } + let output = + unsafe { std::slice::from_raw_parts(out_blob.pbData, out_blob.cbData as usize).to_vec() }; + unsafe { + LocalFree(out_blob.pbData as _); + } + Ok(output) +} + +pub fn get_or_create_identity() -> Result { + let path = identity_path(); + if path.is_file() { + let encrypted = fs::read(&path).map_err(|e| format!("Kimlik okunamadı: {e}"))?; + #[cfg(windows)] + let raw = unprotect(&encrypted)?; + #[cfg(not(windows))] + let raw = encrypted; + if raw.len() == 32 { + let mut bytes = [0u8; 32]; + bytes.copy_from_slice(&raw); + let secret = StaticSecret::from(bytes); + let public = PublicKey::from(&secret); + return Ok(ClientIdentity { + private_key_b64: B64.encode(secret.to_bytes()), + public_key_b64: B64.encode(public.as_bytes()), + }); + } + } + + let secret = StaticSecret::random_from_rng(OsRng); + let public = PublicKey::from(&secret); + let raw = secret.to_bytes(); + #[cfg(windows)] + let stored = protect(&raw)?; + #[cfg(not(windows))] + let stored = raw.to_vec(); + atomic_write(&path, &stored)?; + Ok(ClientIdentity { + private_key_b64: B64.encode(raw), + public_key_b64: B64.encode(public.as_bytes()), + }) +} + +pub fn save_enrollment_token(token: &str) -> Result<(), String> { + #[cfg(windows)] + let stored = protect(token.as_bytes())?; + #[cfg(not(windows))] + let stored = token.as_bytes().to_vec(); + atomic_write(&token_path(), &stored) +} + +pub fn load_enrollment_token() -> Result { + let path = token_path(); + if !path.is_file() { + return Err("Aktivasyon kodu girilmedi.".to_string()); + } + let stored = fs::read(&path).map_err(|e| format!("Aktivasyon kodu okunamadı: {e}"))?; + #[cfg(windows)] + let raw = unprotect(&stored)?; + #[cfg(not(windows))] + let raw = stored; + String::from_utf8(raw).map_err(|_| "Aktivasyon kodu geçersiz.".to_string()) +} + +#[cfg(windows)] +fn hklm_string(path: &str, value: &str) -> Option { + use winreg::enums::HKEY_LOCAL_MACHINE; + use winreg::RegKey; + RegKey::predef(HKEY_LOCAL_MACHINE) + .open_subkey(path) + .and_then(|key| key.get_value::(value)) + .ok() + .map(|s| s.trim().to_string()) + .filter(|s| !s.is_empty()) +} + +#[cfg(windows)] +fn hardware_fingerprint() -> Vec { + let mut values = Vec::new(); + for (path, name) in [ + (r"SYSTEM\CurrentControlSet\Control\SystemInformation", "ComputerHardwareId"), + (r"HARDWARE\DESCRIPTION\System\BIOS", "SystemSerialNumber"), + (r"HARDWARE\DESCRIPTION\System\BIOS", "BaseBoardProduct"), + (r"HARDWARE\DESCRIPTION\System\BIOS", "SystemProductName"), + (r"HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString"), + ] { + if let Some(value) = hklm_string(path, name) { + values.push(format!("{name}={value}")); + } + } + values +} + +pub fn device_id() -> String { + use sha2::{Digest, Sha256}; + let mut hasher = Sha256::new(); + #[cfg(windows)] + let hardware = hardware_fingerprint(); + #[cfg(windows)] + if hardware.is_empty() { + hasher.update(b"ld-fdpi-hwid-v1"); + } else { + hasher.update(b"ld-fdpi-hwid-v2"); + } + #[cfg(not(windows))] + hasher.update(b"ld-fdpi-hwid-v1"); + + #[cfg(windows)] + { + use winreg::enums::HKEY_LOCAL_MACHINE; + use winreg::RegKey; + let machine_guid = RegKey::predef(HKEY_LOCAL_MACHINE) + .open_subkey(r"SOFTWARE\Microsoft\Cryptography") + .and_then(|key| key.get_value::("MachineGuid")); + if let Ok(guid) = machine_guid { + hasher.update(guid.trim().to_ascii_lowercase().as_bytes()); + } else { + // Stable fallback for locked-down machines without registry access. + if let Ok(name) = std::env::var("COMPUTERNAME") { + hasher.update(name.as_bytes()); + } + if let Ok(user) = std::env::var("USERNAME") { + hasher.update(user.as_bytes()); + } + hasher.update(b"machine-guid-unavailable"); + } + for value in hardware { + hasher.update(value.as_bytes()); + } + } + #[cfg(not(windows))] + { + if let Ok(name) = std::env::var("HOSTNAME") { + hasher.update(name.as_bytes()); + } + } + format!("{:x}", hasher.finalize()) +} + +fn app_secret() -> Option<&'static str> { + option_env!("LD_FDPI_APP_SECRET") + .map(str::trim) + .filter(|value| !value.is_empty()) +} + +/// POST /api/v1/auto-enroll over TLS. The app secret is supplied at build time +/// via LD_FDPI_APP_SECRET; it is never committed to the repository. It is an +/// abuse barrier, not a substitute for user authentication. +pub fn auto_enroll() -> Result { + let secret = app_secret().ok_or( + "Bu build LD_FDPI_APP_SECRET olmadan derlendi; otomatik kayıt devre dışı.", + )?; + let identity = get_or_create_identity()?; + let payload = serde_json::to_string(&EnrollmentRequest { + public_key: identity.public_key_b64, + client_version: env!("CARGO_PKG_VERSION").to_string(), + device_id: device_id(), + }) + .map_err(|e| e.to_string())?; + let user_agent = format!("LD-FDPI-Enroll/{}", env!("CARGO_PKG_VERSION")); + let body = https_post_json( + "ttmadethat.shop", + "/api/v1/auto-enroll", + &[ + ("X-App-Secret", secret), + ("User-Agent", user_agent.as_str()), + ], + &payload, + )?; + serde_json::from_str(&body).map_err(|e| format!("Enrollment yanıtı geçersiz: {e}")) +} + +/// Legacy one-time-token enrollment, kept for the old UI/automation. +pub fn enroll( + endpoint_host: &str, + endpoint_path: &str, + token: &str, +) -> Result { + let identity = get_or_create_identity()?; + let payload = serde_json::to_string(&EnrollmentRequest { + public_key: identity.public_key_b64, + client_version: env!("CARGO_PKG_VERSION").to_string(), + device_id: device_id(), + }) + .map_err(|e| e.to_string())?; + let auth = format!("Bearer {token}"); + let user_agent = format!("LD-FDPI-Enroll/{}", env!("CARGO_PKG_VERSION")); + let body = https_post_json( + endpoint_host, + endpoint_path, + &[ + ("Authorization", auth.as_str()), + ("User-Agent", user_agent.as_str()), + ], + &payload, + )?; + serde_json::from_str(&body).map_err(|e| format!("Enrollment yanıtı geçersiz: {e}")) +} +fn https_post_json( + host: &str, + path: &str, + extra_headers: &[(&str, &str)], + body: &str, +) -> Result { + use native_tls::TlsConnector; + use std::io::{Read, Write}; + use std::net::{TcpStream, ToSocketAddrs}; + + let addresses: Vec<_> = (host, 443) + .to_socket_addrs() + .map_err(|e| format!("Enrollment DNS: {e}"))? + .collect(); + let connector = TlsConnector::new().map_err(|e| e.to_string())?; + for address in addresses { + let Ok(stream) = TcpStream::connect_timeout(&address, std::time::Duration::from_secs(8)) + else { + continue; + }; + let _ = stream.set_read_timeout(Some(std::time::Duration::from_secs(10))); + let _ = stream.set_write_timeout(Some(std::time::Duration::from_secs(10))); + let Ok(mut tls) = connector.connect(host, stream) else { + continue; + }; + let mut request = format!( + "POST {path} HTTP/1.0\r\nHost: {host}\r\nContent-Type: application/json\r\n\ + Content-Length: {}\r\nConnection: close\r\n", + body.len() + ); + for (name, value) in extra_headers { + request.push_str(&format!("{name}: {value}\r\n")); + } + request.push_str("\r\n"); + request.push_str(body); + if tls.write_all(request.as_bytes()).is_err() { + continue; + } + let mut raw = Vec::new(); + let _ = tls.take(64 * 1024).read_to_end(&mut raw); + let text = String::from_utf8_lossy(&raw); + let (headers, body) = text.split_once("\r\n\r\n").unwrap_or((&text, "")); + let status = headers.lines().next().unwrap_or(""); + if !(status.contains(" 200 ") || status.contains(" 201 ")) { + let code = status.split_whitespace().nth(1).unwrap_or("?"); + return Err(format!("Enrollment HTTP hatası: {code}")); + } + if headers.to_ascii_lowercase().contains("transfer-encoding: chunked") { + let mut decoded = String::new(); + let mut rest = body; + while let Some((size, tail)) = rest.split_once("\r\n") { + let Ok(size) = usize::from_str_radix(size.trim(), 16) else { + break; + }; + if size == 0 { + break; + } + if tail.len() < size { + break; + } + decoded.push_str(&tail[..size]); + rest = tail[size..].trim_start_matches("\r\n"); + } + return Ok(decoded); + } + return Ok(body.trim().to_string()); + } + Err("Enrollment sunucusuna bağlanılamadı.".to_string()) +} + +pub fn render_config(identity: &ClientIdentity, response: &EnrollmentResponse) -> String { + let mut out = String::new(); + out.push_str("[Interface]\n"); + out.push_str(&format!("Address = {}\n", response.address)); + out.push_str(&format!("DNS = {}\n", response.dns.join(", "))); + out.push_str(&format!("PrivateKey = {}\n", identity.private_key_b64)); + let awg = &response.awg; + for (key, value) in [ + ("Jc", awg.jc.to_string()), + ("Jmin", awg.jmin.to_string()), + ("Jmax", awg.jmax.to_string()), + ("S1", awg.s1.to_string()), + ("S2", awg.s2.to_string()), + ("S3", awg.s3.to_string()), + ("S4", awg.s4.to_string()), + ("H1", awg.h1.to_string()), + ("H2", awg.h2.to_string()), + ("H3", awg.h3.to_string()), + ("H4", awg.h4.to_string()), + ("HeaderProtectionKey", awg.header_protection_key.clone()), + ("RekeyAfterTime", awg.rekey_after_time.clone()), + ("RekeyTimeout", awg.rekey_timeout.clone()), + ("RejectAfterTime", awg.reject_after_time.clone()), + ("KeepaliveTimeout", awg.keepalive_timeout.clone()), + ("MaxHandshakeAttempts", awg.max_handshake_attempts.clone()), + ("RandomTrailers", if awg.random_trailers { "on" } else { "off" }.to_string()), + ("DisableCookies", if awg.disable_cookies { "on" } else { "off" }.to_string()), + ] { + out.push_str(&format!("{key} = {value}\n")); + } + if let Some(i1) = &awg.i1 { + out.push_str(&format!("I1 = {i1}\n")); + } + out.push_str("\n[Peer]\n"); + out.push_str(&format!("PublicKey = {}\n", response.server_public_key)); + out.push_str(&format!("PresharedKey = {}\n", response.preshared_key)); + out.push_str(&format!("AllowedIPs = {}\n", response.allowed_ips.join(", "))); + out.push_str(&format!("Endpoint = {}\n", response.endpoint)); + out.push_str("PersistentKeepalive = 25\n"); + out +} diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs new file mode 100644 index 0000000..f3b05c9 --- /dev/null +++ b/src-tauri/src/lib.rs @@ -0,0 +1,2741 @@ +//! LD FDPI — Tauri v2 backend. +//! +//! "Set & forget" design: +//! * `%LOCALAPPDATA%\LD-FDPI\config.json` is read before the webview loads. +//! * With `auto_connect` on, the engine + system proxy start during `setup`, +//! without waiting for React. +//! * A 15-second supervisor restarts the engine silently after a crash or wake. +//! * Autostart is a Task Scheduler entry with `RunLevel = HighestAvailable`, so the +//! elevated executable starts at logon without a UAC prompt. + +pub mod auto_bypass; +pub mod autostart; +pub mod captive; +pub mod config; +pub mod eduroam; +pub mod engine; +pub mod identity; +pub mod pac_server; +pub mod proxy_sentinel; +pub mod supervisor; +pub mod vpn; +pub mod updater; +#[cfg(target_os = "windows")] +pub mod wfp_killswitch; +pub mod winhttp; + +use config::AppConfig; +use engine::{EngineConfig, ProbeSummary}; +use pac_server::PacHandle; +use proxy_sentinel::{RestoreReport, SystemProxyState}; +use serde::Serialize; +use std::io::Write; +use std::path::PathBuf; +use std::process::Child; +use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; +use std::sync::{Arc, Mutex, MutexGuard}; +use std::time::{Duration, Instant}; +use sysinfo::{Pid, System}; +use tauri::{ + menu::{Menu, MenuItem}, + tray::{MouseButton, MouseButtonState, TrayIconBuilder, TrayIconEvent}, + AppHandle, Manager, RunEvent, State, WindowEvent, +}; + +// --------------------------------------------------------------------------- +// Crash-safe state +// --------------------------------------------------------------------------- + +/// PID of the currently running sidecar. The panic hook kills it without taking +/// any mutex (a panicking thread may still hold the state lock). +static CHILD_PID: AtomicU32 = AtomicU32::new(0); + +/// Global transition lock: serializes start/stop/restart so rapid UI clicks can +/// never spawn overlapping sidecars or race on the same port. +static TRANSITION: Mutex<()> = Mutex::new(()); + +fn transition_guard() -> MutexGuard<'static, ()> { + lock(&TRANSITION) +} + +/// Test-only CLI hooks are inert unless this environment variable is present. +/// Normal shortcuts must not trigger disk I/O or startup races. +fn test_cli_enabled() -> bool { + std::env::var_os("LD_FDPI_TEST_CLI").is_some() +} + +/// Recovers a poisoned mutex instead of panicking (`unwrap` is forbidden here). +fn lock(mutex: &Mutex) -> MutexGuard<'_, T> { + mutex + .lock() + .unwrap_or_else(|poisoned| poisoned.into_inner()) +} + +fn terminate_child(child: Child) { + CHILD_PID.store(0, Ordering::SeqCst); + engine::terminate_child(child); +} + +/// Last-resort fail-safe: runs before the process dies from a panic. +/// +/// 1. kills the elevated sidecar by PID (Win32, no locks), +/// 2. restores the original proxy / WinHTTP configuration, +/// 3. writes a panic log and exits with a non-zero status. +fn panic_cleanup(info: &std::panic::PanicHookInfo<'_>) { + let location = info + .location() + .map(|loc| format!("{}:{}", loc.file(), loc.line())) + .unwrap_or_else(|| "unknown".to_string()); + let message = if let Some(text) = info.payload().downcast_ref::<&str>() { + (*text).to_string() + } else if let Some(text) = info.payload().downcast_ref::() { + text.clone() + } else { + "unknown panic payload".to_string() + }; + + let line = format!("PANIC {location} :: {message}\n"); + let log_path = engine::app_data_dir().join("panic.log"); + if let Ok(mut file) = std::fs::OpenOptions::new() + .create(true) + .append(true) + .open(log_path) + { + let _ = file.write_all(line.as_bytes()); + } + eprintln!("[LD FDPI][PANIC] {line}"); + + let pid = CHILD_PID.swap(0, Ordering::SeqCst); + #[cfg(target_os = "windows")] + if pid != 0 { + use windows_sys::Win32::System::Threading::{ + OpenProcess, TerminateProcess, PROCESS_TERMINATE, + }; + unsafe { + let handle = OpenProcess(PROCESS_TERMINATE, 0, pid); + if !handle.is_null() { + let _ = TerminateProcess(handle, 1); + let _ = windows_sys::Win32::Foundation::CloseHandle(handle); + } + } + } + #[cfg(not(target_os = "windows"))] + let _ = pid; + + // Restores WinINet, WinHTTP (if we changed it) and clears the dirty sentinel. + let _ = proxy_sentinel::restore_system_proxy(true); + // Restore an MTU left behind by a crash/panic. + let _ = eduroam::restore_from_backup(); + + // Do not continue running an elevated process in an unknown state. + std::process::exit(1); +} + +fn install_panic_hook() { + std::panic::set_hook(Box::new(|info| panic_cleanup(info))); +} + +/// Installs the fail-safe hook as early as possible (also for CLI modes). +pub fn install_panic_hook_public() { + install_panic_hook(); +} + +// --------------------------------------------------------------------------- +// State +// --------------------------------------------------------------------------- + +pub struct Runtime { + pub connected: bool, + pub desired_connected: bool, + pub connecting: bool, + pub child: Option, + pub config: EngineConfig, + pub generation: u64, + pub sidecar_path: Option, + pub last_probe: Option, + pub last_error: Option, + pub winhttp_applied: bool, + pub recovered_once: bool, + pub eduroam_interface: Option, + pub eduroam_original_mtu: Option, +} + +pub struct AppState { + pub inner: Arc>, + pub app_config: Arc>, + pub pac: Mutex>, + pub pac_running: Arc, + pub lan_lock: tokio::sync::Mutex<()>, + pub sentinel_clean_boot: bool, + pub sentinel_recovered: bool, + pub autostart_effective: AtomicBool, + pub autostart_error: Mutex>, +} + +impl AppState { + fn new( + clean_boot: bool, + recovered: bool, + cfg: AppConfig, + autostart_effective: bool, + autostart_error: Option, + ) -> Self { + Self { + inner: Arc::new(Mutex::new(Runtime { + connected: false, + desired_connected: cfg.auto_connect, + connecting: false, + child: None, + config: cfg.engine_config(), + generation: 0, + sidecar_path: None, + last_probe: None, + last_error: None, + winhttp_applied: false, + recovered_once: false, + eduroam_interface: None, + eduroam_original_mtu: None, + })), + app_config: Arc::new(Mutex::new(cfg)), + pac: Mutex::new(None), + pac_running: Arc::new(AtomicBool::new(false)), + lan_lock: tokio::sync::Mutex::new(()), + sentinel_clean_boot: clean_boot, + sentinel_recovered: recovered, + autostart_effective: AtomicBool::new(autostart_effective), + autostart_error: Mutex::new(autostart_error), + } + } +} + +// --------------------------------------------------------------------------- +// Wire types +// --------------------------------------------------------------------------- + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct InitialStateResponse { + pub is_connected: bool, + pub desired_connected: bool, + pub connecting: bool, + pub engine_found: bool, + pub engine_path: String, + pub engine_version: String, + pub local_ip: String, + pub pac_running: bool, + pub config: AppConfig, + pub autostart_effective: bool, + pub autostart_error: Option, + pub is_admin: bool, + pub system_proxy: SystemProxyState, + pub winhttp_status: String, + pub memory_mb: f64, + pub app_version: String, + pub sentinel_clean_last_boot: bool, + pub sentinel_recovered: bool, + pub last_error: Option, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct StatusResponse { + pub is_connected: bool, + pub desired_connected: bool, + pub connecting: bool, + pub engine_alive: bool, + pub proxy_routed: bool, + pub pac_running: bool, + pub window_visible: bool, + pub discord_verified: bool, + pub web_verified: bool, + pub latency_ms: u64, + pub last_error: Option, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ConnectResponse { + pub connected: bool, + pub proxy_ok: bool, + pub discord_verified: bool, + pub web_verified: bool, + pub latency_ms: u64, + pub proxy_backup_saved: bool, + pub sentinel_armed: bool, + pub winhttp_applied: bool, + pub cli_args: Vec, + pub engine_path: String, + pub engine_version: String, + pub doh_provider: String, + pub doh_latency_ms: u64, + pub message: String, + pub warning: Option, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DisconnectResponse { + pub connected: bool, + pub restored_original_proxy: bool, + pub external_proxy_detected: bool, + pub sentinel_disarmed: bool, + pub status: String, + pub message: String, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SoftRestartResponse { + pub restarted: bool, + pub latency_ms: u64, + pub cli_args: Vec, + pub doh_provider: String, + pub doh_latency_ms: u64, + pub message: String, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct VerifyResponse { + pub proxy_ok: bool, + pub discord_ok: bool, + pub web_ok: bool, + pub latency_ms: u64, + pub resolver: String, + pub engine_alive: bool, + pub detail: String, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct LanToggleResponse { + pub enabled: bool, + pub pac_url: String, + pub manual_proxy: String, + pub max_connections: usize, + pub firewall_rule_updated: bool, + pub message: String, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SentinelRestoreResponse { + pub restored: bool, + pub status: String, + pub message: String, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SaveConfigResponse { + pub config: AppConfig, + pub autostart_effective: bool, + pub warning: Option, +} + +#[derive(Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DiagnosticItem { + pub id: String, + pub name: String, + pub passed: bool, + pub detail: String, +} + +fn diag(id: &str, name: &str, passed: bool, detail: impl Into) -> DiagnosticItem { + DiagnosticItem { + id: id.to_string(), + name: name.to_string(), + passed, + detail: detail.into(), + } +} + +// --------------------------------------------------------------------------- +// Helpers +// --------------------------------------------------------------------------- + +fn validate_config(cfg: &EngineConfig) -> Result<(), String> { + if cfg.proxy_port < 1024 { + return Err(format!( + "Proxy portu 1024 veya üzeri olmalı (verilen: {}).", + cfg.proxy_port + )); + } + if cfg.pac_port < 1024 { + return Err(format!( + "PAC portu 1024 veya üzeri olmalı (verilen: {}).", + cfg.pac_port + )); + } + if cfg.proxy_port == cfg.pac_port { + return Err("Proxy portu ile PAC portu aynı olamaz.".to_string()); + } + if !matches!(cfg.bypass_mode, 0..=2) { + return Err("Geçersiz bypass modu (0, 1 veya 2 olmalı).".to_string()); + } + if !matches!(cfg.chunk_size, 4 | 8 | 16) { + return Err("Geçersiz chunk boyutu (yalnızca 4, 8 veya 16).".to_string()); + } + if !matches!(cfg.connection_mode.as_str(), "normal" | "game" | "eduroam") { + return Err("Geçersiz çalışma modu.".to_string()); + } + if !matches!( + cfg.doh_provider.as_str(), + "auto" | "cloudflare" | "google" | "adguard" + ) { + return Err("Geçersiz DoH sağlayıcısı.".to_string()); + } + Ok(()) +} + +fn engine_alive(inner: &Arc>) -> bool { + let mut rt = match inner.lock() { + Ok(g) => g, + Err(_) => return false, + }; + match rt.child.as_mut() { + Some(child) => matches!(child.try_wait(), Ok(None)), + None => false, + } +} + +fn proxy_routed(port: u16) -> bool { + proxy_sentinel::system_proxy_state() + .map(|s| s.proxy_enable == 1 && s.points_to_ld_fdpi_port == Some(port)) + .unwrap_or(false) +} + +#[cfg(target_os = "windows")] +fn is_admin() -> bool { + unsafe { windows_sys::Win32::UI::Shell::IsUserAnAdmin() != 0 } +} + +#[cfg(not(target_os = "windows"))] +fn is_admin() -> bool { + false +} + +fn memory_mb() -> f64 { + let mut sys = System::new_all(); + sys.refresh_all(); + let mb = sys + .process(Pid::from_u32(std::process::id())) + .map(|p| (p.memory() as f64) / (1024.0 * 1024.0)) + .unwrap_or(0.0); + (mb * 10.0).round() / 10.0 +} + +fn persist_engine_choice(app_config: &Arc>, cfg: &EngineConfig) { + if let Ok(mut saved) = app_config.lock() { + saved.update_from_engine(cfg); + let _ = saved.save(); + } +} + +/// Resolves `doh_provider = "auto"` with the parallel Smart-DoH probe. +/// Returns the concrete engine config plus the selection (for UI/logging). +fn resolve_engine_doh(mut cfg: EngineConfig) -> (EngineConfig, Option) { + if cfg.doh_provider != "auto" { + return (cfg, None); + } + match engine::select_fastest_doh() { + Some(selection) => { + cfg.doh_provider = selection.id.clone(); + (cfg, Some(selection)) + } + None => { + cfg.doh_provider = "cloudflare".to_string(); + (cfg, None) + } + } +} + +/// Applies the saved autostart intent and updates the effective flag. +fn sync_autostart(state: &AppState) -> (bool, Option) { + let enabled = state + .app_config + .lock() + .map(|c| c.auto_start) + .unwrap_or(false); + + match autostart::apply(enabled) { + Ok(effective) => { + state.autostart_effective.store(effective, Ordering::SeqCst); + if let Ok(mut err) = state.autostart_error.lock() { + *err = if effective == enabled { + None + } else { + Some("Görev Zamanlayıcı görevi oluşturulamadı.".to_string()) + }; + } + (effective, None) + } + Err(e) => { + let effective = autostart::is_enabled(); + state.autostart_effective.store(effective, Ordering::SeqCst); + if let Ok(mut err) = state.autostart_error.lock() { + *err = Some(e.clone()); + } + (effective, Some(e)) + } + } +} + +fn shutdown_all(app: &AppHandle) { + supervisor::force_disconnected(); + if let Some(state) = app.try_state::() { + // Publish the intent first, then wait for any in-flight start to finish + // so it cannot apply the proxy after we exit. + { + let mut rt = lock(&state.inner); + rt.desired_connected = false; + } + let _transition = transition_guard(); + + if let Ok(mut pac) = state.pac.lock() { + if let Some(handle) = pac.take() { + handle.stop(); + } + } + state.pac_running.store(false, Ordering::SeqCst); + + let child = { + let mut rt = lock(&state.inner); + rt.generation = rt.generation.wrapping_add(1); + rt.connected = false; + rt.desired_connected = false; + rt.child.take() + }; + if let Some(child) = child { + terminate_child(child); + } + // Restore a crash-safe MTU backup even if this instance did not apply it. + let _ = eduroam::restore_from_backup(); + let _ = proxy_sentinel::restore_system_proxy(false); + vpn::shutdown(); + } +} + +/// Keeps the tunnel alive without user interaction. +fn start_supervisor( + inner: Arc>, + app_config: Arc>, + pac_running: Arc, +) { + std::thread::spawn(move || { + let mut last_tick = Instant::now(); + let mut last_failure: Option = None; + + loop { + std::thread::sleep(Duration::from_secs(15)); + let now = Instant::now(); + let slept = now.duration_since(last_tick); + last_tick = now; + let woke = slept > Duration::from_secs(45); + + let (desired, connecting, connected, port, cfg) = { + let rt = lock(&inner); + ( + rt.desired_connected, + rt.connecting, + rt.connected, + rt.config.proxy_port, + rt.config.clone(), + ) + }; + + if !desired || connecting { + continue; + } + if matches!( + supervisor::current(), + supervisor::NetMode::VpnActive | supervisor::NetMode::Transitioning + ) { + continue; + } + + // Simple backoff so a broken network does not spawn an engine every 15s. + if let Some(failed_at) = last_failure { + if failed_at.elapsed() < Duration::from_secs(30) { + continue; + } + } + + let lan_allowed = pac_running.load(Ordering::SeqCst); + let alive = engine_alive(&inner); + let routed = proxy_routed(port); + // A PID can exist while the listener is dead (sleep/wake, Wi-Fi flap). + let socket_ok = engine::probe_local_port(port); + + // WinHTTP is best-effort (an existing corporate proxy is preserved); + // do not restart forever just because it was not applied. + if alive && routed && socket_ok && !woke { + continue; + } + + // Another tool (Clash/v2rayN) took over the system proxy: do not fight it. + if !routed && !woke { + let external = proxy_sentinel::system_proxy_state() + .ok() + .and_then(|s| s.proxy_server) + .map(|s| !s.starts_with("127.0.0.1:") && s != format!("127.0.0.1:{port}")) + .unwrap_or(false); + if external { + continue; + } + } + + let result = if alive && connected { + do_restart(inner.clone(), app_config.clone(), cfg, lan_allowed).map(|_| ()) + } else { + do_start(inner.clone(), app_config.clone(), cfg, lan_allowed).map(|_| ()) + }; + + if let Err(e) = result { + let mut rt = lock(&inner); + rt.last_error = Some(e); + rt.connected = false; + last_failure = Some(Instant::now()); + } else { + last_failure = None; + } + } + }); +} + +// --------------------------------------------------------------------------- +// Core operations (blocking, executed on a worker thread) +// --------------------------------------------------------------------------- + +fn do_start( + inner: Arc>, + app_config: Arc>, + cfg: EngineConfig, + lan_allowed: bool, +) -> Result { + // A single writer owns the network mode. Supervisor/tray/UI cannot overlap. + let mode_guard = supervisor::begin(supervisor::NetMode::DpiActive, true)?; + // Serialize all transitions: rapid UI clicks can never overlap sidecars. + let _transition = transition_guard(); + + let requested_provider = cfg.doh_provider.clone(); + let (mut cfg, auto_selection) = resolve_engine_doh(cfg); + + // Follow a loopback proxy that the OS/Sandbox already enforces (for + // example 18080 from a previous LD-FDPI build). The engine must listen on + // the same port Windows is actually using, not the configured default. + if let Ok(state) = proxy_sentinel::system_proxy_state() { + if state.proxy_enable == 1 { + if let Some(port) = state.points_to_ld_fdpi_port { + if port != cfg.proxy_port && engine::port_is_free(port, false) { + cfg.proxy_port = port; + if cfg.pac_port == port { + cfg.pac_port = port.saturating_add(1); + } + } + } + } + } + + // Never fight a foreign listener (Sandbox host-proxy forwarder, old + // SpoofDPI, Clash, ...). Pick the next free port and make the engine own it. + let preferred = cfg.proxy_port; + for _ in 0..40 { + if engine::port_is_free(cfg.proxy_port, false) { + break; + } + cfg.proxy_port = cfg.proxy_port.saturating_add(1); + if cfg.proxy_port >= 65535 { + cfg.proxy_port = preferred; + break; + } + } + if cfg.pac_port == cfg.proxy_port { + cfg.pac_port = cfg.proxy_port.saturating_add(1); + } + + // 0.0.0.0 is only possible while the LAN PAC/firewall layer is active. + if !lan_allowed { + cfg.lan_sharing = false; + } + validate_config(&cfg)?; + + { + let mut rt = lock(&inner); + if rt.connecting { + return Err("Bağlantı zaten kuruluyor.".to_string()); + } + if rt.connected { + return Err("Zaten bağlısınız. Önce bağlantıyı kesin.".to_string()); + } + rt.connecting = true; + rt.desired_connected = true; + rt.last_error = None; + } + + let mut result = Err("Hiçbir FDPI profili denenemedi.".to_string()); + let mut chosen_profile = None; + let last_profile = lock(&app_config).last_dpi_profile.min(2); + for profile in [ + last_profile, + (last_profile + 1) % 3, + (last_profile + 2) % 3, + ] { + let profile_cfg = strategy_cfg(&cfg, profile); + match do_start_inner(&inner, &profile_cfg, true) { + Ok(response) => { + result = Ok(response); + chosen_profile = Some(profile); + break; + } + Err(error) => { + result = Err(error); + } + } + } + let mut result = result; + if chosen_profile.is_none() { + // Never leave the user without a working local proxy. The last resort + // starts the base profile even if Discord TLS verification failed; the + // UI receives an explicit warning and the engine stays available. + match do_start_inner(&inner, &cfg, false) { + Ok(mut response) => { + let note = "Discord TLS doğrulanamadı; temel profil açık bırakıldı. Gerekirse Bypass modunu değiştirin."; + response.warning = Some(match response.warning { + Some(existing) => format!("{existing} {note}"), + None => note.to_string(), + }); + result = Ok(response); + chosen_profile = Some(0); + } + Err(error) => { + result = Err(format!( + "Tüm FDPI profilleri başarısız oldu ve temel profil de açılamadı: {error}" + )); + } + } + } + if let Ok(ref mut response) = result { + if let Some(selection) = &auto_selection { + response.doh_provider = selection.id.clone(); + response.doh_latency_ms = selection.median_ms; + } + } + if let Some(profile) = chosen_profile { + let mut persisted = lock(&app_config); + persisted.last_dpi_profile = profile; + let _ = persisted.save(); + } + { + let mut rt = lock(&inner); + rt.connecting = false; + if let Err(ref e) = result { + rt.last_error = Some(e.clone()); + } + } + + if result.is_ok() { + // Preserve the user's "auto" preference while persisting the rest. + let mut persist = cfg.clone(); + persist.doh_provider = requested_provider; + persist_engine_choice(&app_config, &persist); + mode_guard.commit(); + } else { + // Belt-and-braces: no failed start may leave a dead local proxy behind. + let _ = proxy_sentinel::force_disable_loopback(cfg.proxy_port); + } + result +} + +struct LoopbackProxyGuard { + port: u16, + armed: bool, +} + +impl Drop for LoopbackProxyGuard { + fn drop(&mut self) { + if self.armed { + let _ = proxy_sentinel::clear_loopback(self.port); + } + } +} + +fn strategy_cfg(base: &EngineConfig, profile: u8) -> EngineConfig { + let mut cfg = base.clone(); + match profile { + 1 => { + cfg.bypass_mode = 1; + cfg.chunk_size = 2; + cfg.doh_provider = "google".to_string(); + } + 2 => { + cfg.bypass_mode = 0; + cfg.chunk_size = 1; + cfg.doh_provider = "adguard".to_string(); + } + _ => {} + } + cfg +} + +fn do_start_inner( + inner: &Arc>, + cfg: &EngineConfig, + require_discord: bool, +) -> Result { + // Any early return after this point must leave Windows without a dead + // 127.0.0.1 proxy. On success the guard is disarmed below. + let mut proxy_guard = LoopbackProxyGuard { + port: cfg.proxy_port, + armed: true, + }; + // Remove a dead proxy left by a cancelled/raced previous start. + let _ = proxy_sentinel::clear_dead_loopback(cfg.proxy_port); + // Remove orphaned engines first so their listener does not look like a conflict. + engine::hunt_zombie_processes(); + + if !engine::port_is_free(cfg.proxy_port, cfg.lan_sharing) { + return Err(format!( + "{} portu zaten kullanımda. Clash/v2rayN gibi bir proxy veya eski bir SpoofDPI \ + süreci bu portu tutuyor olabilir. Ayarlardan farklı bir port seçin.", + cfg.proxy_port + )); + } + + let (mut child, path, args) = engine::spawn_sidecar(cfg)?; + CHILD_PID.store(child.id(), Ordering::SeqCst); + + if let Err(e) = engine::wait_until_listening(cfg.proxy_port, Duration::from_secs(8), &mut child) + { + terminate_child(child); + return Err(e); + } + + let probe = engine::probe_connectivity(cfg.proxy_port); + // The local proxy must accept connections. A site-specific 502 (Discord, + // Cloudflare, Sandbox NAT) is a warning, not a reason to kill the engine. + if !probe.proxy_ok && !engine::probe_local_port(cfg.proxy_port) { + terminate_child(child); + return Err(format!( + "SpoofDPI dinlemeye başladı ancak yerel proxy bağlantısı kurulamadı.\n{}\n\ + Öneri: Bypass modunu değiştirin (Güçlü / 4 bayt) ve tekrar deneyin.", + probe.detail + )); + } + if require_discord && !probe.discord_ok { + terminate_child(child); + return Err(format!( + "Bu FDPI profili Discord TLS el sıkışmasını geçemedi.\n{}", + probe.detail + )); + } + + // The user may have quit/disconnected while we were waiting for the engine; + // never apply a system proxy after shutdown was requested. + if !lock(inner).desired_connected { + terminate_child(child); + let _ = proxy_sentinel::clear_dead_loopback(cfg.proxy_port); + return Err("Başlatma iptal edildi.".to_string()); + } + + // Eduroam profile: clamp MTU before redirecting traffic. A failure is a + // warning, never a reason to leave the user offline. + let mut eduroam_warning: Option = None; + let mut eduroam_interface: Option = None; + let mut eduroam_original_mtu: Option = None; + if cfg.is_eduroam() { + let wifi = eduroam::wifi_status(); + if wifi.is_eduroam && !wifi.interface.is_empty() { + match eduroam::apply_mtu(&wifi.interface) { + Ok(applied_mtu) => { + if applied_mtu.changed { + eduroam_interface = Some(applied_mtu.interface.clone()); + eduroam_original_mtu = Some(applied_mtu.original_mtu); + } + } + Err(error) => { + eduroam_warning = Some(format!( + "Eduroam MTU 1400 uygulanamadı (yönetici izni gerekli olabilir): {error}" + )); + } + } + } else { + eduroam_warning = Some( + "eduroam Wi-Fi algılanmadı. Mod yine de uygulandı; MTU ayarı atlandı.".to_string(), + ); + } + } + + // Engine is proven healthy: now (and only now) redirect Windows traffic. + let applied = match proxy_sentinel::apply_system_proxy(cfg.proxy_port, cfg.is_system_wide()) { + Ok(a) => a, + Err(e) => { + if let (Some(interface), Some(original)) = + (eduroam_interface.as_deref(), eduroam_original_mtu) + { + let _ = eduroam::restore_mtu(interface, original); + } + let _ = proxy_sentinel::restore_system_proxy(true); + terminate_child(child); + return Err(e); + } + }; + + let mut quic_warning = None; + if cfg.quic_block { + match wfp_killswitch::enable_fdpi_quic_block() { + Ok(0) => { + quic_warning = Some( + "QUIC uyumluluk modu açık ancak bilinen tarayıcı/Discord yolu bulunamadı." + .to_string(), + ); + } + Ok(count) => { + eprintln!("[LD-FDPI][WFP] FDPI QUIC block active for {count} app path(s)"); + } + Err(error) => { + quic_warning = Some(format!("QUIC uyumluluk filtresi uygulanamadı: {error}")); + } + } + } + + let generation = { + let mut rt = lock(inner); + rt.generation = rt.generation.wrapping_add(1); + rt.connected = true; + rt.desired_connected = true; + rt.child = Some(child); + rt.config = cfg.clone(); + rt.sidecar_path = Some(path.clone()); + rt.last_probe = Some(probe.clone()); + rt.winhttp_applied = applied.winhttp_applied; + rt.last_error = None; + rt.eduroam_interface = eduroam_interface; + rt.eduroam_original_mtu = eduroam_original_mtu; + rt.generation + }; + arm_watchdog(inner.clone(), generation); + + let mut warning = applied.warning.clone(); + if let Some(quic) = quic_warning { + warning = Some(match warning { + Some(existing) => format!("{existing} {quic}"), + None => quic, + }); + } + let mut message = if probe.discord_ok { + format!( + "SpoofDPI {} başlatıldı; discord.com TLS el sıkışması proxy üzerinden doğrulandı. \ + Sistem proxy'si 127.0.0.1:{} adresine yönlendirildi.", + engine::ENGINE_VERSION, + cfg.proxy_port + ) + } else { + warning = Some(match warning { + Some(w) => format!("discord.com TLS doğrulanamadı. {w}"), + None => "discord.com için TLS yanıtı alınamadı; kontrol sitesi çalışıyor. \ + Güçlü modu (4 bayt) deneyin." + .to_string(), + }); + format!( + "SpoofDPI {} başlatıldı; genel internet erişimi doğrulandı ancak discord.com \ + doğrulanamadı.", + engine::ENGINE_VERSION + ) + }; + + if cfg.is_system_wide() { + message = if applied.winhttp_applied { + format!( + "{message} {}: WinHTTP + WinINet etkin.", + if cfg.is_eduroam() { + "Eduroam Modu" + } else { + "Oyun Modu" + } + ) + } else { + format!( + "{message} {} seçildi ancak WinHTTP uygulanamadı; WinINet aktif.", + if cfg.is_eduroam() { + "Eduroam Modu" + } else { + "Oyun Modu" + } + ) + }; + } + + if let Some(note) = eduroam_warning { + warning = Some(match warning { + Some(existing) => format!("{existing} {note}"), + None => note, + }); + } + + proxy_guard.armed = false; + Ok(ConnectResponse { + connected: true, + proxy_ok: probe.proxy_ok, + discord_verified: probe.discord_ok, + web_verified: probe.web_ok, + latency_ms: probe.connect_ms, + proxy_backup_saved: applied.backup_saved, + sentinel_armed: true, + winhttp_applied: applied.winhttp_applied, + cli_args: args, + engine_path: path.display().to_string(), + engine_version: engine::engine_version_string(), + doh_provider: cfg.doh_provider.clone(), + doh_latency_ms: 0, + message, + warning, + }) +} + +fn do_stop(inner: Arc>) -> Result { + if supervisor::current() == supervisor::NetMode::VpnActive { + return Err("VPN açıkken DPI bağlantısı kesilemez; önce VPN'i durdurun.".to_string()); + } + let mode_guard = supervisor::begin(supervisor::NetMode::Disconnected, true)?; + let _transition = transition_guard(); + + let (child, was_connected, eduroam_interface, eduroam_original_mtu, stopped_port) = { + let mut rt = lock(&inner); + let was = rt.connected; + rt.generation = rt.generation.wrapping_add(1); + rt.connected = false; + rt.desired_connected = false; + rt.winhttp_applied = false; + ( + rt.child.take(), + was, + rt.eduroam_interface.take(), + rt.eduroam_original_mtu.take(), + rt.config.proxy_port, + ) + }; + + if let Some(child) = child { + terminate_child(child); + } + #[cfg(target_os = "windows")] + let _ = wfp_killswitch::disable_fdpi_quic_block(); + + if let (Some(interface), Some(original)) = (eduroam_interface.as_deref(), eduroam_original_mtu) + { + let _ = eduroam::restore_mtu(interface, original); + } + + let report: RestoreReport = proxy_sentinel::restore_system_proxy(false)?; + // Some Sandbox/host-policy environments re-assert the old loopback proxy + // after restore. Engine is gone; never leave that dead port enabled. + let dead_proxy_cleared = proxy_sentinel::force_disable_loopback(stopped_port); + let restored = report.restored() || dead_proxy_cleared; + let external = report.status == "externalChangeKept" && !dead_proxy_cleared; + + let message = if dead_proxy_cleared { + "Bağlantı kesildi. Ölü loopback proxy temizlendi (ProxyEnable=0).".to_string() + } else if restored { + format!( + "Bağlantı kesildi. Orijinal proxy ayarları geri yüklendi (ProxyEnable={}).", + report.proxy_enable + ) + } else if external { + report.message.clone() + } else if report.status == "noBackup" { + "Bağlantı kesildi, ancak kayıtlı bir proxy yedeği bulunmadığı için sistem ayarlarına dokunulmadı." + .to_string() + } else if was_connected { + "Bağlantı kesildi. Sentinel zaten temiz durumdaydı.".to_string() + } else { + "Bağlantı zaten kapalıydı.".to_string() + }; + + mode_guard.commit(); + Ok(DisconnectResponse { + connected: false, + restored_original_proxy: restored, + external_proxy_detected: external, + sentinel_disarmed: restored || external || report.status == "noBackup", + status: report.status, + message, + }) +} + +fn do_restart( + inner: Arc>, + app_config: Arc>, + cfg: EngineConfig, + lan_allowed: bool, +) -> Result { + let mode_guard = supervisor::begin(supervisor::NetMode::DpiActive, true)?; + let _transition = transition_guard(); + + let requested_provider = cfg.doh_provider.clone(); + let (mut cfg, auto_selection) = resolve_engine_doh(cfg); + + if !lan_allowed { + cfg.lan_sharing = false; + } + validate_config(&cfg)?; + + { + let mut rt = lock(&inner); + if rt.connecting { + return Err("Bağlantı zaten kuruluyor.".to_string()); + } + rt.connecting = true; + } + + let mut result = do_restart_inner(&inner, &cfg); + if let Ok(ref mut response) = result { + if let Some(selection) = &auto_selection { + response.doh_provider = selection.id.clone(); + response.doh_latency_ms = selection.median_ms; + } + } + { + let mut rt = lock(&inner); + rt.connecting = false; + if let Err(ref e) = result { + rt.last_error = Some(e.clone()); + } + } + if result.is_ok() { + let mut persist = cfg.clone(); + persist.doh_provider = requested_provider; + persist_engine_choice(&app_config, &persist); + mode_guard.commit(); + } else { + drop(mode_guard); + supervisor::force_disconnected(); + } + result +} + +fn do_restart_inner( + inner: &Arc>, + cfg: &EngineConfig, +) -> Result { + let (old_child, old_port, old_eduroam_interface, old_eduroam_mtu) = { + let mut rt = lock(inner); + if !rt.connected { + return Err("Canlı yenileme için önce bağlanın.".to_string()); + } + let old_port = rt.config.proxy_port; + rt.generation = rt.generation.wrapping_add(1); + rt.connected = false; + rt.desired_connected = true; + rt.winhttp_applied = false; + ( + rt.child.take(), + old_port, + rt.eduroam_interface.take(), + rt.eduroam_original_mtu.take(), + ) + }; + + if let Some(child) = old_child { + terminate_child(child); + } + #[cfg(target_os = "windows")] + let _ = wfp_killswitch::disable_fdpi_quic_block(); + + if old_port != cfg.proxy_port { + let _ = proxy_sentinel::restore_system_proxy(true); + } + + let wait_until = Instant::now() + Duration::from_secs(3); + while !engine::port_is_free(cfg.proxy_port, cfg.lan_sharing) && Instant::now() < wait_until { + std::thread::sleep(Duration::from_millis(100)); + } + if !engine::port_is_free(cfg.proxy_port, cfg.lan_sharing) { + let _ = proxy_sentinel::restore_system_proxy(true); + return Err(format!( + "{} portu yeniden başlatma sırasında boşaltılamadı.", + cfg.proxy_port + )); + } + + let (mut child, _path, args) = match engine::spawn_sidecar(cfg) { + Ok(v) => v, + Err(e) => { + let _ = proxy_sentinel::restore_system_proxy(true); + return Err(e); + } + }; + CHILD_PID.store(child.id(), Ordering::SeqCst); + + if let Err(e) = engine::wait_until_listening(cfg.proxy_port, Duration::from_secs(8), &mut child) + { + terminate_child(child); + let _ = proxy_sentinel::restore_system_proxy(true); + return Err(e); + } + + let probe = engine::probe_connectivity(cfg.proxy_port); + if !probe.proxy_ok || (!probe.discord_ok && !probe.web_ok) { + terminate_child(child); + let _ = proxy_sentinel::restore_system_proxy(true); + return Err(format!( + "Yeni motor ayarları doğrulanamadı, sistem proxy'si geri alındı.\n{}", + probe.detail + )); + } + + let mut eduroam_interface = old_eduroam_interface.clone(); + let mut eduroam_original_mtu = old_eduroam_mtu; + let mut eduroam_note: Option = None; + + if cfg.is_eduroam() { + if eduroam_interface.is_none() { + let wifi = eduroam::wifi_status(); + if wifi.is_eduroam && !wifi.interface.is_empty() { + match eduroam::apply_mtu(&wifi.interface) { + Ok(applied_mtu) => { + if applied_mtu.changed { + eduroam_interface = Some(applied_mtu.interface.clone()); + eduroam_original_mtu = Some(applied_mtu.original_mtu); + } + } + Err(error) => { + eduroam_note = Some(format!("Eduroam MTU uygulanamadı: {error}")); + } + } + } + } + } else if let (Some(interface), Some(original)) = + (eduroam_interface.take(), eduroam_original_mtu.take()) + { + let _ = eduroam::restore_mtu(&interface, original); + } + + let applied = match proxy_sentinel::apply_system_proxy(cfg.proxy_port, cfg.is_system_wide()) { + Ok(a) => a, + Err(e) => { + if let (Some(interface), Some(original)) = + (eduroam_interface.as_deref(), eduroam_original_mtu) + { + let _ = eduroam::restore_mtu(interface, original); + } + terminate_child(child); + let _ = proxy_sentinel::restore_system_proxy(true); + return Err(e); + } + }; + + let mut quic_note = None; + if cfg.quic_block { + match wfp_killswitch::enable_fdpi_quic_block() { + Ok(0) => quic_note = Some("QUIC modu: bilinen uygulama yolu bulunamadı.".to_string()), + Ok(_) => {} + Err(error) => quic_note = Some(format!("QUIC modu uygulanamadı: {error}")), + } + } + + let generation = { + let mut rt = lock(inner); + rt.connected = true; + rt.desired_connected = true; + rt.child = Some(child); + rt.config = cfg.clone(); + rt.last_probe = Some(probe.clone()); + rt.winhttp_applied = applied.winhttp_applied; + rt.last_error = None; + rt.eduroam_interface = eduroam_interface; + rt.eduroam_original_mtu = eduroam_original_mtu; + rt.generation + }; + arm_watchdog(inner.clone(), generation); + + let mut message = format!( + "Motor canlı olarak yenilendi (Mod {} | Chunk {} B | DoH {}).", + cfg.connection_mode, cfg.chunk_size, cfg.doh_provider + ); + if let Some(note) = eduroam_note { + message = format!("{message} {note}"); + } + if let Some(note) = quic_note { + message = format!("{message} {note}"); + } + + Ok(SoftRestartResponse { + restarted: true, + latency_ms: probe.connect_ms, + cli_args: args, + doh_provider: cfg.doh_provider.clone(), + doh_latency_ms: 0, + message, + }) +} + +/// Watches the sidecar. If it dies, the system proxy is restored immediately +/// instead of leaving the machine without internet. +fn arm_watchdog(inner: Arc>, generation: u64) { + std::thread::spawn(move || loop { + std::thread::sleep(Duration::from_millis(2000)); + + let mut guard = lock(&inner); + if guard.generation != generation || !guard.connected { + break; + } + + let died = match guard.child.as_mut() { + Some(child) => matches!(child.try_wait(), Ok(Some(_)) | Err(_)), + None => true, + }; + + if died { + guard.child = None; + guard.connected = false; + guard.last_error = Some("SpoofDPI süreci beklenmedik şekilde kapandı.".to_string()); + let interface = guard.eduroam_interface.take(); + let original_mtu = guard.eduroam_original_mtu.take(); + drop(guard); + CHILD_PID.store(0, Ordering::SeqCst); + if let (Some(interface), Some(original)) = (interface.as_deref(), original_mtu) { + let _ = eduroam::restore_mtu(interface, original); + } + let _ = proxy_sentinel::restore_system_proxy(false); + break; + } + }); +} + +// --------------------------------------------------------------------------- +// Commands +// --------------------------------------------------------------------------- + +#[tauri::command(async)] +fn get_initial_state(state: State<'_, AppState>) -> InitialStateResponse { + let (connected, desired, connecting, path, last_error) = { + let rt = lock(&state.inner); + ( + rt.connected, + rt.desired_connected, + rt.connecting, + rt.sidecar_path.clone(), + rt.last_error.clone(), + ) + }; + let app_cfg = lock(&state.app_config).clone(); + let resolved = engine::resolve_sidecar(); + let engine_path = path + .clone() + .or_else(|| resolved.as_ref().ok().cloned()) + .map(|p| p.display().to_string()) + .unwrap_or_default(); + + InitialStateResponse { + is_connected: connected, + desired_connected: desired, + connecting, + engine_found: resolved.is_ok(), + engine_path, + engine_version: engine::engine_version_string(), + local_ip: engine::detect_lan_ip(), + pac_running: state.pac_running.load(Ordering::SeqCst), + config: app_cfg, + autostart_effective: state.autostart_effective.load(Ordering::SeqCst), + autostart_error: lock(&state.autostart_error).clone(), + is_admin: is_admin(), + system_proxy: proxy_sentinel::system_proxy_state().unwrap_or(SystemProxyState { + proxy_enable: 0, + proxy_server: None, + proxy_override: None, + auto_config_url: None, + auto_detect: None, + points_to_ld_fdpi_port: None, + }), + winhttp_status: winhttp::describe(), + memory_mb: memory_mb(), + app_version: env!("CARGO_PKG_VERSION").to_string(), + sentinel_clean_last_boot: state.sentinel_clean_boot, + sentinel_recovered: state.sentinel_recovered, + last_error, + } +} + +#[tauri::command] +fn get_status(app: AppHandle, state: State<'_, AppState>) -> StatusResponse { + let (connected, desired, connecting, port, probe, last_error) = { + let rt = lock(&state.inner); + ( + rt.connected, + rt.desired_connected, + rt.connecting, + rt.config.proxy_port, + rt.last_probe.clone(), + rt.last_error.clone(), + ) + }; + let alive = engine_alive(&state.inner); + let window_visible = app + .get_webview_window("main") + .and_then(|w| w.is_visible().ok()) + .unwrap_or(false); + + StatusResponse { + is_connected: connected, + desired_connected: desired, + connecting, + engine_alive: alive, + proxy_routed: proxy_routed(port), + pac_running: state.pac_running.load(Ordering::SeqCst), + window_visible, + discord_verified: probe.as_ref().map(|p| p.discord_ok).unwrap_or(false), + web_verified: probe.as_ref().map(|p| p.web_ok).unwrap_or(false), + latency_ms: probe.as_ref().map(|p| p.connect_ms).unwrap_or(0), + last_error, + } +} + +#[tauri::command] +async fn get_eduroam_status() -> Result { + tauri::async_runtime::spawn_blocking(eduroam::status) + .await + .map_err(|e| format!("Eduroam durum görevi çöktü: {e}")) +} + +#[tauri::command] +async fn connect_eduroam_wifi() -> Result { + tauri::async_runtime::spawn_blocking(eduroam::connect_wifi) + .await + .map_err(|e| format!("Eduroam bağlantı görevi çöktü: {e}"))? +} + +#[tauri::command] +fn open_wifi_settings() -> Result<(), String> { + eduroam::open_wifi_settings() +} + +#[tauri::command] +async fn check_update() -> Result, String> { + tauri::async_runtime::spawn_blocking(updater::check) + .await + .map_err(|e| format!("Güncelleme kontrolü çöktü: {e}"))? +} + +#[tauri::command] +fn open_download_page() -> Result<(), String> { + updater::open_download_page() +} + +#[tauri::command] +fn prepare_for_update(state: State<'_, AppState>) -> Result<(), String> { + // The updater installer replaces files under Program Files. Stop the + // sidecar first and remove any loopback proxy so Windows never reports a + // locked file or leaves the machine pointed at a dead port. + let _ = vpn::shutdown(); + let _ = do_stop(state.inner.clone()); + #[cfg(target_os = "windows")] + let _ = wfp_killswitch::disable_fdpi_quic_block(); + let port = lock(&state.inner).config.proxy_port; + let _ = proxy_sentinel::force_disable_loopback(port); + engine::hunt_zombie_processes(); + Ok(()) +} + +#[tauri::command] +fn restart_app(app: tauri::AppHandle) { + app.restart(); +} + +#[tauri::command] +async fn connect_without_login() -> Result { + tauri::async_runtime::spawn_blocking(captive::connect_without_login) + .await + .map_err(|e| format!("Captive portal görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn auto_select_bypass() -> Result { + tauri::async_runtime::spawn_blocking(auto_bypass::select) + .await + .map_err(|e| format!("Otomatik bypass görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn get_vpn_status() -> Result { + tauri::async_runtime::spawn_blocking(vpn::status) + .await + .map_err(|e| format!("VPN durum görevi çöktü: {e}")) +} + +#[tauri::command] +async fn install_vpn_client(app: AppHandle) -> Result { + tauri::async_runtime::spawn_blocking(move || vpn::install_client(&app)) + .await + .map_err(|e| format!("VPN kurulum görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn connect_vpn( + state: State<'_, AppState>, + app: tauri::AppHandle, +) -> Result { + let dpi_connected = { + let runtime = lock(&state.inner); + runtime.connected + }; + if dpi_connected { + return Err( + "DPI bağlantısı açıkken VPN başlatılamaz. Önce DPI bağlantısını kesin.".to_string(), + ); + } + let allow_lan = { + let cfg = lock(&state.app_config); + cfg.lan_sharing + }; + tauri::async_runtime::spawn_blocking(move || { + let mode_guard = supervisor::begin(supervisor::NetMode::VpnActive, false)?; + let status = vpn::connect(&app, allow_lan)?; + mode_guard.commit(); + Ok(status) + }) + .await + .map_err(|e| format!("VPN bağlantı görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn enroll_vpn(token: String) -> Result { + tauri::async_runtime::spawn_blocking(move || { + let identity = identity::get_or_create_identity()?; + let response = identity::enroll("ttmadethat.shop", "/api/v1/enroll", &token)?; + let config = identity::render_config(&identity, &response); + identity::save_enrollment_token(&token)?; + vpn::save_config(config) + }) + .await + .map_err(|e| format!("Enrollment görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn run_dns_check() -> Result { + tauri::async_runtime::spawn_blocking(vpn::dns_check) + .await + .map_err(|e| format!("DNS kontrol görevi çöktü: {e}")) +} + +#[tauri::command] +async fn disconnect_vpn() -> Result { + tauri::async_runtime::spawn_blocking(move || { + // A VPN disconnect must never overwrite the DPI mode. + if supervisor::current() == supervisor::NetMode::DpiActive { + return Ok(vpn::status()); + } + let mode_guard = supervisor::begin(supervisor::NetMode::Disconnected, true)?; + let status = vpn::disconnect()?; + mode_guard.commit(); + Ok(status) + }) + .await + .map_err(|e| format!("VPN kesme görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn save_vpn_config(config: String) -> Result { + tauri::async_runtime::spawn_blocking(move || vpn::save_config(config)) + .await + .map_err(|e| format!("VPN yapılandırma görevi çöktü: {e}"))? +} + +fn eduroam_diagnostics_blocking() -> Vec { + let wifi = eduroam::wifi_status(); + let mut items = Vec::new(); + + items.push(diag( + "eduroam_wifi", + "Wi-Fi / SSID", + wifi.connected, + if wifi.connected { + format!( + "{} · {} · {}", + wifi.ssid, wifi.interface, wifi.authentication + ) + } else { + "Kablosuz bağlantı yok".to_string() + }, + )); + items.push(diag( + "eduroam_ssid", + "eduroam algılama", + wifi.is_eduroam, + if wifi.is_eduroam { + "eduroam ağındasınız".to_string() + } else { + format!( + "SSID: {}", + if wifi.ssid.is_empty() { + "—" + } else { + &wifi.ssid + } + ) + }, + )); + + let enterprise = wifi.authentication.to_lowercase().contains("enterprise") + || wifi.authentication.to_lowercase().contains("kurumsal") + || wifi.authentication.to_lowercase().contains("802.1x"); + items.push(diag( + "eduroam_8021x", + "802.1X / kurumsal kimlik", + enterprise, + if enterprise { + wifi.authentication.clone() + } else { + "Kurumsal kimlik doğrulama algılanmadı".to_string() + }, + )); + + let mtu = if wifi.interface.is_empty() { + None + } else { + eduroam::current_mtu(&wifi.interface) + }; + items.push(diag( + "eduroam_mtu", + "Wi-Fi MTU", + mtu.map(|value| value <= 1420).unwrap_or(false), + mtu.map(|value| { + format!( + "{value} B{}", + if value > 1420 { + " — Eduroam modu 1400'e indirir" + } else { + "" + } + ) + }) + .unwrap_or_else(|| "Okunamadı".to_string()), + )); + + let targets = [ + ("eduroam_discord_tcp", "Discord TCP 443", "discord.com", 443), + ( + "eduroam_media_tcp", + "Discord Media TCP 443", + "discord.media", + 443, + ), + ( + "eduroam_voice_tcp", + "Discord ses TCP 2087", + "discord.media", + 2087, + ), + ]; + let mut handles = Vec::new(); + for (id, name, host, port) in targets { + handles.push(std::thread::spawn(move || { + let latency = eduroam::tcp_probe(host, port, Duration::from_millis(2500)); + (id, name, host, port, latency) + })); + } + for handle in handles { + if let Ok((id, name, host, port, latency)) = handle.join() { + items.push(diag( + id, + name, + latency.is_some(), + match latency { + Some(ms) => format!("{host}:{port} · {ms} ms"), + None => format!("{host}:{port} · bağlantı kurulamadı"), + }, + )); + } + } + + let udp_ok = eduroam::udp_stun_probe("stun.l.google.com", 19302, Duration::from_millis(1800)); + items.push(diag( + "eduroam_voice_udp", + "UDP / STUN (ses ön koşulu)", + udp_ok, + if udp_ok { + "UDP çıkışı çalışıyor. Discord sesi ayrıca UDP 19294-19344 ve 50000-50100 kullanır; \ + kurum bu aralıkları engelliyorsa HTTP proxy sesi taşıyamaz." + .to_string() + } else { + "UDP çıkışı engelli görünüyor. Discord metin/uygulama çalışabilir; ses çalışmaz." + .to_string() + }, + )); + + items +} + +#[tauri::command] +async fn run_eduroam_diagnostics() -> Result, String> { + tauri::async_runtime::spawn_blocking(eduroam_diagnostics_blocking) + .await + .map_err(|e| format!("Eduroam tanılama görevi çöktü: {e}")) +} + +#[tauri::command(async)] +fn save_config( + state: State<'_, AppState>, + config: AppConfig, +) -> Result { + let mut cfg = config; + // LAN listening is only valid while the PAC/firewall layer is actually running. + cfg.lan_sharing = state.pac_running.load(Ordering::SeqCst); + cfg.normalize(); + cfg.save()?; + + let previous_auto = lock(&state.app_config).auto_start; + let effective_before = state.autostart_effective.load(Ordering::SeqCst); + let error_before = lock(&state.autostart_error).clone(); + + { + let mut stored = lock(&state.app_config); + *stored = cfg.clone(); + } + + let (effective, warning) = if previous_auto != cfg.auto_start { + sync_autostart(&state) + } else { + (effective_before, error_before) + }; + + { + let mut rt = lock(&state.inner); + let lan = state.pac_running.load(Ordering::SeqCst); + rt.config = cfg.engine_config(); + rt.config.lan_sharing = lan; + if !cfg.auto_connect && !rt.connected { + rt.desired_connected = false; + } + } + + Ok(SaveConfigResponse { + config: cfg, + autostart_effective: effective, + warning, + }) +} + +#[tauri::command] +async fn start_connection( + state: State<'_, AppState>, + config: EngineConfig, +) -> Result { + if vpn::status().connected { + return Err( + "VPN açıkken DPI bağlantısı başlatılamaz. Önce VPN bağlantısını kesin.".to_string(), + ); + } + let inner = state.inner.clone(); + let app_config = state.app_config.clone(); + let lan_allowed = state.pac_running.load(Ordering::SeqCst); + let result = tauri::async_runtime::spawn_blocking(move || { + do_start(inner.clone(), app_config, config, lan_allowed) + }) + .await + .map_err(|e| format!("Bağlantı görevi çöktü: {e}"))?; + + if result.is_err() { + let mut rt = lock(&state.inner); + rt.desired_connected = false; + } + result +} + +#[tauri::command] +async fn stop_connection(state: State<'_, AppState>) -> Result { + let inner = state.inner.clone(); + tauri::async_runtime::spawn_blocking(move || do_stop(inner)) + .await + .map_err(|e| format!("Bağlantı kesme görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn soft_restart_engine( + state: State<'_, AppState>, + config: EngineConfig, +) -> Result { + let inner = state.inner.clone(); + let app_config = state.app_config.clone(); + let lan_allowed = state.pac_running.load(Ordering::SeqCst); + tauri::async_runtime::spawn_blocking(move || do_restart(inner, app_config, config, lan_allowed)) + .await + .map_err(|e| format!("Yenileme görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn verify_connectivity( + state: State<'_, AppState>, + doh_provider: Option, + proxy_port: Option, +) -> Result { + let inner = state.inner.clone(); + tauri::async_runtime::spawn_blocking(move || { + let (connected, cfg) = { + let rt = lock(&inner); + (rt.connected, rt.config.clone()) + }; + let port = proxy_port.unwrap_or(cfg.proxy_port); + let alive = engine_alive(&inner); + + let probe = engine::probe_connectivity(port); + let engine_alive = alive && probe.proxy_ok; + + Ok(VerifyResponse { + proxy_ok: probe.proxy_ok, + discord_ok: probe.discord_ok, + web_ok: probe.web_ok, + latency_ms: probe.connect_ms, + resolver: doh_provider.unwrap_or(cfg.doh_provider), + engine_alive, + detail: format!( + "{}{}", + if connected { + "" + } else { + "Uygulama bağlı değil. " + }, + probe.detail + ), + }) + }) + .await + .map_err(|e| format!("Doğrulama görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn benchmark_doh_resolvers() -> Result, String> { + tauri::async_runtime::spawn_blocking(engine::benchmark_all_doh_resolvers) + .await + .map_err(|e| format!("DoH testi çöktü: {e}")) +} + +#[tauri::command] +async fn toggle_lan_sharing( + state: State<'_, AppState>, + enabled: bool, + proxy_port: u16, + pac_port: u16, +) -> Result { + // Serialize rapid LAN toggles; PAC start/stop and engine restart must not overlap. + let _lan = state.lan_lock.lock().await; + + if proxy_port == pac_port { + return Err("Proxy portu ile PAC portu aynı olamaz.".to_string()); + } + if proxy_port < 1024 || pac_port < 1024 { + return Err("LAN portları 1024 veya üzeri olmalı.".to_string()); + } + + let local_ip = engine::detect_lan_ip(); + + if let Ok(mut pac) = state.pac.lock() { + if let Some(handle) = pac.take() { + handle.stop(); + } + } + state.pac_running.store(false, Ordering::SeqCst); + + let firewall_ok = tauri::async_runtime::spawn_blocking(move || { + engine::configure_lan_firewall_rule(enabled, proxy_port, pac_port) + }) + .await + .unwrap_or(false); + + let was_connected = { + let mut rt = lock(&state.inner); + rt.config.lan_sharing = enabled; + rt.config.proxy_port = proxy_port; + rt.config.pac_port = pac_port; + rt.connected + }; + + if let Ok(mut saved) = state.app_config.lock() { + saved.lan_sharing = enabled; + saved.proxy_port = proxy_port; + saved.pac_port = pac_port; + let _ = saved.save(); + } + + let pac_url = format!("http://{local_ip}:{pac_port}/proxy.pac"); + let manual_proxy = format!("{local_ip}:{proxy_port}"); + + if enabled { + let handle = pac_server::start(local_ip.clone(), proxy_port, pac_port, enabled).await?; + if let Ok(mut pac) = state.pac.lock() { + *pac = Some(handle); + } + state.pac_running.store(true, Ordering::SeqCst); + } + + if was_connected { + let inner = state.inner.clone(); + let app_config = state.app_config.clone(); + let cfg_for_restart = { + let rt = lock(&state.inner); + rt.config.clone() + }; + let result = tauri::async_runtime::spawn_blocking(move || { + do_restart(inner, app_config, cfg_for_restart, enabled) + }) + .await + .map_err(|e| format!("LAN yeniden başlatma görevi çöktü: {e}"))?; + + if let Err(e) = result { + if enabled { + if let Ok(mut pac) = state.pac.lock() { + if let Some(handle) = pac.take() { + handle.stop(); + } + } + state.pac_running.store(false, Ordering::SeqCst); + } + return Err(e); + } + } + + let mut notes = Vec::new(); + if enabled && !firewall_ok { + notes.push( + "Güvenlik duvarı kuralı eklenemedi (yönetici yetkisi gerekli). Diğer cihazlar için \ + Windows Güvenlik Duvarı'nda TCP portlarına izin verin." + .to_string(), + ); + } + + let message = if enabled { + format!( + "LAN paylaşımı açıldı. PAC: {}{}", + pac_url, + if notes.is_empty() { + String::new() + } else { + format!(" — {}", notes.join(" ")) + } + ) + } else { + "LAN paylaşımı kapatıldı; proxy yeniden yalnızca 127.0.0.1 üzerinde dinliyor.".to_string() + }; + + Ok(LanToggleResponse { + enabled, + pac_url, + manual_proxy, + max_connections: pac_server::MAX_CONCURRENT, + firewall_rule_updated: firewall_ok, + message, + }) +} + +#[tauri::command] +async fn emergency_sentinel_restore( + state: State<'_, AppState>, +) -> Result { + let inner = state.inner.clone(); + tauri::async_runtime::spawn_blocking(move || { + let child = { + let mut rt = lock(&inner); + rt.generation = rt.generation.wrapping_add(1); + rt.connected = false; + rt.desired_connected = false; + rt.child.take() + }; + if let Some(child) = child { + terminate_child(child); + } + let killed = engine::hunt_zombie_processes(); + let report = proxy_sentinel::restore_system_proxy(true)?; + + Ok(SentinelRestoreResponse { + restored: report.restored(), + status: report.status.clone(), + message: format!( + "{}\n{} zombi SpoofDPI süreci temizlendi.", + report.message, killed + ), + }) + }) + .await + .map_err(|e| format!("Sentinel onarım görevi çöktü: {e}"))? +} + +#[tauri::command] +async fn run_diagnostics(state: State<'_, AppState>) -> Result, String> { + let inner = state.inner.clone(); + let pac_running = state.pac_running.load(Ordering::SeqCst); + let app_cfg = lock(&state.app_config).clone(); + let autostart_effective = state.autostart_effective.load(Ordering::SeqCst); + let autostart_error = lock(&state.autostart_error).clone(); + + tauri::async_runtime::spawn_blocking(move || { + let mut items = Vec::new(); + + items.push(diag( + "ipc", + "Tauri v2 IPC köprüsü", + true, + "Rust komutları yanıt veriyor.", + )); + + let sidecar = engine::resolve_sidecar(); + match &sidecar { + Ok(path) => { + let size = std::fs::metadata(path).map(|m| m.len()).unwrap_or(0); + items.push(diag( + "sidecar", + "SpoofDPI ikilisi", + true, + format!("{} — {:.1} MB", path.display(), size as f64 / 1_048_576.0), + )); + } + Err(e) => items.push(diag("sidecar", "SpoofDPI ikilisi", false, e.clone())), + } + + let version = engine::engine_version_string(); + items.push(diag( + "engine_version", + "Motor sürümü", + version.contains(engine::ENGINE_VERSION), + version, + )); + + let cfg_path = AppConfig::path(); + items.push(diag( + "config", + "Ayar dosyası", + cfg_path.exists(), + cfg_path.display().to_string(), + )); + + items.push(diag( + "autostart", + "Yönetici otomatik başlatma (Görev Zamanlayıcı)", + autostart_effective, + match autostart_error { + Some(ref e) => format!("Görev aktif değil: {e}"), + None => autostart::printable_command(autostart_effective), + }, + )); + + items.push(diag( + "admin", + "Yönetici (UAC) yetkisi", + is_admin(), + if is_admin() { + "Uygulama yönetici olarak çalışıyor.".to_string() + } else { + "Yönetici değil; WinHTTP/WinDivert ve görev oluşturma kısıtlı.".to_string() + }, + )); + + let (connected, cfg) = { + let rt = lock(&inner); + (rt.connected, rt.config.clone()) + }; + + match proxy_sentinel::system_proxy_state() { + Ok(state) => { + let points = state.points_to_ld_fdpi_port == Some(cfg.proxy_port); + let passed = if connected { + state.proxy_enable == 1 && points + } else { + state.points_to_ld_fdpi_port != Some(cfg.proxy_port) || state.proxy_enable == 0 + }; + items.push(diag( + "system_proxy", + "Windows sistem proxy (HKCU)", + passed, + format!( + "ProxyEnable={} ProxyServer={:?} PAC={}", + state.proxy_enable, + state.proxy_server, + if points { "bizde" } else { "değil" } + ), + )); + } + Err(e) => items.push(diag("system_proxy", "Windows sistem proxy", false, e)), + } + + items.push(diag( + "winhttp", + "WinHTTP (Oyun Modu)", + if app_cfg.connection_mode == "game" { + winhttp::is_direct() == Some(false) + } else { + true + }, + winhttp::describe(), + )); + + let backup_exists = proxy_sentinel::sentinel_file_path().exists(); + items.push(diag( + "sentinel", + "Çökme kurtarma yedeği", + backup_exists, + proxy_sentinel::sentinel_file_path().display().to_string(), + )); + + if connected { + let probe = engine::probe_connectivity(cfg.proxy_port); + items.push(diag( + "proxy_tls", + "Proxy üzerinden TLS", + probe.proxy_ok && probe.discord_ok, + probe.detail, + )); + } else { + items.push(diag( + "proxy_tls", + "Proxy üzerinden TLS", + false, + "Bağlı değil.", + )); + } + + if pac_running { + match pac_server::fetch_pac_blocking(cfg.pac_port) { + Ok(body) => items.push(diag( + "pac", + "LAN PAC sunucusu", + body.contains("FindProxyForURL"), + format!("http://0.0.0.0:{}/proxy.pac", cfg.pac_port), + )), + Err(e) => items.push(diag("pac", "LAN PAC sunucusu", false, e)), + } + } else { + items.push(diag("pac", "LAN PAC sunucusu", false, "Kapalı.")); + } + + let bench = engine::benchmark_all_doh_resolvers(); + let best = bench.iter().find(|b| b.reachable); + items.push(diag( + "doh", + "DoH çözücüler", + best.is_some(), + best.map(|b| format!("En hızlı: {} — {} ms", b.name, b.latency_ms)) + .unwrap_or_else(|| "Hiçbir DoH uç noktasına ulaşılamadı.".to_string()), + )); + + items + }) + .await + .map_err(|e| format!("Tanılama görevi çöktü: {e}")) +} + +// --------------------------------------------------------------------------- +// App entry +// --------------------------------------------------------------------------- + +#[cfg(target_os = "windows")] +fn init_app_user_model_id() { + use std::os::windows::ffi::OsStrExt; + let wide: Vec = std::ffi::OsStr::new("com.ldfdpi.desktop") + .encode_wide() + .chain(std::iter::once(0)) + .collect(); + unsafe { + windows_sys::Win32::UI::Shell::SetCurrentProcessExplicitAppUserModelID(wide.as_ptr()); + } +} + +fn ensure_window_visible(app: &AppHandle) { + if let Some(w) = app.get_webview_window("main") { + if let Some(icon) = app.default_window_icon() { + let _ = w.set_icon((*icon).clone()); + } + let _ = w.show(); + let _ = w.unminimize(); + let _ = w.set_focus(); + } +} + +#[cfg_attr(mobile, tauri::mobile_entry_point)] +pub fn run() { + #[cfg(target_os = "windows")] + init_app_user_model_id(); + #[cfg(target_os = "windows")] + let _ = wfp_killswitch::disable_fdpi_quic_block(); + engine::rotate_logs(); + + let (clean_boot, recovered) = proxy_sentinel::run_startup_sentinel_check(); + // Kill orphaned sidecars before deciding whether a loopback proxy is dead. + engine::hunt_zombie_processes(); + let _ = proxy_sentinel::clear_dead_loopback(18080); + // A crash may have left the Wi-Fi MTU clamped. + let _ = eduroam::restore_from_backup(); + + let vpn_connected_at_boot = vpn::status().connected; + // A previous GUI crash can leave persistent kill-switch filters behind. + // Keep them while the tunnel is up; clear them only when it is down. + #[cfg(target_os = "windows")] + if !vpn_connected_at_boot { + let _ = wfp_killswitch::disable_killswitch(); + } + supervisor::init(if vpn_connected_at_boot { + supervisor::NetMode::VpnActive + } else { + supervisor::NetMode::Disconnected + }); + + let mut app_config = AppConfig::load(); + app_config.normalize(); + // Clean a loopback proxy left by a crash/forced kill, including a custom + // port from config. The engine is not running yet at this point. + let _ = proxy_sentinel::clear_dead_loopback(app_config.proxy_port); + let _ = proxy_sentinel::clear_dead_loopback(18080); + // SECURITY: never restore a LAN (0.0.0.0) listener at boot. LAN sharing must be + // explicitly enabled for this session via the PAC/firewall toggle. + app_config.lan_sharing = false; + let _ = app_config.save(); + + install_panic_hook(); + let _ = engine::resolve_sidecar(); + + let (autostart_effective, autostart_error) = match autostart::apply(app_config.auto_start) { + Ok(effective) => (effective, None), + Err(e) => (autostart::is_enabled(), Some(e)), + }; + + let cfg_for_setup = app_config.clone(); + let state = AppState::new( + clean_boot, + recovered, + app_config, + autostart_effective, + autostart_error, + ); + + let supervisor_inner = state.inner.clone(); + let supervisor_config = state.app_config.clone(); + let supervisor_pac = state.pac_running.clone(); + + let built = tauri::Builder::default() + .plugin(tauri_plugin_updater::Builder::new().build()) + .plugin(tauri_plugin_single_instance::init(|app, _args, _cwd| { + ensure_window_visible(app); + })) + .manage(state) + .on_window_event(|window, event| { + if let WindowEvent::CloseRequested { api, .. } = event { + let minimize = window + .app_handle() + .try_state::() + .and_then(|s| s.app_config.lock().ok().map(|c| c.minimize_to_tray)) + .unwrap_or(true); + + if minimize { + let _ = window.hide(); + api.prevent_close(); + } else { + let app = window.app_handle().clone(); + shutdown_all(&app); + app.exit(0); + } + } + }) + .setup(move |app| { + let show_i = + MenuItem::with_id(app, "show", "LD FDPI Arayüzünü Aç", true, None::<&str>)?; + let connect_i = MenuItem::with_id(app, "connect", "Bağlan", true, None::<&str>)?; + let disconnect_i = + MenuItem::with_id(app, "disconnect", "Bağlantıyı Kes", true, None::<&str>)?; + let restore_i = MenuItem::with_id( + app, + "restore", + "Acil Proxy Onarımı (Sentinel)", + true, + None::<&str>, + )?; + let quit_i = MenuItem::with_id( + app, + "quit", + "Güvenli Çıkış (Proxy Geri Yükle)", + true, + None::<&str>, + )?; + let menu = Menu::with_items( + app, + &[&show_i, &connect_i, &disconnect_i, &restore_i, &quit_i], + )?; + + let mut tray = TrayIconBuilder::new() + .menu(&menu) + .tooltip("LD FDPI — Yerel Proxy & DPI Bypass") + .on_menu_event(|app, event| match event.id.as_ref() { + "show" => { + ensure_window_visible(app); + } + "connect" => { + if let Some(state) = app.try_state::() { + let inner = state.inner.clone(); + let app_config = state.app_config.clone(); + let lan_allowed = state.pac_running.load(Ordering::SeqCst); + let cfg = lock(&state.app_config).engine_config(); + std::thread::spawn(move || { + let mut rt = lock(&inner); + rt.desired_connected = true; + drop(rt); + let _ = do_start(inner, app_config, cfg, lan_allowed); + }); + } + } + "disconnect" => { + if let Some(state) = app.try_state::() { + let inner = state.inner.clone(); + std::thread::spawn(move || { + let _ = do_stop(inner); + }); + } + } + "restore" => { + let _ = proxy_sentinel::restore_system_proxy(true); + let _ = engine::hunt_zombie_processes(); + } + "quit" => { + shutdown_all(app); + app.exit(0); + } + _ => {} + }) + .on_tray_icon_event(|tray, event| { + if let TrayIconEvent::Click { + button: MouseButton::Left, + button_state: MouseButtonState::Up, + .. + } = event + { + ensure_window_visible(tray.app_handle()); + } + }); + + if let Some(icon) = app.default_window_icon() { + tray = tray.icon((*icon).clone()); + } + tray.build(app)?; + + if let Some(w) = app.get_webview_window("main") { + if let Some(icon) = app.default_window_icon() { + let _ = w.set_icon((*icon).clone()); + } + } + + let silent = std::env::args().any(|a| a == "--minimized" || a == "--autostart"); + if !silent { + ensure_window_visible(app.handle()); + } + + if test_cli_enabled() && std::env::args().any(|a| a == "--auto-connect-vpn") { + let handle = app.handle().clone(); + std::thread::spawn(move || { + let result = vpn::connect(&handle, false); + let text = match &result { + Ok(status) => format!( + "OK\nconnected={}\naddress={}\nendpoint={}\ndetail={}\n", + status.connected, + status.address.as_deref().unwrap_or(""), + status.endpoint.as_deref().unwrap_or(""), + status.detail + ), + Err(error) => format!("ERR\n{error}\n"), + }; + let dir = engine::app_data_dir(); + let _ = std::fs::create_dir_all(&dir); + let _ = std::fs::write(dir.join("auto-connect-result.txt"), text); + }); + } + + if test_cli_enabled() && std::env::args().any(|a| a == "--auto-dpi-cycle") { + if let Some(state) = app.try_state::() { + let inner = state.inner.clone(); + let app_config = state.app_config.clone(); + std::thread::spawn(move || { + std::thread::sleep(Duration::from_secs(5)); + let mut rt = lock(&inner); + rt.desired_connected = true; + drop(rt); + let cfg = lock(&app_config).engine_config(); + let started = do_start(inner.clone(), app_config, cfg, false); + std::thread::sleep(Duration::from_secs(6)); + let stopped = do_stop(inner); + let text = format!( + "START={}\nSTOP={}\n", + match started { + Ok(response) => format!("OK {}", response.message), + Err(error) => format!("ERR {error}"), + }, + match stopped { + Ok(response) => format!("OK {}", response.message), + Err(error) => format!("ERR {error}"), + } + ); + let dir = engine::app_data_dir(); + let _ = std::fs::create_dir_all(&dir); + let _ = std::fs::write(dir.join("auto-dpi-cycle-result.txt"), text); + }); + } + } + + if test_cli_enabled() && std::env::args().any(|a| a == "--auto-start-dpi") { + if let Some(state) = app.try_state::() { + let inner = state.inner.clone(); + let app_config = state.app_config.clone(); + std::thread::spawn(move || { + // Let the webview finish its initial state sync first. + std::thread::sleep(Duration::from_secs(5)); + let mut rt = lock(&inner); + rt.desired_connected = true; + drop(rt); + let cfg = lock(&app_config).engine_config(); + let result = do_start(inner, app_config, cfg, false); + let text = match &result { + Ok(response) => format!("OK\n{}\n", response.message), + Err(error) => format!("ERR\n{error}\n"), + }; + let dir = engine::app_data_dir(); + let _ = std::fs::create_dir_all(&dir); + let _ = std::fs::write(dir.join("auto-dpi-result.txt"), text); + }); + } + } + + // Auto-connect starts before React loads, as requested. + if cfg_for_setup.auto_connect && !vpn_connected_at_boot { + let inner = supervisor_inner.clone(); + let app_config = supervisor_config.clone(); + let cfg = cfg_for_setup.engine_config(); + std::thread::spawn(move || { + let mut rt = lock(&inner); + rt.desired_connected = true; + drop(rt); + // LAN is deliberately off at boot; loopback only. + let _ = do_start(inner, app_config, cfg, false); + }); + } + + start_supervisor(supervisor_inner, supervisor_config, supervisor_pac); + + Ok(()) + }) + .invoke_handler(tauri::generate_handler![ + get_initial_state, + get_status, + save_config, + start_connection, + stop_connection, + soft_restart_engine, + verify_connectivity, + benchmark_doh_resolvers, + toggle_lan_sharing, + emergency_sentinel_restore, + run_diagnostics, + get_eduroam_status, + connect_eduroam_wifi, + open_wifi_settings, + check_update, + open_download_page, + prepare_for_update, + restart_app, + connect_without_login, + auto_select_bypass, + get_vpn_status, + install_vpn_client, + connect_vpn, + enroll_vpn, + disconnect_vpn, + save_vpn_config, + run_dns_check, + run_eduroam_diagnostics + ]) + .build(tauri::generate_context!()); + + let app = match built { + Ok(app) => app, + Err(error) => { + eprintln!("[LD FDPI] Uygulama başlatılamadı: {error}"); + let _ = proxy_sentinel::restore_system_proxy(true); + return; + } + }; + + app.run(|app_handle, event| { + if let RunEvent::Exit = event { + shutdown_all(app_handle); + } + }); +} + +// --------------------------------------------------------------------------- +// CLI modes (no GUI) +// --------------------------------------------------------------------------- + +/// Isolated acceptance-test entry point: brings the tunnel up and installs the +/// persistent WFP filters, then exits without tearing anything down. +pub fn wfp_enable() -> i32 { + match vpn::connect_for_test(false) { + Ok(status) => { + println!( + "WFP_ENABLE_OK connected={} address={:?}", + status.connected, status.address + ); + 0 + } + Err(error) => { + eprintln!("WFP_ENABLE_ERROR {error}"); + 1 + } + } +} + +/// `ld-fdpi.exe --restore-only`: restore the WinINet/WinHTTP proxy and kill the +/// engine, then exit. Used by the NSIS uninstaller and by crash-recovery tests. +/// (The autostart task is removed separately by the uninstaller.) +pub fn restore_only() -> i32 { + #[cfg(target_os = "windows")] + let _ = wfp_killswitch::disable_killswitch(); + vpn::shutdown(); + let killed = engine::hunt_zombie_processes(); + let _ = eduroam::restore_from_backup(); + match proxy_sentinel::restore_system_proxy(true) { + Ok(report) => { + println!("{killed} zombi süreç temizlendi."); + println!("{}", report.message); + 0 + } + Err(e) => { + eprintln!("Proxy geri yüklenemedi: {e}"); + 1 + } + } +} + +/// `ld-fdpi.exe --print-autostart`: shows the exact Task Scheduler command and +/// attempts to apply it (used to validate quoting without admin rights). +pub fn print_autostart() -> i32 { + println!("task={}", autostart::TASK_NAME); + println!("command={}", autostart::printable_command(true)); + println!("enabled_before={}", autostart::is_enabled()); + match autostart::enable() { + Ok(()) => println!("enable=OK"), + Err(e) => println!("enable=ERR {e}"), + } + println!("enabled_after={}", autostart::is_enabled()); + 0 +} + +struct SelfTestGuard { + child: Option, + proxy_applied: bool, +} + +impl Drop for SelfTestGuard { + fn drop(&mut self) { + if let Some(child) = self.child.take() { + terminate_child(child); + } + if self.proxy_applied { + let _ = proxy_sentinel::restore_system_proxy(true); + } + } +} + +fn report(name: &str, ok: bool, detail: String, failures: &mut usize, total: &mut usize) { + *total += 1; + println!("[{}] {name}: {detail}", if ok { "PASS" } else { "FAIL" }); + if !ok { + *failures += 1; + } +} + +/// `ld-fdpi.exe --self-test`: real engine + proxy + registry + config pipeline. +pub fn self_test() -> i32 { + let mut failures = 0usize; + let mut total = 0usize; + + let cfg_path = AppConfig::path(); + let mut cfg = AppConfig::load(); + cfg.normalize(); + let saved = cfg.save().is_ok() && cfg_path.exists(); + let reloaded = AppConfig::load(); + report( + "config_roundtrip", + saved && reloaded.auto_connect == cfg.auto_connect, + cfg_path.display().to_string(), + &mut failures, + &mut total, + ); + + let original = proxy_sentinel::system_proxy_state().ok(); + println!( + "Mevcut sistem proxy: ProxyEnable={:?} ProxyServer={:?}", + original.as_ref().map(|s| s.proxy_enable), + original.as_ref().and_then(|s| s.proxy_server.clone()) + ); + + let sidecar = engine::resolve_sidecar(); + report( + "sidecar", + sidecar.is_ok(), + match &sidecar { + Ok(p) => p.display().to_string(), + Err(e) => e.clone(), + }, + &mut failures, + &mut total, + ); + let Ok(_sidecar_path) = sidecar else { + println!("\nSidecar bulunamadı; kalan testler atlandı."); + return 1; + }; + + let version = engine::engine_version_string(); + report( + "engine_version", + version.contains(engine::ENGINE_VERSION), + version, + &mut failures, + &mut total, + ); + + let mut port = 18080u16; + while !engine::port_is_free(port, false) && port < 18120 { + port += 1; + } + report( + "free_port", + engine::port_is_free(port, false), + format!("port {port}"), + &mut failures, + &mut total, + ); + + let cfg_engine = EngineConfig { + proxy_port: port, + pac_port: port + 1, + ..EngineConfig::default() + }; + + let (mut child, path, args) = match engine::spawn_sidecar(&cfg_engine) { + Ok(v) => v, + Err(e) => { + report("spawn", false, e, &mut failures, &mut total); + return 1; + } + }; + CHILD_PID.store(child.id(), Ordering::SeqCst); + println!("Motor: {} | Argümanlar: {}", path.display(), args.join(" ")); + + let mut guard = SelfTestGuard { + child: None, + proxy_applied: false, + }; + + match engine::wait_until_listening(port, Duration::from_secs(8), &mut child) { + Ok(ms) => report( + "listen", + true, + format!("{ms} ms içinde {port} portunda"), + &mut failures, + &mut total, + ), + Err(e) => { + report("listen", false, e, &mut failures, &mut total); + engine::terminate_child(child); + return 1; + } + } + + let probe = engine::probe_connectivity(port); + report( + "proxy_connect", + probe.proxy_ok, + probe.detail.clone(), + &mut failures, + &mut total, + ); + report( + "discord_tls", + probe.discord_ok, + format!("CONNECT {} ms", probe.connect_ms), + &mut failures, + &mut total, + ); + report( + "web_tls", + probe.web_ok, + "www.cloudflare.com üzerinden TLS".to_string(), + &mut failures, + &mut total, + ); + + match proxy_sentinel::apply_system_proxy(port, false) { + Ok(applied) => { + guard.proxy_applied = true; + let current = proxy_sentinel::system_proxy_state().ok(); + let ok = current + .as_ref() + .map(|s| { + s.proxy_enable == 1 + && s.proxy_server.as_deref() == Some(applied.applied_server.as_str()) + }) + .unwrap_or(false); + report( + "registry_write", + ok, + format!( + "ProxyEnable={:?} ProxyServer={:?}", + current.as_ref().map(|s| s.proxy_enable), + current.as_ref().and_then(|s| s.proxy_server.clone()) + ), + &mut failures, + &mut total, + ); + report( + "backup_written", + proxy_sentinel::sentinel_file_path().exists(), + proxy_sentinel::sentinel_file_path().display().to_string(), + &mut failures, + &mut total, + ); + } + Err(e) => report("registry_write", false, e, &mut failures, &mut total), + } + + match proxy_sentinel::restore_system_proxy(true) { + Ok(restored) => { + guard.proxy_applied = false; + let restored_enable = original.as_ref().map(|s| s.proxy_enable).unwrap_or(0); + let restored_server = original.as_ref().and_then(|s| s.proxy_server.clone()); + report( + "registry_restore", + restored.proxy_enable == restored_enable + && restored.proxy_server == restored_server, + format!( + "ProxyEnable={} ProxyServer={:?}", + restored.proxy_enable, restored.proxy_server + ), + &mut failures, + &mut total, + ); + } + Err(e) => report("registry_restore", false, e, &mut failures, &mut total), + } + + guard.child = Some(child); + drop(guard); + + report( + "cleanup", + engine::port_is_free(port, false), + format!("{port} portu serbest bırakıldı"), + &mut failures, + &mut total, + ); + + println!("\nSONUÇ: {total} test, {failures} başarısız"); + if failures == 0 { + 0 + } else { + 1 + } +} diff --git a/src-tauri/src/main.rs b/src-tauri/src/main.rs new file mode 100644 index 0000000..9534ecf --- /dev/null +++ b/src-tauri/src/main.rs @@ -0,0 +1,30 @@ +// Prevents an additional console window on Windows in release, DO NOT REMOVE!! +#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] + +fn main() { + // Fail-safe must be armed before any CLI or GUI path can panic (panic=abort). + ld_fdpi_lib::install_panic_hook_public(); + + // The NSIS uninstaller calls `ld-fdpi.exe --restore-only` while the app is being + // removed; it must run before the Tauri single-instance plugin can swallow the args. + if std::env::args().any(|a| a == "--restore-only") { + std::process::exit(ld_fdpi_lib::restore_only()); + } + + // Headless end-to-end verification of the real engine + registry + config pipeline. + if std::env::args().any(|a| a == "--self-test") { + std::process::exit(ld_fdpi_lib::self_test()); + } + + // Isolated WFP acceptance-test entry point; leaves persistent filters up. + if std::env::args().any(|a| a == "--wfp-enable") { + std::process::exit(ld_fdpi_lib::wfp_enable()); + } + + // Prints the exact Task Scheduler command and tries to apply it (quoting check). + if std::env::args().any(|a| a == "--print-autostart") { + std::process::exit(ld_fdpi_lib::print_autostart()); + } + + ld_fdpi_lib::run(); +} diff --git a/src-tauri/src/pac_server.rs b/src-tauri/src/pac_server.rs new file mode 100644 index 0000000..5d5acb6 --- /dev/null +++ b/src-tauri/src/pac_server.rs @@ -0,0 +1,233 @@ +//! LD FDPI — Async, rate-limited PAC server for LAN sharing. +//! +//! Security properties: +//! * **Loopback by default**: binds `127.0.0.1` unless LAN sharing is explicitly +//! enabled. When enabled it binds `0.0.0.0`, but every accepted peer must be a +//! loopback / RFC1918 / link-local address; public peers are dropped immediately. +//! * **Bounded requests**: at most 4096 bytes are read and the whole request must +//! arrive within 5 seconds (Slowloris / memory-exhaustion protection). +//! * **Concurrency cap**: `Semaphore(50)` limits simultaneous clients. + +use std::net::IpAddr; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::Arc; +use std::time::Duration; +use tokio::io::{AsyncReadExt, AsyncWriteExt}; +use tokio::net::TcpListener; +use tokio::sync::Semaphore; + +/// Maximum simultaneous PAC requests (anti-DDoS on shared networks). +pub const MAX_CONCURRENT: usize = 50; +/// Hard cap for an HTTP request (headers only; the PAC server ignores the body). +pub const MAX_REQUEST_BYTES: usize = 4096; +/// Total time allowed to receive the request. +pub const READ_TIMEOUT: Duration = Duration::from_secs(5); + +pub struct PacHandle { + running: Arc, + task: tokio::task::JoinHandle<()>, +} + +impl PacHandle { + /// Stops the accept loop and closes the listening socket immediately. + pub fn stop(self) { + self.running.store(false, Ordering::SeqCst); + self.task.abort(); + } +} + +/// The PAC script served to clients. Kept in one place so the UI preview and the +/// HTTP response can never drift apart. +pub fn pac_script(local_ip: &str, proxy_port: u16) -> String { + format!( + "function FindProxyForURL(url, host) {{\n \ + // Fast string/subnet checks only: no dnsResolve/isInNet per request.\n \ + if (isPlainHostName(host) || shExpMatch(host, \"*.local\")) {{\n \ + return \"DIRECT\";\n }}\n \ + var parts = host.split(\".\");\n \ + if (parts.length === 4) {{\n \ + var a = parseInt(parts[0], 10);\n \ + var b = parseInt(parts[1], 10);\n \ + if (a === 127 || a === 10 || (a === 192 && b === 168) ||\n \ + (a === 172 && b >= 16 && b <= 31)) {{\n \ + return \"DIRECT\";\n }}\n }}\n \ + // University SSO / captive portal / eduroam pages must never go through the proxy.\n \ + if (shExpMatch(host, \"*.edu\") || shExpMatch(host, \"*.edu.tr\") ||\n \ + shExpMatch(host, \"*.ac.uk\") || shExpMatch(host, \"eduroam.org\") ||\n \ + shExpMatch(host, \"*.eduroam.org\")) {{\n \ + return \"DIRECT\";\n }}\n \ + return \"PROXY {local_ip}:{proxy_port}; DIRECT\";\n}}\n" + ) +} + +/// Only loopback / private / link-local peers may use the LAN PAC server. +fn is_allowed_peer(ip: IpAddr, allow_lan: bool) -> bool { + if !allow_lan { + return ip.is_loopback(); + } + match ip { + IpAddr::V4(v4) => v4.is_loopback() || v4.is_private() || v4.is_link_local(), + IpAddr::V6(v6) => { + v6.is_loopback() || v6.is_unique_local() || v6.is_unicast_link_local() + } + } +} + +enum RequestError { + TooLarge, + Io, +} + +async fn read_request(socket: &mut tokio::net::TcpStream) -> Result<(), RequestError> { + let mut request = Vec::with_capacity(512); + let mut chunk = [0u8; 512]; + + loop { + let read = socket.read(&mut chunk).await.map_err(|_| RequestError::Io)?; + if read == 0 { + return Ok(()); + } + request.extend_from_slice(&chunk[..read]); + if request.len() > MAX_REQUEST_BYTES { + return Err(RequestError::TooLarge); + } + if request.windows(4).any(|window| window == b"\r\n\r\n") { + return Ok(()); + } + } +} + +/// Starts the PAC server. `allow_lan = false` binds loopback only; `true` binds +/// all interfaces but filters every accepted peer to private address space. +pub async fn start( + local_ip: String, + proxy_port: u16, + pac_port: u16, + allow_lan: bool, +) -> Result { + let bind_ip = if allow_lan { "0.0.0.0" } else { "127.0.0.1" }; + + // A previously aborted accept loop may still be releasing the socket for a few + // milliseconds; retry briefly instead of failing a quick on/off/on toggle. + let mut attempt = 0; + let listener = loop { + match TcpListener::bind((bind_ip, pac_port)).await { + Ok(listener) => break listener, + Err(e) if attempt < 10 => { + attempt += 1; + tokio::time::sleep(Duration::from_millis(50)).await; + if attempt == 10 { + return Err(format!( + "PAC sunucusu {bind_ip}:{pac_port} portuna bağlanamadı: {e}" + )); + } + } + Err(e) => { + return Err(format!( + "PAC sunucusu {bind_ip}:{pac_port} portuna bağlanamadı: {e}" + )) + } + } + }; + + let running = Arc::new(AtomicBool::new(true)); + let running_task = running.clone(); + let script = Arc::new(pac_script(&local_ip, proxy_port)); + let semaphore = Arc::new(Semaphore::new(MAX_CONCURRENT)); + + let task = tokio::spawn(async move { + while running_task.load(Ordering::SeqCst) { + let accepted = tokio::time::timeout( + Duration::from_millis(300), + listener.accept(), + ) + .await; + + let (mut socket, peer) = match accepted { + Ok(Ok(pair)) => pair, + Ok(Err(_)) => break, + Err(_) => continue, // timeout: re-check the stop flag + }; + + // Layer 2 (after the LocalSubnet firewall rule): reject public peers. + if !is_allowed_peer(peer.ip(), allow_lan) { + let _ = socket.shutdown().await; + continue; + } + + // PAC is tiny: disable Nagle so clients get the script immediately. + let _ = socket.set_nodelay(true); + + let permit = match semaphore.clone().try_acquire_owned() { + Ok(p) => p, + Err(_) => { + // Over the limit: drop without allocating. + let _ = socket.shutdown().await; + continue; + } + }; + + let body = script.clone(); + tokio::spawn(async move { + let _permit = permit; + + match tokio::time::timeout(READ_TIMEOUT, read_request(&mut socket)).await { + Ok(Ok(())) => { + let response = format!( + "HTTP/1.1 200 OK\r\n\ + Content-Type: application/x-ns-proxy-autoconfig; charset=utf-8\r\n\ + Content-Length: {}\r\n\ + Cache-Control: public, max-age=3600\r\n\ + X-Content-Type-Options: nosniff\r\n\ + Connection: close\r\n\ + \r\n{}", + body.len(), + body + ); + let _ = socket.write_all(response.as_bytes()).await; + } + Ok(Err(RequestError::TooLarge)) => { + let response = "HTTP/1.1 413 Payload Too Large\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"; + let _ = socket.write_all(response.as_bytes()).await; + } + _ => { + let response = "HTTP/1.1 408 Request Timeout\r\nContent-Length: 0\r\nConnection: close\r\n\r\n"; + let _ = socket.write_all(response.as_bytes()).await; + } + } + + let _ = socket.flush().await; + let _ = socket.shutdown().await; + let _ = peer; + }); + } + }); + + Ok(PacHandle { running, task }) +} + +/// Blocking HTTP GET used by diagnostics / self-test (no async runtime needed). +pub fn fetch_pac_blocking(pac_port: u16) -> Result { + use std::io::{Read, Write}; + use std::net::{SocketAddr, TcpStream}; + + let addr = SocketAddr::from(([127, 0, 0, 1], pac_port)); + let mut stream = TcpStream::connect_timeout(&addr, std::time::Duration::from_secs(2)) + .map_err(|e| format!("PAC sunucusuna bağlanılamadı: {e}"))?; + let _ = stream.set_read_timeout(Some(std::time::Duration::from_secs(3))); + stream + .write_all(b"GET /proxy.pac HTTP/1.1\r\nHost: 127.0.0.1\r\nConnection: close\r\n\r\n") + .map_err(|e| format!("PAC isteği gönderilemedi: {e}"))?; + + let mut body = String::new(); + stream + .read_to_string(&mut body) + .map_err(|e| format!("PAC yanıtı okunamadı: {e}"))?; + if !body.starts_with("HTTP/1.1 200") { + return Err(format!( + "PAC sunucusu beklenmeyen yanıt verdi: {}", + body.lines().next().unwrap_or("(boş)") + )); + } + Ok(body) +} diff --git a/src-tauri/src/proxy_sentinel.rs b/src-tauri/src/proxy_sentinel.rs new file mode 100644 index 0000000..d8cca22 --- /dev/null +++ b/src-tauri/src/proxy_sentinel.rs @@ -0,0 +1,673 @@ +//! LD FDPI — Native Windows system proxy manager with crash-safe backup / restore. +//! +//! Responsibilities: +//! * Back up the *complete* HKCU Internet Settings proxy state before touching it. +//! * Remove `AutoConfigURL` / `AutoDetect` while connected, because a PAC or WPAD +//! configuration takes precedence over `ProxyServer` and would silently bypass us. +//! * Push the change to every WinInet consumer with `InternetSetOptionW` +//! (`INTERNET_OPTION_SETTINGS_CHANGED` + `INTERNET_OPTION_REFRESH`) and a +//! `WM_SETTINGCHANGE` broadcast. +//! * Restore the exact previous values on disconnect, on app exit, or on the next +//! boot after a crash (dirty-state sentinel). +//! +//! Safety rule: if there is no valid backup on disk, restore is a **no-op**. The old +//! implementation fell back to `Default`, which disabled the proxy and deleted the +//! user's `ProxyServer` / `AutoConfigURL` values when the backup was missing. + +use serde::{Deserialize, Serialize}; +use std::fs; +use std::path::PathBuf; + +const INTERNET_SETTINGS: &str = + "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings"; + +/// Open Internet Settings with the minimum rights needed to write proxy values. +/// `create_subkey` requests KEY_ALL_ACCESS and can fail with Access Denied in +/// Windows Sandbox / hardened images even though the user can write values. +#[cfg(target_os = "windows")] +fn open_internet_settings() -> std::io::Result { + use winreg::enums::{HKEY_CURRENT_USER, KEY_READ, KEY_SET_VALUE}; + use winreg::RegKey; + + let hkcu = RegKey::predef(HKEY_CURRENT_USER); + hkcu.open_subkey_with_flags(INTERNET_SETTINGS, KEY_READ | KEY_SET_VALUE) + .or_else(|_| { + hkcu.create_subkey(INTERNET_SETTINGS) + .map(|(settings, _)| settings) + }) +} + +#[derive(Debug, Clone, Serialize, Deserialize)] +#[serde(default)] +pub struct ProxyBackup { + pub schema: u32, + pub dirty_sentinel: bool, + pub proxy_enable: u32, + pub proxy_server: Option, + pub proxy_override: Option, + pub auto_config_url: Option, + pub auto_detect: Option, + pub applied_ld_fdpi_server: String, + pub applied_port: u16, + pub winhttp_applied: bool, + pub timestamp_utc: u64, +} + +impl Default for ProxyBackup { + fn default() -> Self { + Self { + schema: 2, + dirty_sentinel: false, + proxy_enable: 0, + proxy_server: None, + proxy_override: None, + auto_config_url: None, + auto_detect: None, + applied_ld_fdpi_server: String::new(), + applied_port: 0, + winhttp_applied: false, + timestamp_utc: 0, + } + } +} + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct ApplyReport { + pub backup_saved: bool, + pub applied_server: String, + pub previous_proxy_enable: u32, + pub previous_proxy_server: Option, + pub previous_auto_config_url: Option, + pub winhttp_applied: bool, + pub warning: Option, +} + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct RestoreReport { + /// `restored` | `externalChangeKept` | `noBackup` + pub status: String, + pub proxy_enable: u32, + pub proxy_server: Option, + pub message: String, +} + +impl RestoreReport { + pub fn restored(&self) -> bool { + self.status == "restored" + } +} + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct SystemProxyState { + pub proxy_enable: u32, + pub proxy_server: Option, + pub proxy_override: Option, + pub auto_config_url: Option, + pub auto_detect: Option, + pub points_to_ld_fdpi_port: Option, +} + +pub fn sentinel_file_path() -> PathBuf { + crate::engine::app_data_dir().join("sentinel_proxy_backup.json") +} + +/// Clears a proxy that points at our own loopback port, even if the listener is +/// still half-alive. Fail-closed: never leave Windows pointed at a broken local +/// proxy after an aborted start. +#[cfg(target_os = "windows")] +pub fn clear_loopback(port: u16) -> bool { + let expected = format!("127.0.0.1:{port}"); + let Ok(current) = read_raw() else { + return false; + }; + if current.proxy_enable != 1 || current.proxy_server.as_deref() != Some(expected.as_str()) { + return false; + } + let Ok(settings) = open_internet_settings() else { + return false; + }; + let _ = settings.set_value("ProxyEnable", &0u32); + let _ = settings.delete_value("ProxyServer"); + refresh_wininet_proxy(); + true +} + +#[cfg(not(target_os = "windows"))] +pub fn clear_loopback(_port: u16) -> bool { + false +} + +/// Hard cleanup for a failed start. Clears any loopback proxy (not only the +/// configured port) and reads the registry back to confirm ProxyEnable=0. +#[cfg(target_os = "windows")] +pub fn force_disable_loopback(port: u16) -> bool { + let _ = clear_loopback(port); + let Ok(settings) = open_internet_settings() else { + return false; + }; + let Ok(current) = read_raw() else { + return false; + }; + let loopback = current + .proxy_server + .as_deref() + .map(|s| s.trim().starts_with("127.0.0.1:")) + .unwrap_or(false); + if current.proxy_enable == 1 && loopback { + let _ = settings.set_value("ProxyEnable", &0u32); + let _ = settings.delete_value("ProxyServer"); + refresh_wininet_proxy(); + } + read_raw() + .map(|s| s.proxy_enable == 0 && s.proxy_server.is_none()) + .unwrap_or(false) +} + +#[cfg(not(target_os = "windows"))] +pub fn force_disable_loopback(_port: u16) -> bool { + false +} + +/// Clears a proxy that points at our own loopback port while the engine is not +/// listening. This is the last-resort guard against a dead proxy surviving a +/// cancelled/raced startup and cutting the user's internet. +#[cfg(target_os = "windows")] +pub fn clear_dead_loopback(port: u16) -> bool { + if crate::engine::probe_local_port(port) { + return false; + } + clear_loopback(port) +} + +#[cfg(not(target_os = "windows"))] +pub fn clear_dead_loopback(_port: u16) -> bool { + false +} + +fn now_secs() -> u64 { + std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map(|d| d.as_secs()) + .unwrap_or(0) +} + +fn read_backup_from(path: &std::path::Path) -> Option { + let meta = fs::metadata(path).ok()?; + if !meta.is_file() || meta.len() > 64 * 1024 { + return None; + } + let raw = fs::read_to_string(path).ok()?; + let mut backup: ProxyBackup = serde_json::from_str(&raw).ok()?; + + // Defensive validation: a manipulated backup must not write arbitrary data. + if backup.proxy_enable > 1 { + backup.proxy_enable = 0; + } + if backup.applied_port != 0 && backup.applied_port < 1024 { + return None; + } + if backup.applied_ld_fdpi_server.len() > 64 { + return None; + } + if backup.proxy_server.as_ref().map(|s| s.len()).unwrap_or(0) > 2048 { + return None; + } + if backup.proxy_override.as_ref().map(|s| s.len()).unwrap_or(0) > 4096 { + return None; + } + if backup.auto_config_url.as_ref().map(|s| s.len()).unwrap_or(0) > 2048 { + return None; + } + Some(backup) +} + +fn read_backup() -> Option { + let path = sentinel_file_path(); + // A crash during atomic replacement can leave either side of the swap. + read_backup_from(&path) + .or_else(|| read_backup_from(&path.with_extension("json.bak"))) + .or_else(|| read_backup_from(&path.with_extension("json.tmp"))) +} + +fn write_backup(backup: &ProxyBackup) -> Result<(), String> { + let path = sentinel_file_path(); + let json = serde_json::to_string_pretty(backup) + .map_err(|e| format!("Sentinel yedeği serileştirilemedi: {e}"))?; + let tmp = path.with_extension("json.tmp"); + fs::write(&tmp, json) + .map_err(|e| format!("Sentinel yedeği yazılamadı ({}): {e}", tmp.display()))?; + if path.exists() { + let _ = fs::copy(&path, path.with_extension("json.bak")); + } + #[cfg(target_os = "windows")] + if path.exists() { + fs::remove_file(&path) + .map_err(|e| format!("Eski sentinel silinemedi ({}): {e}", path.display()))?; + } + if let Err(e) = fs::rename(&tmp, &path) { + let _ = fs::remove_file(&tmp); + return Err(format!("Sentinel yedeği taşınamadı ({}): {e}", path.display())); + } + Ok(()) +} + +#[cfg(target_os = "windows")] +fn read_raw() -> Result { + use winreg::enums::HKEY_CURRENT_USER; + use winreg::RegKey; + + let hkcu = RegKey::predef(HKEY_CURRENT_USER); + let settings = hkcu + .open_subkey(INTERNET_SETTINGS) + .map_err(|e| format!("Kayıt defteri okunamadı: {e}"))?; + + let proxy_enable: u32 = settings.get_value("ProxyEnable").unwrap_or(0); + let proxy_server: Option = settings.get_value("ProxyServer").ok(); + let proxy_override: Option = settings.get_value("ProxyOverride").ok(); + let auto_config_url: Option = settings.get_value("AutoConfigURL").ok(); + let auto_detect: Option = settings.get_value("AutoDetect").ok(); + + let points_to_ld_fdpi_port = proxy_server.as_ref().and_then(|s| { + let trimmed = s.trim(); + let port = trimmed + .rsplit_once(':') + .map(|(_, p)| p.trim()) + .and_then(|p| p.parse::().ok())?; + let host_ok = trimmed.starts_with("127.0.0.1:") + || trimmed.starts_with("localhost:") + || trimmed.starts_with("http=127.0.0.1:") + || trimmed.starts_with("https=127.0.0.1:"); + if host_ok { + Some(port) + } else { + None + } + }); + + Ok(SystemProxyState { + proxy_enable, + proxy_server, + proxy_override, + auto_config_url, + auto_detect, + points_to_ld_fdpi_port, + }) +} + +#[cfg(not(target_os = "windows"))] +fn read_raw() -> Result { + Ok(SystemProxyState { + proxy_enable: 0, + proxy_server: None, + proxy_override: None, + auto_config_url: None, + auto_detect: None, + points_to_ld_fdpi_port: None, + }) +} + +pub fn system_proxy_state() -> Result { + read_raw() +} + +/// Tells WinInet (Edge, WebView2, .NET, Discord's Chromium stack) that the proxy changed. +#[cfg(target_os = "windows")] +pub fn refresh_wininet_proxy() { + use windows_sys::Win32::Networking::WinInet::{ + InternetSetOptionW, INTERNET_OPTION_REFRESH, INTERNET_OPTION_SETTINGS_CHANGED, + }; + use windows_sys::Win32::UI::WindowsAndMessaging::{ + SendMessageTimeoutW, HWND_BROADCAST, SMTO_ABORTIFHUNG, WM_SETTINGCHANGE, + }; + + unsafe { + InternetSetOptionW( + std::ptr::null(), + INTERNET_OPTION_SETTINGS_CHANGED, + std::ptr::null(), + 0, + ); + InternetSetOptionW(std::ptr::null(), INTERNET_OPTION_REFRESH, std::ptr::null(), 0); + + // Some applications only listen for the shell broadcast. + let mut result: usize = 0; + let section: Vec = "Software\\Microsoft\\Windows\\CurrentVersion\\Internet Settings\0" + .encode_utf16() + .collect(); + SendMessageTimeoutW( + HWND_BROADCAST, + WM_SETTINGCHANGE, + 0, + section.as_ptr() as isize, + SMTO_ABORTIFHUNG, + 1000, + &mut result, + ); + } +} + +#[cfg(not(target_os = "windows"))] +pub fn refresh_wininet_proxy() {} + +/// Backs up the current proxy state (once per dirty session) and points Windows at +/// `127.0.0.1:`. +/// +/// `extend_winhttp` additionally routes WinHTTP (services/launchers) through the same +/// proxy — best effort, and only when WinHTTP is currently direct. +pub fn apply_system_proxy(proxy_port: u16, extend_winhttp: bool) -> Result { + let current = read_raw()?; + let applied_server = format!("127.0.0.1:{proxy_port}"); + + // Reuse the pristine snapshot if a previous session crashed, otherwise capture now. + let mut backup = match read_backup() { + Some(prev) if prev.dirty_sentinel => prev, + _ => ProxyBackup { + schema: 2, + dirty_sentinel: true, + proxy_enable: current.proxy_enable, + proxy_server: current.proxy_server.clone(), + proxy_override: current.proxy_override.clone(), + auto_config_url: current.auto_config_url.clone(), + auto_detect: current.auto_detect, + applied_ld_fdpi_server: applied_server.clone(), + applied_port: proxy_port, + winhttp_applied: false, + timestamp_utc: now_secs(), + }, + }; + + // A stale dirty snapshot may still have WinHTTP pointed at us; clear it first. + if backup.winhttp_applied { + let _ = crate::winhttp::reset(); + backup.winhttp_applied = false; + } + + backup.dirty_sentinel = true; + backup.applied_ld_fdpi_server = applied_server.clone(); + backup.applied_port = proxy_port; + // Arm the crash sentinel *before* touching WinHTTP so a crash is recoverable. + backup.winhttp_applied = extend_winhttp; + backup.timestamp_utc = now_secs(); + write_backup(&backup)?; + + #[cfg(target_os = "windows")] + { + let settings = open_internet_settings() + .map_err(|e| format!("Kayıt defterine yazılamadı (HKCU Internet Settings): {e}"))?; + + // PAC / WPAD win over ProxyServer — they must be out of the way while we are active. + let _ = settings.delete_value("AutoConfigURL"); + let _ = settings.set_value("AutoDetect", &0u32); + + settings + .set_value("ProxyEnable", &1u32) + .map_err(|e| format!("ProxyEnable yazılamadı: {e}"))?; + settings + .set_value("ProxyServer", &applied_server) + .map_err(|e| format!("ProxyServer yazılamadı: {e}"))?; + settings + .set_value( + "ProxyOverride", + &"localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.2*;172.30.*;172.31.*;192.168.*;", + ) + .map_err(|e| format!("ProxyOverride yazılamadı: {e}"))?; + } + + refresh_wininet_proxy(); + + // Verify the write actually landed; otherwise roll back and fail loudly. + let check = read_raw()?; + if check.proxy_enable != 1 || check.points_to_ld_fdpi_port != Some(proxy_port) { + let _ = restore_system_proxy(true); + return Err(format!( + "Sistem proxy'si yazıldıktan sonra doğrulanamadı (ProxyEnable={}, ProxyServer={:?}, beklenen port={}). \ + Bir güvenlik yazılımı kayıt defteri değişikliğini engelliyor olabilir.", + check.proxy_enable, check.proxy_server, proxy_port + )); + } + + // Optional WinHTTP coverage (game / system-wide mode). + let mut winhttp_applied = false; + let mut warning = None; + if extend_winhttp { + match crate::winhttp::apply(proxy_port) { + Ok(()) => winhttp_applied = true, + Err(e) => { + backup.winhttp_applied = false; + let _ = write_backup(&backup); + warning = Some(format!( + "WinHTTP sistem proxy'si uygulanamadı: {e} WinINet/Discord etkilenmedi." + )); + } + } + } + + Ok(ApplyReport { + backup_saved: true, + applied_server, + previous_proxy_enable: backup.proxy_enable, + previous_proxy_server: backup.proxy_server.clone(), + previous_auto_config_url: backup.auto_config_url.clone(), + winhttp_applied, + warning, + }) +} + +/// Restores the backed-up proxy state. +/// +/// * `force = false` (normal disconnect): if another tool changed `ProxyServer` +/// while LD FDPI was running, leave it alone and just mark the sentinel clean. +/// * `force = true` (emergency / crash recovery / uninstall): always restore. +pub fn restore_system_proxy(force: bool) -> Result { + let backup = match read_backup() { + Some(b) if b.schema > 0 || b.dirty_sentinel || b.applied_port > 0 => b, + _ => { + // Last-resort recovery: the proxy points at our loopback port but the + // backup is gone/corrupt. Clear the dead proxy instead of no-op. + let current = read_raw()?; + if force && current.proxy_enable == 1 && current.points_to_ld_fdpi_port.is_some() { + #[cfg(target_os = "windows")] + { + if let Ok(settings) = open_internet_settings() { + let _ = settings.set_value("ProxyEnable", &0u32); + let _ = settings.delete_value("ProxyServer"); + } + refresh_wininet_proxy(); + } + return Ok(RestoreReport { + status: "recoveredNoBackup".to_string(), + proxy_enable: 0, + proxy_server: None, + message: "Proxy yedeği okunamadı; ölü yerel proxy temizlendi.".to_string(), + }); + } + return Ok(RestoreReport { + status: "noBackup".to_string(), + proxy_enable: current.proxy_enable, + proxy_server: current.proxy_server.clone(), + message: "Kayıtlı proxy yedeği bulunamadı; sistem ayarlarına dokunulmadı.".to_string(), + }); + } + }; + + // A clean snapshot must never be replayed: the user may have configured a new + // proxy after our session ended. Only an "armed" (dirty) session is restored. + if !backup.dirty_sentinel { + let current = read_raw()?; + return Ok(RestoreReport { + status: "alreadyClean".to_string(), + proxy_enable: current.proxy_enable, + proxy_server: current.proxy_server.clone(), + message: "Geri yüklenecek etkin bir oturum yedeği yok (sentinel temiz).".to_string(), + }); + } + + let current = read_raw()?; + + // WinHTTP belongs to us and is restored even if the WinINet settings were + // changed by another tool in the meantime. + if backup.winhttp_applied { + let _ = crate::winhttp::reset(); + } + + if !force { + let ours = backup.applied_ld_fdpi_server.is_empty() + || current.proxy_server.as_deref() == Some(backup.applied_ld_fdpi_server.as_str()); + if !ours { + let mut clean = backup.clone(); + clean.dirty_sentinel = false; + clean.winhttp_applied = false; + let _ = write_backup(&clean); + // Do not clobber a foreign ProxyServer, but always give the user's + // PAC/WPAD/override settings back. + #[cfg(target_os = "windows")] + { + if let Ok(settings) = open_internet_settings() { + match backup.proxy_override.as_ref() { + Some(value) => { + let _ = settings.set_value("ProxyOverride", value); + } + None => { + let _ = settings.delete_value("ProxyOverride"); + } + } + match backup.auto_config_url.as_ref() { + Some(value) => { + let _ = settings.set_value("AutoConfigURL", value); + } + None => { + let _ = settings.delete_value("AutoConfigURL"); + } + } + match backup.auto_detect { + Some(value) => { + let _ = settings.set_value("AutoDetect", &value); + } + None => { + let _ = settings.delete_value("AutoDetect"); + } + } + } + refresh_wininet_proxy(); + } + return Ok(RestoreReport { + status: "externalChangeKept".to_string(), + proxy_enable: current.proxy_enable, + proxy_server: current.proxy_server.clone(), + message: format!( + "Harici bir proxy (Clash/v2rayN/kurumsal) algılandı (ProxyServer={:?}); \ + proxy korundu, PAC/DNS ayarları geri yüklendi.", + current.proxy_server + ), + }); + } + } + + #[cfg(target_os = "windows")] + { + let settings = open_internet_settings() + .map_err(|e| format!("Kayıt defterine yazılamadı (HKCU Internet Settings): {e}"))?; + + settings + .set_value("ProxyEnable", &backup.proxy_enable) + .map_err(|e| format!("ProxyEnable geri yüklenemedi: {e}"))?; + + match backup.proxy_server { + Some(ref value) => { + let _ = settings.set_value("ProxyServer", value); + } + None => { + let _ = settings.delete_value("ProxyServer"); + } + } + match backup.proxy_override { + Some(ref value) => { + let _ = settings.set_value("ProxyOverride", value); + } + None => { + let _ = settings.delete_value("ProxyOverride"); + } + } + match backup.auto_config_url { + Some(ref value) => { + let _ = settings.set_value("AutoConfigURL", value); + } + None => { + let _ = settings.delete_value("AutoConfigURL"); + } + } + match backup.auto_detect { + Some(value) => { + let _ = settings.set_value("AutoDetect", &value); + } + None => { + let _ = settings.delete_value("AutoDetect"); + } + } + } + + refresh_wininet_proxy(); + + let after = read_raw()?; + let matches = after.proxy_enable == backup.proxy_enable + && after.proxy_server == backup.proxy_server + && after.proxy_override == backup.proxy_override + && after.auto_config_url == backup.auto_config_url + && after.auto_detect == backup.auto_detect; + + if !matches { + // Keep the sentinel dirty so a later run can retry the restore. + return Err(format!( + "Proxy ayarları yazıldı ancak doğrulanamadı. Beklenen: ProxyEnable={} ProxyServer={:?} \ + AutoConfigURL={:?}; okunan: ProxyEnable={} ProxyServer={:?} AutoConfigURL={:?}.", + backup.proxy_enable, + backup.proxy_server, + backup.auto_config_url, + after.proxy_enable, + after.proxy_server, + after.auto_config_url + )); + } + + let mut clean = backup.clone(); + clean.dirty_sentinel = false; + clean.winhttp_applied = false; + write_backup(&clean)?; + + Ok(RestoreReport { + status: "restored".to_string(), + proxy_enable: after.proxy_enable, + proxy_server: after.proxy_server.clone(), + message: format!( + "Orijinal proxy ayarları geri yüklendi (ProxyEnable={}, ProxyServer={:?}).", + after.proxy_enable, after.proxy_server + ), + }) +} + +/// Runs at process start. If the previous session left `dirty_sentinel = true` +/// (BSOD, power loss, Task Manager kill), the original proxy is restored immediately. +/// Returns `(clean_boot, recovered)`. +pub fn run_startup_sentinel_check() -> (bool, bool) { + match read_backup() { + Some(backup) if backup.dirty_sentinel => match restore_system_proxy(true) { + Ok(report) if report.restored() => (false, true), + _ => (false, false), + }, + _ => (true, false), + } +} + +/// Human-readable one-liner used in the UI footer / diagnostics. +pub fn describe_current() -> String { + match read_raw() { + Ok(state) => format!( + "ProxyEnable={} ProxyServer={:?} AutoConfigURL={:?}", + state.proxy_enable, state.proxy_server, state.auto_config_url + ), + Err(e) => e, + } +} diff --git a/src-tauri/src/supervisor.rs b/src-tauri/src/supervisor.rs new file mode 100644 index 0000000..9028a45 --- /dev/null +++ b/src-tauri/src/supervisor.rs @@ -0,0 +1,93 @@ +//! Single-writer network mode supervisor. +//! +//! DPI and VPN transitions both acquire the same guard. This prevents the +//! supervisor loop, tray actions, auto-connect and UI commands from racing each +//! other (two sidecars, a proxy overwritten after quit, DPI while VPN is up). + +use std::sync::{Mutex, MutexGuard, OnceLock}; + +#[derive(Clone, Copy, PartialEq, Eq, Debug)] +pub enum NetMode { + Disconnected, + DpiActive, + VpnActive, + Transitioning, +} + +fn lock(mutex: &Mutex) -> MutexGuard<'_, T> { + mutex.lock().unwrap_or_else(|poisoned| poisoned.into_inner()) +} + +pub struct ModeGuard<'a> { + supervisor: &'a NetworkSupervisor, + previous: NetMode, + target: NetMode, + committed: bool, +} + +impl ModeGuard<'_> { + pub fn commit(mut self) { + *lock(&self.supervisor.mode) = self.target; + self.committed = true; + } +} + +impl Drop for ModeGuard<'_> { + fn drop(&mut self) { + if !self.committed { + *lock(&self.supervisor.mode) = self.previous; + } + } +} + +pub struct NetworkSupervisor { + mode: Mutex, +} + +static SUPERVISOR: OnceLock = OnceLock::new(); + +pub fn init(initial: NetMode) -> &'static NetworkSupervisor { + SUPERVISOR.get_or_init(|| NetworkSupervisor { + mode: Mutex::new(initial), + }) +} + +pub fn begin(target: NetMode, allow_same: bool) -> Result, String> { + let supervisor = init(NetMode::Disconnected); + let mut mode = lock(&supervisor.mode); + let previous = *mode; + + if previous == NetMode::Transitioning { + return Err("Ağ geçişi sürüyor; lütfen bekleyin.".to_string()); + } + if !allow_same && previous == target && target != NetMode::Disconnected { + return Err("Seçilen ağ modu zaten aktif.".to_string()); + } + match (previous, target) { + (NetMode::VpnActive, NetMode::DpiActive) => { + return Err("VPN açıkken DPI başlatılamaz.".to_string()) + } + (NetMode::DpiActive, NetMode::VpnActive) => { + return Err("DPI açıkken VPN başlatılamaz.".to_string()) + } + _ => {} + } + + *mode = NetMode::Transitioning; + drop(mode); + Ok(ModeGuard { + supervisor, + previous, + target, + committed: false, + }) +} + +pub fn current() -> NetMode { + *lock(&init(NetMode::Disconnected).mode) +} + +/// Used only on shutdown: wake a stuck transition without waiting for its guard. +pub fn force_disconnected() { + *lock(&init(NetMode::Disconnected).mode) = NetMode::Disconnected; +} diff --git a/src-tauri/src/updater.rs b/src-tauri/src/updater.rs new file mode 100644 index 0000000..66d2808 --- /dev/null +++ b/src-tauri/src/updater.rs @@ -0,0 +1,143 @@ +use serde::{Deserialize, Serialize}; + +const VERSION_URL_HOST: &str = "ttmadethat.shop"; +const VERSION_URL_PATH: &str = "/ld-fdpi/version.json"; +pub const DOWNLOAD_PAGE: &str = "https://ttmadethat.shop/ld-fdpi"; + +#[derive(Debug, Serialize)] +pub struct UpdateInfo { + pub current_version: String, + pub latest_version: String, + pub notes: String, + pub page_url: String, +} + +#[derive(Deserialize)] +struct VersionFile { + version: String, + #[serde(default)] + notes: String, + #[serde(default)] + page_url: String, +} + +fn parse_version(value: &str) -> Vec { + value + .trim() + .trim_start_matches('v') + .split('.') + .map(|part| { + part.chars() + .take_while(|c| c.is_ascii_digit()) + .collect::() + .parse::() + .unwrap_or(0) + }) + .collect() +} + +fn is_newer(latest: &str, current: &str) -> bool { + let mut left = parse_version(latest); + let mut right = parse_version(current); + while left.len() < 3 { + left.push(0); + } + while right.len() < 3 { + right.push(0); + } + left > right +} + +fn https_get(path: &str) -> Result { + use native_tls::TlsConnector; + use std::io::{Read, Write}; + use std::net::{TcpStream, ToSocketAddrs}; + + let addresses: Vec<_> = (VERSION_URL_HOST, 443) + .to_socket_addrs() + .map_err(|e| format!("Güncelleme DNS: {e}"))? + .collect(); + let connector = TlsConnector::new().map_err(|e| e.to_string())?; + for address in addresses { + let Ok(stream) = TcpStream::connect_timeout(&address, std::time::Duration::from_secs(5)) + else { + continue; + }; + let _ = stream.set_read_timeout(Some(std::time::Duration::from_secs(6))); + let _ = stream.set_write_timeout(Some(std::time::Duration::from_secs(6))); + let Ok(mut tls) = connector.connect(VERSION_URL_HOST, stream) else { + continue; + }; + let request = format!( + "GET {path} HTTP/1.0\r\nHost: {VERSION_URL_HOST}\r\n\ + User-Agent: LD-FDPI-Update/1\r\nConnection: close\r\n\r\n" + ); + if tls.write_all(request.as_bytes()).is_err() { + continue; + } + let mut response = Vec::new(); + let _ = tls.read_to_end(&mut response); + let text = String::from_utf8_lossy(&response); + if let Some((head, body)) = text.split_once("\r\n\r\n") { + let status_ok = head.lines().next().is_some_and(|line| line.starts_with("HTTP/1.0 200") || line.starts_with("HTTP/1.1 200")); + if status_ok { + return Ok(body.to_string()); + } + } + } + Err("Güncelleme sunucusuna ulaşılamadı.".to_string()) +} + +pub fn check() -> Result, String> { + let body = https_get(VERSION_URL_PATH)?; + let remote: VersionFile = + serde_json::from_str(&body).map_err(|e| format!("version.json geçersiz: {e}"))?; + let current = env!("CARGO_PKG_VERSION").to_string(); + if !is_newer(&remote.version, ¤t) { + return Ok(None); + } + let page_url = if remote.page_url.starts_with("https://ttmadethat.shop/") { + remote.page_url + } else { + DOWNLOAD_PAGE.to_string() + }; + Ok(Some(UpdateInfo { + current_version: current, + latest_version: remote.version, + notes: remote.notes, + page_url, + })) +} + +#[cfg(windows)] +pub fn open_download_page() -> Result<(), String> { + use std::ffi::OsStr; + use std::os::windows::ffi::OsStrExt; + use windows_sys::Win32::UI::Shell::ShellExecuteW; + use windows_sys::Win32::UI::WindowsAndMessaging::SW_SHOWNORMAL; + + let url: Vec = OsStr::new(DOWNLOAD_PAGE) + .encode_wide() + .chain(std::iter::once(0)) + .collect(); + let operation: Vec = OsStr::new("open").encode_wide().chain(std::iter::once(0)).collect(); + let result = unsafe { + ShellExecuteW( + std::ptr::null_mut(), + operation.as_ptr(), + url.as_ptr(), + std::ptr::null(), + std::ptr::null(), + SW_SHOWNORMAL, + ) + }; + if result as isize <= 32 { + return Err("İndirme sayfası açılamadı.".to_string()); + } + Ok(()) +} + +#[cfg(not(windows))] +pub fn open_download_page() -> Result<(), String> { + Err("Bu platformda desteklenmiyor.".to_string()) +} diff --git a/src-tauri/src/vpn.rs b/src-tauri/src/vpn.rs new file mode 100644 index 0000000..24cf58b --- /dev/null +++ b/src-tauri/src/vpn.rs @@ -0,0 +1,969 @@ +//! AmneziaWG VPN tab backend. +//! +//! The official AmneziaWG Windows client is shipped as an MSI resource. The +//! tunnel is managed through the documented `/installtunnelservice` and +//! `/uninstalltunnelservice` commands; no shell is used. Config files contain a +//! private key and are only written to the user's local app data directory. + +use serde::Serialize; +use std::fs; +use std::path::{Path, PathBuf}; +use std::process::{Command, Stdio}; +use std::sync::atomic::{AtomicBool, Ordering}; +use std::sync::{Mutex, MutexGuard}; +use std::time::Duration; + +#[cfg(target_os = "windows")] +use std::os::windows::process::CommandExt; + +use tauri::path::BaseDirectory; +use tauri::{AppHandle, Emitter, Manager}; + +const SERVICE: &str = "AmneziaWGTunnel$ld-fdpi"; +const CREATE_NO_WINDOW: u32 = 0x0800_0000; +static VPN_TRANSITION: Mutex<()> = Mutex::new(()); +static WATCHDOG_RUNNING: AtomicBool = AtomicBool::new(false); +static WATCHDOG_STOP: AtomicBool = AtomicBool::new(false); +static WATCHDOG_ALLOW_LAN: AtomicBool = AtomicBool::new(false); + +fn vpn_guard() -> MutexGuard<'static, ()> { + VPN_TRANSITION + .lock() + .unwrap_or_else(|poisoned| poisoned.into_inner()) +} + +fn hidden(command: &mut Command) -> &mut Command { + #[cfg(target_os = "windows")] + { + command.creation_flags(CREATE_NO_WINDOW); + } + command +} + +/// The upstream client ships a desktop manager next to the service binary. +/// The manager is launched by `/installtunnelservice`; close only the windowed +/// manager, never the session-0 tunnel service. +fn close_manager() { + let Ok(taskkill) = crate::engine::system32_binary("taskkill.exe") else { + return; + }; + let _ = hidden( + Command::new(taskkill) + .args(["/IM", "amneziawg.exe", "/FI", "WINDOWTITLE eq AmneziaWG", "/F"]) + .stdin(Stdio::null()), + ) + .output(); +} +const CLIENT_RELATIVE: &str = r"AmneziaWG\amneziawg.exe"; +const MSI_SHA256: &str = "a1b48ea8699cd347832a3691d832004574ef8ad65bcf887611ac8acb99b7de8b"; +const MAX_CONFIG: usize = 64 * 1024; + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct VpnStatus { + pub config_exists: bool, + pub client_installed: bool, + pub connected: bool, + pub service_state: String, + pub endpoint: Option, + pub address: Option, + pub detail: String, +} + +fn config_path() -> PathBuf { + crate::engine::app_data_dir().join("ld-fdpi.conf") +} + +fn client_path() -> PathBuf { + std::env::var_os("ProgramFiles") + .map(PathBuf::from) + .unwrap_or_else(|| PathBuf::from(r"C:\Program Files")) + .join(CLIENT_RELATIVE) +} + +fn client_installed() -> bool { + client_path().is_file() +} + +fn service_state() -> String { + let Ok(sc) = crate::engine::system32_binary("sc.exe") else { + return "unknown".to_string(); + }; + let output = match hidden( + Command::new(sc) + .args(["query", SERVICE]) + .stdin(Stdio::null()), + ) + .output() + { + Ok(output) => output, + Err(_) => return "unknown".to_string(), + }; + let text = format!( + "{}{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); + if text.contains("RUNNING") { + "running".to_string() + } else if text.contains("STOPPED") { + "stopped".to_string() + } else { + "not-installed".to_string() + } +} + +fn parse_summary(raw: &str) -> (Option, Option) { + let mut endpoint = None; + let mut address = None; + for line in raw.lines() { + let line = line.trim(); + if let Some(value) = line.strip_prefix("Endpoint") { + endpoint = value + .trim_start_matches([' ', '=']) + .trim() + .split_whitespace() + .next() + .map(|value| value.to_string()); + } + if let Some(value) = line.strip_prefix("Address") { + address = value + .trim_start_matches([' ', '=']) + .trim() + .split(',') + .next() + .map(|value| value.trim().to_string()); + } + } + (endpoint, address) +} + +fn status_from_disk() -> VpnStatus { + let path = config_path(); + let config_exists = path.is_file(); + let raw = config_exists + .then(|| fs::read_to_string(&path).ok()) + .flatten() + .unwrap_or_default(); + let (endpoint, address) = parse_summary(&raw); + let state = service_state(); + let connected = state == "running"; + let detail = if !client_installed() { + "İlk kullanım hazırlığı: BAĞLAN'a basın, VPN motoru otomatik kurulacak.".to_string() + } else if !config_exists { + "Cihaz profili BAĞLAN'a basınca otomatik oluşturulacak.".to_string() + } else if connected { + format!( + "AmneziaWG tüneli çalışıyor · {}", + endpoint.as_deref().unwrap_or("sunucu") + ) + } else { + "VPN bağlı değil.".to_string() + }; + VpnStatus { + config_exists, + client_installed: client_installed(), + connected, + service_state: state, + endpoint, + address, + detail, + } +} + +pub fn status() -> VpnStatus { + status_from_disk() +} + +const INTERFACE_KEYS: &[&str] = &[ + "Address", "DNS", "PrivateKey", "ListenPort", "MTU", "Jc", "Jmin", "Jmax", "S1", "S2", + "S3", "S4", "H1", "H2", "H3", "H4", "I1", "I2", "I3", "I4", "I5", + "HeaderProtectionKey", "RekeyAfterTime", "RekeyTimeout", "RejectAfterTime", + "KeepaliveTimeout", "MaxHandshakeAttempts", "RandomTrailers", "DisableCookies", +]; +const PEER_KEYS: &[&str] = &[ + "PublicKey", "PresharedKey", "AllowedIPs", "Endpoint", "PersistentKeepalive", +]; + +fn valid_endpoint(value: &str) -> bool { + let value = value.trim(); + let Some((host, port)) = value.rsplit_once(':') else { + return false; + }; + !host.is_empty() + && port + .parse::() + .map(|port| port > 0) + .unwrap_or(false) +} + +fn validate_config(text: &str) -> Result<(), String> { + if text.len() > MAX_CONFIG { + return Err("VPN yapılandırması 64 KB sınırını aşıyor.".to_string()); + } + let mut section = ""; + let mut has_interface = false; + let mut has_peer = false; + let mut has_private = false; + let mut has_public = false; + let mut has_endpoint = false; + + for (index, raw) in text.lines().enumerate() { + let line = raw.trim_start_matches('\u{feff}').trim(); + if line.is_empty() || line.starts_with('#') || line.starts_with(';') { + continue; + } + if line.len() > 4096 { + return Err(format!("VPN yapılandırması {}. satırı çok uzun.", index + 1)); + } + if line.starts_with('[') { + if !line.ends_with(']') { + return Err(format!("VPN yapılandırması {}. satırı geçersiz başlık.", index + 1)); + } + section = match &line[1..line.len() - 1] { + "Interface" => { + has_interface = true; + "Interface" + } + "Peer" => { + has_peer = true; + "Peer" + } + _ => { + return Err(format!( + "VPN yapılandırmasında desteklenmeyen bölüm: {}", + &line[1..line.len() - 1] + )) + } + }; + continue; + } + let (key, value) = line.split_once('=').ok_or_else(|| { + format!("VPN yapılandırması {}. satırı 'anahtar = değer' biçiminde değil.", index + 1) + })?; + let key = key.trim(); + let value = value.trim(); + if key.is_empty() || key.len() > 64 || key.chars().any(char::is_whitespace) { + return Err(format!("VPN yapılandırması {}. satırında geçersiz anahtar.", index + 1)); + } + if value.len() > 4096 { + return Err(format!("VPN yapılandırması {}. satırındaki değer çok uzun.", index + 1)); + } + let allowed = match section { + "Interface" => INTERFACE_KEYS.contains(&key), + "Peer" => PEER_KEYS.contains(&key), + _ => false, + }; + if !allowed { + return Err(format!( + "Güvenlik: '{}' anahtarı bu VPN yapılandırmasında kullanılamaz.", + key + )); + } + match (section, key) { + ("Interface", "PrivateKey") => has_private = !value.is_empty(), + ("Peer", "PublicKey") => has_public = !value.is_empty(), + ("Peer", "Endpoint") => { + if !valid_endpoint(value) { + return Err("VPN Endpoint 'host:port' biçiminde olmalı.".to_string()); + } + has_endpoint = true; + } + _ => {} + } + } + + if !has_interface || !has_peer { + return Err("Geçersiz AmneziaWG yapılandırması: [Interface] ve [Peer] gerekli.".to_string()); + } + if !has_private || !has_public || !has_endpoint { + return Err("Geçersiz AmneziaWG yapılandırması: PrivateKey, PublicKey ve Endpoint gerekli." + .to_string()); + } + Ok(()) +} + +fn write_private_config(path: &std::path::Path, text: &str) -> Result<(), String> { + if let Some(parent) = path.parent() { + fs::create_dir_all(parent).map_err(|e| format!("VPN klasörü oluşturulamadı: {e}"))?; + } + let tmp = path.with_extension("conf.tmp"); + fs::write(&tmp, text).map_err(|e| format!("VPN yapılandırması yazılamadı: {e}"))?; + #[cfg(target_os = "windows")] + if path.exists() { + // Windows rename does not replace an existing destination. + fs::remove_file(path).map_err(|e| format!("Eski VPN yapılandırması silinemedi: {e}"))?; + } + if let Err(e) = fs::rename(&tmp, path) { + let _ = fs::remove_file(&tmp); + return Err(format!("VPN yapılandırması taşınamadı: {e}")); + } + Ok(()) +} + +pub fn save_config(text: String) -> Result { + let _transition = vpn_guard(); + validate_config(&text)?; + write_private_config(&config_path(), &text)?; + if service_state() != "not-installed" { + let _ = service_control("stop"); + let _ = service_control("delete"); + close_manager(); + } + Ok(status_from_disk()) +} + +fn msi_resource(app: &AppHandle) -> Result { + let from_resource = app + .path() + .resolve("resources/amneziawg.msi", BaseDirectory::Resource) + .ok() + .filter(|path| path.is_file()); + if let Some(path) = from_resource { + return Ok(path); + } + let dev = PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("resources/amneziawg.msi"); + if dev.is_file() { + return Ok(dev); + } + let beside = std::env::current_exe() + .ok() + .and_then(|path| path.parent().map(|dir| dir.join("resources/amneziawg.msi"))) + .filter(|path| path.is_file()); + if let Some(path) = beside { + return Ok(path); + } + Err("AmneziaWG kurulum dosyası bulunamadı.".to_string()) +} + +fn plain_path(path: &Path) -> PathBuf { + let raw = path.to_string_lossy(); + raw.strip_prefix(r"\\?\") + .map(PathBuf::from) + .unwrap_or_else(|| path.to_path_buf()) +} + +fn msi_temp_paths() -> (PathBuf, PathBuf) { + let root = std::env::var_os("WINDIR") + .map(PathBuf::from) + .unwrap_or_else(std::env::temp_dir) + .join("Temp"); + (root.join("ld-amneziawg.msi"), root.join("ld-awg-msi.log")) +} + +pub fn install_client(app: &AppHandle) -> Result { + let _transition = vpn_guard(); + if client_installed() { + close_manager(); + return Ok(status_from_disk()); + } + let source = plain_path(&msi_resource(app)?); + let hash = crate::engine::sha256_file(&source)?; + if hash.to_lowercase() != MSI_SHA256 { + return Err("AmneziaWG MSI bütünlük doğrulaması başarısız.".to_string()); + } + + // msiexec rejects \\?\ extended paths and can fail with 1619 when the + // package lives under Program Files. Copy to a plain, space-free temp path. + let (msi, log) = msi_temp_paths(); + if let Some(parent) = msi.parent() { + fs::create_dir_all(parent).map_err(|e| format!("MSI temp klasörü: {e}"))?; + } + fs::copy(&source, &msi).map_err(|e| format!("MSI geçici kopya: {e}"))?; + let size = fs::metadata(&msi).map(|m| m.len()).unwrap_or(0); + if size == 0 { + let _ = fs::remove_file(&msi); + return Err("Geçici MSI kopyası boş.".to_string()); + } + + let msiexec = crate::engine::system32_binary("msiexec.exe")?; + let output = hidden( + Command::new(&msiexec) + .arg("/i") + .arg(&msi) + .args(["/qn", "/norestart", "/l*v"]) + .arg(&log) + .stdin(Stdio::null()), + ) + .output() + .map_err(|e| format!("AmneziaWG kurulumu başlatılamadı: {e}"))?; + if !output.status.success() || !client_installed() { + // A non-elevated app can still ask Windows for elevation. The MSI is + // SHA-256 verified above; the UAC prompt is the only user interaction. + #[cfg(target_os = "windows")] + { + use windows_sys::Win32::UI::Shell::ShellExecuteW; + let operation: Vec = "runas\0".encode_utf16().collect(); + let target: Vec = msiexec.to_string_lossy().encode_utf16().chain([0]).collect(); + let params: Vec = format!( + "/i \"{}\" /qn /norestart /l*v \"{}\"", + msi.display(), + log.display() + ) + .encode_utf16() + .chain([0]) + .collect(); + let result = unsafe { + ShellExecuteW( + std::ptr::null_mut(), + operation.as_ptr(), + target.as_ptr(), + params.as_ptr(), + std::ptr::null(), + 1, + ) + }; + if result as isize > 32 { + for _ in 0..120 { + if client_installed() { + let _ = fs::remove_file(&msi); + close_manager(); + return Ok(status_from_disk()); + } + std::thread::sleep(Duration::from_millis(500)); + } + } + } + let tail = fs::read_to_string(&log) + .ok() + .map(|text| { + text.lines() + .rev() + .take(20) + .collect::>() + .into_iter() + .rev() + .collect::>() + .join(" | ") + }) + .unwrap_or_default(); + let _ = fs::remove_file(&msi); + return Err(format!( + "AmneziaWG kurulumu başarısız (çıkış {:?}). MSI log: {}", + output.status.code(), + tail + )); + } + let _ = fs::remove_file(&msi); + close_manager(); + Ok(status_from_disk()) +} + +fn run_client(args: &[&str]) -> Result<(), String> { let path = client_path(); + if !path.is_file() { + return Err("AmneziaWG istemcisi kurulu değil.".to_string()); + } + let output = hidden( + Command::new(path) + .args(args) + .stdin(Stdio::null()), + ) + .output() + .map_err(|e| format!("AmneziaWG çalıştırılamadı: {e}"))?; + if output.status.success() { + return Ok(()); + } + let text = format!( + "{}{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); + Err(format!( + "AmneziaWG komutu başarısız (çıkış {:?}): {}", + output.status.code(), + text.trim() + )) +} + +fn service_control(action: &str) -> Result<(), String> { + let sc = crate::engine::system32_binary("sc.exe")?; + let output = hidden( + Command::new(sc) + .args([action, SERVICE]) + .stdin(Stdio::null()), + ) + .output() + .map_err(|e| format!("Tünel servisi {action} çalıştırılamadı: {e}"))?; + if output.status.success() { + return Ok(()); + } + let text = format!( + "{}{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ); + Err(format!("Tünel servisi {action} başarısız: {}", text.trim())) +} + +#[derive(Debug, Clone, Serialize)] +#[serde(rename_all = "camelCase")] +pub struct DnsCheck { + pub tunnel_active: bool, + pub servers: Vec, + pub egress_ip: Option, + pub leak_risk: bool, + pub detail: String, + pub physical_dns_blocked: bool, + pub ipv6_status: String, + pub egress_matches_vpn: bool, +} + +fn https_get(host: &str, path: &str) -> Option { + use std::io::{Read, Write}; + use std::net::{TcpStream, ToSocketAddrs}; + let addresses: Vec<_> = (host, 443).to_socket_addrs().ok()?.collect(); + let connector = native_tls::TlsConnector::builder().build().ok()?; + for address in addresses { + let Ok(stream) = TcpStream::connect_timeout(&address, Duration::from_secs(4)) else { + continue; + }; + let _ = stream.set_read_timeout(Some(Duration::from_secs(5))); + let _ = stream.set_write_timeout(Some(Duration::from_secs(5))); + let Ok(mut tls) = connector.connect(host, stream) else { + continue; + }; + let request = format!( + "GET {path} HTTP/1.1\r\nHost: {host}\r\nUser-Agent: LD-FDPI-DNS/1.0\r\nConnection: close\r\n\r\n" + ); + if tls.write_all(request.as_bytes()).is_err() { + continue; + } + let mut bytes = Vec::new(); + let _ = tls.take(16 * 1024).read_to_end(&mut bytes); + let text = String::from_utf8_lossy(&bytes); + let body = text.split("\r\n\r\n").nth(1).unwrap_or("").trim().to_string(); + if !body.is_empty() { + return Some(body); + } + } + None +} + +fn dns_servers() -> Vec { + let Ok(netsh) = crate::engine::system32_binary("netsh.exe") else { + return Vec::new(); + }; + let output = match hidden( + Command::new(netsh) + .args(["interface", "ipv4", "show", "dnsservers"]) + .stdin(Stdio::null()), + ) + .output() + { + Ok(output) => output, + Err(_) => return Vec::new(), + }; + let text = String::from_utf8_lossy(&output.stdout); + let mut servers = Vec::new(); + for line in text.lines() { + for token in line.split_whitespace() { + let token = token.trim_matches(|c: char| !c.is_ascii_digit() && c != '.'); + if token.parse::().is_ok() && !servers.iter().any(|s| s == token) { + servers.push(token.to_string()); + } + } + } + servers +} + +fn fetch_egress_ip() -> Option { + let body = https_get("1.1.1.1", "/cdn-cgi/trace")?; + body.lines() + .find_map(|line| line.strip_prefix("ip=")) + .map(|ip| ip.trim().to_string()) +} + +fn test_untrusted_dns_blocked(physical_ip: Option) -> bool { + use std::net::{SocketAddr, UdpSocket}; + let Some(ip) = physical_ip else { + return false; + }; + let Ok(sock) = UdpSocket::bind(SocketAddr::from((ip, 0))) else { + return false; + }; + let _ = sock.set_read_timeout(Some(Duration::from_millis(1200))); + let query: [u8; 29] = [ + 0xAB, 0xCD, 0x01, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x07, b'e', b'x', b'a', b'm', b'p', b'l', b'e', 0x03, b'c', b'o', b'm', + 0x00, 0x00, 0x01, 0x00, 0x01, + ]; + if sock.send_to(&query, "9.9.9.9:53").is_err() { + return true; + } + let mut buf = [0u8; 64]; + sock.recv_from(&mut buf).is_err() +} + +fn test_ipv6_leak_status(has_global_ipv6: bool) -> (&'static str, bool) { + if !has_global_ipv6 { + return ("not_applicable", true); + } + let target = std::net::SocketAddr::new( + std::net::IpAddr::V6(std::net::Ipv6Addr::new( + 0x2606, 0x4700, 0x4700, 0, 0, 0, 0, 0x1111, + )), + 443, + ); + match std::net::TcpStream::connect_timeout(&target, Duration::from_millis(1200)) { + Ok(_) => ("leaking", false), + Err(_) => ("blocked", true), + } +} + +pub fn dns_check() -> DnsCheck { + let connected = status().connected; + let expected_vpn_ip = "116.202.14.171"; + let (physical_ip, has_global_ipv6) = crate::wfp_killswitch::probe_physical_network(); + let egress_ip = fetch_egress_ip(); + let physical_dns_blocked = if connected { + test_untrusted_dns_blocked(physical_ip) + } else { + false + }; + let (ipv6_status, ipv6_safe) = if connected { + test_ipv6_leak_status(has_global_ipv6) + } else { + ("not_applicable", true) + }; + let egress_matches_vpn = egress_ip.as_deref() == Some(expected_vpn_ip); + let servers = if connected { + vec!["1.1.1.1".to_string(), "1.0.0.1".to_string()] + } else { + dns_servers() + }; + let leak_risk = connected && !(physical_dns_blocked && ipv6_safe && egress_matches_vpn); + let detail = if !connected { + "VPN kapalı; standart sistem bağlantısı aktif.".to_string() + } else { + format!( + "Çıkış IP: {} | Fiziksel DNS Engeli: {} | IPv6: {}", + egress_ip.as_deref().unwrap_or("yok"), + if physical_dns_blocked { "Aktif" } else { "AÇIK" }, + ipv6_status + ) + }; + DnsCheck { + tunnel_active: connected, + servers, + egress_ip, + leak_risk, + detail, + physical_dns_blocked, + ipv6_status: ipv6_status.to_string(), + egress_matches_vpn, + } +} + +pub(crate) fn start_service_only() -> Result<(), String> { + if service_state() == "not-installed" { + return Err("VPN servisi kurulu değil.".to_string()); + } + if service_state() != "running" { + service_control("start")?; + } + Ok(()) +} + +pub(crate) fn stop_service_only() -> Result<(), String> { + if service_state() == "running" { + service_control("stop")?; + } + Ok(()) +} + +pub fn connect(app: &AppHandle, allow_lan: bool) -> Result { + if !client_installed() { + emit_progress(app, "İlk kullanım hazırlığı: VPN motoru kuruluyor..."); + install_client(app)?; + } + if !config_ready() { + emit_progress(app, "Cihaz profili otomatik oluşturuluyor..."); + auto_enroll_config()?; + } + emit_progress(app, "Tünel başlatılıyor..."); + let status = connect_inner(allow_lan, Some(app))?; + if !wait_for_handshake() { + emit_progress(app, "Tünel yanıt vermedi; WFP kilidi kaldırılıp profil yenileniyor..."); + disable_wfp_for_retry()?; + let _ = stop_service_only(); + let _ = service_control("delete"); + let _ = fs::remove_file(config_path()); + auto_enroll_config()?; + let retry = connect_inner(allow_lan, Some(app))?; + if !wait_for_handshake() { + disable_wfp_for_retry()?; + let _ = stop_service_only(); + let _ = service_control("delete"); + return Err("Tünel 10 saniye içinde el sıkışmadı. Sunucu peer'ı yenilendi; tekrar deneyin.".to_string()); + } + start_watchdog(app, allow_lan); + return Ok(retry); + } + start_watchdog(app, allow_lan); + Ok(status) +} + +/// Headless entry point used by the isolated WFP acceptance test. +pub fn connect_for_test(allow_lan: bool) -> Result { + connect_inner(allow_lan, None) +} + +fn connect_inner(allow_lan: bool, app: Option<&AppHandle>) -> Result { + let _transition = vpn_guard(); + connect_locked(allow_lan, app) +} + +fn config_ready() -> bool { + let path = config_path(); + path.is_file() + && fs::read_to_string(&path) + .map(|text| validate_config(&text).is_ok()) + .unwrap_or(false) +} + +fn auto_enroll_config() -> Result<(), String> { + let identity = crate::identity::get_or_create_identity()?; + let response = crate::identity::auto_enroll()?; + let config = crate::identity::render_config(&identity, &response); + validate_config(&config)?; + write_private_config(&config_path(), &config) +} + +fn emit_progress(app: &AppHandle, message: &str) { + let _ = app.emit("vpn-progress", message.to_string()); +} + +fn wait_for_handshake() -> bool { + for _ in 0..10 { + if crate::engine::tcp_latency("1.1.1.1", 443).is_some() { + return true; + } + std::thread::sleep(Duration::from_secs(1)); + } + false +} + +/// Enrollment HTTPS must not run while the WFP catch-all is active. Retry the +/// teardown a few times and hard-fail instead of falling through to a request +/// that the kill-switch will blackhole. +fn disable_wfp_for_retry() -> Result<(), String> { + let mut last = String::new(); + for _ in 0..3 { + match crate::wfp_killswitch::disable_killswitch() { + Ok(()) => return Ok(()), + Err(e) => { + last = e; + std::thread::sleep(Duration::from_millis(250)); + } + } + } + Err(format!( + "Tünel el sıkışmadı ve WFP kill-switch temizlenemedi; internet kesilmemesi için VPN açık tutuldu: {last}" + )) +} + +fn connect_locked(allow_lan: bool, app: Option<&AppHandle>) -> Result { + if !client_installed() { + return Err("AmneziaWG istemcisi kurulu değil.".to_string()); + } + let config = config_path(); + if !config.is_file() { + return Err("VPN yapılandırması oluşturulamadı.".to_string()); + } + let config_str = config.to_string_lossy().to_string(); + if service_state() == "not-installed" { + run_client(&["/installtunnelservice", &config_str])?; + close_manager(); + } else if service_state() != "running" { + service_control("start")?; + } + for _ in 0..40 { + if service_state() == "running" { + break; + } + std::thread::sleep(Duration::from_millis(250)); + } + if service_state() != "running" { + close_manager(); + return Err("AmneziaWG tüneli 10 saniye içinde başlamadı.".to_string()); + } + + let mut luid = None; + for _ in 0..25 { + if let Ok(value) = crate::wfp_killswitch::find_tunnel_luid("ld-fdpi") { + luid = Some(value); + break; + } + std::thread::sleep(Duration::from_millis(200)); + } + let Some(luid) = luid else { + let _ = service_control("stop"); + close_manager(); + return Err("VPN adaptörü (LUID) 5 saniye içinde hazır olmadı.".to_string()); + }; + + if let Err(e) = crate::wfp_killswitch::enable_killswitch( + std::net::Ipv4Addr::new(116, 202, 14, 171), + 42771, + luid, + &[ + std::net::Ipv4Addr::new(1, 1, 1, 1), + std::net::Ipv4Addr::new(1, 0, 0, 1), + ], + allow_lan, + ) { + let _ = crate::wfp_killswitch::disable_killswitch(); + let _ = service_control("stop"); + close_manager(); + return Err(format!("Kill-switch etkinleştirilemedi: {e}")); + } + if let Some(app) = app { + emit_progress(app, "Bağlandı."); + } + close_manager(); + Ok(status_from_disk()) +} + +fn start_watchdog(app: &AppHandle, allow_lan: bool) { + WATCHDOG_ALLOW_LAN.store(allow_lan, Ordering::SeqCst); + WATCHDOG_STOP.store(false, Ordering::SeqCst); + if WATCHDOG_RUNNING.swap(true, Ordering::SeqCst) { + return; + } + let app = app.clone(); + std::thread::spawn(move || { + let mut failures = 0u8; + let mut recovery_attempts = 0u8; + loop { + for _ in 0..3 { + if WATCHDOG_STOP.load(Ordering::SeqCst) { + WATCHDOG_RUNNING.store(false, Ordering::SeqCst); + return; + } + std::thread::sleep(Duration::from_secs(1)); + } + if WATCHDOG_STOP.load(Ordering::SeqCst) { + WATCHDOG_RUNNING.store(false, Ordering::SeqCst); + return; + } + let service_running = service_state() == "running"; + if service_running && crate::engine::dns_probe("1.1.1.1", 2000) { + failures = 0; + continue; + } + if service_running { + failures = failures.saturating_add(1); + if failures < 3 { + continue; + } + emit_progress(&app, "Tünel yanıt vermiyor; kendi kendini onarma başlıyor..."); + } else { + emit_progress(&app, "VPN servisi durdu; kendi kendini onarma başlıyor..."); + } + { + let _transition = vpn_guard(); + if WATCHDOG_STOP.load(Ordering::SeqCst) { + WATCHDOG_RUNNING.store(false, Ordering::SeqCst); + return; + } + if let Err(e) = recover_locked(&app) { + recovery_attempts = recovery_attempts.saturating_add(1); + append_recovery_log(&format!("recovery failed ({recovery_attempts}): {e}")); + emit_progress(&app, &format!("Kendi kendini onarma başarısız: {e}")); + if recovery_attempts >= 3 { + emit_progress(&app, "Kendi kendini onarma 3 kez başarısız; watchdog durdu."); + WATCHDOG_RUNNING.store(false, Ordering::SeqCst); + return; + } + } else { + recovery_attempts = 0; + } + } + failures = 0; + } + }); +} + +fn recover_locked(app: &AppHandle) -> Result<(), String> { + append_recovery_log("recovery start"); + disable_wfp_for_retry()?; + append_recovery_log("wfp removed"); + stop_service_only()?; + let _ = service_control("delete"); + let _ = fs::remove_file(config_path()); + auto_enroll_config()?; + append_recovery_log("enrolled"); + let _ = service_control("delete"); + connect_locked(WATCHDOG_ALLOW_LAN.load(Ordering::SeqCst), Some(app))?; + if !wait_for_handshake() { + disable_wfp_for_retry()?; + let _ = stop_service_only(); + return Err("Yeniden bağlanma sonrası el sıkışma yok.".to_string()); + } + append_recovery_log("recovery complete"); + emit_progress(app, "Kendi kendini onarma tamamlandı."); + Ok(()) +} + +fn append_recovery_log(message: &str) { + let path = crate::engine::app_data_dir().join("auto-recovery.log"); + let _ = fs::create_dir_all(crate::engine::app_data_dir()); + if let Ok(mut file) = fs::OpenOptions::new().create(true).append(true).open(path) { + use std::io::Write; + let _ = writeln!(file, "{message}"); + } +} + +pub fn disconnect() -> Result { + WATCHDOG_STOP.store(true, Ordering::SeqCst); + let _transition = vpn_guard(); + let stop_result = stop_service_only(); + if let Err(wfp_error) = crate::wfp_killswitch::disable_killswitch() { + let _ = start_service_only(); + return Err(format!( + "Ağ kilidi (WFP) kaldırılamadı, internet erişimi kesilmemesi için VPN açık tutuldu: {wfp_error}" + )); + } + stop_result?; + close_manager(); + Ok(status_from_disk()) +} + +/// Best-effort teardown for app exit and uninstall. +pub fn shutdown() { + WATCHDOG_STOP.store(true, Ordering::SeqCst); + let _transition = vpn_guard(); + let _ = crate::wfp_killswitch::disable_killswitch(); + let _ = stop_service_only(); + close_manager(); +} + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn rejects_incomplete_config() { + assert!(validate_config("[Interface]\nPrivateKey = x\n").is_err()); + assert!(validate_config( + "[Interface]\nPrivateKey = x\n[Peer]\nPublicKey = y\nEndpoint = host:1\n" + ) + .is_ok()); + assert!(validate_config( + "[Interface]\nPrivateKey = x\n[Peer]\nPublicKey = y\nEndpoint = host:1\nPostUp = calc.exe\n" + ) + .is_err()); + assert!(validate_config( + "[Interface]\nPrivateKey = x\n[Peer]\nPublicKey = y\nEndpoint = host:notaport\n" + ) + .is_err()); + } + + #[test] + fn parses_summary_without_keys() { + let (endpoint, address) = + parse_summary("[Interface]\nAddress = 10.8.1.5/32\n[Peer]\nEndpoint = 1.2.3.4:42771\n"); + assert_eq!(address.as_deref(), Some("10.8.1.5/32")); + assert_eq!(endpoint.as_deref(), Some("1.2.3.4:42771")); + } +} diff --git a/src-tauri/src/wfp_killswitch.rs b/src-tauri/src/wfp_killswitch.rs new file mode 100644 index 0000000..7123064 --- /dev/null +++ b/src-tauri/src/wfp_killswitch.rs @@ -0,0 +1,937 @@ +//! Fail-closed WFP kill switch for the LD-FDPI VPN tunnel. +//! +//! Persistent filters are intentional: if the GUI or the tunnel service dies, +//! outbound traffic stays blocked until `disable_killswitch()` is called by the +//! app, `--restore-only`, or the uninstaller. + +#![cfg(windows)] + +use std::ffi::OsStr; +use std::net::Ipv4Addr; +use std::os::windows::ffi::OsStrExt; +use std::ptr; + +use windows_sys::core::GUID; +use windows_sys::Win32::Foundation::{ERROR_BUFFER_OVERFLOW, ERROR_SUCCESS, HANDLE}; +use windows_sys::Win32::NetworkManagement::IpHelper::{ + FreeMibTable, GetAdaptersAddresses, GetIfTable2, GAA_FLAG_SKIP_ANYCAST, + GAA_FLAG_SKIP_DNS_SERVER, GAA_FLAG_SKIP_MULTICAST, IP_ADAPTER_ADDRESSES_LH, MIB_IF_TABLE2, +}; +use windows_sys::Win32::NetworkManagement::WindowsFilteringPlatform::*; +use windows_sys::Win32::Networking::WinSock::{ + AF_INET, AF_INET6, AF_UNSPEC, SOCKADDR_IN, SOCKADDR_IN6, +}; + +const SUBLAYER_GUID: GUID = GUID { + data1: 0x7A9E4B12, + data2: 0x6C3D, + data3: 0x4E81, + data4: [0x9B, 0x2A, 0x1F, 0x8D, 0x5C, 0x4E, 0x9A, 0x01], +}; + +const fn filter_guid(seq: u8) -> GUID { + GUID { + data1: 0x7A9E4B13, + data2: 0x6C3D, + data3: 0x4E81, + data4: [0x9B, 0x2A, 0x1F, 0x8D, 0x5C, 0x4E, 0x9A, seq], + } +} + +const MAX_FILTER_SEQ: u8 = 52; +const FWP_E_FILTER_NOT_FOUND: u32 = 0x8032_0003; +const FWP_E_SUBLAYER_NOT_FOUND: u32 = 0x8032_0007; + +const WFP_SUBLAYER_FLAG_PERSISTENT: u32 = 0x0000_0001; +const WFP_FILTER_FLAG_PERSISTENT: u32 = 0x0000_0001; + +// FDPI QUIC compatibility filters deliberately use their own namespace. They +// must never share keys with the VPN kill-switch above; otherwise a DPI stop +// could delete a live VPN firewall or vice versa. +const FDPI_SUBLAYER_GUID: GUID = GUID { + data1: 0x7A9E4C12, + data2: 0x6C3D, + data3: 0x4E81, + data4: [0x9B, 0x2A, 0x1F, 0x8D, 0x5C, 0x4E, 0x9A, 0x01], +}; + +const fn fdpi_filter_guid(seq: u8) -> GUID { + GUID { + data1: 0x7A9E4C13, + data2: 0x6C3D, + data3: 0x4E81, + data4: [0x9B, 0x2A, 0x1F, 0x8D, 0x5C, 0x4E, 0x9A, seq], + } +} + +const FDPI_MAX_FILTER_SEQ: u8 = 40; + +fn wide_null(s: &str) -> Vec { + OsStr::new(s) + .encode_wide() + .chain(std::iter::once(0)) + .collect() +} + +/// WFP expects host-order IPv4 values in FWP_V4_ADDR_AND_MASK. +#[inline] +fn ipv4_to_wfp_u32(ip: Ipv4Addr) -> u32 { + u32::from_be_bytes(ip.octets()) +} + +struct EngineHandle(HANDLE); + +impl Drop for EngineHandle { + fn drop(&mut self) { + if !self.0.is_null() { + unsafe { + let _ = FwpmEngineClose0(self.0); + } + } + } +} + +fn open_engine() -> Result { + unsafe { + let mut session_name = wide_null("LD-FDPI Persistent WFP Manager"); + let mut session: FWPM_SESSION0 = std::mem::zeroed(); + session.displayData.name = session_name.as_mut_ptr(); + session.flags = 0; // non-dynamic; persistent filters survive GUI exit + session.txnWaitTimeoutInMSec = 5_000; + + let mut handle: HANDLE = ptr::null_mut(); + let status = FwpmEngineOpen0(ptr::null(), 10, ptr::null(), &session, &mut handle); + if status != ERROR_SUCCESS { + return Err(format!("FwpmEngineOpen0 başarısız: 0x{status:08X}")); + } + Ok(EngineHandle(handle)) + } +} + +pub fn find_tunnel_luid(adapter_hint: &str) -> Result { + unsafe { + let mut table: *mut MIB_IF_TABLE2 = ptr::null_mut(); + let status = GetIfTable2(&mut table); + if status != ERROR_SUCCESS || table.is_null() { + return Err(format!("GetIfTable2 hatası: 0x{status:08X}")); + } + + let rows = + std::slice::from_raw_parts((*table).Table.as_ptr(), (*table).NumEntries as usize); + let hint = adapter_hint.to_lowercase(); + let mut found = None; + for row in rows { + if row.OperStatus != 1 { + continue; + } + let alias = String::from_utf16_lossy(&row.Alias) + .trim_end_matches('\0') + .to_lowercase(); + let desc = String::from_utf16_lossy(&row.Description) + .trim_end_matches('\0') + .to_lowercase(); + if alias.contains(&hint) + || desc.contains(&hint) + || desc.contains("amnezia") + || desc.contains("wintun") + { + found = Some(row.InterfaceLuid.Value); + break; + } + } + FreeMibTable(table as *const _); + found.ok_or_else(|| "Aktif VPN tünel adaptörü (LUID) bulunamadı.".to_string()) + } +} + +/// Finds the physical Ethernet/Wi-Fi IPv4 and whether a global IPv6 exists. +pub fn probe_physical_network() -> (Option, bool) { + unsafe { + let flags = GAA_FLAG_SKIP_ANYCAST | GAA_FLAG_SKIP_MULTICAST | GAA_FLAG_SKIP_DNS_SERVER; + let mut buf_len: u32 = 16 * 1024; + let mut buf: Vec = vec![0u64; (buf_len as usize + 7) / 8]; + let mut ret = GetAdaptersAddresses( + AF_UNSPEC as u32, + flags, + ptr::null_mut(), + buf.as_mut_ptr() as *mut IP_ADAPTER_ADDRESSES_LH, + &mut buf_len, + ); + if ret == ERROR_BUFFER_OVERFLOW { + buf = vec![0u64; (buf_len as usize + 7) / 8]; + ret = GetAdaptersAddresses( + AF_UNSPEC as u32, + flags, + ptr::null_mut(), + buf.as_mut_ptr() as *mut IP_ADAPTER_ADDRESSES_LH, + &mut buf_len, + ); + } + if ret != ERROR_SUCCESS { + return (None, false); + } + + let mut physical = None; + let mut global_v6 = false; + let mut curr = buf.as_ptr() as *const IP_ADAPTER_ADDRESSES_LH; + while !curr.is_null() { + let adapter = &*curr; + let is_up = adapter.OperStatus == 1; + let is_physical = adapter.IfType == 6 || adapter.IfType == 71; + let desc = if adapter.Description.is_null() { + String::new() + } else { + let mut len = 0; + while *adapter.Description.add(len) != 0 { + len += 1; + } + String::from_utf16_lossy(std::slice::from_raw_parts(adapter.Description, len)) + .to_lowercase() + }; + let is_virtual = [ + "hyper-v", + "vmware", + "virtualbox", + "vethernet", + "loopback", + "wintun", + "amnezia", + "wireguard", + ] + .iter() + .any(|needle| desc.contains(needle)); + if is_up && is_physical && !is_virtual { + let mut ua = adapter.FirstUnicastAddress; + while !ua.is_null() { + let address = &*ua; + let sa = address.Address.lpSockaddr; + if !sa.is_null() { + match (*sa).sa_family { + f if f == AF_INET as u16 => { + let sin = &*(sa as *const SOCKADDR_IN); + let ip = Ipv4Addr::from(u32::from_be(sin.sin_addr.S_un.S_addr)); + let o = ip.octets(); + if physical.is_none() + && !ip.is_loopback() + && !(o[0] == 169 && o[1] == 254) + && !(o[0] == 10 && o[1] == 8 && o[2] == 1) + { + physical = Some(ip); + } + } + f if f == AF_INET6 as u16 => { + let sin6 = &*(sa as *const SOCKADDR_IN6); + let b = sin6.sin6_addr.u.Byte; + if (b[0] & 0xE0) == 0x20 { + global_v6 = true; + } + } + _ => {} + } + } + ua = address.Next; + } + } + curr = adapter.Next; + } + (physical, global_v6) + } +} + +pub fn disable_killswitch() -> Result<(), String> { + let engine = open_engine()?; + unsafe { + let status = FwpmTransactionBegin0(engine.0, 0); + if status != ERROR_SUCCESS { + return Err(format!("WFP TransactionBegin hatası: 0x{status:08X}")); + } + for seq in 1..=MAX_FILTER_SEQ { + let guid = filter_guid(seq); + let res = FwpmFilterDeleteByKey0(engine.0, &guid); + if res != ERROR_SUCCESS && res != FWP_E_FILTER_NOT_FOUND { + eprintln!("[LD-FDPI][WFP] filtre silme uyarı (seq={seq}): 0x{res:08X}"); + } + } + let sl = FwpmSubLayerDeleteByKey0(engine.0, &SUBLAYER_GUID); + if sl != ERROR_SUCCESS && sl != FWP_E_SUBLAYER_NOT_FOUND { + let _ = FwpmTransactionAbort0(engine.0); + return Err(format!("SubLayer silinemedi: 0x{sl:08X}")); + } + let commit = FwpmTransactionCommit0(engine.0); + if commit != ERROR_SUCCESS { + let _ = FwpmTransactionAbort0(engine.0); + return Err(format!("WFP disable commit hatası: 0x{commit:08X}")); + } + } + Ok(()) +} + +pub fn enable_killswitch( + endpoint_ip: Ipv4Addr, + endpoint_port: u16, + tunnel_luid: u64, + dns_servers: &[Ipv4Addr], + allow_lan: bool, +) -> Result<(), String> { + let _ = disable_killswitch(); + let result = enable_inner( + endpoint_ip, + endpoint_port, + tunnel_luid, + dns_servers, + allow_lan, + ); + if result.is_err() { + let _ = disable_killswitch(); + } + result +} + +fn enable_inner( + endpoint_ip: Ipv4Addr, + endpoint_port: u16, + tunnel_luid: u64, + dns_servers: &[Ipv4Addr], + allow_lan: bool, +) -> Result<(), String> { + let engine = open_engine()?; + let mut seq = 1u8; + unsafe { + let status = FwpmTransactionBegin0(engine.0, 0); + if status != ERROR_SUCCESS { + return Err(format!("Transaction başlatılamadı: 0x{status:08X}")); + } + let result = (|| -> Result<(), String> { + let mut name = wide_null("LD-FDPI KillSwitch SubLayer"); + let mut sublayer: FWPM_SUBLAYER0 = std::mem::zeroed(); + sublayer.subLayerKey = SUBLAYER_GUID; + sublayer.displayData.name = name.as_mut_ptr(); + sublayer.flags = WFP_SUBLAYER_FLAG_PERSISTENT; + sublayer.weight = 0xFF00; + let res = FwpmSubLayerAdd0(engine.0, &sublayer, ptr::null_mut()); + if res != ERROR_SUCCESS { + return Err(format!("SubLayer eklenemedi: 0x{res:08X}")); + } + + for layer in [ + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + FWPM_LAYER_ALE_AUTH_CONNECT_V6, + ] { + add_loopback(engine.0, &mut seq, layer, 15)?; + } + add_endpoint( + engine.0, + &mut seq, + 14, + ipv4_to_wfp_u32(endpoint_ip), + endpoint_port, + )?; + add_dhcp(engine.0, &mut seq, 14)?; + + if allow_lan { + for &(net, mask) in LAN_RANGES { + add_lan(engine.0, &mut seq, 13, ipv4_to_wfp_u32(net), mask)?; + } + } + for &dns in dns_servers { + for proto in [17u8, 6u8] { + add_tunnel_dns( + engine.0, + &mut seq, + 13, + tunnel_luid, + ipv4_to_wfp_u32(dns), + 53, + proto, + )?; + } + } + for layer in [ + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + FWPM_LAYER_ALE_AUTH_CONNECT_V6, + ] { + for port in [53u16, 853u16] { + add_port_block(engine.0, &mut seq, layer, 12, port)?; + } + } + add_luid_permit( + engine.0, + &mut seq, + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + 11, + tunnel_luid, + )?; + for (low, high) in [(3478u16, 3479u16), (5349, 5349), (19302, 19309)] { + for layer in [ + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + FWPM_LAYER_ALE_AUTH_CONNECT_V6, + ] { + add_stun_block(engine.0, &mut seq, layer, 10, low, high)?; + } + } + for layer in [ + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + FWPM_LAYER_ALE_AUTH_CONNECT_V6, + ] { + add_catchall(engine.0, &mut seq, layer, 1)?; + } + Ok(()) + })(); + if let Err(e) = result { + let _ = FwpmTransactionAbort0(engine.0); + return Err(e); + } + let commit = FwpmTransactionCommit0(engine.0); + if commit != ERROR_SUCCESS { + let _ = FwpmTransactionAbort0(engine.0); + return Err(format!("KillSwitch commit hatası: 0x{commit:08X}")); + } + } + Ok(()) +} + +const LAN_RANGES: &[(Ipv4Addr, u32)] = &[ + (Ipv4Addr::new(192, 168, 0, 0), 0xFFFF_0000), + (Ipv4Addr::new(172, 16, 0, 0), 0xFFF0_0000), + // 10.0.0.0/8 minus 10.8.1.0/24 + (Ipv4Addr::new(10, 0, 0, 0), 0xFFF8_0000), + (Ipv4Addr::new(10, 8, 0, 0), 0xFFFF_FF00), + (Ipv4Addr::new(10, 8, 2, 0), 0xFFFF_FE00), + (Ipv4Addr::new(10, 8, 4, 0), 0xFFFF_FC00), + (Ipv4Addr::new(10, 8, 8, 0), 0xFFFF_F800), + (Ipv4Addr::new(10, 8, 16, 0), 0xFFFF_F000), + (Ipv4Addr::new(10, 8, 32, 0), 0xFFFF_E000), + (Ipv4Addr::new(10, 8, 64, 0), 0xFFFF_C000), + (Ipv4Addr::new(10, 8, 128, 0), 0xFFFF_8000), + (Ipv4Addr::new(10, 9, 0, 0), 0xFFFF_0000), + (Ipv4Addr::new(10, 10, 0, 0), 0xFFFE_0000), + (Ipv4Addr::new(10, 12, 0, 0), 0xFFFC_0000), + (Ipv4Addr::new(10, 16, 0, 0), 0xFFF0_0000), + (Ipv4Addr::new(10, 32, 0, 0), 0xFFE0_0000), + (Ipv4Addr::new(10, 64, 0, 0), 0xFFC0_0000), + (Ipv4Addr::new(10, 128, 0, 0), 0xFF80_0000), +]; + +unsafe fn add_filter( + engine: HANDLE, + seq: &mut u8, + layer: GUID, + weight: u64, + action: FWP_ACTION_TYPE, + name: &str, + conditions: &mut [FWPM_FILTER_CONDITION0], +) -> Result<(), String> { + let mut weight_value = weight; + let mut name_w = wide_null(name); + let mut filter: FWPM_FILTER0 = std::mem::zeroed(); + filter.filterKey = filter_guid(*seq); + *seq += 1; + filter.layerKey = layer; + filter.subLayerKey = SUBLAYER_GUID; + filter.displayData.name = name_w.as_mut_ptr(); + filter.flags = WFP_FILTER_FLAG_PERSISTENT; + filter.action.r#type = action; + filter.weight.r#type = FWP_UINT64; + filter.weight.Anonymous.uint64 = &mut weight_value; + filter.numFilterConditions = conditions.len() as u32; + filter.filterCondition = conditions.as_mut_ptr(); + let res = FwpmFilterAdd0(engine, &filter, ptr::null_mut(), ptr::null_mut()); + if res != ERROR_SUCCESS { + return Err(format!("{name} eklenemedi: 0x{res:08X}")); + } + Ok(()) +} + +unsafe fn add_loopback( + engine: HANDLE, + seq: &mut u8, + layer: GUID, + weight: u64, +) -> Result<(), String> { + let mut cond: FWPM_FILTER_CONDITION0 = std::mem::zeroed(); + cond.fieldKey = FWPM_CONDITION_FLAGS; + cond.matchType = FWP_MATCH_FLAGS_ALL_SET; + cond.conditionValue.r#type = FWP_UINT32; + cond.conditionValue.Anonymous.uint32 = FWP_CONDITION_FLAG_IS_LOOPBACK; + add_filter( + engine, + seq, + layer, + weight, + FWP_ACTION_PERMIT, + "LD-FDPI Permit Loopback", + std::slice::from_mut(&mut cond), + ) +} + +unsafe fn add_endpoint( + engine: HANDLE, + seq: &mut u8, + weight: u64, + ip: u32, + port: u16, +) -> Result<(), String> { + let mut addr = FWP_V4_ADDR_AND_MASK { + addr: ip, + mask: 0xFFFF_FFFF, + }; + let mut conds: [FWPM_FILTER_CONDITION0; 3] = std::mem::zeroed(); + conds[0].fieldKey = FWPM_CONDITION_IP_REMOTE_ADDRESS; + conds[0].matchType = FWP_MATCH_EQUAL; + conds[0].conditionValue.r#type = FWP_V4_ADDR_MASK; + conds[0].conditionValue.Anonymous.v4AddrMask = &mut addr; + conds[1].fieldKey = FWPM_CONDITION_IP_REMOTE_PORT; + conds[1].matchType = FWP_MATCH_EQUAL; + conds[1].conditionValue.r#type = FWP_UINT16; + conds[1].conditionValue.Anonymous.uint16 = port; + conds[2].fieldKey = FWPM_CONDITION_IP_PROTOCOL; + conds[2].matchType = FWP_MATCH_EQUAL; + conds[2].conditionValue.r#type = FWP_UINT8; + conds[2].conditionValue.Anonymous.uint8 = 17; + add_filter( + engine, + seq, + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + weight, + FWP_ACTION_PERMIT, + "LD-FDPI Permit VPN Endpoint", + &mut conds, + ) +} + +unsafe fn add_dhcp(engine: HANDLE, seq: &mut u8, weight: u64) -> Result<(), String> { + let mut conds: [FWPM_FILTER_CONDITION0; 3] = std::mem::zeroed(); + conds[0].fieldKey = FWPM_CONDITION_IP_PROTOCOL; + conds[0].matchType = FWP_MATCH_EQUAL; + conds[0].conditionValue.r#type = FWP_UINT8; + conds[0].conditionValue.Anonymous.uint8 = 17; + conds[1].fieldKey = FWPM_CONDITION_IP_LOCAL_PORT; + conds[1].matchType = FWP_MATCH_EQUAL; + conds[1].conditionValue.r#type = FWP_UINT16; + conds[1].conditionValue.Anonymous.uint16 = 68; + conds[2].fieldKey = FWPM_CONDITION_IP_REMOTE_PORT; + conds[2].matchType = FWP_MATCH_EQUAL; + conds[2].conditionValue.r#type = FWP_UINT16; + conds[2].conditionValue.Anonymous.uint16 = 67; + add_filter( + engine, + seq, + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + weight, + FWP_ACTION_PERMIT, + "LD-FDPI Permit DHCPv4", + &mut conds, + ) +} + +unsafe fn add_lan( + engine: HANDLE, + seq: &mut u8, + weight: u64, + net: u32, + mask: u32, +) -> Result<(), String> { + let mut addr = FWP_V4_ADDR_AND_MASK { addr: net, mask }; + let mut conds: [FWPM_FILTER_CONDITION0; 2] = std::mem::zeroed(); + conds[0].fieldKey = FWPM_CONDITION_IP_REMOTE_ADDRESS; + conds[0].matchType = FWP_MATCH_EQUAL; + conds[0].conditionValue.r#type = FWP_V4_ADDR_MASK; + conds[0].conditionValue.Anonymous.v4AddrMask = &mut addr; + conds[1].fieldKey = FWPM_CONDITION_IP_REMOTE_PORT; + conds[1].matchType = FWP_MATCH_NOT_EQUAL; + conds[1].conditionValue.r#type = FWP_UINT16; + conds[1].conditionValue.Anonymous.uint16 = 53; + add_filter( + engine, + seq, + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + weight, + FWP_ACTION_PERMIT, + "LD-FDPI Permit LAN Subnet", + &mut conds, + ) +} + +unsafe fn add_tunnel_dns( + engine: HANDLE, + seq: &mut u8, + weight: u64, + luid: u64, + dns: u32, + port: u16, + proto: u8, +) -> Result<(), String> { + let mut luid = luid; + let mut addr = FWP_V4_ADDR_AND_MASK { + addr: dns, + mask: 0xFFFF_FFFF, + }; + let mut conds: [FWPM_FILTER_CONDITION0; 4] = std::mem::zeroed(); + conds[0].fieldKey = FWPM_CONDITION_IP_LOCAL_INTERFACE; + conds[0].matchType = FWP_MATCH_EQUAL; + conds[0].conditionValue.r#type = FWP_UINT64; + conds[0].conditionValue.Anonymous.uint64 = &mut luid; + conds[1].fieldKey = FWPM_CONDITION_IP_REMOTE_ADDRESS; + conds[1].matchType = FWP_MATCH_EQUAL; + conds[1].conditionValue.r#type = FWP_V4_ADDR_MASK; + conds[1].conditionValue.Anonymous.v4AddrMask = &mut addr; + conds[2].fieldKey = FWPM_CONDITION_IP_REMOTE_PORT; + conds[2].matchType = FWP_MATCH_EQUAL; + conds[2].conditionValue.r#type = FWP_UINT16; + conds[2].conditionValue.Anonymous.uint16 = port; + conds[3].fieldKey = FWPM_CONDITION_IP_PROTOCOL; + conds[3].matchType = FWP_MATCH_EQUAL; + conds[3].conditionValue.r#type = FWP_UINT8; + conds[3].conditionValue.Anonymous.uint8 = proto; + add_filter( + engine, + seq, + FWPM_LAYER_ALE_AUTH_CONNECT_V4, + weight, + FWP_ACTION_PERMIT, + "LD-FDPI Permit Tunnel DNS", + &mut conds, + ) +} + +unsafe fn add_port_block( + engine: HANDLE, + seq: &mut u8, + layer: GUID, + weight: u64, + port: u16, +) -> Result<(), String> { + let mut cond: FWPM_FILTER_CONDITION0 = std::mem::zeroed(); + cond.fieldKey = FWPM_CONDITION_IP_REMOTE_PORT; + cond.matchType = FWP_MATCH_EQUAL; + cond.conditionValue.r#type = FWP_UINT16; + cond.conditionValue.Anonymous.uint16 = port; + add_filter( + engine, + seq, + layer, + weight, + FWP_ACTION_BLOCK, + "LD-FDPI Block Untrusted DNS", + std::slice::from_mut(&mut cond), + ) +} + +unsafe fn add_stun_block( + engine: HANDLE, + seq: &mut u8, + layer: GUID, + weight: u64, + low: u16, + high: u16, +) -> Result<(), String> { + let mut range = FWP_RANGE0 { + valueLow: FWP_VALUE0 { + r#type: FWP_UINT16, + Anonymous: FWP_VALUE0_0 { uint16: low }, + }, + valueHigh: FWP_VALUE0 { + r#type: FWP_UINT16, + Anonymous: FWP_VALUE0_0 { uint16: high }, + }, + }; + let mut conds: [FWPM_FILTER_CONDITION0; 2] = std::mem::zeroed(); + conds[0].fieldKey = FWPM_CONDITION_IP_PROTOCOL; + conds[0].matchType = FWP_MATCH_EQUAL; + conds[0].conditionValue.r#type = FWP_UINT8; + conds[0].conditionValue.Anonymous.uint8 = 17; + conds[1].fieldKey = FWPM_CONDITION_IP_REMOTE_PORT; + conds[1].matchType = FWP_MATCH_RANGE; + conds[1].conditionValue.r#type = FWP_RANGE_TYPE; + conds[1].conditionValue.Anonymous.rangeValue = &mut range; + add_filter( + engine, + seq, + layer, + weight, + FWP_ACTION_BLOCK, + "LD-FDPI Block Physical STUN", + &mut conds, + ) +} + +unsafe fn add_luid_permit( + engine: HANDLE, + seq: &mut u8, + layer: GUID, + weight: u64, + luid: u64, +) -> Result<(), String> { + let mut luid = luid; + let mut cond: FWPM_FILTER_CONDITION0 = std::mem::zeroed(); + cond.fieldKey = FWPM_CONDITION_IP_LOCAL_INTERFACE; + cond.matchType = FWP_MATCH_EQUAL; + cond.conditionValue.r#type = FWP_UINT64; + cond.conditionValue.Anonymous.uint64 = &mut luid; + add_filter( + engine, + seq, + layer, + weight, + FWP_ACTION_PERMIT, + "LD-FDPI Permit Tunnel LUID", + std::slice::from_mut(&mut cond), + ) +} + +unsafe fn add_catchall( + engine: HANDLE, + seq: &mut u8, + layer: GUID, + weight: u64, +) -> Result<(), String> { + add_filter( + engine, + seq, + layer, + weight, + FWP_ACTION_BLOCK, + "LD-FDPI CatchAll Block", + &mut [], + ) +} +// --------------------------------------------------------------------------- +// FDPI QUIC compatibility layer +// --------------------------------------------------------------------------- + +fn fdpi_app_candidates() -> Vec { + use std::path::PathBuf; + let mut out = Vec::new(); + let mut push = |path: PathBuf| { + if path.is_file() && !out.iter().any(|item: &PathBuf| item == &path) { + out.push(path); + } + }; + if let Some(pf) = std::env::var_os("ProgramFiles") { + let base = PathBuf::from(pf); + push(base.join(r"Google\Chrome\Application\chrome.exe")); + push(base.join(r"Microsoft\Edge\Application\msedge.exe")); + push(base.join(r"BraveSoftware\Brave-Browser\Application\brave.exe")); + push(base.join(r"Mozilla Firefox\firefox.exe")); + push(base.join(r"Opera\launcher.exe")); + push(base.join(r"Discord\Discord.exe")); + } + if let Some(pf86) = std::env::var_os("ProgramFiles(x86)") { + let base = PathBuf::from(pf86); + push(base.join(r"Google\Chrome\Application\chrome.exe")); + push(base.join(r"Microsoft\Edge\Application\msedge.exe")); + push(base.join(r"BraveSoftware\Brave-Browser\Application\brave.exe")); + push(base.join(r"Mozilla Firefox\firefox.exe")); + push(base.join(r"Opera\launcher.exe")); + } + if let Some(local) = std::env::var_os("LOCALAPPDATA") { + let base = PathBuf::from(local); + push(base.join(r"Programs\Opera\launcher.exe")); + push(base.join(r"Discord\Update.exe")); + let discord = base.join("Discord"); + if let Ok(entries) = std::fs::read_dir(&discord) { + for entry in entries.flatten() { + let name = entry.file_name().to_string_lossy().to_string(); + if name.to_lowercase().starts_with("app-") { + push(entry.path().join("Discord.exe")); + } + } + } + } + out +} + +unsafe fn add_fdpi_filter( + engine: HANDLE, + seq: &mut u8, + layer: GUID, + weight: u64, + action: FWP_ACTION_TYPE, + name: &str, + conditions: &mut [FWPM_FILTER_CONDITION0], +) -> Result<(), String> { + let mut weight_value = weight; + let mut name_w = wide_null(name); + let mut filter: FWPM_FILTER0 = std::mem::zeroed(); + filter.filterKey = fdpi_filter_guid(*seq); + *seq += 1; + filter.layerKey = layer; + filter.subLayerKey = FDPI_SUBLAYER_GUID; + filter.displayData.name = name_w.as_mut_ptr(); + filter.flags = WFP_FILTER_FLAG_PERSISTENT; + filter.action.r#type = action; + filter.weight.r#type = FWP_UINT64; + filter.weight.Anonymous.uint64 = &mut weight_value; + filter.numFilterConditions = conditions.len() as u32; + filter.filterCondition = conditions.as_mut_ptr(); + let res = FwpmFilterAdd0(engine, &filter, ptr::null_mut(), ptr::null_mut()); + if res != ERROR_SUCCESS { + return Err(format!("{name} eklenemedi: 0x{res:08X}")); + } + Ok(()) +} + +unsafe fn add_fdpi_port_block( + engine: HANDLE, + seq: &mut u8, + layer: GUID, + weight: u64, + port: u16, + proto: u8, +) -> Result<(), String> { + let mut conds: [FWPM_FILTER_CONDITION0; 2] = std::mem::zeroed(); + conds[0].fieldKey = FWPM_CONDITION_IP_PROTOCOL; + conds[0].matchType = FWP_MATCH_EQUAL; + conds[0].conditionValue.r#type = FWP_UINT8; + conds[0].conditionValue.Anonymous.uint8 = proto; + conds[1].fieldKey = FWPM_CONDITION_IP_REMOTE_PORT; + conds[1].matchType = FWP_MATCH_EQUAL; + conds[1].conditionValue.r#type = FWP_UINT16; + conds[1].conditionValue.Anonymous.uint16 = port; + add_fdpi_filter( + engine, + seq, + layer, + weight, + FWP_ACTION_BLOCK, + "LD-FDPI Block Physical IPv6", + &mut conds, + ) +} + +/// Blocks outbound QUIC (UDP/443) only for known browser/Discord executables. +/// No global UDP/443 rule is created. Returns the number of apps covered. +pub fn enable_fdpi_quic_block() -> Result { + let _ = disable_fdpi_quic_block(); + let engine = open_engine()?; + let apps = fdpi_app_candidates(); + if apps.is_empty() { + return Ok(0); + } + let mut app_ids: Vec<*mut FWP_BYTE_BLOB> = Vec::new(); + unsafe { + for app in &apps { + let path = wide_null(&app.to_string_lossy()); + let mut blob: *mut FWP_BYTE_BLOB = ptr::null_mut(); + let rc = FwpmGetAppIdFromFileName0(path.as_ptr(), &mut blob); + if rc == ERROR_SUCCESS && !blob.is_null() { + app_ids.push(blob); + } + } + if app_ids.is_empty() { + return Ok(0); + } + let mut seq = 1u8; + let status = FwpmTransactionBegin0(engine.0, 0); + if status != ERROR_SUCCESS { + return Err(format!("FDPI WFP TransactionBegin: 0x{status:08X}")); + } + let result = (|| -> Result<(), String> { + let mut name = wide_null("LD-FDPI FDPI QUIC Sublayer"); + let mut sublayer: FWPM_SUBLAYER0 = std::mem::zeroed(); + sublayer.subLayerKey = FDPI_SUBLAYER_GUID; + sublayer.displayData.name = name.as_mut_ptr(); + sublayer.flags = WFP_SUBLAYER_FLAG_PERSISTENT; + sublayer.weight = 0xFE00; + let res = FwpmSubLayerAdd0(engine.0, &sublayer, ptr::null_mut()); + if res != ERROR_SUCCESS { + return Err(format!("FDPI WFP Sublayer eklenemedi: 0x{res:08X}")); + } + for layer in [FWPM_LAYER_ALE_AUTH_CONNECT_V4, FWPM_LAYER_ALE_AUTH_CONNECT_V6] { + // Loopback must never be blocked by the app rules. + let mut cond: FWPM_FILTER_CONDITION0 = std::mem::zeroed(); + cond.fieldKey = FWPM_CONDITION_FLAGS; + cond.matchType = FWP_MATCH_FLAGS_ALL_SET; + cond.conditionValue.r#type = FWP_UINT32; + cond.conditionValue.Anonymous.uint32 = FWP_CONDITION_FLAG_IS_LOOPBACK; + add_fdpi_filter( + engine.0, &mut seq, layer, 100, FWP_ACTION_PERMIT, + "LD-FDPI FDPI Permit Loopback", + std::slice::from_mut(&mut cond), + )?; + for blob in &app_ids { + let mut conds: [FWPM_FILTER_CONDITION0; 3] = std::mem::zeroed(); + conds[0].fieldKey = FWPM_CONDITION_ALE_APP_ID; + conds[0].matchType = FWP_MATCH_EQUAL; + conds[0].conditionValue.r#type = FWP_BYTE_BLOB_TYPE; + conds[0].conditionValue.Anonymous.byteBlob = *blob; + conds[1].fieldKey = FWPM_CONDITION_IP_PROTOCOL; + conds[1].matchType = FWP_MATCH_EQUAL; + conds[1].conditionValue.r#type = FWP_UINT8; + conds[1].conditionValue.Anonymous.uint8 = 17; + conds[2].fieldKey = FWPM_CONDITION_IP_REMOTE_PORT; + conds[2].matchType = FWP_MATCH_EQUAL; + conds[2].conditionValue.r#type = FWP_UINT16; + conds[2].conditionValue.Anonymous.uint16 = 443; + add_fdpi_filter( + engine.0, &mut seq, layer, 50, FWP_ACTION_BLOCK, + "LD-FDPI Block App QUIC/443", + &mut conds, + )?; + } + } + // FDPI has no IPv6 tunnel. Fail closed on physical IPv6 DNS/HTTPS + // instead of letting QUIC/DoH bypass the IPv4 proxy. + for port in [53u16, 443u16] { + for proto in [6u8, 17u8] { + add_fdpi_port_block( + engine.0, + &mut seq, + FWPM_LAYER_ALE_AUTH_CONNECT_V6, + 40, + port, + proto, + )?; + } + } + Ok(()) + })(); + if let Err(error) = result { + let _ = FwpmTransactionAbort0(engine.0); + for blob in app_ids { + let mut ptr_value = blob as *mut std::ffi::c_void; + let _ = FwpmFreeMemory0(&mut ptr_value as *mut *mut _ as *mut *mut std::ffi::c_void); + } + return Err(error); + } + let commit = FwpmTransactionCommit0(engine.0); + if commit != ERROR_SUCCESS { + let _ = FwpmTransactionAbort0(engine.0); + for blob in app_ids { + let mut ptr_value = blob as *mut std::ffi::c_void; + let _ = FwpmFreeMemory0(&mut ptr_value as *mut *mut _ as *mut *mut std::ffi::c_void); + } + return Err(format!("FDPI WFP commit: 0x{commit:08X}")); + } + for blob in app_ids { + let mut ptr_value = blob as *mut std::ffi::c_void; + let _ = FwpmFreeMemory0(&mut ptr_value as *mut *mut _ as *mut *mut std::ffi::c_void); + } + } + Ok(apps.len()) +} + +/// Removes only the FDPI QUIC sublayer/filters, never the VPN kill-switch. +pub fn disable_fdpi_quic_block() -> Result<(), String> { + let engine = open_engine()?; + unsafe { + let status = FwpmTransactionBegin0(engine.0, 0); + if status != ERROR_SUCCESS { + return Err(format!("FDPI WFP TransactionBegin: 0x{status:08X}")); + } + for seq in 1..=FDPI_MAX_FILTER_SEQ { + let _ = FwpmFilterDeleteByKey0(engine.0, &fdpi_filter_guid(seq)); + } + let sl = FwpmSubLayerDeleteByKey0(engine.0, &FDPI_SUBLAYER_GUID); + if sl != ERROR_SUCCESS && sl != FWP_E_SUBLAYER_NOT_FOUND { + let _ = FwpmTransactionAbort0(engine.0); + return Err(format!("FDPI WFP Sublayer silinemedi: 0x{sl:08X}")); + } + let commit = FwpmTransactionCommit0(engine.0); + if commit != ERROR_SUCCESS { + let _ = FwpmTransactionAbort0(engine.0); + return Err(format!("FDPI WFP cleanup commit: 0x{commit:08X}")); + } + } + Ok(()) +} diff --git a/src-tauri/src/winhttp.rs b/src-tauri/src/winhttp.rs new file mode 100644 index 0000000..9eb3210 --- /dev/null +++ b/src-tauri/src/winhttp.rs @@ -0,0 +1,94 @@ +//! Best-effort system-wide proxy (WinHTTP) for the "Game / system-wide" mode. +//! +//! SpoofDPI 0.12.2 is an HTTP CONNECT proxy; WinINet (browsers, Discord) already +//! uses it. Windows services, launchers and some games use WinHTTP instead, so the +//! second mode installs the same proxy there as well. +//! +//! Safety rule: WinHTTP is only touched when the current configuration is +//! "Direct access". A corporate/existing WinHTTP proxy is never overwritten. +//! Because we only change a direct configuration, restoring is a plain reset. + +use std::process::{Command, Stdio}; + +fn run_netsh(args: &[&str]) -> Result { + // Absolute System32 path: never resolve netsh through PATH/CWD (binary planting). + let netsh = crate::engine::system32_binary("netsh.exe")?; + let mut cmd = Command::new(netsh); + cmd.args(args).stdin(Stdio::null()); + + #[cfg(target_os = "windows")] + { + use std::os::windows::process::CommandExt; + const CREATE_NO_WINDOW: u32 = 0x0800_0000; + cmd.creation_flags(CREATE_NO_WINDOW); + } + + let output = cmd + .output() + .map_err(|e| format!("netsh çalıştırılamadı: {e}"))?; + let text = format!( + "{}{}", + String::from_utf8_lossy(&output.stdout), + String::from_utf8_lossy(&output.stderr) + ) + .trim() + .to_string(); + + if output.status.success() { + Ok(text) + } else { + // netsh is localized/OEM-encoded; return a readable message instead of mojibake. + Err(format!( + "WinHTTP ayarı yazılamadı (çıkış kodu {:?}). Yönetici izni gerekli olabilir.", + output.status.code() + )) + } +} + +/// `Some(true)` = direct, `Some(false)` = an existing proxy, `None` = unreadable. +pub fn is_direct() -> Option { + let out = run_netsh(&["winhttp", "show", "proxy"]).ok()?; + let lower = out.to_lowercase(); + if lower.contains("direct access") + || lower.contains("doğrudan erişim") + || lower.contains("dogrudan erisim") + || lower.contains("no proxy server") + { + Some(true) + } else if lower.contains("proxy server") || lower.contains("proxy sunucusu") { + Some(false) + } else { + None + } +} + +pub fn apply(port: u16) -> Result<(), String> { + match is_direct() { + Some(true) => { + let server = format!("proxy-server=127.0.0.1:{port}"); + run_netsh(&[ + "winhttp", + "set", + "proxy", + &server, + "bypass-list=localhost;127.0.0.1;::1", + ]) + .map(|_| ()) + } + Some(false) => Err( + "WinHTTP zaten bir proxy kullanıyor; mevcut kurumsal ayar korunuyor.".to_string(), + ), + None => Err("WinHTTP durumu okunamadı; ayarlar korunuyor.".to_string()), + } +} + +pub fn reset() -> Result<(), String> { + run_netsh(&["winhttp", "reset", "proxy"]).map(|_| ()) +} + +pub fn describe() -> String { + match run_netsh(&["winhttp", "show", "proxy"]) { + Ok(text) => text.lines().last().unwrap_or("(boş)").trim().to_string(), + Err(e) => e, + } +} diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json new file mode 100644 index 0000000..f91babe --- /dev/null +++ b/src-tauri/tauri.conf.json @@ -0,0 +1,77 @@ +{ + "productName": "LD FDPI", + "version": "1.7.0", + "identifier": "com.ldfdpi.desktop", + "build": { + "beforeDevCommand": "npm run dev", + "devUrl": "http://localhost:1420", + "beforeBuildCommand": "npm run build", + "frontendDist": "../dist" + }, + "app": { + "windows": [ + { + "label": "main", + "title": "LD FDPI - Yerel Proxy \u0026 DPI Bypass", + "width": 400, + "height": 740, + "minWidth": 380, + "minHeight": 620, + "resizable": true, + "fullscreen": false, + "center": true, + "visible": false, + "skipTaskbar": false + } + ], + "security": { + "csp": "default-src \u0027self\u0027; script-src \u0027self\u0027; style-src \u0027self\u0027 \u0027unsafe-inline\u0027; img-src \u0027self\u0027 data:; connect-src \u0027self\u0027 ipc: http://ipc.localhost" + } + }, + "bundle": { + "active": true, + "targets": [ + "nsis" + ], + "icon": [ + "icons/32x32.png", + "icons/128x128.png", + "icons/128x128@2x.png", + "icons/icon.icns", + "icons/icon.ico" + ], + "externalBin": [ + "binaries/spoofdpi" + ], + "resources": [ + "resources/amneziawg.msi" + ], + "windows": { + "webviewInstallMode": { + "type": "embedBootstrapper", + "silent": true + }, + "nsis": { + "installMode": "perMachine", + "languages": [ + "Turkish", + "English" + ], + "displayLanguageSelector": true, + "installerHooks": "nsis/hooks.nsh" + } + }, + "createUpdaterArtifacts": true + }, + "plugins": { + "updater": { + "endpoints": [ + "https://ttmadethat.shop/ld-fdpi/latest.json" + ], + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEZBRUY0NDhCODdENDVDNzUKUldSMVhOU0hpMFR2K3JsNjFEVVd6T081THFFcnFjZ21hOXVPUERrL1ZTQlFjM092S0FMVzJLTUgK", + "windows": { + "installMode": "passive" + } + } + } +} \ No newline at end of file diff --git a/src-tauri/windows-app-manifest.xml b/src-tauri/windows-app-manifest.xml new file mode 100644 index 0000000..01188a2 --- /dev/null +++ b/src-tauri/windows-app-manifest.xml @@ -0,0 +1,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true/pm + permonitorv2,permonitor + true + + + + + + + + + diff --git a/src/App.jsx b/src/App.jsx new file mode 100644 index 0000000..dfa4bf8 --- /dev/null +++ b/src/App.jsx @@ -0,0 +1,1841 @@ +import React, { useEffect, useMemo, useRef, useState } from "react"; +import { + ShieldCheck, + ShieldAlert, + Shield, + Power, + Zap, + Globe, + Gamepad2, + GraduationCap, + DoorOpen, + Gauge, + Activity, + Terminal, + Settings, + Info, + RefreshCw, + Copy, + Check, + ChevronDown, + RotateCcw, + Wifi, + Smartphone, + Lock, + Cpu, + Trash2, + AlertTriangle, + CheckCircle2, + XCircle, + X, + Languages, + Sparkles, + Server, +} from "lucide-react"; +import { QRCodeSVG } from "qrcode.react"; +import { TEXT } from "./i18n"; +import { + invokeTauri, + sanitizeText, + isTauriRuntime, + buildSpoofDpiArgs, + SPOOFDPI_VERSION, +} from "./utils/tauriBridge"; +import { listen } from "@tauri-apps/api/event"; +import { check as checkTauriUpdate } from "@tauri-apps/plugin-updater"; + +const EMPTY_STATUS = { + isConnected: false, + desiredConnected: false, + connecting: false, + engineAlive: false, + proxyRouted: false, + discordVerified: false, + webVerified: false, + latencyMs: 0, + lastError: null, +}; + +const engineConfigFrom = (cfg) => ({ + connectionMode: cfg.connectionMode, + bypassMode: cfg.bypassMode, + chunkSize: cfg.chunkSize, + dohProvider: cfg.dohProvider, + quicBlock: Boolean(cfg.quicBlock), + lanSharing: cfg.lanSharing, + proxyPort: cfg.proxyPort, + pacPort: cfg.pacPort, +}); + +function Toggle({ checked, onChange, label, desc, disabled = false }) { + return ( +
+
+
{label}
+
{desc}
+
+ +
+ ); +} + +function Pill({ tone = "slate", children }) { + const tones = { + slate: "bg-slate-800 text-slate-300 border-slate-700", + green: "bg-emerald-500/15 text-emerald-300 border-emerald-500/30", + amber: "bg-amber-500/15 text-amber-300 border-amber-500/30", + red: "bg-rose-500/15 text-rose-300 border-rose-500/30", + blue: "bg-blue-500/15 text-blue-300 border-blue-500/30", + }; + return ( + + {children} + + ); +} + +export default function App() { + const [lang, setLang] = useState("tr"); + const t = TEXT[lang]; + + const [view, setView] = useState("home"); + const [runtimeReady] = useState(() => isTauriRuntime()); + const [config, setConfig] = useState(null); + const [bootError, setBootError] = useState(null); + const configRef = useRef(null); + const saveQueue = useRef(Promise.resolve()); + const [status, setStatus] = useState(EMPTY_STATUS); + const [busy, setBusy] = useState(null); + const [lastError, setLastError] = useState(null); + const [engineFound, setEngineFound] = useState(true); + const [engineVersion, setEngineVersion] = useState(`SpoofDPI ${SPOOFDPI_VERSION}`); + const [localIp, setLocalIp] = useState("127.0.0.1"); + const [isAdmin, setIsAdmin] = useState(false); + const [appVersion, setAppVersion] = useState("1.7.0"); + const [updateInfo, setUpdateInfo] = useState(null); + const [updateBusy, setUpdateBusy] = useState(false); + const [updateError, setUpdateError] = useState(null); + const [autostartEffective, setAutostartEffective] = useState(false); + const [autostartWarning, setAutostartWarning] = useState(null); + + const [logs, setLogs] = useState([]); + const [logsOpen, setLogsOpen] = useState(false); + const [benchmarks, setBenchmarks] = useState([]); + const [benchmarking, setBenchmarking] = useState(false); + const [diagnostics, setDiagnostics] = useState(null); + const [diagRunning, setDiagRunning] = useState(false); + const [copied, setCopied] = useState(null); + const [ports, setPorts] = useState({ proxyPort: 18080, pacPort: 18081 }); + const [lanWarn, setLanWarn] = useState(false); + const [autostartNote, setAutostartNote] = useState(false); + const [eduroam, setEduroam] = useState(null); + const [captive, setCaptive] = useState(null); + const [autoBypass, setAutoBypass] = useState(null); + const [vpn, setVpn] = useState(null); + const [vpnBusy, setVpnBusy] = useState(null); + const [vpnError, setVpnError] = useState(null); + const [vpnProgress, setVpnProgress] = useState(null); + const [dnsCheck, setDnsCheck] = useState(null); + const [dnsChecking, setDnsChecking] = useState(false); + const dohAutoRan = useRef(false); + const [uiActive, setUiActive] = useState( + () => typeof document === "undefined" || document.visibilityState !== "hidden" + ); + + const logEndRef = useRef(null); + const prevConnected = useRef(false); + + const pushLog = (level, message) => { + const now = new Date(); + setLogs((prev) => [ + ...prev.slice(-149), + { + id: `${Date.now()}-${Math.random()}`, + time: now.toTimeString().split(" ")[0], + level, + text: sanitizeText(String(message ?? "")), + }, + ]); + }; + + // Load the initial snapshot once. + useEffect(() => { + if (!runtimeReady) { + setLastError(t.errors.tauri); + return; + } + let cancelled = false; + (async () => { + try { + const s = await invokeTauri("get_initial_state"); + if (cancelled) return; + setConfig(s.config); + configRef.current = s.config; + setBootError(null); + setPorts({ proxyPort: s.config.proxyPort, pacPort: s.config.pacPort }); + setEngineFound(s.engineFound); + setEngineVersion(s.engineVersion); + setLocalIp(s.localIp); + setIsAdmin(s.isAdmin); + setAppVersion(s.appVersion); + setAutostartEffective(s.autostartEffective); + setAutostartWarning(s.autostartError); + setStatus({ + ...EMPTY_STATUS, + isConnected: s.isConnected, + desiredConnected: s.desiredConnected, + connecting: s.connecting, + lastError: s.lastError, + }); + prevConnected.current = s.isConnected; + + pushLog("INFO", `LD FDPI ${s.appVersion} — ${s.engineVersion}`); + if (s.sentinelRecovered) { + pushLog("WARN", "Sentinel: önceki oturumdan kalan proxy ayarları geri yüklendi."); + } + if (!s.engineFound) pushLog("ERROR", t.errors.engine); + if (s.autostartError) pushLog("WARN", `Otomatik başlatma: ${s.autostartError}`); + if (s.isConnected) pushLog("SUCCESS", t.log.connected); + else if (s.desiredConnected) pushLog("INFO", t.log.auto); + } catch (error) { + if (!cancelled) { + setBootError(String(error)); + setLastError(String(error)); + pushLog("ERROR", String(error)); + } + } + })(); + return () => { + cancelled = true; + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [runtimeReady]); + + // Pause the status timer while the window is hidden in the tray or unfocused. + // The Rust supervisor keeps the tunnel alive independently. + useEffect(() => { + const update = () => + setUiActive( + document.visibilityState !== "hidden" && + (typeof document.hasFocus !== "function" || document.hasFocus()) + ); + update(); + document.addEventListener("visibilitychange", update); + window.addEventListener("focus", update); + window.addEventListener("blur", update); + return () => { + document.removeEventListener("visibilitychange", update); + window.removeEventListener("focus", update); + window.removeEventListener("blur", update); + }; + }, []); + + // Cheap status polling; the Rust supervisor does the heavy health checks. + useEffect(() => { + if (!runtimeReady || !uiActive) return undefined; + let cancelled = false; + + const tick = async () => { + try { + const s = await invokeTauri("get_status"); + if (cancelled) return; + setStatus((prev) => ({ ...prev, ...s })); + if (s.isConnected && !prevConnected.current) pushLog("SUCCESS", t.log.connected); + if (!s.isConnected && prevConnected.current) pushLog("INFO", t.log.disconnected); + prevConnected.current = s.isConnected; + if (s.lastError) setLastError(s.lastError); + } catch { + /* Rust is busy or reloading; next tick will retry */ + } + }; + + tick(); + const timer = setInterval(tick, 2500); + return () => { + cancelled = true; + clearInterval(timer); + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [runtimeReady, lang, uiActive]); + + // First launch: if DNS is still on "auto", benchmark before the user connects + // and persist the fastest resolver. Settings can override it afterwards. + useEffect(() => { + if (!runtimeReady || !config || config.dohProvider !== "auto" || dohAutoRan.current) { + return undefined; + } + dohAutoRan.current = true; + let cancelled = false; + (async () => { + try { + const results = await invokeTauri("benchmark_doh_resolvers"); + if (cancelled || !Array.isArray(results)) return; + setBenchmarks(results); + const best = results.find((item) => item.reachable); + if (best) { + await saveConfig({ dohProvider: best.id }); + if (!cancelled) { + pushLog("INFO", `DNS otomatik seçildi: ${best.name} (${best.latencyMs} ms).`); + } + } + } catch { + /* Network may be captive; leave "auto" and retry next launch. */ + } + })(); + return () => { + cancelled = true; + }; + // eslint-disable-next-line react-hooks/exhaustive-deps + }, [runtimeReady, config?.dohProvider]); + + // VPN progress comes from the Rust zero-touch setup pipeline. + useEffect(() => { + let unlisten = null; + let cancelled = false; + listen("vpn-progress", (event) => { + if (!cancelled) setVpnProgress(String(event.payload || "")); + }) + .then((fn) => { + if (cancelled) fn(); + else unlisten = fn; + }) + .catch(() => {}); + return () => { + cancelled = true; + if (unlisten) unlisten(); + }; + }, []); + + // VPN status is polled globally so DPI and VPN stay mutually exclusive. + useEffect(() => { + if (!runtimeReady) return undefined; + let cancelled = false; + const load = async () => { + try { + const snapshot = await invokeTauri("get_vpn_status"); + if (!cancelled) setVpn(snapshot); + } catch { + /* client not installed or service unavailable */ + } + }; + load(); + const timer = setInterval(load, 5000); + return () => { + cancelled = true; + clearInterval(timer); + }; + }, [runtimeReady]); + + // Eduroam SSID/MTU snapshot (only while the mode is selected and the UI is active). + useEffect(() => { + if (!runtimeReady || !uiActive || config?.connectionMode !== "eduroam") { + return undefined; + } + let cancelled = false; + const load = async () => { + try { + const snapshot = await invokeTauri("get_eduroam_status"); + if (!cancelled) setEduroam(snapshot); + } catch { + /* Wi-Fi service may be off; UI keeps the last value */ + } + }; + load(); + const timer = setInterval(load, 15000); + return () => { + cancelled = true; + clearInterval(timer); + }; + }, [runtimeReady, uiActive, config?.connectionMode]); + + useEffect(() => { + if (!runtimeReady) return undefined; + let cancelled = false; + invokeTauri("check_update") + .then((info) => { + if (!cancelled && info) setUpdateInfo(info); + }) + .catch(() => {}); + return () => { + cancelled = true; + }; + }, [runtimeReady]); + + const handleInstallUpdate = async () => { + if (updateBusy) return; + setUpdateBusy(true); + setUpdateError(null); + try { + await invokeTauri("prepare_for_update"); + const update = await checkTauriUpdate(); + if (!update) { + setUpdateError( + lang === "tr" + ? "Güncelleme bulunamadı. Sayfayı yenileyip tekrar deneyin." + : "No update found. Refresh and try again." + ); + return; + } + await update.downloadAndInstall(); + await invokeTauri("restart_app"); + } catch (error) { + setUpdateError( + lang === "tr" + ? "Güncelleme indirilemedi/doğrulanamadı. Lütfen tekrar deneyin." + : "Update could not be downloaded/verified. Please try again." + ); + pushLog("ERROR", `Güncelleme: ${String(error)}`); + } finally { + setUpdateBusy(false); + } + }; + + useEffect(() => { + if (logsOpen && logEndRef.current) { + logEndRef.current.scrollIntoView({ behavior: "smooth", block: "end" }); + } + }, [logs, logsOpen]); + + const saveConfig = (patch, restartIfConnected = false) => { + const run = async () => { + const previous = configRef.current; + if (!previous) return { config: null, warning: "Ayarlar henüz yüklenmedi." }; + const next = { ...previous, ...patch }; + configRef.current = next; + setConfig(next); + if (patch.proxyPort || patch.pacPort) { + setPorts({ + proxyPort: next.proxyPort, + pacPort: next.pacPort, + }); + } + + let res; + try { + res = await invokeTauri("save_config", { config: next }); + configRef.current = res.config; + setConfig(res.config); + setAutostartEffective(res.autostartEffective); + setAutostartWarning(res.warning || null); + if (res.warning) pushLog("WARN", res.warning); + } catch (error) { + configRef.current = previous; + setConfig(previous); + setLastError(String(error)); + pushLog("ERROR", String(error)); + return { config: previous, autostartEffective, warning: String(error) }; + } + + // Persist succeeded; a restart failure must not roll the saved config back. + if (restartIfConnected && status.isConnected) { + try { + const restarted = await invokeTauri("soft_restart_engine", { + config: engineConfigFrom(res.config), + }); + pushLog("SUCCESS", restarted.message || t.log.restart); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } + } + return res; + }; + + const queued = saveQueue.current.then(run, run); + saveQueue.current = queued.catch(() => {}); + return queued; + }; + + const handleConnect = async () => { + if (!config) return; + if (vpn?.connected) { + const message = "VPN açıkken DPI bağlantısı başlatılamaz. Önce VPN sekmesinden bağlantıyı kesin."; + setLastError(message); + pushLog("ERROR", message); + return; + } + setBusy("connect"); + setLastError(null); + pushLog("INFO", t.log.connecting); + try { + let active = config; + if (config.autoOptimize !== false) { + pushLog("INFO", "Otomatik test: DNS ve bypass modları sınanıyor..."); + try { + const [dohResults, bypassResult] = await Promise.all([ + invokeTauri("benchmark_doh_resolvers"), + invokeTauri("auto_select_bypass"), + ]); + if (Array.isArray(dohResults)) { + setBenchmarks(dohResults); + const bestDoh = dohResults.find((item) => item.reachable); + if (bestDoh) { + active = { ...active, dohProvider: bestDoh.id }; + pushLog("INFO", `Otomatik DNS: ${bestDoh.name} (${bestDoh.latencyMs} ms).`); + } + } + if (bypassResult?.success) { + setAutoBypass(bypassResult); + active = { ...active, bypassMode: bypassResult.mode }; + pushLog("INFO", `Otomatik bypass: ${bypassResult.name} (${bypassResult.latencyMs} ms).`); + } + if (active.dohProvider !== config.dohProvider || active.bypassMode !== config.bypassMode) { + await saveConfig({ + dohProvider: active.dohProvider, + bypassMode: active.bypassMode, + }); + } + } catch (error) { + pushLog("WARN", `Otomatik test atlandı: ${String(error)}`); + } + } + + const res = await invokeTauri("start_connection", { + config: engineConfigFrom(active), + }); + setStatus((prev) => ({ + ...prev, + isConnected: true, + desiredConnected: true, + connecting: false, + discordVerified: Boolean(res.discordVerified), + webVerified: Boolean(res.webVerified), + latencyMs: res.latencyMs || 0, + })); + pushLog("SUCCESS", res.message); + if (res.dohProvider) { + pushLog( + "INFO", + `DoH: ${res.dohProvider}${res.dohLatencyMs ? ` (${res.dohLatencyMs} ms)` : ""}` + ); + } + if (res.warning) pushLog("WARN", res.warning); + prevConnected.current = true; + if (config.connectionMode === "eduroam") { + invokeTauri("get_eduroam_status").then(setEduroam).catch(() => {}); + } + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + setStatus((prev) => ({ + ...prev, + isConnected: false, + desiredConnected: false, + connecting: false, + })); + } finally { + setBusy(null); + } + }; + + const handleDisconnect = async () => { + setBusy("disconnect"); + try { + const res = await invokeTauri("stop_connection"); + setStatus((prev) => ({ + ...prev, + isConnected: false, + desiredConnected: false, + connecting: false, + discordVerified: false, + webVerified: false, + latencyMs: 0, + })); + prevConnected.current = false; + pushLog(res.externalProxyDetected ? "WARN" : "SUCCESS", res.message); + setLastError(null); + if (config?.connectionMode === "eduroam") { + invokeTauri("get_eduroam_status").then(setEduroam).catch(() => {}); + } + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setBusy(null); + } + }; + + const handleToggle = () => { + if (status.isConnected) handleDisconnect(); + else handleConnect(); + }; + + const handleLan = async (enabled) => { + if (!config) return; + setBusy("lan"); + try { + const res = await invokeTauri("toggle_lan_sharing", { + enabled, + proxyPort: config.proxyPort, + pacPort: config.pacPort, + }); + setConfig((prev) => ({ ...prev, lanSharing: enabled })); + setLanWarn(enabled && !res.firewallRuleUpdated); + pushLog(enabled ? "SUCCESS" : "INFO", res.message); + setLastError(null); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setBusy(null); + } + }; + + const handleFastestDoh = async () => { + setBenchmarking(true); + try { + const results = await invokeTauri("benchmark_doh_resolvers"); + if (Array.isArray(results)) setBenchmarks(results); + const best = results?.find((r) => r.reachable); + if (!best) { + pushLog("WARN", "Hiçbir DoH uç noktasına ulaşılamadı."); + return; + } + await saveConfig({ dohProvider: best.id }, true); + pushLog("SUCCESS", `${t.log.fastest}: ${best.name} (${best.latencyMs} ms)`); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setBenchmarking(false); + } + }; + + const handleDiagnostics = async () => { + setDiagRunning(true); + try { + const items = await invokeTauri("run_diagnostics"); + setDiagnostics(Array.isArray(items) ? items : []); + const ok = (items || []).filter((i) => i.passed).length; + pushLog("INFO", `Tanılama: ${ok}/${(items || []).length} kontrol başarılı.`); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setDiagRunning(false); + } + }; + + const refreshEduroam = async () => { + try { + const snapshot = await invokeTauri("get_eduroam_status"); + setEduroam(snapshot); + return snapshot; + } catch { + return null; + } + }; + + const handleEduroamConnect = async () => { + setBusy("eduroam"); + try { + const message = await invokeTauri("connect_eduroam_wifi"); + pushLog("SUCCESS", message); + setLastError(null); + await refreshEduroam(); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setBusy(null); + } + }; + + const handleGameToggle = async (enabled) => { + if (config?.connectionMode === "eduroam") return; + setBusy("mode"); + try { + await saveConfig({ connectionMode: enabled ? "game" : "normal" }, true); + } finally { + setBusy(null); + } + }; + + const handleEduroamToggle = async (enabled) => { + setBusy("mode"); + try { + if (enabled) { + await saveConfig( + { + connectionMode: "eduroam", + bypassMode: 1, + chunkSize: 4, + dohProvider: config?.dohProvider || "auto", + }, + true + ); + await refreshEduroam(); + } else { + await saveConfig({ connectionMode: "normal" }, true); + setEduroam(null); + } + } finally { + setBusy(null); + } + }; + + const handleWifiSettings = async () => { + try { + await invokeTauri("open_wifi_settings"); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } + }; + + const handleEduroamDiagnostics = async () => { + setDiagRunning(true); + try { + const items = await invokeTauri("run_eduroam_diagnostics"); + setDiagnostics(Array.isArray(items) ? items : []); + const ok = (items || []).filter((i) => i.passed).length; + pushLog("INFO", `Eduroam ağ testi: ${ok}/${(items || []).length} kontrol başarılı.`); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setDiagRunning(false); + } + }; + + const handleCaptiveConnect = async () => { + setBusy("captive"); + setCaptive(null); + try { + const result = await invokeTauri("connect_without_login"); + setCaptive(result); + const level = result.state === "online" ? "SUCCESS" : result.state === "portal" ? "WARN" : "ERROR"; + pushLog(level, result.detail); + if (result.portalUrl) pushLog("INFO", `Portal: ${result.portalUrl}`); + setLastError(result.state === "blocked" || result.state === "eduroam" ? result.detail : null); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setBusy(null); + } + }; + + const handleAutoBypass = async () => { + setBusy("autoBypass"); + setAutoBypass(null); + try { + const result = await invokeTauri("auto_select_bypass"); + setAutoBypass(result); + if (result?.success) { + await saveConfig({ bypassMode: result.mode }, true); + pushLog("SUCCESS", `Otomatik bypass: ${result.name} (${result.latencyMs} ms).`); + } else { + pushLog("WARN", t.power.autoFail); + } + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setBusy(null); + } + }; + + const handleVpnToggle = async () => { + if (!vpn?.connected && connected) { + const message = "DPI bağlantısı açıkken VPN başlatılamaz. Önce DPI bağlantısını kesin."; + setVpnError(message); + pushLog("ERROR", message); + return; + } + setVpnBusy(vpn?.connected ? "disconnect" : "connect"); + setVpnError(null); + setVpnProgress(null); + try { + const snapshot = await invokeTauri(vpn?.connected ? "disconnect_vpn" : "connect_vpn"); + setVpn(snapshot); + pushLog(snapshot.connected ? "SUCCESS" : "INFO", snapshot.detail); + } catch (error) { + setVpnError(String(error)); + pushLog("ERROR", String(error)); + } finally { + setVpnBusy(null); + setVpnProgress(null); + } + }; + + const handleDnsCheck = async () => { + setDnsChecking(true); + try { + const result = await invokeTauri("run_dns_check"); + setDnsCheck(result); + pushLog(result.leakRisk ? "WARN" : "INFO", result.detail); + } catch (error) { + pushLog("ERROR", String(error)); + } finally { + setDnsChecking(false); + } + }; + + const handleEmergencyRestore = async () => { + try { + const res = await invokeTauri("emergency_sentinel_restore"); + setStatus((prev) => ({ ...prev, isConnected: false, desiredConnected: false })); + prevConnected.current = false; + pushLog(res.restored ? "SUCCESS" : "WARN", res.message); + setLastError(null); + } catch (error) { + setLastError(String(error)); + pushLog("ERROR", String(error)); + } + }; + + const savePorts = async () => { + const proxyPort = Math.max(1024, Math.min(65535, Number(ports.proxyPort) || 18080)); + const pacPort = Math.max(1024, Math.min(65535, Number(ports.pacPort) || 18081)); + if (proxyPort === pacPort) { + setLastError(lang === "tr" ? "Proxy ve PAC portu aynı olamaz." : "Proxy and PAC ports must differ."); + return; + } + await saveConfig({ proxyPort, pacPort }, false); + setPorts({ proxyPort, pacPort }); + pushLog("INFO", t.log.configSaved); + }; + + const copyText = async (key, text) => { + try { + await navigator.clipboard.writeText(text); + } catch { + const area = document.createElement("textarea"); + area.value = text; + document.body.appendChild(area); + area.select(); + try { + document.execCommand("copy"); + } finally { + document.body.removeChild(area); + } + } + setCopied(key); + setTimeout(() => setCopied(null), 1600); + }; + + const pacUrl = `http://${localIp}:${config?.pacPort ?? 18081}/proxy.pac`; + const manualProxy = `${localIp}:${config?.proxyPort ?? 18080}`; + + const cliPreview = useMemo( + () => (config ? `spoofdpi.exe ${buildSpoofDpiArgs(config).join(" ")}` : ""), + [config] + ); + + const connected = status.isConnected; + const vpnConnected = Boolean(vpn?.connected); + const connecting = status.connecting || busy === "connect"; + const autoWaiting = !connected && !connecting && status.desiredConnected; + + const statusTitle = vpnConnected + ? t.status.vpnConnected + : connected + ? t.status.fdpiConnected + : connecting + ? t.status.connecting + : autoWaiting + ? t.status.autoConnecting + : t.status.disconnected; + + const statusTone = vpnConnected || connected ? "green" : connecting || autoWaiting ? "amber" : "slate"; + + if (!config) { + return ( +
+ LD FDPI +
+ {runtimeReady ? "LD FDPI başlatılıyor..." : t.errors.tauri} +
+ {bootError && ( +
+

{bootError}

+ +
+ )} +
+ ); + } + + return ( +
+ {/* Main */} +
+
+
+ LD FDPI +
+

{t.nav[view]}

+

+ {vpnConnected + ? vpn?.endpoint || "AmneziaWG" + : connected + ? `${localIp}:${config.proxyPort}` + : "LD FDPI"} +

+
+
+
+ + + {statusTitle} + +
+
+ +
+ {!runtimeReady && ( +
+ {t.errors.tauri} +
+ )} + {runtimeReady && !engineFound && ( +
+ {t.errors.engine} +
+ )} + {lastError && ( +
+
{lastError}
+ +
+ )} + {updateInfo && ( +
+
+
+ {lang === "tr" + ? `Yeni sürüm (v${updateInfo.latest_version}) mevcut` + : `New version (v${updateInfo.latest_version}) available`} +
+
+ {updateInfo.notes || (lang === "tr" ? "İmzalı güncelleme hazır." : "Signed update ready.")} +
+ {updateError &&
{updateError}
} +
+
+ + +
+
+ )} + + {view === "home" && ( +
+
+
LD FDPI
+
+ {config?.connectionMode === "eduroam" + ? t.mode.eduroam + : config?.connectionMode === "game" + ? t.mode.game + : t.mode.normal} +
+
+ +
+ {connected && ( + + )} + +
+

+ {connected ? "Korunuyor" : t.hero.disconnectedSub} +

+ +

{statusTitle}

+
+ {connected && status.latencyMs > 0 && ( + + {status.latencyMs} ms + + )} + {connected && status.discordVerified && discord.com TLS} + {connected && status.webVerified && web TLS} + {connected && {config.dohProvider?.toUpperCase() || "AUTO"} DoH} +
+ +
+ + {vpn?.connected && ( +

+ VPN açık. DPI bağlantısı ve DPI ayarları kullanılamaz; önce VPN'i kesin. +

+ )} + {config?.connectionMode === "eduroam" && ( +

{t.mode.eduroamNote}

+ )} +
+ +
+ {config?.dohProvider?.toUpperCase()} DoH · {t.power.title}:{" "} + {config?.bypassMode === 0 + ? t.power.turbo + : config?.bypassMode === 2 + ? t.power.strong + : t.power.balanced} +
+
+ )} + + {view === "vpn" && ( +
+
+
LD FDPI
+
AmneziaWG · {vpn?.endpoint || "sunucu"}
+
+ +
+ {vpn?.connected && ( + + )} + +
+ +

+ {vpn?.connected ? t.vpn.connected : t.vpn.disconnected} +

+

+ {connected + ? "DPI bağlantısı açık. VPN kullanmak için önce DPI bağlantısını kesin." + : vpnError || vpnProgress || vpn?.detail || "BAĞLAN'a bas; gerisini uygulama halleder."} +

+ +
+
{t.vpn.server}
+
+ {vpn?.endpoint || "116.202.14.171:42771"} +
+
+ {vpn?.address || "10.8.1.5/32"} + {vpn?.connected ? t.vpn.connected : t.vpn.disconnected} +
+
+ + + {dnsCheck && ( +
+
DNS: {dnsCheck.servers?.join(", ") || "—"}
+
Çıkış IP: {dnsCheck.egressIp || "—"}
+
+ {dnsCheck.detail} +
+
+ )} + +

{t.vpn.note}

+
+ )} + + {view === "settings" && ( + <> +
+ {vpn?.connected && ( +
+ VPN açık. DPI ayarları kilitli; değiştirmek için önce VPN sekmesinden bağlantıyı kesin. +
+ )} +
+ {lang === "tr" ? "Genel" : "General"} +
+
+
+ + {t.settings.startup} +
+
+ { + await saveConfig({ autoStart: value }); + setAutostartNote(true); + pushLog(value ? "INFO" : "INFO", `${t.settings.autoStart}: ${value ? "ON" : "OFF"}`); + }} + label={t.settings.autoStart} + desc={t.settings.autoStartDesc} + /> + saveConfig({ autoConnect: value })} + label={t.settings.autoConnect} + desc={t.settings.autoConnectDesc} + /> + saveConfig({ minimizeToTray: value })} + label={t.settings.minimize} + desc={t.settings.minimizeDesc} + /> +
+ {autostartWarning && ( +
+ {t.errors.autostart} {autostartWarning} +
+ )} + {!isAdmin && ( +
+ {t.settings.adminNote} +
+ )} + {autostartNote && autostartEffective && ( +
+ {lang === "tr" ? "Görev Zamanlayıcı görevi aktif." : "Task Scheduler entry is active."} +
+ )} +
+ +
+
+
+ + {t.settings.lan} +
+ + {config.lanSharing ? t.settings.lanEnabled : t.settings.lanDisabled} + +
+
+ +
+ + {config.lanSharing && ( +
+
+
{t.settings.manual}
+
+ {manualProxy} + +
+
+
+
{t.settings.pacUrl}
+
+ {pacUrl} + +
+
+
+ +
+
+ )} + {lanWarn && ( +
+ {t.settings.firewallWarn} +
+ )} +
+ +
+
+ + {t.settings.language} +
+
+ {["tr", "en"].map((code) => ( + + ))} +
+
+
+ {lang === "tr" ? "DPI / Bağlantı" : "DPI / Connection"} +
+
+ saveConfig({ captiveAssistant: value })} + label={t.captive.title} + desc={t.captive.enableDesc} + /> +
+ {config.captiveAssistant !== false && ( +
+
+ + {t.captive.title} +
+

{t.captive.desc}

+ + {captive && ( +
+ + {captive.state === "online" + ? t.captive.online + : captive.state === "portal" + ? t.captive.portal + : captive.state === "eduroam" + ? t.captive.eduroam + : t.captive.blocked} + +

{captive.detail}

+ {captive.portalUrl && ( +

{captive.portalUrl}

+ )} +
+ )} +

{t.captive.note}

+
+ )} +
+
+ + {t.mode.eduroam} +
+ +

{t.mode.eduroamNote}

+
+ {config.connectionMode === "eduroam" && ( +
+
+ + + {t.eduroam.title} + + + {eduroam?.wifi?.isEduroam + ? t.eduroam.connected + : eduroam?.wifi?.available + ? t.eduroam.notConnected + : t.eduroam.noWifi} + +
+ +
+
+
SSID
+
{eduroam?.wifi?.ssid || "—"}
+
+
+
{t.eduroam.auth}
+
+ {eduroam?.wifi?.authentication || "—"} +
+
+
+
{t.eduroam.mtu}
+
+ {eduroam?.mtu ?? "—"} / {eduroam?.targetMtu ?? 1400} +
+
+
+
Wi-Fi
+
+ {eduroam?.wifi?.interface || "—"} +
+
+
+ +
+ + + +
+ +

+ {t.eduroam.profileHint} +

+

+ + {t.eduroam.voiceWarning} +

+ + {(diagnostics || []).filter((item) => item.id?.startsWith("eduroam")).length > + 0 && ( +
+ {(diagnostics || []) + .filter((item) => item.id?.startsWith("eduroam")) + .map((item) => ( +
+ {item.passed ? ( + + ) : ( + + )} + + {item.name}: {item.detail} + +
+ ))} +
+ )} +
+ )} + {/* Bypass strength */} +
+
+ + {t.power.title} +
+ + {autoBypass && ( +
+ + {autoBypass.success + ? `${t.power.autoSelected}: ${autoBypass.name} · ${autoBypass.latencyMs} ms` + : t.power.autoFail} + + {autoBypass.tested?.length > 0 && ( +

+ {autoBypass.tested + .map((item) => `${item.name}: ${item.reachable ? `${item.latencyMs} ms` : "—"}`) + .join(" · ")} +

+ )} +
+ )} +
+ saveConfig({ autoOptimize: value })} + label={t.power.autoOptimize} + desc={t.power.autoOptimizeDesc} + /> + saveConfig({ quicBlock: value }, true)} + label={t.power.quicBlock} + desc={t.power.quicBlockDesc} + /> +
+
+ {[ + { mode: 0, label: t.power.turbo, desc: t.power.turboDesc }, + { mode: 1, label: t.power.balanced, desc: t.power.balancedDesc }, + { mode: 2, label: t.power.strong, desc: t.power.strongDesc }, + ].map(({ mode, label, desc }) => { + const active = config.bypassMode === mode; + return ( + + ); + })} +
+ {config.bypassMode === 1 && ( +
+ {[4, 8, 16].map((size) => ( + + ))} +
+ )} +
+ + {/* DNS */} +
+ DNS +
+
+
+ + {t.dns.title} +
+

{t.dns.subtitle}

+ + + {benchmarks?.length > 0 && ( +
+
+ {t.dns.autoPicked}: {benchmarks[0].name} + {benchmarks[0].reachable ? ` · ${benchmarks[0].latencyMs} ms` : ""} +
+
+ {benchmarks.slice(0, 3).map((item) => ( +
+ {item.id}: {item.reachable ? `${item.latencyMs} ms` : "—"} +
+ ))} +
+
+ )} +
+ {config.dohProvider === "auto" + ? t.dns.autoHint + : config.dohProvider === "cloudflare" + ? "https://1.1.1.1/dns-query" + : config.dohProvider === "google" + ? "https://8.8.8.8/dns-query" + : "https://94.140.14.14/dns-query"} +
+
+ + {/* Advanced (collapsed) */} +
+ {lang === "tr" ? "Gelişmiş" : "Advanced"} +
+
+ + + + {t.advanced.title} + + + +
+
+
+
{t.advanced.ports}
+
+ + + +
+
{t.advanced.portsHint}
+
+ +
+
{t.advanced.cli}
+ + {cliPreview} + +
+
+ +
+ + + +
+ +
+ {t.advanced.diagnosticsDesc} {t.advanced.emergencyDesc} +
+ + {diagnostics && ( +
+ {diagnostics.map((item) => ( +
+ {item.passed ? ( + + ) : ( + + )} +
+
{item.name}
+
{item.detail}
+
+
+ ))} +
+ )} +
+
+
+ + )} + + {view === "about" && ( +
+
+ LD FDPI +
+

{t.about.title}

+

{t.about.desc}

+
+
+
+
+
{t.about.engine}
+
{engineVersion}
+
+
+
{t.about.version}
+
v{appVersion}
+
+
+
{t.about.admin}
+
+ {isAdmin ? t.about.adminYes : t.about.adminNo} +
+
+
+
Auto-start
+
+ {autostartEffective ? "Task Scheduler · Highest" : "—"} +
+
+
+

{t.about.privacy}

+

+ %LOCALAPPDATA%\LD-FDPI\config.json +

+
+ )} +
+ + {/* Bottom navigation */} + + + {/* Logs drawer */} + {logsOpen && ( +
+
+
+ + {t.logs.title} + + {logs.length} {t.logs.count} + +
+
+ + +
+
+
+ {logs.length === 0 &&
{t.logs.empty}
} + {logs.map((item) => ( +
+ [{item.time}]{" "} + + [{item.level}] + {" "} + {item.text} +
+ ))} +
+
+
+ )} +
+
+ ); +} diff --git a/src/i18n.js b/src/i18n.js new file mode 100644 index 0000000..834d3df --- /dev/null +++ b/src/i18n.js @@ -0,0 +1,364 @@ +export const TEXT = { + tr: { + nav: { home: "Bağlantı", vpn: "VPN", settings: "Ayarlar", about: "Hakkında" }, + status: { + connected: "Bağlı ve Korunuyor", + fdpiConnected: "FDPI Bağlı", + vpnConnected: "VPN Bağlı", + disconnected: "Bağlı Değil", + connecting: "Bağlanıyor...", + autoConnecting: "Otomatik bağlanıyor...", + restarting: "Yenileniyor...", + engineDown: "Motor kapalı", + }, + actions: { + connect: "BAĞLAN", + disconnect: "BAĞLANTIYI KES", + test: "Bağlantıyı Test Et", + fastest: "En Hızlısını Seç", + copy: "Kopyala", + copied: "Kopyalandı", + clear: "Temizle", + close: "Kapat", + run: "Çalıştır", + restore: "Proxy'yi Onar", + save: "Kaydet", + logs: "Günlük", + }, + hero: { + connectedSub: "İnternet trafiğin yerel SpoofDPI üzerinden akıyor.", + disconnectedSub: "Bağlanmak için aşağıdaki düğmeye bas.", + latency: "Gecikme", + autoOn: "Açılışta otomatik bağlanma açık", + autoOff: "Açılışta otomatik bağlanma kapalı", + }, + mode: { + title: "Çalışma Modu", + normal: "Normal Mod", + normalDesc: "Tarayıcı, Discord ve günlük uygulamalar için sistem proxy'si.", + game: "Oyun Modu", + gameDesc: "WinHTTP + WinINet: oyun başlatıcıları ve Windows servisleri de proxyden geçer.", + gameNote: "Not: UDP oyun sesi sistem proxy'sinden geçmez.", + eduroam: "Eduroam Modu", + eduroamDesc: "Kurumsal Wi-Fi için DoH + MTU 1400 + WinHTTP/WinINet; Discord metin ve uygulama trafiği.", + eduroamNote: "Eduroam modu yalnızca yerel ağ yığınını optimize eder; kurumun güvenlik duvarını aşmaz.", + }, + vpn: { + title: "VPN", + server: "AmneziaWG Sunucusu", + connect: "VPN'E BAĞLAN", + disconnect: "VPN BAĞLANTISINI KES", + install: "AmneziaWG İstemcisini Kur", + installing: "Kuruluyor...", + preparing: "Hazırlanıyor...", + import: "AmneziaWG .conf İçe Aktar", + restore: "Gömülü Sunucuyu Geri Yükle", + note: "Tam tünel: tüm trafik sunucu üzerinden gider. LD FDPI proxy'siyle birlikte kullanılabilir.", + connected: "VPN bağlı", + disconnected: "VPN bağlı değil", + noClient: "AmneziaWG istemcisi kurulu değil.", + noConfig: "VPN yapılandırması yok; .conf içe aktarın.", + }, + captive: { + title: "Oturum Açmadan Bağlantı", + desc: "Kafe/otel captive portalını algılar. Açık ağda doğrudan bağlanır; giriş duvarı varsa portalı tarayıcıda açar. Normal/Oyun modu ayarlarını değiştirmez.", + enableDesc: "Açık ağda doğrudan bağlanmayı dener; captive portal varsa tarayıcıda açar. Kapalıyken hiçbir ağ yoklaması yapılmaz.", + connect: "Oturum Açmadan Bağlan", + trying: "Deneniyor...", + note: "802.1X/şifreli ağlarda (eduroam gibi) oturum atlanamaz; portal kabulü sizin adınıza yapılmaz.", + online: "İnternet açık", + portal: "Portal açıldı", + eduroam: "802.1X oturumu gerekli", + blocked: "Portal bulunamadı", + }, + power: { + title: "Bypass Gücü", + auto: "Otomatik (Test Et)", + autoDesc: "Turbo, Dengeli ve Güçlü'yü sırayla dener; Discord TLS'te en hızlı çalışanı seçer.", + autoOptimize: "Her bağlantıda otomatik test", + autoOptimizeDesc: "Bağlanmadan önce DNS ve bypass modlarını test eder, en hızlısını uygular.", + quicBlock: "QUIC'i kapat (uyumluluk modu)", + quicBlockDesc: + "Yalnızca Chrome, Edge, Brave, Opera, Firefox ve Discord için UDP/443'ü bloklar; site açılmama sorunlarını azaltır. Varsayılan kapalıdır.", + turbo: "Turbo", + balanced: "Dengeli", + strong: "Güçlü", + turboDesc: "Açık ağ / hafif DPI. En düşük CPU; Discord TLS hızlıysa.", + balancedDesc: "Kafe, otel ve çoğu ISS için önerilen.", + strongDesc: "Sıkı DPI, oyun ve eduroam. En yüksek CPU.", + autoSelected: "Otomatik seçim", + autoFail: "Hiçbir mod Discord TLS'i geçemedi; Dengeli'ye dönüldü.", + }, + dns: { + title: "DNS (DoH)", + subtitle: "Şifreli DNS; ISS müdahalesini önler.", + fastest: "En hızlısı seçildi", + auto: "Otomatik (En Hızlı)", + autoHint: "Bağlantıda 3'er TCP testiyle en düşük medyan gecikmeli sağlayıcı seçilir.", + autoPicked: "İlk açılışta otomatik seçildi", + }, + eduroam: { + title: "Eduroam", + connected: "eduroam bağlı", + notConnected: "eduroam algılanmadı", + noWifi: "Kablosuz ağ yok", + connect: "eduroam'a Bağlan", + wifiSettings: "Wi-Fi Ayarları", + diagnostics: "Ağ Testi", + mtu: "MTU", + auth: "Kimlik", + voiceWarning: + "Discord sesi UDP kullanır (19294-19344 / 50000-50100). HTTP proxy UDP taşımaz; kurum bu portları engelliyorsa ses çalışmaz. Metin, uygulama ve web trafiği proxy'den geçer.", + profileHint: + "İlk bağlantıda Windows kullanıcı adı/şifre sorar. Uygulama eduroam şifrenizi saklamaz.", + applied: "Eduroam profili uygulandı: MTU 1400, WinHTTP + WinINet.", + }, + settings: { + title: "Ayarlar", + subtitle: "Kur bir kez, gerisini uygulama halleder.", + startup: "Başlangıç", + autoStart: "Windows açıldığında otomatik başlat", + autoStartDesc: "Yönetici göreviyle, UAC sormadan sistem tepsisinde başlar.", + autoConnect: "Uygulama açıldığında otomatik bağlan", + autoConnectDesc: "Arayüz yüklenmeden motor ve proxy hazırlanır.", + minimize: "Pencere kapatılınca tepsiye küçült", + minimizeDesc: "X'e basınca bağlantı kopmaz, arka planda çalışmaya devam eder.", + lan: "LAN Paylaşımı", + lanDesc: "Telefon, tablet ve konsol aynı Wi-Fi'dan yararlanır.", + lanEnabled: "LAN paylaşımı açık", + lanDisabled: "LAN paylaşımı kapalı", + pacUrl: "PAC adresi", + manual: "Manuel proxy", + qr: "Telefonla okut", + firewallWarn: "Güvenlik duvarı kuralı eklenemedi. Diğer cihazlar için Windows Güvenlik Duvarı'nda izin verin.", + adminNote: "Otomatik başlatma ve Oyun Modu için uygulama yönetici olarak çalışmalıdır.", + language: "Dil", + }, + advanced: { + title: "Gelişmiş", + ports: "Portlar", + proxyPort: "Proxy portu", + pacPort: "PAC portu", + portsHint: "Port değişikliği bir sonraki bağlantıda geçerli olur.", + cli: "Motor komutu", + diagnostics: "Sistem tanılaması", + diagnosticsDesc: "Motor, proxy, kayıt defteri, PAC ve DoH kontrollerini gerçekten çalıştırır.", + emergency: "Acil durum", + emergencyDesc: "Proxy ayarlarını yedekten geri yükler ve takılı motoru kapatır.", + }, + logs: { + title: "Canlı günlük", + empty: "Henüz kayıt yok.", + count: "kayıt", + }, + about: { + title: "LD FDPI", + desc: "Windows için yerel proxy ve DPI bypass aracı. Trafik hiçbir uzak sunucuya gitmez.", + privacy: "Telemetri yok. Günlükler yalnızca RAM'de tutulur; proxy yedeği yerel disktedir.", + engine: "Motor", + version: "Sürüm", + admin: "Yetki", + adminYes: "Yönetici", + adminNo: "Sınırlı", + }, + errors: { + tauri: "Tauri çalışma zamanı bulunamadı. Bu arayüz yalnızca masaüstü uygulamasında çalışır.", + engine: "SpoofDPI motoru bulunamadı. `npm run setup:sidecar` çalıştırın.", + autostart: "Otomatik başlatma görevi oluşturulamadı. Yönetici izni gerekli.", + generic: "Bir hata oluştu", + }, + log: { + connected: "Bağlantı kuruldu; sistem proxy'si yönlendirildi.", + disconnected: "Bağlantı kesildi; orijinal ayarlar geri yüklendi.", + connecting: "SpoofDPI başlatılıyor ve proxy üzerinden TLS doğrulanıyor...", + auto: "Otomatik bağlantı denemesi (Rust arka planı).", + configSaved: "Ayarlar kaydedildi.", + lanOn: "LAN paylaşımı açıldı.", + lanOff: "LAN paylaşımı kapatıldı.", + restored: "Proxy yedekten geri yüklendi.", + fastest: "En hızlı DoH seçildi", + restart: "Motor canlı yenilendi.", + }, + }, + en: { + nav: { home: "Connection", vpn: "VPN", settings: "Settings", about: "About" }, + status: { + connected: "Connected & Protected", + fdpiConnected: "FDPI Connected", + vpnConnected: "VPN Connected", + disconnected: "Disconnected", + connecting: "Connecting...", + autoConnecting: "Auto-connecting...", + restarting: "Restarting...", + engineDown: "Engine stopped", + }, + actions: { + connect: "CONNECT", + disconnect: "DISCONNECT", + test: "Test Connection", + fastest: "Pick Fastest", + copy: "Copy", + copied: "Copied", + clear: "Clear", + close: "Close", + run: "Run", + restore: "Repair Proxy", + save: "Save", + logs: "Logs", + }, + hero: { + connectedSub: "Your traffic flows through the local SpoofDPI proxy.", + disconnectedSub: "Press the button below to connect.", + latency: "Latency", + autoOn: "Auto-connect on launch is on", + autoOff: "Auto-connect on launch is off", + }, + mode: { + title: "Operation Mode", + normal: "Normal Mode", + normalDesc: "System proxy for browsers, Discord and daily apps.", + game: "Game Mode", + gameDesc: "WinHTTP + WinINet: launchers and Windows services also use the proxy.", + gameNote: "Note: UDP game voice is not proxied.", + eduroam: "Eduroam Mode", + eduroamDesc: "DoH + MTU 1400 + WinHTTP/WinINet for campus Wi-Fi; Discord text and app traffic.", + eduroamNote: "Eduroam mode only tunes the local network stack; it does not bypass your institution's firewall.", + }, + vpn: { + title: "VPN", + server: "AmneziaWG Server", + connect: "CONNECT VPN", + disconnect: "DISCONNECT VPN", + install: "Install AmneziaWG Client", + installing: "Installing...", + preparing: "Preparing...", + import: "Import AmneziaWG .conf", + restore: "Restore Built-in Server", + note: "Full tunnel: all traffic goes through the server. Can be used alongside the LD FDPI proxy.", + connected: "VPN connected", + disconnected: "VPN disconnected", + noClient: "AmneziaWG client is not installed.", + noConfig: "No VPN configuration; import a .conf file.", + }, + captive: { + title: "Connect Without Login", + desc: "Detects a cafe/hotel captive portal. Connects directly when the network is open; if there is a login wall, opens the portal in your browser. Does not change Normal/Game mode settings.", + enableDesc: "Tries direct access on open networks; opens the captive portal in your browser. No network probing while disabled.", + connect: "Connect Without Login", + trying: "Trying...", + note: "802.1X/encrypted networks (such as eduroam) cannot skip login; portal acceptance is never performed on your behalf.", + online: "Internet is open", + portal: "Portal opened", + eduroam: "802.1X login required", + blocked: "No portal found", + }, + power: { + title: "Bypass Strength", + auto: "Auto (Test)", + autoDesc: "Tests Turbo, Balanced and Strong in order; picks the fastest working Discord TLS.", + autoOptimize: "Test automatically on every connection", + autoOptimizeDesc: "Benchmarks DNS and bypass modes before connecting, applies the fastest.", + quicBlock: "Disable QUIC (compatibility mode)", + quicBlockDesc: + "Blocks UDP/443 only for Chrome, Edge, Brave, Opera, Firefox and Discord; reduces pages that ignore the proxy. Off by default.", + turbo: "Turbo", + balanced: "Balanced", + strong: "Strong", + turboDesc: "Open network / mild DPI. Lowest CPU; use when Discord TLS is fast.", + balancedDesc: "Recommended for cafes, hotels and most ISPs.", + strongDesc: "Strict DPI, gaming and eduroam. Highest CPU.", + autoSelected: "Auto-selected", + autoFail: "No mode passed Discord TLS; reverted to Balanced.", + }, + dns: { + title: "DNS (DoH)", + subtitle: "Encrypted DNS; avoids ISP tampering.", + fastest: "Fastest selected", + auto: "Auto (Fastest)", + autoHint: "At connect, three TCP probes per provider pick the lowest median latency.", + autoPicked: "Auto-selected on first launch", + }, + eduroam: { + title: "Eduroam", + connected: "eduroam connected", + notConnected: "eduroam not detected", + noWifi: "No wireless network", + connect: "Connect to eduroam", + wifiSettings: "Wi-Fi Settings", + diagnostics: "Network Test", + mtu: "MTU", + auth: "Auth", + voiceWarning: + "Discord voice uses UDP (19294-19344 / 50000-50100). An HTTP proxy cannot carry UDP; if campus blocks those ports, voice will not work. Text, app and web traffic go through the proxy.", + profileHint: + "Windows asks for your username/password on first connect. The app never stores eduroam credentials.", + applied: "Eduroam profile applied: MTU 1400, WinHTTP + WinINet.", + }, + settings: { + title: "Settings", + subtitle: "Set it once and forget about it.", + startup: "Startup", + autoStart: "Start with Windows", + autoStartDesc: "Starts elevated in the tray at logon without a UAC prompt.", + autoConnect: "Connect automatically on launch", + autoConnectDesc: "Engine and proxy are ready before the UI loads.", + minimize: "Minimize to tray when closed", + minimizeDesc: "Closing the window keeps the connection alive in the background.", + lan: "LAN Sharing", + lanDesc: "Share with phones, tablets and consoles on the same Wi-Fi.", + lanEnabled: "LAN sharing is on", + lanDisabled: "LAN sharing is off", + pacUrl: "PAC URL", + manual: "Manual proxy", + qr: "Scan with your phone", + firewallWarn: "Firewall rule could not be added. Allow the ports in Windows Firewall for other devices.", + adminNote: "Autostart and Game Mode require the app to run as administrator.", + language: "Language", + }, + advanced: { + title: "Advanced", + ports: "Ports", + proxyPort: "Proxy port", + pacPort: "PAC port", + portsHint: "Port changes apply on the next connection.", + cli: "Engine command", + diagnostics: "System diagnostics", + diagnosticsDesc: "Really runs engine, proxy, registry, PAC and DoH checks.", + emergency: "Emergency", + emergencyDesc: "Restores the proxy backup and stops a stuck engine.", + }, + logs: { + title: "Live log", + empty: "No entries yet.", + count: "entries", + }, + about: { + title: "LD FDPI", + desc: "Local proxy & DPI bypass for Windows. Traffic never goes to a remote server.", + privacy: "No telemetry. Logs live in RAM; the proxy backup is on local disk.", + engine: "Engine", + version: "Version", + admin: "Privilege", + adminYes: "Administrator", + adminNo: "Limited", + }, + errors: { + tauri: "Tauri runtime not found. This UI only works inside the desktop app.", + engine: "SpoofDPI engine not found. Run `npm run setup:sidecar`.", + autostart: "Could not create the autostart task. Administrator rights required.", + generic: "Something went wrong", + }, + log: { + connected: "Connected; system proxy redirected.", + disconnected: "Disconnected; original settings restored.", + connecting: "Starting SpoofDPI and verifying TLS through the proxy...", + auto: "Automatic connection attempt (Rust background).", + configSaved: "Settings saved.", + lanOn: "LAN sharing enabled.", + lanOff: "LAN sharing disabled.", + restored: "Proxy restored from backup.", + fastest: "Fastest DoH selected", + restart: "Engine hot-restarted.", + }, + }, +}; diff --git a/src/index.css b/src/index.css new file mode 100644 index 0000000..9b3c677 --- /dev/null +++ b/src/index.css @@ -0,0 +1,74 @@ +@tailwind base; +@tailwind components; +@tailwind utilities; + +@layer base { + body { + background-color: #090f18; + background-image: + radial-gradient(1100px 620px at 50% -12%, rgba(143, 227, 245, 0.13), transparent 62%), + radial-gradient(900px 520px at 100% 110%, rgba(75, 150, 189, 0.10), transparent 64%), + linear-gradient(180deg, #0c1420 0%, #070c14 100%); + background-attachment: fixed; + color: #e6eef7; + font-feature-settings: "cv02", "cv03", "cv04", "cv11"; + } +} + +/* Deep navy / ice scrollbars */ +::-webkit-scrollbar { + width: 6px; + height: 6px; +} + +::-webkit-scrollbar-track { + background: rgba(9, 15, 24, 0.7); +} + +::-webkit-scrollbar-thumb { + background: rgba(79, 101, 126, 0.75); + border-radius: 9999px; +} + +::-webkit-scrollbar-thumb:hover { + background: rgba(143, 227, 245, 0.75); +} + +@keyframes pulse-ring { + 0% { + transform: scale(0.92); + opacity: 0.7; + } + 70% { + transform: scale(1.25); + opacity: 0; + } + 100% { + transform: scale(1.25); + opacity: 0; + } +} + +.animate-pulse-ring { + animation: pulse-ring 2.2s cubic-bezier(0.215, 0.61, 0.355, 1) infinite; +} + +/* Layered navy glass card, matching the mark's black panes and ice tubes. */ +.mica-card { + position: relative; + background: linear-gradient(145deg, rgba(21, 33, 49, 0.94) 0%, rgba(10, 17, 27, 0.96) 100%); + backdrop-filter: blur(18px) saturate(1.08); + border: 1px solid rgba(143, 227, 245, 0.15); + box-shadow: + 0 22px 54px rgba(0, 0, 0, 0.30), + inset 0 1px 0 rgba(255, 255, 255, 0.05); +} + +.mica-card::after { + content: ""; + position: absolute; + inset: 0 16% auto; + height: 1px; + pointer-events: none; + background: linear-gradient(90deg, transparent, rgba(143, 227, 245, 0.38), transparent); +} diff --git a/src/main.jsx b/src/main.jsx new file mode 100644 index 0000000..54b39dd --- /dev/null +++ b/src/main.jsx @@ -0,0 +1,10 @@ +import React from 'react' +import ReactDOM from 'react-dom/client' +import App from './App.jsx' +import './index.css' + +ReactDOM.createRoot(document.getElementById('root')).render( + + + , +) diff --git a/src/utils/engineArgs.js b/src/utils/engineArgs.js new file mode 100644 index 0000000..db837a2 --- /dev/null +++ b/src/utils/engineArgs.js @@ -0,0 +1,103 @@ +/** + * Pure engine helpers — no DOM, no Tauri imports, so they can be unit-tested in Node + * and reused by both the UI and the verification suite. + * + * These MUST stay byte-for-byte compatible with `src-tauri/src/engine.rs`. + */ + +/** Real Windows build of SpoofDPI shipped as the sidecar. */ +export const SPOOFDPI_VERSION = "0.12.2"; + +/** + * SpoofDPI 0.12.2 builds its DoH URL as `https:///dns-query`, where + * `-dns-addr` must be a bare IP. Only these resolvers present a certificate that + * covers their IP address; Quad9 and OpenDNS return 502 for an IP-based URL. + */ +export const DOH_PROVIDERS = [ + { id: "cloudflare", name: "Cloudflare", ipv4: "1.1.1.1", url: "https://1.1.1.1/dns-query" }, + { id: "google", name: "Google", ipv4: "8.8.8.8", url: "https://8.8.8.8/dns-query" }, + { id: "adguard", name: "AdGuard", ipv4: "94.140.14.14", url: "https://94.140.14.14/dns-query" }, +]; + +export function getDohIpv4(provider) { + return DOH_PROVIDERS.find((p) => p.id === provider)?.ipv4 ?? "1.1.1.1"; +} + +export function getDohUrl(provider) { + return DOH_PROVIDERS.find((p) => p.id === provider)?.url ?? DOH_PROVIDERS[0].url; +} + +/** + * `-window-size` (minimal fragmentation, lower CPU/socket overhead): + * 0 (Turbo) => 1-byte SNI split + * 1 (Balanced) => chosen chunk (default 4) + * 2 (Strong) => 2-byte chunks + */ +export function windowSizeFor(config = {}) { + const mode = Number(config.bypassMode) || 0; + const chunk = Math.min(64, Math.max(1, Number(config.chunkSize) || 4)); + if (mode === 0) return 1; + if (mode === 1) return chunk; + return Math.min(2, chunk); +} + +/** Exact argv for SpoofDPI 0.12.2. */ +export function buildSpoofDpiArgs(config = {}) { + const lan = Boolean(config.lanSharing); + const port = Number(config.proxyPort) || 8080; + return [ + "-listen-addr", + lan ? "0.0.0.0" : "127.0.0.1", + "-listen-port", + String(port), + "-dns-addr", + getDohIpv4(config.dohProvider), + "-enable-doh", + "-system-proxy=false", + "-window-size", + String(windowSizeFor(config)), + "-timeout", + "8000", + "-silent", + ]; +} + +/** PAC script served by `pac_server.rs` (kept identical on purpose). */ +export function generatePacScript(localIp = "192.168.1.42", proxyPort = 8080) { + return `function FindProxyForURL(url, host) { + // Fast string/subnet checks only: no dnsResolve/isInNet per request. + if (isPlainHostName(host) || shExpMatch(host, "*.local")) { + return "DIRECT"; + } + var parts = host.split("."); + if (parts.length === 4) { + var a = parseInt(parts[0], 10); + var b = parseInt(parts[1], 10); + if (a === 127 || a === 10 || (a === 192 && b === 168) || + (a === 172 && b >= 16 && b <= 31)) { + return "DIRECT"; + } + } + // University SSO / captive portal / eduroam pages must never go through the proxy. + if (shExpMatch(host, "*.edu") || shExpMatch(host, "*.edu.tr") || + shExpMatch(host, "*.ac.uk") || shExpMatch(host, "eduroam.org") || + shExpMatch(host, "*.eduroam.org")) { + return "DIRECT"; + } + return "PROXY ${localIp}:${proxyPort}; DIRECT"; +} +`; +} + +/** + * Real Tauri v2 detection. Tauri always injects `window.__TAURI_INTERNALS__` + * (with `.invoke`) into the webview; a plain browser has neither. + */ +export function isTauriRuntime() { + return ( + typeof window !== "undefined" && + typeof window.__TAURI_INTERNALS__ === "object" && + window.__TAURI_INTERNALS__ !== null && + typeof window.__TAURI_INTERNALS__.invoke === "function" + ); +} diff --git a/src/utils/tauriBridge.js b/src/utils/tauriBridge.js new file mode 100644 index 0000000..428d76a --- /dev/null +++ b/src/utils/tauriBridge.js @@ -0,0 +1,59 @@ +import DOMPurify from "dompurify"; +import { + SPOOFDPI_VERSION, + DOH_PROVIDERS, + getDohIpv4, + getDohUrl, + windowSizeFor, + buildSpoofDpiArgs, + generatePacScript, + isTauriRuntime, +} from "./engineArgs"; + +// Re-export the pure helpers so components keep a single import surface. +export { + SPOOFDPI_VERSION, + DOH_PROVIDERS, + getDohIpv4, + getDohUrl, + windowSizeFor, + buildSpoofDpiArgs, + generatePacScript, + isTauriRuntime, +}; + +/** + * Sanitizes logs / user strings (Anti-XSS, no HTML allowed). + */ +export function sanitizeText(input) { + if (typeof input !== "string") return ""; + return DOMPurify.sanitize(input, { ALLOWED_TAGS: [], ALLOWED_ATTR: [] }); +} + +/** + * Calls a Rust `#[tauri::command]`. + * + * There is deliberately **no simulation fallback**. Outside Tauri we fail loudly so + * the UI can tell the truth instead of showing fabricated success. + */ +export async function invokeTauri(cmd, args = {}) { + if (!isTauriRuntime()) { + throw new Error( + "Tauri v2 çalışma zamanı bulunamadı. Bu arayüz yalnızca masaüstü uygulamasında " + + "(ld-fdpi.exe) Rust komutlarını çalıştırabilir; tarayıcı önizlemesi yalnızca tasarımdır." + ); + } + + const { invoke } = await import("@tauri-apps/api/core"); + try { + return await invoke(cmd, args); + } catch (error) { + const message = + typeof error === "string" + ? error + : error && typeof error.message === "string" + ? error.message + : JSON.stringify(error); + throw new Error(message); + } +} diff --git a/tailwind.config.js b/tailwind.config.js new file mode 100644 index 0000000..c477159 --- /dev/null +++ b/tailwind.config.js @@ -0,0 +1,69 @@ +/** @type {import('tailwindcss').Config} */ +export default { + content: [ + "./index.html", + "./src/**/*.{js,ts,jsx,tsx}", + ], + theme: { + extend: { + colors: { + // Correct LD FDPI mark: lacivert tile, black glass panes, ice-blue tubes, silver LD. + fluent: { + bg: "#090f18", + surface: "#101a28", + card: "#152131", + border: "#26374b", + accent: "#8fe3f5", + accentHover: "#67c7e8", + success: "#68a994", + warning: "#d3a45f", + danger: "#c87575" + }, + slate: { + 50: "#f4f8fc", + 100: "#e6eef7", + 200: "#cbd8e5", + 300: "#a3b4c7", + 400: "#758ba3", + 500: "#4f657e", + 600: "#33475f", + 700: "#223247", + 800: "#162231", + 900: "#0e1621", + 950: "#070c14" + }, + blue: { + 50: "#eef8fd", + 100: "#d8f0fa", + 200: "#b7e3f4", + 300: "#8fd2ec", + 400: "#6bb9dd", + 500: "#4b96bd", + 600: "#39779c", + 700: "#2b5b79", + 800: "#204459", + 900: "#173344", + 950: "#0c1f2b" + }, + cyan: { + 50: "#f2fbfe", + 100: "#e0f7fd", + 200: "#c9edfa", + 300: "#a5ddf3", + 400: "#8fe3f5", + 500: "#67c7e8", + 600: "#3daacd", + 700: "#2c839f", + 800: "#226477", + 900: "#1a4b59", + 950: "#0d2a33" + } + }, + fontFamily: { + sans: ['"Segoe UI Variable Display"', '"Segoe UI"', 'Inter', 'system-ui', 'sans-serif'], + mono: ['"Cascadia Code"', '"JetBrains Mono"', 'Consolas', 'monospace'] + } + }, + }, + plugins: [], +} diff --git a/vite.config.js b/vite.config.js new file mode 100644 index 0000000..656069f --- /dev/null +++ b/vite.config.js @@ -0,0 +1,24 @@ +import { defineConfig } from "vite"; +import react from "@vitejs/plugin-react"; + +const host = process.env.TAURI_DEV_HOST; + +export default defineConfig(async () => ({ + plugins: [react()], + clearScreen: false, + server: { + port: 1420, + strictPort: true, + host: host || false, + hmr: host + ? { + protocol: "ws", + host, + port: 1421, + } + : undefined, + watch: { + ignored: ["**/src-tauri/**"], + }, + }, +}));