diff --git a/bucket/simple-dnscrypt.json b/bucket/simple-dnscrypt.json index 57bebe59847101..15dd6f344d5b11 100644 --- a/bucket/simple-dnscrypt.json +++ b/bucket/simple-dnscrypt.json @@ -1,8 +1,11 @@ { "version": "0.7.1", - "description": "An easy to use GUI for dnscrypt-proxy", - "homepage": "https://simplednscrypt.org/", - "license": "MIT", + "description": "A simple management tool to configure dnscrypt-proxy on windows based systems.", + "homepage": "https://simplednscrypt.org", + "license": { + "identifier": "MIT", + "url": "https://github.com/bitbeans/SimpleDnsCrypt/blob/HEAD/LICENSE.md" + }, "suggest": { "vcredist": "extras/vcredist2022" }, @@ -17,9 +20,14 @@ } }, "pre_install": [ - "if (!(Test-Path \"$env:LOCALAPPDATA\\SimpleDnsCrypt\")) { New-Item \"$env:LOCALAPPDATA\\SimpleDnsCrypt\" -ItemType Directory -Force | Out-Null }", - "'blacklist.txt', 'blocked.log', 'query.log', 'domain-blacklist.txt', 'domain-whitelist.txt' | ForEach-Object {", - " if (!(Test-Path \"$persist_dir\\$_\")) { New-Item \"$dir\\$_\" | Out-Null }", + "if (Test-Path -Path \"$dir\\APPDIR\" -PathType Container) {", + " Copy-Item -Path \"$dir\\APPDIR\\*\" -Destination $dir -Force -Recurse", + " Remove-Item -Path \"$dir\\APPDIR\" -Recurse -Force -ErrorAction SilentlyContinue", + "}", + "'*.log', '*.txt' | ForEach-Object {", + " if (Test-Path -Path \"$persist_dir\\$_\" -PathType Leaf) {", + " Copy-Item -Path \"$persist_dir\\$_\" -Destination \"$dir\\dnscrypt-proxy\" -Force", + " }", "}" ], "shortcuts": [ @@ -28,30 +36,41 @@ "Simple DnsCrypt" ] ], - "bin": "SimpleDnsCrypt.exe", - "persist": [ - "dnscrypt-proxy\\dnscrypt-proxy.toml", - "dnscrypt-proxy\\blacklist.txt", - "dnscrypt-proxy\\blocked.log", - "dnscrypt-proxy\\query.log", - "dnscrypt-proxy\\domain-blacklist.txt", - "dnscrypt-proxy\\domain-whitelist.txt" - ], + "persist": "dnscrypt-proxy\\dnscrypt-proxy.toml", "pre_uninstall": [ - "if (!(is_admin)) { error \"$app requires admin rights to $cmd\"; break }", - "", - "Start-Process -Wait \"$dir\\Uninstall.exe\" | Out-Null", - "if (Get-Process -Name 'SimpleDnsCrypt' -ErrorAction SilentlyContinue) { Stop-Process -Name 'SimpleDnsCrypt' | Out-Null }", - "$service = Get-Service -Name 'dnscrypt-proxy' -ErrorAction SilentlyContinue", - "if (($service) -and ($service.Status -ne 'Stopped')) {", - " if (!(is_admin)) { error 'Admin rights are required to stop dnscrypt-proxy service'; break }", - " Stop-Service -Name 'dnscrypt-proxy' | Out-Null", - "}", - "if (($service) -and ($cmd -eq 'uninstall')) {", - " if (!(is_admin)) { error 'Admin rights are required to remove dnscrypt-proxy service'; break }", - " Remove-Service -Name 'dnscrypt-proxy' | Out-Null", + "'*.log', '*.txt' | ForEach-Object {", + " if (Test-Path -Path \"$dir\\dnscrypt-proxy\\$_\" -PathType Leaf) {", + " Copy-Item -Path \"$dir\\dnscrypt-proxy\\$_\" -Destination $persist_dir -Force", + " }", "}" ], + "uninstaller": { + "script": [ + "$base_service_name = 'dnscrypt-proxy'", + "$path_regex = [regex]::Escape((Split-Path -Path $dir -Parent))", + "Stop-Process -Name 'SimpleDnsCrypt' -Force -ErrorAction SilentlyContinue", + "if ($PSVersionTable.PSVersion -ge [version]::new(6, 0)) {", + " $services = Get-Service -Name \"*$base_service_name*\" -ErrorAction SilentlyContinue", + "} else {", + " $name_filter = \"Name like '%$base_service_name%'\"", + " $services = Get-CimInstance -ClassName Win32_Service -Filter $name_filter -ErrorAction SilentlyContinue |", + " Select-Object -Property *, @{ Name = 'BinaryPathName'; Expression = { $_.PathName } }", + "}", + "$service = $services | Where-Object { $_.BinaryPathName -match $path_regex }", + "if ($null -ne $service) {", + " if (-not (is_admin)) { abort \"`n[ERROR] $app requires admin rights to $cmd.\" }", + " Stop-Service -Name $service.Name -Force -ErrorAction SilentlyContinue", + " Stop-Process -Name 'dnscrypt-proxy' -Force -ErrorAction SilentlyContinue", + " Start-Sleep -Milliseconds 1500", + " if ($cmd -ne 'uninstall') { return }", + " if ($PSVersionTable.PSVersion -ge [version]::new(6, 0)) {", + " Remove-Service -Name 'dnscrypt-proxy' -ErrorAction SilentlyContinue", + " } else {", + " Start-Process -FilePath 'sc.exe' -ArgumentList @('delete', 'dnscrypt-proxy') -NoNewWindow -Wait", + " }", + "}" + ] + }, "checkver": { "github": "https://github.com/bitbeans/SimpleDnsCrypt" },