File tree Expand file tree Collapse file tree 14 files changed +220
-0
lines changed
META-INF/com/google/android
Volume-Key-Selector/tools Expand file tree Collapse file tree 14 files changed +220
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /sbin/sh
2+
3+ # ################
4+ # Initialization
5+ # ################
6+
7+ umask 022
8+
9+ # echo before loading util_functions
10+ ui_print () { echo " $1 " ; }
11+
12+ require_new_magisk () {
13+ ui_print " *******************************"
14+ ui_print " Please install Magisk v20.4+! "
15+ ui_print " *******************************"
16+ exit 1
17+ }
18+
19+ # ########################
20+ # Load util_functions.sh
21+ # ########################
22+
23+ OUTFD=$2
24+ ZIPFILE=$3
25+
26+ mount /data 2> /dev/null
27+
28+ [ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
29+ . /data/adb/magisk/util_functions.sh
30+ [ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk
31+
32+ install_module
33+ exit 0
Original file line number Diff line number Diff line change 1+ #MAGISK
Original file line number Diff line number Diff line change 1+ # Systemless Adblocker
2+
3+ ---
4+ ## Overview:
5+ - The ultimate ad blocker, with no user interface
6+ - Added key-selector to choose from different hosts
7+ - Automatically downloads the lastest unified-hosts from [ @StevenBlack ] ( https://github.com/StevenBlack/hosts ) hosts sources
8+ - Support Magisk & KernelSU
9+
10+ ## Added hosts:
11+ - Unified Hosts
12+ - Unified hosts + fakenews + gambling + social
13+ - Unified hosts + fakenews + gambling + porn + social
14+ - more will be added soon....
15+
16+ ---
17+ ## Credits:
18+ - [ @topjohnwu ] ( https://github.com/topjohnwu ) / Magisk - Magisk Module Template
19+ - [ @StevenBlack ] ( https://github.com/StevenBlack ) / Base hosts sources
20+ - [ @JumbomanXDA ] ( https://github.com/JumbomanXDA ) / Custom installation script
21+ - [ @gloeyisk ] ( https://github.com/gloeyisk/systemless-hosts ) / Original source
Original file line number Diff line number Diff line change 1+ # External Tools
2+ chmod -R 0755 $MODPATH /addon/Volume-Key-Selector/tools
3+
4+ chooseport_legacy () {
5+ [ " $1 " ] && local delay=$1 || local delay=3
6+ local error=false
7+ while true ; do
8+ timeout 0 $MODPATH /addon/Volume-Key-Selector/tools/$ARCH32 /keycheck
9+ timeout $delay $MODPATH /addon/Volume-Key-Selector/tools/$ARCH32 /keycheck
10+ local sel=$?
11+ if [ $sel -eq 42 ]; then
12+ return 0
13+ elif [ $sel -eq 41 ]; then
14+ return 1
15+ elif $error ; then
16+ abort " No version selected, please restart installation"
17+ else
18+ error=true
19+ fi
20+ done
21+ }
22+
23+ chooseport () {
24+ [ " $1 " ] && local delay=$1 || local delay=3
25+ local error=false
26+ while true ; do
27+ local count=0
28+ while true ; do
29+ timeout $delay /system/bin/getevent -lqc 1 2>&1 > $TMPDIR /events &
30+ sleep 0.5; count=$(( count + 1 ))
31+ if (` grep -q ' KEY_VOLUMEUP *DOWN' $TMPDIR /events` ); then
32+ return 0
33+ elif (` grep -q ' KEY_VOLUMEDOWN *DOWN' $TMPDIR /events` ); then
34+ return 1
35+ fi
36+ [ $count -gt 30 ] && break
37+ done
38+ if $error ; then
39+ export chooseport=chooseport_legacy VKSEL=chooseport_legacy
40+ chooseport_legacy $delay
41+ return $?
42+ else
43+ error=true
44+ echo " "
45+ echo " Volume key not detected, try again"
46+ echo " "
47+ fi
48+ done
49+ }
50+
51+ VKSEL=chooseport
Original file line number Diff line number Diff line change 1+ ## v1.1 [ Release | 20240506 ]
2+ - Simplified the main script logic.
3+ - Made a separate dir for the host installer scripts.
4+
5+ ## v1.0 [ Release | 20240506 ]
6+ - Added key-selector to switch between different hosts
7+ ### Below are the currently supported hosts:
8+ - Unified Hosts.
9+ - Unified hosts + fakenews + gambling + social.
10+ - Unified hosts + fakenews + gambling + porn + social.
11+ - more will be added soon...
Original file line number Diff line number Diff line change 1+ #! /system/bin/sh
2+
3+ # Systemless Hosts by the open source loving GL-DP and all contributors;
4+ # Consolidating and extending hosts files from several well-curated sources
5+
6+ install_hosts () {
7+ . $MODPATH /addon/install.sh
8+ ui_print " Install Unified Hosts (UH)?"
9+ ui_print " "
10+ ui_print " Vol+ = Yes"
11+ ui_print " Vol- = No"
12+ ui_print " "
13+ if chooseport; then
14+ . $MODPATH /host-installer/uh.sh
15+ else
16+ ui_print " Install UH + fakenews + gambling + social ?"
17+ ui_print " "
18+ ui_print " Vol+ = Yes"
19+ ui_print " Vol- = No"
20+ ui_print " "
21+ if chooseport; then
22+ . $MODPATH /host-installer/uhfgs.sh
23+ else
24+ ui_print " Install Unified hosts + fakenews + gambling + porn + social?"
25+ ui_print " "
26+ ui_print " Vol+ = Yes"
27+ ui_print " Vol- = No"
28+ ui_print " "
29+ if chooseport; then
30+ . $MODPATH /host-installer/uhfgps.sh
31+ else
32+ ui_print " - Exiting"
33+ fi
34+ fi
35+ fi
36+ }
37+
38+ patch_hosts () {
39+ PATH=/system/etc
40+ ui_print " - Patching hosts file"
41+ mkdir -p $MODPATH$PATH
42+ mv -f $MODPATH /hosts $MODPATH$PATH
43+ }
44+
45+ cleanup () {
46+ rm -rf $MODPATH /LICENSE
47+ rm -rf $MODPATH /addon 2> /dev/null
48+ rm -f $MODPATH /install.sh 2> /dev/null
49+ }
50+
51+ run_install () {
52+ unzip -o " $ZIPFILE " -x ' META-INF/*' -d $MODPATH >&2
53+ ui_print " "
54+ ui_print " - Installing & patching hosts"
55+ install_hosts
56+ patch_hosts
57+ ui_print " "
58+ ui_print " - Cleaning up"
59+ cleanup
60+ ui_print " "
61+ }
62+
63+ run_install
Original file line number Diff line number Diff line change 1+ ui_print " - Unified Hosts Selected"
2+ HOSTS_URL=" https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
3+ GIT_URL=" https://github.com/StevenBlack/hosts"
4+ ui_print " - Downloading latest hosts file from $GIT_URL "
5+ curl -o $MODPATH /hosts $HOSTS_URL
6+ if [ $? -ne 0 ]; then
7+ ui_print " Error: Failed to download hosts file."
8+ exit 1
9+ fi
Original file line number Diff line number Diff line change 1+ ui_print " - Unified hosts + fakenews + gambling + porn + social Selected"
2+ HOSTS_URL=" https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts"
3+ GIT_URL=" https://github.com/StevenBlack/hosts"
4+ ui_print " - Downloading latest hosts file from $GIT_URL "
5+ curl -o $MODPATH /hosts $HOSTS_URL
6+ if [ $? -ne 0 ]; then
7+ ui_print " Error: Failed to download hosts file."
8+ exit 1
9+ fi
You can’t perform that action at this time.
0 commit comments