feat: Add self-hosted OTA auto-update infrastructure and publish automation

This commit is contained in:
LilDosto 2026-11-12 19:44:25 +03:00
parent 4ef32db388
commit 1f0c0eff67
16 changed files with 855 additions and 115 deletions

6
.gitignore vendored
View file

@ -3,8 +3,14 @@ node_modules
target/
dist
dist-ssr
dist_server/
*.local
# Secrets & Signing Keys
.keys/
*.key
*.pub
# .NET artifacts
bin/
obj/

20
package-lock.json generated
View file

@ -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",

View file

@ -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",

9
publish.bat Normal file
View file

@ -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

196
publish.ps1 Normal file
View file

@ -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
}

281
src-tauri/Cargo.lock generated
View file

@ -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"

View file

@ -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"

View file

@ -5,6 +5,8 @@
"windows": ["main"],
"permissions": [
"core:default",
"opener:default"
"opener:default",
"updater:default",
"process:default"
]
}

View file

@ -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,

View file

@ -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"
]
}
}
}

View file

@ -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 (
<div className="flex h-screen w-screen bg-ld-bg text-slate-100 select-none overflow-hidden font-sans">
{/* Özel Pencere Başlık Çubuğu */}
{/* Özel Pencere Başlık Çubuğu & OTA Bildirim Bannerı */}
<Titlebar />
<UpdateBanner />
{/* Ana Arayüz */}
<div className="flex flex-1 h-full w-full overflow-hidden">

View file

@ -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 && (
<button
onClick={() => setShowUpdateModal(true)}
className="flex items-center gap-1.5 px-2 py-0.5 rounded-full bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 text-[11px] font-medium hover:bg-emerald-500/30 transition-all cursor-pointer whitespace-nowrap animate-pulse"
>
<span className="w-1.5 h-1.5 rounded-full bg-emerald-400" />
v{updateInfo.latest_version} Hazır
v{availableUpdate.version} Hazır
</button>
)}
</div>
@ -69,9 +76,9 @@ export const Titlebar: React.FC = () => {
{/* Sağ: Pencere Butonları */}
<div className="flex items-center gap-1">
<button
onClick={() => checkUpdates(false)}
onClick={() => checkForUpdatesOTA(true)}
title="Güncellemeleri Denetle"
className="p-1.5 text-slate-400 hover:text-slate-200 hover:bg-white/5 rounded transition-colors"
className="p-1.5 text-slate-400 hover:text-slate-200 hover:bg-white/5 rounded transition-colors cursor-pointer"
>
<RefreshCw className={`w-3.5 h-3.5 ${isCheckingUpdate ? 'animate-spin text-sky-400' : ''}`} />
</button>

View file

@ -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 (
<div className="fixed top-10 left-0 right-0 z-40 bg-gradient-to-r from-sky-600/90 via-indigo-600/90 to-purple-600/90 text-white px-4 py-2 flex items-center justify-between shadow-lg backdrop-blur-md select-none border-b border-white/10 animate-in fade-in slide-in-from-top-2 duration-300">
<div className="flex items-center gap-2.5 text-xs">
<span className="p-1 rounded-full bg-white/20">
<Sparkles className="w-3.5 h-3.5 text-yellow-300" />
</span>
<span className="font-medium">
LD Uninstaller <strong className="font-mono underline">v{availableUpdate.version}</strong> yayınlandı!
</span>
<span className="hidden sm:inline text-white/80 text-[11px]">
Sürüm notlarını inceleyip tek tıkla güncellemek için tıklayın.
</span>
</div>
<div className="flex items-center gap-2">
<button
onClick={() => {
setShowUpdateBanner(false);
setShowUpdateModal(true);
}}
className="flex items-center gap-1 px-3 py-1 rounded-lg text-xs font-semibold bg-white text-slate-900 hover:bg-slate-100 transition-colors cursor-pointer shadow-sm"
>
<span>İncele ve Güncelle</span>
<ArrowRight className="w-3.5 h-3.5" />
</button>
<button
onClick={() => setShowUpdateBanner(false)}
className="p-1 rounded text-white/70 hover:text-white transition-colors"
>
<X className="w-3.5 h-3.5" />
</button>
</div>
</div>
);
};

View file

