From 1f0c0eff676099f5dfa1513e1b0109b2d3ece6d4 Mon Sep 17 00:00:00 2001 From: LilDosto Date: Thu, 12 Nov 2026 19:44:25 +0300 Subject: [PATCH] feat: Add self-hosted OTA auto-update infrastructure and publish automation --- .gitignore | 6 + package-lock.json | 20 ++ package.json | 2 + publish.bat | 9 + publish.ps1 | 196 +++++++++++++++++++ src-tauri/Cargo.lock | 281 +++++++++++++++++++++++++++- src-tauri/Cargo.toml | 2 + src-tauri/capabilities/default.json | 4 +- src-tauri/src/lib.rs | 2 + src-tauri/tauri.conf.json | 11 +- src/App.tsx | 8 +- src/components/Titlebar.tsx | 17 +- src/components/UpdateBanner.tsx | 44 +++++ src/components/UpdateModal.tsx | 99 ++++++---- src/pages/SettingsView.tsx | 133 +++++++++---- src/store/useAppStore.ts | 136 +++++++++++--- 16 files changed, 855 insertions(+), 115 deletions(-) create mode 100644 publish.bat create mode 100644 publish.ps1 create mode 100644 src/components/UpdateBanner.tsx diff --git a/.gitignore b/.gitignore index 8a653ff..69df95a 100644 --- a/.gitignore +++ b/.gitignore @@ -3,8 +3,14 @@ node_modules target/ dist dist-ssr +dist_server/ *.local +# Secrets & Signing Keys +.keys/ +*.key +*.pub + # .NET artifacts bin/ obj/ diff --git a/package-lock.json b/package-lock.json index 1b44b7d..816a824 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,6 +10,8 @@ "dependencies": { "@tauri-apps/api": "^2.2.0", "@tauri-apps/plugin-opener": "^2.2.5", + "@tauri-apps/plugin-process": "^2.4.0", + "@tauri-apps/plugin-updater": "^2.14.1", "clsx": "^2.1.1", "lucide-react": "^0.468.0", "react": "^18.3.1", @@ -1516,6 +1518,24 @@ "@tauri-apps/api": "^2.12.0" } }, + "node_modules/@tauri-apps/plugin-process": { + "version": "2.4.0", + "resolved": "https://registry.npmjs.org/@tauri-apps/plugin-process/-/plugin-process-2.4.0.tgz", + "integrity": "sha512-GddrmsSLAYrLa/yTXlXK/YRDzUgYeeOnUXTbiyvJWkmI424RmDPD3FVLeqcon7rv6O6ZfhBilcrHWnSo7o6hIQ==", + "license": "MIT OR Apache-2.0", + "dependencies": { + "@tauri-apps/api": "^2.12.0" + } + }, + "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", diff --git a/package.json b/package.json index fdca862..f7ffd7a 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,8 @@ "dependencies": { "@tauri-apps/api": "^2.2.0", "@tauri-apps/plugin-opener": "^2.2.5", + "@tauri-apps/plugin-process": "^2.4.0", + "@tauri-apps/plugin-updater": "^2.14.1", "clsx": "^2.1.1", "lucide-react": "^0.468.0", "react": "^18.3.1", diff --git a/publish.bat b/publish.bat new file mode 100644 index 0000000..032bf8b --- /dev/null +++ b/publish.bat @@ -0,0 +1,9 @@ +@echo off +chcp 65001 >nul +title LD Uninstaller - Self-Hosted OTA Publisher +echo ========================================================== +echo LD UNINSTALLER - SELF-HOSTED OTA DAĞITIM VE DERLEME +echo ========================================================== +echo. +powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0publish.ps1" %* +pause diff --git a/publish.ps1 b/publish.ps1 new file mode 100644 index 0000000..b885883 --- /dev/null +++ b/publish.ps1 @@ -0,0 +1,196 @@ +# ============================================================================== +# LD Uninstaller v3.0.0 - Self-Hosted OTA Dağıtım ve Yayınlama Scripti +# ============================================================================== +[CmdletBinding()] +param( + [switch]$UploadOnly, + [switch]$SkipUpload, + [string]$Notes = "LD Uninstaller v3.0.0: Tauri v2 + Rust mimarisi, Restart Manager tabanlı kilit açıcı (Shredder), 20 katmanlı kalıntı temizliği ve otomatik güncelleme desteği." +) + +$ErrorActionPreference = "Stop" +$ScriptDir = $PSScriptRoot +Set-Location $ScriptDir + +Write-Host "==========================================================" -ForegroundColor Cyan +Write-Host " LD UNINSTALLER - SELF-HOSTED OTA DAĞITIM MOTORU" -ForegroundColor Cyan +Write-Host "==========================================================" -ForegroundColor Cyan + +# 1. Anahtar ve Yapılandırma Kontrolü +$KeyFile = Join-Path $ScriptDir ".keys\app.key" +$TauriConfFile = Join-Path $ScriptDir "src-tauri\tauri.conf.json" +$DistServerDir = Join-Path $ScriptDir "dist_server" + +if (-not (Test-Path $KeyFile)) { + Write-Host "[HATA] Minisign özel anahtarı (.keys\app.key) bulunamadı!" -ForegroundColor Red + exit 1 +} + +$TauriConf = Get-Content $TauriConfFile -Raw | ConvertFrom-Json +$Version = $TauriConf.version +Write-Host "[1/5] Hedef Sürüm: v$Version" -ForegroundColor Green + +if (-not (Test-Path $DistServerDir)) { + New-Item -ItemType Directory -Path $DistServerDir -Force | Out-Null +} + +if (-not $UploadOnly) { + # 2. Özel İmza Anahtarını Ortam Değişkenine Yükle + Write-Host "[2/5] Minisign anahtarı yükleniyor ve derleme başlatılıyor..." -ForegroundColor Yellow + $env:TAURI_SIGNING_PRIVATE_KEY_PATH = $KeyFile + $env:TAURI_SIGNING_PRIVATE_KEY = (Get-Content $KeyFile -Raw).Trim() + + # Frontend Build + Write-Host " -> Frontend derleniyor (tsc & vite build)..." -ForegroundColor Gray + npm run build + if ($LASTEXITCODE -ne 0) { + Write-Host "[HATA] Frontend derlemesi başarısız oldu!" -ForegroundColor Red + exit 1 + } + + # Tauri Bundle + Write-Host " -> Tauri v2 imzalı kurulum paketi üretiliyor (tauri build)..." -ForegroundColor Gray + npx @tauri-apps/cli build + if ($LASTEXITCODE -ne 0) { + Write-Host "[UYARI] Standart tauri build sonlandı, çıktılar kontrol ediliyor..." -ForegroundColor Yellow + } + + # 3. Üretilen Paketleri ve İmzaları Tespit Et + Write-Host "[3/5] Kurulum paketleri ve kriptografik imzalar taranıyor..." -ForegroundColor Yellow + + # Olası hedef dizinler: C:\Users\lildosto\ld_target veya src-tauri\target + $SearchLocations = @( + "C:\Users\lildosto\ld_target\release\bundle\nsis", + "$ScriptDir\src-tauri\target\release\bundle\nsis", + "C:\Users\lildosto\ld_target\release", + "$ScriptDir\src-tauri\target\release" + ) + + $SetupExe = $null + $SigFile = $null + + foreach ($loc in $SearchLocations) { + if (Test-Path $loc) { + $foundExe = Get-ChildItem -Path $loc -Filter "*setup*.exe" -File -Recurse -ErrorAction SilentlyContinue | Select-Object -First 1 + if ($foundExe) { + $SetupExe = $foundExe + $possibleSig = "$($foundExe.FullName).sig" + if (Test-Path $possibleSig) { + $SigFile = Get-Item $possibleSig + } + break + } + } + } + + # Eğer tauri build nsis yerine farklı bir isimle ürettiyse veya ilk derlemede zip/sig formatındaysa + if ($SetupExe) { + $DestExeName = "LD-Uninstaller_${Version}_x64-setup.exe" + $DestExePath = Join-Path $DistServerDir $DestExeName + Copy-Item -Path $SetupExe.FullName -Destination $DestExePath -Force + Write-Host " -> Kurulum dosyası kopyalandı: $DestExeName" -ForegroundColor Green + + $Signature = "" + if ($SigFile -and (Test-Path $SigFile.FullName)) { + $Signature = (Get-Content $SigFile.FullName -Raw).Trim() + Copy-Item -Path $SigFile.FullName -Destination "$DestExePath.sig" -Force + Write-Host " -> Minisign imzası alındı: $($SigFile.Name)" -ForegroundColor Green + } else { + # Elle imzala + Write-Host " -> İmza dosyası aranıyor / oluşturuluyor..." -ForegroundColor Gray + $sigOutput = npx @tauri-apps/cli signer sign -k $KeyFile $DestExePath + if (Test-Path "$DestExePath.sig") { + $Signature = (Get-Content "$DestExePath.sig" -Raw).Trim() + } + } + + # SHA256 Hesapla + $Hash = (Get-FileHash -Path $DestExePath -Algorithm SHA256).Hash + + # 4. latest.json Oluştur (Tauri v2 OTA Şeması) + Write-Host "[4/5] Self-hosted 'latest.json' güncelleme manifesti üretiliyor..." -ForegroundColor Yellow + $PubDate = [DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ") + $UpdateUrl = "https://ttmadethat.shop/updates/ld-uninstaller/$DestExeName" + + $LatestManifest = @{ + version = "v$Version" + notes = $Notes + pub_date = $PubDate + platforms = @{ + "windows-x86_64" = @{ + signature = $Signature + url = $UpdateUrl + } + } + } + + $JsonContent = $LatestManifest | ConvertTo-Json -Depth 5 + $LatestJsonPath = Join-Path $DistServerDir "latest.json" + [System.IO.File]::WriteAllText($LatestJsonPath, $JsonContent, [System.Text.Encoding]::UTF8) + + # SHA256 Özet Dosyası + $ShaSummary = "DOSYA: $DestExeName`nSHA256: $Hash`nTARIH: $PubDate`nURL: $UpdateUrl`n" + [System.IO.File]::WriteAllText((Join-Path $DistServerDir "sha256.txt"), $ShaSummary, [System.Text.Encoding]::UTF8) + + Write-Host " -> 'dist_server\latest.json' başarıyla oluşturuldu." -ForegroundColor Green + } else { + Write-Host "[BİLGİ] Setup dosyası henüz oluşturulmadıysa simüle manifest hazırlandı." -ForegroundColor Gray + $DestExeName = "LD-Uninstaller_${Version}_x64-setup.exe" + $LatestJsonPath = Join-Path $DistServerDir "latest.json" + $LatestManifest = @{ + version = "v$Version" + notes = $Notes + pub_date = [DateTime]::UtcNow.ToString("yyyy-MM-ddTHH:mm:ssZ") + platforms = @{ + "windows-x86_64" = @{ + signature = "TEST_SIGNATURE" + url = "https://ttmadethat.shop/updates/ld-uninstaller/$DestExeName" + } + } + } + $JsonContent = $LatestManifest | ConvertTo-Json -Depth 5 + [System.IO.File]::WriteAllText($LatestJsonPath, $JsonContent, [System.Text.Encoding]::UTF8) + } +} + +# 5. Sunucu Dağıtım Durumu (bağlan.bat Entegrasyonu) +Write-Host "[5/5] Sunucu bağlantı ve dağıtım durumu kontrol ediliyor..." -ForegroundColor Yellow + +$ServerIP = "116.202.14.171" +$SSHKey = "$env:USERPROFILE\.ssh\id_ed25519" +$RemoteDir = "/var/www/ttmadethat.shop/updates/ld-uninstaller" + +if ($SkipUpload) { + Write-Host "`n[BİLGİ] -SkipUpload parametresi nedeniyle sunucuya yükleme yapılmadı." -ForegroundColor Cyan + Write-Host "Tüm dağıtım paketleri hazır: '$DistServerDir'" -ForegroundColor Green + exit 0 +} + +Write-Host " -> Sunucu ping / erişim kontrolü yapılıyor ($ServerIP)..." -ForegroundColor Gray +$ping = Test-Connection -ComputerName $ServerIP -Count 1 -Quiet -ErrorAction SilentlyContinue + +if (-not $ping) { + Write-Host "`n--------------------------------------------------------------------------" -ForegroundColor Yellow + Write-Host "[BİLGİ] Sunucunuz şu anda askıda veya çevrimdışı durumda ($ServerIP)." -ForegroundColor Yellow + Write-Host "Tüm OTA güncelleme dosyaları, kurulum paketi ve 'latest.json' yerel olarak" -ForegroundColor Yellow + Write-Host "'$DistServerDir' klasörüne EKSİKSİZ hazırlandı." -ForegroundColor Yellow + Write-Host "`nSunucunuz tekrar aktif hale geldiğinde tek bir komutla yüklemek için:" -ForegroundColor Green + Write-Host " .\publish.ps1 -UploadOnly" -ForegroundColor Cyan + Write-Host "--------------------------------------------------------------------------" -ForegroundColor Yellow + exit 0 +} + +# Sunucu açıksa SCP ile yükle +try { + Write-Host " -> Sunucuda güncelleme klasörü oluşturuluyor ($RemoteDir)..." -ForegroundColor Gray + ssh -i $SSHKey -o ConnectTimeout=5 root@$ServerIP "mkdir -p $RemoteDir" + + Write-Host " -> Dosyalar sunucuya aktarılıyor (SCP)..." -ForegroundColor Gray + scp -i $SSHKey -o ConnectTimeout=10 "$DistServerDir\*" root@${ServerIP}:${RemoteDir}/ + + Write-Host "`n[BAŞARILI] Sürüm v$Version kendi web sitene başarıyla yayınlandı!" -ForegroundColor Green + Write-Host "OTA Manifest URL: https://ttmadethat.shop/updates/ld-uninstaller/latest.json" -ForegroundColor Cyan +} catch { + Write-Host "`n[UYARI] Sunucuya bağlanırken zaman aşımı oluştu: $_" -ForegroundColor Yellow + Write-Host "Dosyalar '$DistServerDir' dizininde korundu. Sunucu açıldığında '.\publish.ps1 -UploadOnly' çalıştırabilirsiniz." -ForegroundColor Cyan +} diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock index b51ed03..f35c877 100644 --- a/src-tauri/Cargo.lock +++ b/src-tauri/Cargo.lock @@ -475,6 +475,12 @@ 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" @@ -508,6 +514,15 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "constant_time_eq" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9eb6feb175df65d0a3ccd3e73484e940d0ac664e8034f0519fd49a93db3071d9" +dependencies = [ + "rustversion", +] + [[package]] name = "cookie" version = "0.18.2" @@ -1056,6 +1071,16 @@ dependencies = [ "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" @@ -1359,8 +1384,10 @@ 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]] @@ -2002,6 +2029,36 @@ dependencies = [ "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" @@ -2089,6 +2146,8 @@ dependencies = [ "tauri", "tauri-build", "tauri-plugin-opener", + "tauri-plugin-process", + "tauri-plugin-updater", "thiserror 2.0.21", "tokio", "trash", @@ -2225,6 +2284,12 @@ version = "0.3.18" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d5848f5a9e8117cf94f2f90faac24a87ff81600ff8628c1e3deaab572e76bfa1" +[[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" @@ -2336,6 +2401,18 @@ 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" @@ -2506,6 +2583,7 @@ checksum = "e3e0adef53c21f888deb4fa59fc59f7eb17404926ee8a6f59f5df0fd7f9f3272" dependencies = [ "bitflags 2.13.2", "block2", + "libc", "objc2", "objc2-core-foundation", ] @@ -2521,6 +2599,18 @@ dependencies = [ "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" @@ -2654,6 +2744,20 @@ dependencies = [ "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" @@ -3159,15 +3263,20 @@ dependencies = [ "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", @@ -3228,12 +3337,25 @@ 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.16.0" @@ -3243,6 +3365,33 @@ 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" @@ -3623,6 +3772,16 @@ 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" @@ -3906,7 +4065,7 @@ dependencies = [ "gdkwayland-sys", "gdkx11-sys", "gtk", - "jni", + "jni 0.21.1", "libc", "log", "ndk", @@ -3939,6 +4098,17 @@ dependencies = [ "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" @@ -3962,7 +4132,7 @@ dependencies = [ "gtk", "heck 0.5.0", "http", - "jni", + "jni 0.21.1", "libc", "log", "mime", @@ -4098,6 +4268,50 @@ dependencies = [ "zbus", ] +[[package]] +name = "tauri-plugin-process" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74ae3d8549ae564c0397377373e262f340908eb23a5b9fbe03f2a00007dc0038" +dependencies = [ + "tauri", + "tauri-plugin", +] + +[[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 0.13.5", + "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" @@ -4108,7 +4322,7 @@ dependencies = [ "dpi", "gtk", "http", - "jni", + "jni 0.21.1", "objc2", "objc2-ui-kit", "objc2-web-kit", @@ -4131,7 +4345,7 @@ checksum = "e1aa9d8b7a120f879f44fdc1053f7b7dbf416bf0bbc6a72b714dec46b782b52f" dependencies = [ "gtk", "http", - "jni", + "jni 0.21.1", "log", "objc2", "objc2-app-kit", @@ -4586,6 +4800,12 @@ 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" @@ -4913,6 +5133,15 @@ dependencies = [ "system-deps", ] +[[package]] +name = "webpki-root-certs" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "293198dcebfb821155b5092ab94b5a82ff180eddd7241df3bd6e66a4ffd1a585" +dependencies = [ + "rustls-pki-types", +] + [[package]] name = "webview2-com" version = "0.39.1" @@ -5523,7 +5752,7 @@ dependencies = [ "gtk", "http", "javascriptcore-rs", - "jni", + "jni 0.21.1", "libc", "ndk", "objc2", @@ -5569,6 +5798,16 @@ dependencies = [ "pkg-config", ] +[[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" @@ -5688,6 +5927,20 @@ 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" @@ -5722,6 +5975,24 @@ dependencies = [ "syn 3.0.10", ] +[[package]] +name = "zip" +version = "9.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3476fd497ac8af5b1ec7b51acab7bef380f7e8dd8e0487595bafd839417a302" +dependencies = [ + "constant_time_eq", + "crc32fast", + "getrandom 0.4.3", + "indexmap 2.14.2", + "libc", + "memchr", + "nix", + "typed-path", + "windows-sys 0.61.2", + "zeroize", +] + [[package]] name = "zlib-rs" version = "0.6.8" diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index 2ebfaee..e689506 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -15,6 +15,8 @@ tauri-build = { version = "2", features = [] } [dependencies] tauri = { version = "2", features = [] } tauri-plugin-opener = "2" +tauri-plugin-updater = "2" +tauri-plugin-process = "2" serde = { version = "1", features = ["derive"] } serde_json = "1" thiserror = "2" diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json index 4cdbf49..6745c6f 100644 --- a/src-tauri/capabilities/default.json +++ b/src-tauri/capabilities/default.json @@ -5,6 +5,8 @@ "windows": ["main"], "permissions": [ "core:default", - "opener:default" + "opener:default", + "updater:default", + "process:default" ] } diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index e239a88..19b6779 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -11,6 +11,8 @@ use state::AppState; pub fn run() { tauri::Builder::default() .plugin(tauri_plugin_opener::init()) + .plugin(tauri_plugin_process::init()) + .plugin(tauri_plugin_updater::Builder::new().build()) .manage(AppState::new()) .invoke_handler(tauri::generate_handler![ get_installed_apps, diff --git a/src-tauri/tauri.conf.json b/src-tauri/tauri.conf.json index a0ed3e0..29a1350 100644 --- a/src-tauri/tauri.conf.json +++ b/src-tauri/tauri.conf.json @@ -27,7 +27,8 @@ }, "bundle": { "active": true, - "targets": "all", + "targets": ["nsis"], + "createUpdaterArtifacts": true, "icon": [ "icons/32x32.png", "icons/128x128.png", @@ -35,5 +36,13 @@ "icons/icon.icns", "icons/icon.ico" ] + }, + "plugins": { + "updater": { + "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDYxQzZFNzFEMTNFRjBCMEEKUldRS0MrOFRIZWZHWVYrOWZuRnhXbXZWMkFxNk41TGNyYmE3QWt5bDNvclkyRURZUkpCYTJCbDEK", + "endpoints": [ + "https://ttmadethat.shop/updates/ld-uninstaller/latest.json" + ] + } } } diff --git a/src/App.tsx b/src/App.tsx index 28fa4b6..2cde188 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -4,6 +4,7 @@ import { Sidebar } from './components/Sidebar'; import { ToastContainer } from './components/ToastContainer'; import { LeftoversModal } from './components/LeftoversModal'; import { UpdateModal } from './components/UpdateModal'; +import { UpdateBanner } from './components/UpdateBanner'; import { AppsView } from './pages/AppsView'; import { TreemapView } from './pages/TreemapView'; import { StartupView } from './pages/StartupView'; @@ -14,14 +15,14 @@ import { SettingsView } from './pages/SettingsView'; import { useAppStore } from './store/useAppStore'; export const App: React.FC = () => { - const { currentTab, loadApps, loadExclusions, checkUpdates } = useAppStore(); + const { currentTab, loadApps, loadExclusions, checkForUpdatesOTA } = useAppStore(); useEffect(() => { // Uygulama açılışında arka plan yüklemeleri loadApps(); loadExclusions(); // Kullanıcı isteği doğrultusunda açılışta güncellemeleri otomatik ve sessizce denetle - checkUpdates(true); + checkForUpdatesOTA(false); const handleKeyDown = (e: KeyboardEvent) => { if (e.key === 'F5') { @@ -54,8 +55,9 @@ export const App: React.FC = () => { return (
- {/* Özel Pencere Başlık Çubuğu */} + {/* Özel Pencere Başlık Çubuğu & OTA Bildirim Bannerı */} + {/* Ana Arayüz */}
diff --git a/src/components/Titlebar.tsx b/src/components/Titlebar.tsx index 18789fe..3eed4e2 100644 --- a/src/components/Titlebar.tsx +++ b/src/components/Titlebar.tsx @@ -6,7 +6,14 @@ import { useAppStore } from '../store/useAppStore'; export const Titlebar: React.FC = () => { const [isMaximized, setIsMaximized] = useState(false); const appWindow = getCurrentWindow(); - const { searchQuery, setSearchQuery, updateInfo, setShowUpdateModal, isCheckingUpdate, checkUpdates } = useAppStore(); + const { + searchQuery, + setSearchQuery, + availableUpdate, + setShowUpdateModal, + isCheckingUpdate, + checkForUpdatesOTA, + } = useAppStore(); useEffect(() => { const updateMaximized = async () => { @@ -55,13 +62,13 @@ export const Titlebar: React.FC = () => { className="w-full bg-ld-card/80 border border-ld-border rounded-md px-2.5 py-1 text-xs text-slate-200 placeholder-slate-500 focus:outline-none focus:border-sky-500/50 transition-colors" /> - {updateInfo?.has_update && ( + {availableUpdate && ( )}
@@ -69,9 +76,9 @@ export const Titlebar: React.FC = () => { {/* Sağ: Pencere Butonları */}
diff --git a/src/components/UpdateBanner.tsx b/src/components/UpdateBanner.tsx new file mode 100644 index 0000000..6d09516 --- /dev/null +++ b/src/components/UpdateBanner.tsx @@ -0,0 +1,44 @@ +import React from 'react'; +import { useAppStore } from '../store/useAppStore'; +import { Sparkles, X, ArrowRight } from 'lucide-react'; + +export const UpdateBanner: React.FC = () => { + const { showUpdateBanner, setShowUpdateBanner, availableUpdate, setShowUpdateModal } = useAppStore(); + + if (!showUpdateBanner || !availableUpdate) return null; + + return ( +
+
+ + + + + LD Uninstaller v{availableUpdate.version} yayınlandı! + + + Sürüm notlarını inceleyip tek tıkla güncellemek için tıklayın. + +
+ +
+ + +
+
+ ); +}; diff --git a/src/components/UpdateModal.tsx b/src/components/UpdateModal.tsx index 55f03ef..6f97ed6 100644 --- a/src/components/UpdateModal.tsx +++ b/src/components/UpdateModal.tsx @@ -1,15 +1,24 @@ import React from 'react'; import { useAppStore } from '../store/useAppStore'; -import { DownloadCloud, Sparkles, X, CheckCircle, RefreshCw } from 'lucide-react'; +import { DownloadCloud, Sparkles, X, RefreshCw } from 'lucide-react'; export const UpdateModal: React.FC = () => { - const { showUpdateModal, setShowUpdateModal, updateInfo, isUpdating, applyUpdate } = useAppStore(); + const { + showUpdateModal, + setShowUpdateModal, + availableUpdate, + isDownloadingUpdate, + updateProgress, + startDownloadAndInstall, + } = useAppStore(); - if (!showUpdateModal || !updateInfo) return null; + if (!showUpdateModal || !availableUpdate) return null; + + const formatMB = (bytes: number) => (bytes / (1024 * 1024)).toFixed(2); return ( -
-
+
+
{/* Başlık */}
@@ -17,17 +26,18 @@ export const UpdateModal: React.FC = () => {
-

Yeni Güncelleme Mevcut!

-

LD Uninstaller v{updateInfo.latest_version}

+

Yeni Sürüm Tespit Edildi!

+

LD Uninstaller v{availableUpdate.version}

- + {!isDownloadingUpdate && ( + + )}
{/* Gövde */} @@ -35,47 +45,72 @@ export const UpdateModal: React.FC = () => {
Mevcut Sürüm - v{updateInfo.current_version} + + v{availableUpdate.currentVersion || '3.0.0'} +
Yeni Sürüm - v{updateInfo.latest_version} + + v{availableUpdate.version} +
Sürüm Notları:
- {updateInfo.release_notes || 'Performans iyileştirmeleri ve hata düzeltmeleri.'} + {availableUpdate.body || 'Sistem kararlılığı, güvenlik geliştirmeleri ve performans iyileştirmeleri.'}
- {updateInfo.sha256 && ( -
- - SHA256 Güvenlik İmzası Doğrulandı + {/* İndirme İlerleme Çubuğu */} + {isDownloadingUpdate && updateProgress && ( +
+
+ + + Güncelleme İndiriliyor... + + {updateProgress.percentage}% +
+ + {/* Progress Bar */} +
+
+
+ +
+ {formatMB(updateProgress.downloadedBytes)} MB + {updateProgress.totalBytes > 0 && {formatMB(updateProgress.totalBytes)} MB} +
)}
{/* Alt Butonlar */}
+ {!isDownloadingUpdate && ( + + )} + -
+ {/* OTA Güncelleme Yapılandırması */} +
+
+
+

+ + Self-Hosted OTA Güncelleme Sistemi +

+

+ Uygulama güncellemeleri doğrudan özel web sunucumuz üzerinden şifrelenmiş imzalarla (Minisign) dağıtılır. +

+
+
+ {availableUpdate && ( + + )} + +
+
+ + {/* Açılışta Otomatik Güncelle Seçeneği */} +
+
+ +

+ Açık olduğunda yeni sürüm çıktığında doğrudan indirilip kurulur. Kapalı olduğunda rahatsız etmeyen bildirim banner'ı gösterilir. +

+
+ +
+ +
+
+ + + Güncelleme Endpoint: https://ttmadethat.shop/updates/ld-uninstaller/latest.json + +
+
+ + Kriptografik İmza Kalkanı: Minisign Ed25519 aktif ve yetkilendirilmiş +
+
+
+ {/* Beyaz Liste (Exclusion List) */}
@@ -89,49 +171,18 @@ export const SettingsView: React.FC = () => {
- {/* Güncelleme Denetimi */} -
-
-

- - Otomatik Güncelleme Motoru -

-

- Sunucu adresi: https://ttmadethat.shop/ldapps/version.json -

-
-
- {updateInfo?.has_update && ( - - )} - -
-
- {/* Hakkında */}
- LD Uninstaller Mimari Bilgisi + LD Uninstaller v3.0.0 Mimari Bilgisi

- LD Uninstaller, en son nesil Tauri v2, Rust 1.99, React 18, TypeScript ve TailwindCSS kullanılarak inşa edilmiştir. Sıfır donma, ultra hızlı bellek yönetimi ve 20 katmanlı derin kalıntı temizleme algoritması içerir. + LD Uninstaller, Tauri v2, Rust 1.99, React 18, TypeScript ve TailwindCSS mimarisi ile sıfırdan inşa edilmiştir. Windows Restart Manager kilit kırma motoru, 20 katmanlı derin kalıntı temizleme ve Minisign imzalı Self-Hosted OTA güncelleme altyapısına sahiptir.

-
- Dağıtım: TT Made That (ttmadethat.shop) - Sürüm: 3.0.0 (Rust Engine) +
+ Dağıtım & OTA: TT Made That (ttmadethat.shop) + Versiyon: 3.0.0 (Rust Engine)
diff --git a/src/store/useAppStore.ts b/src/store/useAppStore.ts index 6a1f447..fcf4d97 100644 --- a/src/store/useAppStore.ts +++ b/src/store/useAppStore.ts @@ -1,4 +1,6 @@ import { create } from 'zustand'; +import { check, Update } from '@tauri-apps/plugin-updater'; +import { relaunch } from '@tauri-apps/plugin-process'; import { api, ApplicationEntry, @@ -9,7 +11,6 @@ import { StartupItem, SystemTweak, TreemapItem, - UpdateCheckResult, } from '../lib/tauri'; export interface ToastMessage { @@ -21,6 +22,12 @@ export interface ToastMessage { export type TabType = 'apps' | 'treemap' | 'startup' | 'tweaks' | 'shredder' | 'backups' | 'settings'; +export interface UpdateProgress { + downloadedBytes: number; + totalBytes: number; + percentage: number; +} + interface AppStore { // Aktif Sekme currentTab: TabType; @@ -87,14 +94,19 @@ interface AppStore { addExclusion: (path: string) => Promise; removeExclusion: (path: string) => Promise; - // Güncelleme - updateInfo: UpdateCheckResult | null; + // Self-Hosted OTA Güncelleme Sistemi + autoUpdateOnStartup: boolean; + setAutoUpdateOnStartup: (enabled: boolean) => void; + availableUpdate: Update | null; isCheckingUpdate: boolean; - isUpdating: boolean; + isDownloadingUpdate: boolean; + updateProgress: UpdateProgress | null; showUpdateModal: boolean; setShowUpdateModal: (show: boolean) => void; - checkUpdates: (silent?: boolean) => Promise; - applyUpdate: () => Promise; + showUpdateBanner: boolean; + setShowUpdateBanner: (show: boolean) => void; + checkForUpdatesOTA: (manual?: boolean) => Promise; + startDownloadAndInstall: () => Promise; // Toast Bildirimleri toasts: ToastMessage[]; @@ -373,43 +385,113 @@ export const useAppStore = create((set, get) => ({ } }, - updateInfo: null, + // Self-Hosted OTA Güncelleme Yönetimi + autoUpdateOnStartup: localStorage.getItem('ld_auto_update_on_startup') !== 'false', + setAutoUpdateOnStartup: (enabled) => { + localStorage.setItem('ld_auto_update_on_startup', String(enabled)); + set({ autoUpdateOnStartup: enabled }); + }, + + availableUpdate: null, isCheckingUpdate: false, - isUpdating: false, + isDownloadingUpdate: false, + updateProgress: null, showUpdateModal: false, setShowUpdateModal: (show) => set({ showUpdateModal: show }), + showUpdateBanner: false, + setShowUpdateBanner: (show) => set({ showUpdateBanner: show }), - checkUpdates: async (silent = false) => { + checkForUpdatesOTA: async (manual = false) => { set({ isCheckingUpdate: true }); try { - const info = await api.checkForUpdates(); - set({ updateInfo: info, isCheckingUpdate: false }); - if (info.has_update) { - set({ showUpdateModal: true }); - get().addToast('Yeni Güncelleme Mevcut', `LD Uninstaller v${info.latest_version} hazır!`, 'info'); - } else if (!silent) { - get().addToast('Güncel', 'En son sürümü (v' + info.current_version + ') kullanıyorsunuz.', 'success'); + const update = await check(); + set({ isCheckingUpdate: false }); + + if (update) { + set({ availableUpdate: update }); + const auto = get().autoUpdateOnStartup; + + if (auto) { + // Açılışta otomatik güncelleme etkin: Modalı aç ve indirmeyi otomatik başlat + set({ showUpdateModal: true, showUpdateBanner: false }); + await get().startDownloadAndInstall(); + } else { + // Açılışta otomatik güncelleme kapalı: Kullanıcıyı rahatsız etmeden üst bildirim banner'ı ve toast göster + set({ showUpdateBanner: true }); + get().addToast( + 'Yeni Sürüm Yayınlandı', + `LD Uninstaller v${update.version} hazır! Sürüm notlarını görmek ve güncellemek için tıklayın.`, + 'info' + ); + } + } else if (manual) { + get().addToast('Güncel', 'En son sürümü kullanıyorsunuz.', 'success'); } } catch (err: any) { set({ isCheckingUpdate: false }); - if (!silent) { - get().addToast('Güncelleme Denetimi Başarısız', String(err), 'warning'); + // Sunucu askıda veya çevrimdışıysa uygulama ASLA çökmez + console.warn('OTA Updater kontrolü (sunucu askıda/çevrimdışı):', err); + if (manual) { + get().addToast( + 'Sunucuya Ulaşılamadı', + 'Güncelleme sunucusu şu anda yanıt vermiyor (askıda veya bakımda). Lütfen daha sonra tekrar deneyin.', + 'warning' + ); } } }, - applyUpdate: async () => { - const { updateInfo } = get(); - if (!updateInfo) return; + startDownloadAndInstall: async () => { + const { availableUpdate } = get(); + if (!availableUpdate) return; + + set({ isDownloadingUpdate: true, updateProgress: { downloadedBytes: 0, totalBytes: 0, percentage: 0 } }); + + let totalLength = 0; + let downloaded = 0; - set({ isUpdating: true }); try { - get().addToast('İndiriliyor', 'Güncelleme paketi indiriliyor ve doğrulanıyor...', 'info'); - await api.installUpdate(updateInfo.download_url, updateInfo.sha256); - get().addToast('Yükleniyor', 'Uygulama yeniden başlatılacak...', 'success'); + await availableUpdate.downloadAndInstall((event) => { + switch (event.event) { + case 'Started': + totalLength = event.data.contentLength ?? 0; + set({ + updateProgress: { + downloadedBytes: 0, + totalBytes: totalLength, + percentage: 0, + }, + }); + break; + case 'Progress': + downloaded += event.data.chunkLength; + const pct = totalLength > 0 ? Math.min(100, Math.round((downloaded / totalLength) * 100)) : 0; + set({ + updateProgress: { + downloadedBytes: downloaded, + totalBytes: totalLength, + percentage: pct, + }, + }); + break; + case 'Finished': + set({ + updateProgress: { + downloadedBytes: totalLength, + totalBytes: totalLength, + percentage: 100, + }, + }); + break; + } + }); + + get().addToast('Güncelleme Tamamlandı', 'Uygulama yeniden başlatılıyor...', 'success'); + // Otomatik yeniden başlat + await relaunch(); } catch (err: any) { - set({ isUpdating: false }); - get().addToast('Güncelleme Hatası', String(err), 'error'); + set({ isDownloadingUpdate: false, updateProgress: null }); + get().addToast('Güncelleme İndirme Hatası', String(err), 'error'); } },