Skip to content

Commit

Permalink
rmlwk: fix whitelist behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
ZG089 committed Dec 22, 2024
1 parent 0ab3656 commit 6006e7c
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions system/bin/rmlwk
Original file line number Diff line number Diff line change
Expand Up @@ -134,10 +134,11 @@ case "$(tolower "$1")" in
echo "- Entries for blocking porn sites are added successfully."
;;
--whitelist)
[[ -z "$domain" ]] && abort "Please provide a domain to whitelist."
sed "/0\.0\.0\.0 $domain/d" "$hosts_file" > "$temp" && cp -f "$temp" "$hosts_file" || abort "Failed to whitelist $domain ."
echo "- Whitelisted $domain."
;;
[[ -z "$domain" ]] && abort "Please provide a domain to whitelist."
# Directly remove the line containing the domain
sed -i "/0\.0\.0\.0 $domain/d" "$hosts_file" || abort "Failed to whitelist $domain."
echo "- Whitelisted $domain."
;;
--blacklist)
[[ -z "$domain" ]] && abort "Please provide a domain to blacklist."
echo "0.0.0.0 $domain" >> "$hosts_file"
Expand Down

0 comments on commit 6006e7c

Please sign in to comment.