import { useCallback, useEffect, useMemo, useState } from "react"; import { invoke } from "@tauri-apps/api/core"; import { AlertTriangle, CheckCircle2, FolderOpen, Loader2, Play, Power, RefreshCw, Settings, Square, } from "lucide-react"; const EMPTY = { connected: false, helper: "unknown", desktop: "unknown", spoofdpiAvailable: false, config: { proxyPort: 18080, quicBlock: false, spoofdpiPath: "", autoStart: false, }, appVersion: "1.0.0", lastError: null, }; async function call(command, args) { if (!window.__TAURI_INTERNALS__) { throw new Error("Tauri çalışma zamanı bulunamadı."); } return invoke(command, args); } export default function App() { const [state, setState] = useState(EMPTY); const [updateInfo, setUpdateInfo] = useState(null); const [busy, setBusy] = useState(""); const [error, setError] = useState(null); const [draft, setDraft] = useState(EMPTY.config); const [notice, setNotice] = useState(null); const refresh = useCallback(async () => { try { const next = await call("get_state"); setState(next); setDraft(next.config); setError(null); } catch (e) { setError(String(e)); } }, []); useEffect(() => { refresh(); const timer = window.setInterval(refresh, 4000); return () => window.clearInterval(timer); }, [refresh]); const connected = Boolean(state.connected); const helperOk = state.helper === "ready"; const canStart = state.spoofdpiAvailable && !connected && busy !== "start"; const handleUpdate = async () => { setBusy("update"); setError(null); try { const info = await call("check_linux_update"); setUpdateInfo(info); setNotice(info.available ? `Yeni sürüm: ${info.version}` : "Güncel sürümdesiniz."); } catch (e) { setError(String(e)); } finally { setBusy(""); } }; const handleConnect = async () => { setBusy(connected ? "stop" : "start"); setError(null); setNotice(null); try { await call(connected ? "stop_fdpi" : "start_fdpi"); setNotice(connected ? "FDPI durduruldu." : "FDPI başlatıldı."); await refresh(); } catch (e) { setError(String(e)); await refresh(); } finally { setBusy(""); } }; const handleSave = async () => { setBusy("save"); setError(null); try { const next = await call("save_config", { config: draft }); setState((prev) => ({ ...prev, config: next })); setDraft(next); setNotice("Ayarlar kaydedildi."); } catch (e) { setError(String(e)); } finally { setBusy(""); } }; const openFolder = async () => { try { await call("open_data_folder"); } catch (e) { setError(String(e)); } }; const status = useMemo(() => { if (connected) return { label: "FDPI bağlı", tone: "ok" }; if (busy === "start") return { label: "Başlatılıyor", tone: "warn" }; return { label: "Bağlı değil", tone: "idle" }; }, [connected, busy]); return (
LD
LD FDPI Linux Phase 1 · FDPI MVP
v{state.appVersion} {status.label}
{error && (
{error}
)} {notice && (
{notice}
)}
WINDOWS PARITY · PHASE 1

DPI engelini
Linux'ta aş.

SpoofDPI tabanlı yerel proxy. Sistem proxy'si GNOME üzerinden uygulanır ve QUIC uyumluluğu systemd helper tarafından yönetilir.

{connected ? "Koruma aktif" : "Hazır"} {connected ? `127.0.0.1:${state.config.proxyPort}` : "Bağlantı bekleniyor"}
FDPI

SpoofDPI yerel proxy

helper: {state.helper}
Desktop{state.desktop}
SpoofDPI{state.spoofdpiAvailable ? "bulundu" : "yok"}
Proxy portu{state.config.proxyPort}
Helper{state.helper}
{!state.spoofdpiAvailable && (

SpoofDPI bulunamadı. /usr/lib/ld-fdpi/spoofdpi yolu veya Ayarlar'daki spoofdpiPath gerekli.

)} {state.desktop !== "gnome" && (

Bu MVP yalnızca GNOME sistem proxy'sini destekler. KDE Faz 2'de.

)}
Ayarlar

Bağlantı tercihleri

{updateInfo && (

Sürüm: {updateInfo.version} ·{" "} {updateInfo.available ? ( güncellemeyi indir ) : ( "güncel" )} {updateInfo.notes ? ` · ${updateInfo.notes}` : ""}

)}
); }