File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff 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
Original file line number Diff line number Diff 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)
7979echo " 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."
8282chmod 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
129129launchctl load -w " $PLIST_PATH "
130130
131131echo " Installation complete."
132+ exit 0
You can’t perform that action at this time.
0 commit comments