Skip to content

Commit 80f0425

Browse files
committed
feat: v1.0.35 final - uninstall button, installer fixes, oob strategy, diagnostics v2
1 parent 38115e5 commit 80f0425

2 files changed

Lines changed: 39 additions & 1 deletion

File tree

Sources/main.swift

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -199,6 +199,17 @@ struct ContentView: View {
199199
.buttonStyle(.plain)
200200
.font(.subheadline)
201201
.foregroundStyle(.secondary)
202+
203+
Text("")
204+
.foregroundStyle(.tertiary)
205+
.padding(.horizontal, 4)
206+
207+
Button("Uninstall Service") {
208+
installerManager.uninstall()
209+
}
210+
.buttonStyle(.plain)
211+
.font(.subheadline)
212+
.foregroundStyle(.secondary)
202213
}
203214

204215
Spacer()
@@ -796,6 +807,32 @@ class InstallerManager: ObservableObject {
796807
self.isInstalled = hasDir && hasSudoers
797808
}
798809

810+
func uninstall() {
811+
self.isInstalling = true
812+
self.errorMessage = nil
813+
814+
let path = "/opt/darkware-zapret"
815+
let sudoers = "/etc/sudoers.d/darkware-zapret"
816+
817+
let scriptSource = "do shell script \"rm -rf '\(path)' && rm -f '\(sudoers)'\" with administrator privileges"
818+
819+
DispatchQueue.global(qos: .userInitiated).async {
820+
var error: NSDictionary?
821+
if let scriptObject = NSAppleScript(source: scriptSource) {
822+
scriptObject.executeAndReturnError(&error)
823+
}
824+
825+
DispatchQueue.main.async {
826+
if let error = error {
827+
self.errorMessage = (error["NSAppleScriptErrorBriefMessage"] as? String) ?? "Uninstall failed"
828+
} else {
829+
self.checkInstallation()
830+
}
831+
self.isInstalling = false
832+
}
833+
}
834+
}
835+
799836
func install() {
800837
self.isInstalling = true
801838
self.errorMessage = nil

install_darkware.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ chmod +x "$TARGET_DIR/ipset/"*.sh
7878
# Try to download Re-filter list (contains YouTube and other needed domains)
7979
echo "Downloading Re-filter hostlist..."
8080
# Run in subshell to not change script cwd, ignore errors to not break install
81-
(export GZIP_LISTS=0 && cd "$TARGET_DIR/ipset" && ./get_refilter_domains.sh) || echo "Warning: Failed to download Re-filter list. Using empty list."
81+
(export GZIP_LISTS=0 && cd "$TARGET_DIR/ipset" && ./get_refilter_domains.sh >/dev/null 2>&1) || echo "Warning: Failed to download Re-filter list. Using empty list."
8282
chmod 644 "$TARGET_DIR/ipset/"*.txt
8383

8484
# Add dummy entry if user list is empty (best practice from install_easy.sh)
@@ -129,3 +129,4 @@ launchctl unload "$PLIST_PATH" 2>/dev/null || true
129129
launchctl load -w "$PLIST_PATH"
130130

131131
echo "Installation complete."
132+
exit 0

0 commit comments

Comments
 (0)