Skip to content

Commit

Permalink
Bump version to 1.1
Browse files Browse the repository at this point in the history
  • Loading branch information
Burhanverse committed May 6, 2024
0 parents commit 38f19cf
Show file tree
Hide file tree
Showing 14 changed files with 220 additions and 0 deletions.
33 changes: 33 additions & 0 deletions META-INF/com/google/android/update-binary
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/sbin/sh

#################
# Initialization
#################

umask 022

# echo before loading util_functions
ui_print() { echo "$1"; }

require_new_magisk() {
ui_print "*******************************"
ui_print " Please install Magisk v20.4+! "
ui_print "*******************************"
exit 1
}

#########################
# Load util_functions.sh
#########################

OUTFD=$2
ZIPFILE=$3

mount /data 2>/dev/null

[ -f /data/adb/magisk/util_functions.sh ] || require_new_magisk
. /data/adb/magisk/util_functions.sh
[ $MAGISK_VER_CODE -lt 20400 ] && require_new_magisk

install_module
exit 0
1 change: 1 addition & 0 deletions META-INF/com/google/android/updater-script
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#MAGISK
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Systemless Adblocker

---
## Overview:
- The ultimate ad blocker, with no user interface
- Added key-selector to choose from different hosts
- Automatically downloads the lastest unified-hosts from [@StevenBlack](https://github.com/StevenBlack/hosts) hosts sources
- Support Magisk & KernelSU

## Added hosts:
- Unified Hosts
- Unified hosts + fakenews + gambling + social
- Unified hosts + fakenews + gambling + porn + social
- more will be added soon....

---
## Credits:
- [@topjohnwu](https://github.com/topjohnwu) / Magisk - Magisk Module Template
- [@StevenBlack](https://github.com/StevenBlack) / Base hosts sources
- [@JumbomanXDA](https://github.com/JumbomanXDA) / Custom installation script
- [@gloeyisk](https://github.com/gloeyisk/systemless-hosts) / Original source
Binary file added addon/Volume-Key-Selector/tools/arm/keycheck
Binary file not shown.
Binary file added addon/Volume-Key-Selector/tools/x86/keycheck
Binary file not shown.
51 changes: 51 additions & 0 deletions addon/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# External Tools
chmod -R 0755 $MODPATH/addon/Volume-Key-Selector/tools

chooseport_legacy() {
[ "$1" ] && local delay=$1 || local delay=3
local error=false
while true; do
timeout 0 $MODPATH/addon/Volume-Key-Selector/tools/$ARCH32/keycheck
timeout $delay $MODPATH/addon/Volume-Key-Selector/tools/$ARCH32/keycheck
local sel=$?
if [ $sel -eq 42 ]; then
return 0
elif [ $sel -eq 41 ]; then
return 1
elif $error; then
abort " No version selected, please restart installation"
else
error=true
fi
done
}

chooseport() {
[ "$1" ] && local delay=$1 || local delay=3
local error=false
while true; do
local count=0
while true; do
timeout $delay /system/bin/getevent -lqc 1 2>&1 > $TMPDIR/events &
sleep 0.5; count=$((count + 1))
if (`grep -q 'KEY_VOLUMEUP *DOWN' $TMPDIR/events`); then
return 0
elif (`grep -q 'KEY_VOLUMEDOWN *DOWN' $TMPDIR/events`); then
return 1
fi
[ $count -gt 30 ] && break
done
if $error; then
export chooseport=chooseport_legacy VKSEL=chooseport_legacy
chooseport_legacy $delay
return $?
else
error=true
echo " "
echo " Volume key not detected, try again"
echo " "
fi
done
}

VKSEL=chooseport
11 changes: 11 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## v1.1 [ Release | 20240506 ]
- Simplified the main script logic.
- Made a separate dir for the host installer scripts.

## v1.0 [ Release | 20240506 ]
- Added key-selector to switch between different hosts
### Below are the currently supported hosts:
- Unified Hosts.
- Unified hosts + fakenews + gambling + social.
- Unified hosts + fakenews + gambling + porn + social.
- more will be added soon...
63 changes: 63 additions & 0 deletions customize.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
#!/system/bin/sh

# Systemless Hosts by the open source loving GL-DP and all contributors;
# Consolidating and extending hosts files from several well-curated sources

install_hosts() {
. $MODPATH/addon/install.sh
ui_print " Install Unified Hosts (UH)?"
ui_print " "
ui_print " Vol+ = Yes"
ui_print " Vol- = No"
ui_print " "
if chooseport; then
. $MODPATH/host-installer/uh.sh
else
ui_print " Install UH + fakenews + gambling + social ?"
ui_print " "
ui_print " Vol+ = Yes"
ui_print " Vol- = No"
ui_print " "
if chooseport; then
. $MODPATH/host-installer/uhfgs.sh
else
ui_print " Install Unified hosts + fakenews + gambling + porn + social?"
ui_print " "
ui_print " Vol+ = Yes"
ui_print " Vol- = No"
ui_print " "
if chooseport; then
. $MODPATH/host-installer/uhfgps.sh
else
ui_print "- Exiting"
fi
fi
fi
}

patch_hosts() {
PATH=/system/etc
ui_print "- Patching hosts file"
mkdir -p $MODPATH$PATH
mv -f $MODPATH/hosts $MODPATH$PATH
}

cleanup() {
rm -rf $MODPATH/LICENSE
rm -rf $MODPATH/addon 2>/dev/null
rm -f $MODPATH/install.sh 2>/dev/null
}

run_install() {
unzip -o "$ZIPFILE" -x 'META-INF/*' -d $MODPATH >&2
ui_print " "
ui_print "- Installing & patching hosts"
install_hosts
patch_hosts
ui_print " "
ui_print "- Cleaning up"
cleanup
ui_print " "
}

run_install
9 changes: 9 additions & 0 deletions host-installer/uh.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ui_print "- Unified Hosts Selected"
HOSTS_URL="https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts"
GIT_URL="https://github.com/StevenBlack/hosts"
ui_print "- Downloading latest hosts file from $GIT_URL"
curl -o $MODPATH/hosts $HOSTS_URL
if [ $? -ne 0 ]; then
ui_print "Error: Failed to download hosts file."
exit 1
fi
9 changes: 9 additions & 0 deletions host-installer/uhfgps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ui_print "- Unified hosts + fakenews + gambling + porn + social Selected"
HOSTS_URL="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-porn-social/hosts"
GIT_URL="https://github.com/StevenBlack/hosts"
ui_print "- Downloading latest hosts file from $GIT_URL"
curl -o $MODPATH/hosts $HOSTS_URL
if [ $? -ne 0 ]; then
ui_print "Error: Failed to download hosts file."
exit 1
fi
9 changes: 9 additions & 0 deletions host-installer/uhfgs.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ui_print "- Unified hosts + fakenews + gambling + social Selected"
HOSTS_URL="https://raw.githubusercontent.com/StevenBlack/hosts/master/alternates/fakenews-gambling-social/hosts"
GIT_URL="https://github.com/StevenBlack/hosts"
ui_print "- Downloading latest hosts file from $GIT_URL"
curl -o $MODPATH/hosts $HOSTS_URL
if [ $? -ne 0 ]; then
ui_print "Error: Failed to download hosts file."
exit 1
fi
1 change: 1 addition & 0 deletions hosts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is a dummy host file
6 changes: 6 additions & 0 deletions module.prop
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
id=systemless_adblocker
name=Systemless Adblocker - Ultimate
version=1.1
versionCode=16
author=burhanverse
description=An efficient ad blocker based on @gloeyisk's systemless-host module with no user interface & the lastest hosts from github@StevenBlack
6 changes: 6 additions & 0 deletions update.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"version": 1.1,
"versionCode": 16,
"zipUrl": https://github.com/Burhanverse/systemless-adblocker/releases/download/1.1/Systemless_Adblocker-Ult_V1.1.zip,
"changelog": https://github.com/Burhanverse/systemless-adblocker/blob/main/changelog.md
}

0 comments on commit 38f19cf

Please sign in to comment.