@ -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 (
<div className="fixed inset-0 z-50 bg-black/70 backdrop-blur-sm flex items-center justify-center p-4">
<div className="bg-ld-surface border border-ld-border rounded-xl w-full max-w-md shadow-2xl overflow-hidden flex flex-col">
<div className="fixed inset-0 z-50 bg-black/75 backdrop-blur-sm flex items-center justify-center p-4">
<div className="bg-ld-surface border border-ld-border rounded-xl w-full max-w-md shadow-2xl overflow-hidden flex flex-col animate-in fade-in zoom-in-95 duration-200">
{/* Başlık */}
<div className="px-5 py-4 border-b border-ld-border flex items-center justify-between bg-gradient-to-r from-sky-500/10 to-transparent">
<div className="flex items-center gap-2.5">
@ -17,17 +26,18 @@ export const UpdateModal: React.FC = () => {
<Sparkles className="w-5 h-5" />
</div>
<div>
<h3 className="text-sm font-semibold text-slate-100">Yeni Güncelleme Mevcut!</h3>
<p className="text-[11px] text-slate-400">LD Uninstaller v{updateInfo.latest_version}</p>
<h3 className="text-sm font-semibold text-slate-100">Yeni Sürüm Tespit Edildi!</h3>
<p className="text-[11px] text-slate-400">LD Uninstaller v{availableUpdate.version}</p>
</div>
</div>
{!isDownloadingUpdate && (
<button
disabled={isUpdating}
onClick={() => setShowUpdateModal(false)}
className="p-1 rounded text-slate-400 hover:text-slate-200 transition-colors"
>
<X className="w-4 h-4" />
</button>
)}
</div>
{/* Gövde */}
@ -35,47 +45,72 @@ export const UpdateModal: React.FC = () => {
<div className="grid grid-cols-2 gap-3 text-xs">
<div className="p-3 rounded-lg bg-ld-card border border-ld-border">
<span className="text-slate-400 block text-[11px]">Mevcut Sürüm</span>
<span className="font-mono font-semibold text-slate-200 mt-0.5 block">v{updateInfo.current_version}</span>
<span className="font-mono font-semibold text-slate-200 mt-0.5 block">
v{availableUpdate.currentVersion || '3.0.0'}
</span>
</div>
<div className="p-3 rounded-lg bg-emerald-500/10 border border-emerald-500/20">
<span className="text-emerald-400 block text-[11px]">Yeni Sürüm</span>
<span className="font-mono font-semibold text-emerald-300 mt-0.5 block">v{updateInfo.latest_version}</span>
<span className="font-mono font-semibold text-emerald-300 mt-0.5 block">
v{availableUpdate.version}
</span>
</div>
</div>
<div>
<span className="text-xs font-medium text-slate-300 block mb-1.5">Sürüm Notları:</span>
<div className="p-3 rounded-lg bg-ld-card border border-ld-border text-xs text-slate-300 max-h-36 overflow-y-auto leading-relaxed">
{updateInfo.release_notes || 'Performans iyileştirmeleri ve hata düzeltmeleri.'}
{availableUpdate.body || 'Sistem kararlılığı, güvenlik geliştirmeleri ve performans iyileştirmeleri.'}
</div>
</div>
{updateInfo.sha256 && (
<div className="flex items-center gap-2 text-[11px] text-slate-400">
<CheckCircle className="w-3.5 h-3.5 text-emerald-400" />
<span>SHA256 Güvenlik İmzası Doğrulandı</span>
{/* İndirme İlerleme Çubuğu */}
{isDownloadingUpdate && updateProgress && (
<div className="p-4 rounded-xl bg-ld-card border border-ld-border space-y-2">
<div className="flex items-center justify-between text-xs">
<span className="text-slate-300 font-medium flex items-center gap-2">
<RefreshCw className="w-3.5 h-3.5 text-sky-400 animate-spin" />
Güncelleme İndiriliyor...
</span>
<span className="font-mono text-sky-400 font-semibold">{updateProgress.percentage}%</span>
</div>
{/* Progress Bar */}
<div className="w-full bg-slate-800 rounded-full h-2.5 overflow-hidden">
<div
className="h-full bg-gradient-to-r from-sky-500 to-indigo-500 transition-all duration-200 rounded-full"
style={{ width: `${updateProgress.percentage}%` }}
/>
</div>
<div className="flex justify-between text-[11px] font-mono text-slate-400 pt-0.5">
<span>{formatMB(updateProgress.downloadedBytes)} MB</span>
{updateProgress.totalBytes > 0 && <span>{formatMB(updateProgress.totalBytes)} MB</span>}
</div>
</div>
)}
</div>
{/* Alt Butonlar */}
<div className="px-5 py-3 border-t border-ld-border bg-ld-card/50 flex items-center justify-end gap-2.5">
{!isDownloadingUpdate && (
<button
disabled={isUpdating}
onClick={() => setShowUpdateModal(false)}
className="px-3 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:text-slate-200 hover:bg-white/5 transition-colors"
className="px-3.5 py-1.5 rounded-lg text-xs font-medium text-slate-400 hover:text-slate-200 hover:bg-white/5 transition-colors cursor-pointer"
>
Daha Sonra
</button>
)}
<button
disabled={isUpdating}
onClick={() => applyUpdate()}
disabled={isDownloadingUpdate}
onClick={() => startDownloadAndInstall()}
className="flex items-center gap-1.5 px-4 py-1.5 rounded-lg text-xs font-semibold bg-gradient-to-r from-sky-500 to-indigo-600 text-white hover:opacity-95 shadow-md shadow-sky-500/20 transition-all cursor-pointer disabled:opacity-50"
>
{isUpdating ? (
{isDownloadingUpdate ? (
<>
<RefreshCw className="w-3.5 h-3.5 animate-spin" />
İndiriliyor & Kuruluyor...
İndiriliyor ve Yeniden Başlatılıyor...
</>
) : (
<>

View file

@ -1,6 +1,16 @@
import React, { useEffect, useState } from 'react';
import { useAppStore } from '../store/useAppStore';
import { Settings, ShieldCheck, Plus, Trash2, RefreshCw, Sparkles, Laptop } from 'lucide-react';
import {
Settings,
ShieldCheck,
Plus,
Trash2,
RefreshCw,
Sparkles,
Laptop,
CheckCircle2,
Radio,
} from 'lucide-react';
export const SettingsView: React.FC = () => {
const {
@ -8,9 +18,11 @@ export const SettingsView: React.FC = () => {
loadExclusions,
addExclusion,
removeExclusion,
checkUpdates,
autoUpdateOnStartup,
setAutoUpdateOnStartup,
checkForUpdatesOTA,
isCheckingUpdate,
updateInfo,
availableUpdate,
setShowUpdateModal,
} = useAppStore();
@ -32,13 +44,83 @@ export const SettingsView: React.FC = () => {
<div>
<h2 className="text-xs font-semibold text-slate-100 flex items-center gap-2">
<Settings className="w-4 h-4 text-sky-400" />
Uygulama Ayarları & Koruma Listesi
Uygulama Ayarları & Koruma Merkezi
</h2>
<p className="text-[11px] text-slate-500">Beyaz liste (Exclusion List) ve güncelleme yapılandırması.</p>
<p className="text-[11px] text-slate-500">
Self-Hosted OTA güncelleme sistemi ve beyaz liste (Exclusion List) yönetimi.
</p>
</div>
</div>
<div className="p-6 max-w-3xl mx-auto w-full space-y-6 flex-1 overflow-y-auto">
{/* OTA Güncelleme Yapılandırması */}
<div className="p-5 rounded-xl bg-ld-surface border border-ld-border space-y-4">
<div className="flex items-center justify-between border-b border-ld-border/60 pb-3">
<div className="space-y-0.5">
<h4 className="text-xs font-semibold text-slate-200 flex items-center gap-2">
<Sparkles className="w-4 h-4 text-sky-400" />
Self-Hosted OTA Güncelleme Sistemi
</h4>
<p className="text-[11px] text-slate-400">
Uygulama güncellemeleri doğrudan özel web sunucumuz üzerinden şifrelenmiş imzalarla (Minisign) dağıtılır.
</p>
</div>
<div className="flex items-center gap-2">
{availableUpdate && (
<button
onClick={() => setShowUpdateModal(true)}
className="px-3 py-1.5 rounded-lg text-xs font-semibold bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 hover:bg-emerald-500/30 transition-all cursor-pointer"
>
v{availableUpdate.version} Yükle
</button>
)}
<button
disabled={isCheckingUpdate}
onClick={() => checkForUpdatesOTA(true)}
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-ld-card border border-ld-border text-slate-300 hover:text-white hover:bg-white/5 transition-colors cursor-pointer disabled:opacity-50"
>
<RefreshCw className={`w-3.5 h-3.5 ${isCheckingUpdate ? 'animate-spin text-sky-400' : ''}`} />
Güncellemeleri Şimdi Kontrol Et
</button>
</div>
</div>
{/* Açılışta Otomatik Güncelle Seçeneği */}
<div className="flex items-center justify-between py-2">
<div className="space-y-0.5 pr-4">
<label htmlFor="auto-update-toggle" className="text-xs font-semibold text-slate-200 block cursor-pointer">
Uygulama Açılırken Otomatik Güncelle
</label>
<p className="text-[11px] text-slate-400">
Açık olduğunda yeni sürüm çıktığında doğrudan indirilip kurulur. Kapalı olduğunda rahatsız etmeyen bildirim banner'ı gösterilir.
</p>
</div>
<label className="relative inline-flex items-center cursor-pointer">
<input
id="auto-update-toggle"
type="checkbox"
checked={autoUpdateOnStartup}
onChange={(e) => setAutoUpdateOnStartup(e.target.checked)}
className="sr-only peer"
/>
<div className="w-11 h-6 bg-slate-800 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-sky-500"></div>
</label>
</div>
<div className="p-3 rounded-lg bg-ld-card border border-ld-border text-[11px] text-slate-400 space-y-1">
<div className="flex items-center gap-2">
<Radio className="w-3.5 h-3.5 text-sky-400 shrink-0" />
<span>
Güncelleme Endpoint: <code className="text-slate-300 font-mono">https://ttmadethat.shop/updates/ld-uninstaller/latest.json</code>
</span>
</div>
<div className="flex items-center gap-2">
<CheckCircle2 className="w-3.5 h-3.5 text-emerald-400 shrink-0" />
<span>Kriptografik İmza Kalkanı: Minisign Ed25519 aktif ve yetkilendirilmiş</span>
</div>
</div>
</div>
{/* Beyaz Liste (Exclusion List) */}
<div className="p-5 rounded-xl bg-ld-surface border border-ld-border space-y-4">
<div className="flex items-center gap-2 text-xs font-semibold text-slate-200">
@ -89,49 +171,18 @@ export const SettingsView: React.FC = () => {
</div>
</div>
{/* Güncelleme Denetimi */}
<div className="p-5 rounded-xl bg-ld-surface border border-ld-border flex items-center justify-between">
<div className="space-y-1">
<h4 className="text-xs font-semibold text-slate-200 flex items-center gap-2">
<Sparkles className="w-4 h-4 text-sky-400" />
Otomatik Güncelleme Motoru
</h4>
<p className="text-[11px] text-slate-400">
Sunucu adresi: <code className="text-slate-300">https://ttmadethat.shop/ldapps/version.json</code>
</p>
</div>
<div className="flex items-center gap-2">
{updateInfo?.has_update && (
<button
onClick={() => setShowUpdateModal(true)}
className="px-3 py-1.5 rounded-lg text-xs font-semibold bg-emerald-500/20 text-emerald-400 border border-emerald-500/30 hover:bg-emerald-500/30 transition-all cursor-pointer"
>
v{updateInfo.latest_version} Yükle
</button>
)}
<button
disabled={isCheckingUpdate}
onClick={() => checkUpdates(false)}
className="flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-xs font-medium bg-ld-card border border-ld-border text-slate-300 hover:text-white hover:bg-white/5 transition-colors cursor-pointer"
>
<RefreshCw className={`w-3.5 h-3.5 ${isCheckingUpdate ? 'animate-spin text-sky-400' : ''}`} />
Güncellemeleri Denetle
</button>
</div>
</div>
{/* Hakkında */}
<div className="p-5 rounded-xl bg-ld-surface border border-ld-border text-xs text-slate-400 space-y-2">
<div className="flex items-center gap-2 text-slate-200 font-semibold">
<Laptop className="w-4 h-4 text-sky-400" />
<span>LD Uninstaller Mimari Bilgisi</span>
<span>LD Uninstaller v3.0.0 Mimari Bilgisi</span>
</div>
<p className="text-[11px] leading-relaxed">
LD Uninstaller, en son nesil <strong>Tauri v2</strong>, <strong>Rust 1.99</strong>, <strong>React 18</strong>, <strong>TypeScript</strong> ve <strong>TailwindCSS</strong> 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, <strong>Tauri v2</strong>, <strong>Rust 1.99</strong>, <strong>React 18</strong>, <strong>TypeScript</strong> ve <strong>TailwindCSS</strong> 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.
</p>
<div className="pt-2 text-[10px] text-slate-500 flex justify-between">
<span>Dağıtım: TT Made That (ttmadethat.shop)</span>
<span>Sürüm: 3.0.0 (Rust Engine)</span>
<div className="pt-2 text-[10px] text-slate-500 flex justify-between border-t border-ld-border/40">
<span>Dağıtım & OTA: TT Made That (ttmadethat.shop)</span>
<span>Versiyon: 3.0.0 (Rust Engine)</span>
</div>
</div>
</div>

View file

@ -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<void>;
removeExclusion: (path: string) => Promise<void>;
// 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<void>;
applyUpdate: () => Promise<void>;
showUpdateBanner: boolean;
setShowUpdateBanner: (show: boolean) => void;
checkForUpdatesOTA: (manual?: boolean) => Promise<void>;
startDownloadAndInstall: () => Promise<void>;
// Toast Bildirimleri
toasts: ToastMessage[];
@ -373,43 +385,113 @@ export const useAppStore = create<AppStore>((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');
}
},