├── .github └── workflows │ └── release.yml ├── CHANGELOG.md ├── META-INF └── com │ └── google │ └── android │ ├── update-binary │ └── updater-script ├── README.md ├── action.sh ├── build.sh ├── cleaner ├── cleaner ├── cleaner.inotify ├── cleaner.service └── start.sh ├── cleaner_service.sh ├── customize.sh ├── docs └── tubot.py ├── module.prop ├── uninstall.sh └── update.json /.github/workflows/release.yml: -------------------------------------------------------------------------------- 1 | name: release 2 | 3 | on: 4 | workflow_dispatch: 5 | inputs: 6 | tag: 7 | description: 'Release Tag' 8 | required: true 9 | branch: 10 | description: 'Push Changes' 11 | required: true 12 | 13 | jobs: 14 | build: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - uses: actions/checkout@v3 18 | - name: Get Version 19 | id: get_version 20 | run: | 21 | echo "date=$(date +%Y%m%d)" >> "$GITHUB_OUTPUT" 22 | 23 | - name: Update update.json and module.prop 24 | run: | 25 | echo '{ 26 | "version": "${{ github.event.inputs.tag }}", 27 | "versionCode": "${{ steps.get_version.outputs.date }}", 28 | "zipUrl": "https://github.com/taamarin/cleaner/releases/download/${{ github.event.inputs.tag }}/CCforKSUM-${{ github.event.inputs.tag }}.zip", 29 | "changelog": "https://github.com/taamarin/cleaner/raw/master/CHANGELOG.md" 30 | }' > update.json 31 | 32 | sed -i "s/$(grep -oP 'version=\K[^ ]+' module.prop)/${{ github.event.inputs.tag }}/g" module.prop 33 | sed -i "s/$(grep -oP 'versionCode=\K[^ ]+' module.prop)/$(date +%Y%m%d)/g" module.prop 34 | 35 | - name: Commit and push changes 36 | run: | 37 | git config --local user.name "renovate[bot]" 38 | git config --local user.email "29139614+renovate[bot]@users.noreply.github.com" 39 | git add update.json module.prop 40 | git commit -m "${{ github.event.inputs.tag }}" 41 | git push -f origin "${{github.event.inputs.branch}}" 42 | 43 | - name: run build.sh 44 | run: sh build.sh 45 | 46 | - name: Create GitHub Release 47 | uses: softprops/action-gh-release@v1 48 | with: 49 | tag_name: ${{ github.event.inputs.tag }} 50 | files: CCforKSUM-v*.zip 51 | generate_release_notes: true 52 | 53 | - name: Upload to telegram 54 | env: 55 | CHAT_ID: ${{ secrets.CHAT_ID }} 56 | CACHE_CHAT_ID: ${{ secrets.CACHE_CHAT_ID }} 57 | BOT_TOKEN: ${{ secrets.BOT_TOKEN }} 58 | MESSAGE_THREAD_ID: ${{ secrets.MESSAGE_THREAD_ID }} 59 | COMMIT_MESSAGE: ${{ github.event.head_commit.message }} 60 | COMMIT_URL: ${{ github.event.head_commit.url }} 61 | RUN_URL: ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} 62 | TITLE: ${{ github.event.inputs.tag }} 63 | run: | 64 | export VERSION=$(git rev-parse --short HEAD) 65 | FILE=$(find ./CCforKSUM-v* -type f) 66 | pip3 install python-telegram-bot 67 | python3 docs/tubot.py $FILE -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | ## Changelog v4.1 2 | - add Action -------------------------------------------------------------------------------- /META-INF/com/google/android/update-binary: -------------------------------------------------------------------------------- 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 34 | -------------------------------------------------------------------------------- /META-INF/com/google/android/updater-script: -------------------------------------------------------------------------------- 1 | #MAGISK 2 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### CLEANER CACHE 2 | 3 | [![MAGISK](https://img.shields.io/badge/Magisk%20-v20.4+-brightgreen)](https://github.com/topjohnwu/Magisk) 4 | [![API](https://img.shields.io/badge/API-21%2B-brightgreen.svg?style=flat)](https://android-arsenal.com/api?level=21) 5 | [![RELEASES](https://img.shields.io/github/downloads/taamarin/cleaner/total.svg)](https://github.com/taamarin/cleaner/releases) 6 | 7 | 8 | It will clean the cache in the following directories: 9 | ```shell 10 | "/data/data/*/cache/*" 11 | "/data/data/*/code_cache/*" 12 | "/data/user_de/*/*/cache/*" 13 | "/data/user_de/*/*/code_cache/*" 14 | "/sdcard/Android/data/*/cache/*" 15 | "/data/system/dropbox/*" 16 | ``` 17 | If the total reaches 1GB, the checking will be done every 6 hours. 18 | 19 | open **/data/adb/cleaner/cleaner.service**,to make changes: 20 | 21 | limit size (KB) 22 | https://github.com/taamarin/cleaner/blob/e79c4645ad3a7119ce8cacd90617beee0c862e48/cleaner/cleaner.service#L78 23 | 24 | Checking interval 25 | https://github.com/taamarin/cleaner/blob/e79c4645ad3a7119ce8cacd90617beee0c862e48/cleaner/cleaner.service#L16 26 | if you understand. 27 | -------------------------------------------------------------------------------- /action.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | if [ -e "/system/bin/cleaner" ]; then 4 | cleaner 5 | sleep 2 6 | else 7 | echo "file /system/bin/cleaner not found" 8 | exit 9 | fi -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | zip -r -o -X -ll CCforKSUM-$(cat module.prop | grep 'version=' | awk -F '=' '{print $2}').zip ./ -x '.git/*' -x 'CHANGELOG.md' -x 'update.json' -x 'build.sh' -x '.github/*' -x 'docs/*' -x 'README.md' -------------------------------------------------------------------------------- /cleaner/cleaner: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | PROPFILE="/data/adb/modules/cache_cleaner/module.prop" 4 | current_time=$(date +"%I:%M %P") 5 | 6 | log() { 7 | case $1 in 8 | info) 9 | [ -t 1 ] && echo -e "\033[1;33m${current_time} [info]: $2\033[0m" || echo "${current_time} [info]: $2" 10 | ;; 11 | *) 12 | [ -t 1 ] && echo -e "\033[1;34m${current_time} [$1]: $2\033[0m" || echo "${current_time} [$1]: $2" 13 | ;; 14 | esac 15 | } 16 | 17 | cleaner() { 18 | log info "$(date)" 19 | log info "Script is running!" 20 | log info "Cleaning apps cache..." 21 | 22 | echo $(date) > /data/adb/cleaner/run/cleaner.log 23 | echo $(date +"[%H:%M %z]") "[info]: Cleaning apps cache... (Terminal)" >> /data/adb/cleaner/run/cleaner.log 24 | 25 | local total=0 26 | directories=( 27 | "/data/data/*/cache" 28 | "/data/data/*/code_cache" 29 | "/data/user_de/*/*/cache" 30 | "/data/user_de/*/*/code_cache" 31 | "/sdcard/Android/data/*/cache" 32 | "/data/system/dropbox" 33 | ) 34 | 35 | for dir in "${directories[@]}" 36 | do 37 | size=$(du -cs $dir | grep total | cut -f 1) 38 | total=$(( total + size )) 39 | log debug "$dir >>>>> ${size} Kb" 40 | find $dir/* -delete &>/dev/null 41 | done 42 | 43 | echo $(date +"[%H:%M %z]") "[info]: Done! The apps cache has been cleaned!\n" >> /data/adb/cleaner/run/cleaner.log 44 | 45 | # Total Cache 46 | if [ "${total}" -ge 1024 ]; then 47 | total_cache="$(expr ${total} / 1024) MB" 48 | else 49 | total_cache="${total} KB" 50 | fi 51 | 52 | # Escape special characters in the total_cache variable 53 | escaped_total_cache=$(printf '%s\n' "${total_cache}" | sed -e 's/[\/&]/\\&/g') 54 | 55 | # Use the escaped variable in the sed command 56 | sed -Ei "s/^description=(\\[.*][[:space:]]*)?/description=[ $current_time | 🥰 Total cache: ${escaped_total_cache}, Done! The apps cache has been cleaned!! ] /g" "$PROPFILE" 57 | 58 | log info "total Cache: ${total_cache}" 59 | log info "Done! The apps cache has been cleaned!" 60 | } 61 | 62 | # Check if the script is running with root privileges 63 | if [ "$(whoami)" != "root" ]; then 64 | log info "Run this command with root privileges!" 65 | else 66 | # Call the cleaner function 67 | log info "Running script..." 68 | cleaner 69 | fi -------------------------------------------------------------------------------- /cleaner/cleaner.inotify: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | inotify=$(realpath $0) 4 | scripts_dir=$(dirname ${inotify}) 5 | service="${scripts_dir}/cleaner.service" 6 | folder_run="/data/adb/cleaner/run" 7 | 8 | events=$1 9 | monitor_dir=$2 10 | monitor_file=$3 11 | 12 | create_folder_run() { 13 | if [ ! -d "${folder_run}" ] ; then 14 | mkdir -p ${folder_run} 15 | fi 16 | } 17 | 18 | start_cleaner() { 19 | if [ "${monitor_file}" = "disable" ] ; then 20 | if [ "${events}" = "d" ] ; then 21 | ${service} start > ${folder_run}/cleaner.log 2> ${folder_run}/service.log 22 | elif [ "${events}" = "n" ] ; then 23 | ${service} stop >> ${folder_run}/cleaner.log 2>> ${folder_run}/service.log 24 | fi 25 | fi 26 | } 27 | 28 | create_folder_run 29 | start_cleaner -------------------------------------------------------------------------------- /cleaner/cleaner.service: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | scripts=$(realpath $0) 4 | scripts_dir=$(dirname ${scripts}) 5 | busybox_path="/data/adb/magisk/busybox" 6 | if ! command -v "${busybox_path}" >/dev/null 2>&1; then 7 | busybox_path="/data/adb/ksu/bin/busybox" 8 | fi 9 | cleaner_run_path="/data/adb/cleaner/run" 10 | log_cleaner="${cleaner_run_path}/cleaner.log" 11 | cleaner_pid="${cleaner_run_path}/cache.pid" 12 | current_time=$(date +"%I:%M %P") 13 | 14 | PROPFILE="/data/adb/modules/cache_cleaner/module.prop" 15 | 16 | # “At minute 0 past every 6th hour.” 17 | schedule_cleaner="0 */6 * * *" 18 | 19 | # Define the log function 20 | log() { 21 | # Check the log level 22 | if [ "$1" = "info" ]; then 23 | if [ -t 1 ]; then 24 | echo -e "\033[1;33m${current_time} [info]: $2\033[0m" 25 | fi 26 | else 27 | if [ -t 1 ]; then 28 | echo -e "\033[1;30m${current_time} [$1]: $2\033[0m" 29 | fi 30 | fi 31 | # Append the log to a file specified by the log_cleaner variable 32 | echo "${current_time} [$1]: $2" >> "${log_cleaner}" 2>/dev/null 33 | } 34 | 35 | # Define the run_cleaner function 36 | run_cleaner() { 37 | # Define an array of directories to clean 38 | dirs=( 39 | "/data/data/*/cache/*" 40 | "/data/data/*/code_cache/*" 41 | "/data/user_de/*/*/cache/*" 42 | "/data/user_de/*/*/code_cache/*" 43 | "/sdcard/Android/data/*/cache/*" 44 | "/data/system/dropbox/*" 45 | ) 46 | 47 | # Loop through each directory and clear its contents 48 | for dir in "${dirs[@]}" 49 | do 50 | size=$(du -cs $dir | grep total | cut -f 1) 51 | total=$(( total + size )) 52 | log debug "$dir >>>>> ${size} Kb" 53 | find $dir/* -delete &>/dev/null 54 | done 55 | # Print a message to indicate that the cleaning is complete 56 | log info "Cache cleaning is complete." 57 | } 58 | 59 | run_otomatis() { 60 | echo $(date) > ${log_cleaner} 61 | 62 | total=$(du -cs /data/data/*/cache /data/data/*/code_cache /data/user_de/*/*/cache /data/user_de/*/*/code_cache /sdcard/Android/data/*/cache /data/system/dropbox | grep total | cut -f 1 | paste -sd+ | bc) 63 | 64 | # Total Cache 65 | if [ "${total}" -ge 1024 ]; then 66 | total_cache="$(expr ${total} / 1024) MB" 67 | else 68 | total_cache="${total} KB" 69 | fi 70 | 71 | # Escape special characters in the total_cache variable 72 | escaped_total_cache=$(printf '%s\n' "${total_cache}" | sed -e 's/[\/&]/\\&/g') 73 | 74 | log info "total Cache: ${total_cache}" 75 | 76 | size_cache=1024000 # Set size limit for Cache (in KB) 77 | 78 | if [ "$total" -gt "$size_cache" ]; then 79 | log info "Cleaning apps cache..." 80 | run_cleaner # call the cleaner function 81 | log info "Done! The apps cache has been cleaned!" 82 | # Use the escaped variable in the sed command 83 | sed -Ei "s/^description=(\\[.*][[:space:]]*)?/description=[ $current_time | 🥰 Total cache: ${escaped_total_cache}, Done! The apps cache has been cleaned! ] /g" "$PROPFILE" 84 | else 85 | log info "skip cleaning! Cache size is not yet ${size_cache} KB" 86 | # Use the escaped variable in the sed command 87 | sed -Ei "s/^description=(\\[.*][[:space:]]*)?/description=[ $current_time | 😍 Total cache: ${escaped_total_cache}, Skip cleaning!! ] /g" "$PROPFILE" 88 | fi 89 | 90 | log info "Have you ever jumped over these bushes?" 91 | } 92 | 93 | run_crond() { 94 | # Setup crond 95 | if [ "$?" -eq 0 ]; then 96 | ulimit -SHn 1000000 97 | nohup "${busybox_path}" crond -c "${cleaner_run_path}" > /dev/null 2>&1 & 98 | PID=$! 99 | echo -n $PID > "${cleaner_pid}" 100 | fi 101 | 102 | # Run crontab 103 | "${busybox_path}" crontab -c "${cleaner_run_path}" -r 104 | touch "${cleaner_run_path}/root" 105 | chmod 0600 "${cleaner_run_path}/root" 106 | 107 | # Set schedule Cache cleaner & otomatis 108 | if echo "${schedule_cleaner} ${scripts_dir}/cleaner.service auto" >> "${cleaner_run_path}/root"; then 109 | log info "Schedule Cache Cleaner (${schedule_cleaner})" 110 | fi 111 | } 112 | 113 | display_pid() { 114 | local PID 115 | PID=$(ps -ef | grep "crond -c /data/adb/cleaner" | grep -v grep | "${busybox_path}" awk '{print $2}' | head -n 1) 116 | if [ -n "$PID" ]; then 117 | echo "$PID" > "${cleaner_pid}" 118 | log info "Cache Cleaner service is running (PID: $PID)" 119 | else 120 | log error "Cache Cleaner service is not running" 121 | fi 122 | } 123 | 124 | start_cleaner() { 125 | run_otomatis 126 | run_crond 127 | display_pid 128 | } 129 | 130 | stop_cleaner() { 131 | local PID 132 | PID=$(ps -ef | grep "crond -c /data/adb/cleaner/run" | grep -v grep | "${busybox_path}" awk '{ print $2 }') 133 | if [ -n "$PID" ]; then 134 | kill -15 "$PID" 135 | rm -f "${cleaner_pid}" 136 | log info "Cache Cleaner stopped (PID: $PID)" 137 | else 138 | log error "Cache Cleaner is not running" 139 | fi 140 | } 141 | 142 | case "$1" in 143 | start) 144 | stop_cleaner 145 | start_cleaner 146 | ;; 147 | stop) 148 | stop_cleaner 149 | ;; 150 | auto) 151 | run_otomatis 152 | ;; 153 | *) 154 | echo "$0: usage: $0 {start|stop}" 155 | ;; 156 | esac 157 | -------------------------------------------------------------------------------- /cleaner/start.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | moddir=/data/adb/modules/cache_cleaner 4 | if [ -n "$(magisk -v | grep lite)" ]; then 5 | moddir=/data/adb/lite_modules/cache_cleaner 6 | fi 7 | 8 | scripts_dir=/data/adb/cleaner 9 | 10 | log_file=/data/adb/cleaner/run/cleaner.log 11 | service_log=/data/adb/cleaner/run/service.log 12 | 13 | if [ ! -d ${moddir} ] || [ ! -d ${scripts_dir} ]; then 14 | echo "Error: Directories not found" >&2 15 | exit 1 16 | fi 17 | 18 | if ! type inotifyd > /dev/null; then 19 | echo "Error: inotifyd command not found" >&2 20 | exit 1 21 | fi 22 | 23 | start_cleaner() { 24 | ${scripts_dir}/cleaner.service start > ${log_file} 2> ${service_log} 25 | } 26 | 27 | if [ ! -f ${scripts_dir}/manual ] ; then 28 | echo -n "" > ${log_file} 29 | if [ ! -f ${moddir}/disable ] ; then 30 | start_cleaner 31 | fi 32 | inotifyd ${scripts_dir}/cleaner.inotify ${moddir} &>> /dev/null & 33 | fi -------------------------------------------------------------------------------- /cleaner_service.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | # Set the path to the service script 4 | service_script=/data/adb/cleaner/start.sh 5 | 6 | # Check if the necessary directories and files exist 7 | if [ ! -f ${service_script} ]; then 8 | echo "Error: Service script not found" >&2 9 | exit 1 10 | fi 11 | 12 | # Wait for the system to finish booting 13 | ( 14 | until [ $(getprop sys.boot_completed) -eq 1 ] ; do 15 | sleep 5 16 | done 17 | 18 | # Launch the service script 19 | ${service_script} 20 | )& -------------------------------------------------------------------------------- /customize.sh: -------------------------------------------------------------------------------- 1 | #!/sbin/sh 2 | 3 | SKIPUNZIP=1 4 | ASH_STANDALONE=1 5 | 6 | module_descriptions() { 7 | # Print text on the Terminal screen (Magisk) 8 | ui_print "- Cleaner Cache (Magisk Module)" 9 | ui_print "- A simple module that allows your device to clean all apps cache" 10 | ui_print "- Automatically if the total cache size is more than 1GB" 11 | ui_print "- And can be done manually by typing 'su -c cleaner' in the Terminal." 12 | 13 | ui_print "" 14 | ui_print "- This module only clears the applications cache" 15 | ui_print "- In the 'cache' and 'code_cache' directories." 16 | } 17 | 18 | # Declaring a function with the name "install_module" 19 | install_module() { 20 | module_descriptions 21 | ui_print "- Installing..." 22 | ui_print "- Extracting module files" 23 | mkdir -p $MODPATH/system/bin 24 | mkdir -p /data/adb/cleaner 25 | mkdir -p /data/adb/cleaner/run 26 | 27 | unzip -j -o "${ZIPFILE}" 'cleaner_service.sh' -d /data/adb/service.d >&2 28 | unzip -j -o "${ZIPFILE}" 'cleaner/cleaner' -d $MODPATH/system/bin >&2 29 | unzip -j -o "${ZIPFILE}" 'cleaner/*' -d /data/adb/cleaner >&2 30 | unzip -j -o "${ZIPFILE}" 'module.prop' -d $MODPATH >&2 31 | unzip -j -o "${ZIPFILE}" 'service.sh' -d $MODPATH >&2 32 | unzip -j -o "${ZIPFILE}" 'uninstall.sh' -d $MODPATH >&2 33 | 34 | rm -rf /data/adb/cleaner/cleaner 35 | 36 | ui_print "- Settings module" 37 | ui_print "- Settings permission" 38 | set_perm_recursive $MODPATH 0 0 0755 0644 39 | set_perm_recursive /data/adb/cleaner 0 0 0755 0644 40 | set_perm $MODPATH/system/bin/cleaner 0 0 0755 41 | set_perm /data/adb/service.d/cleaner_service.sh 0 0 0755 42 | chmod ugo+x /data/adb/cleaner/* 43 | } 44 | 45 | ### INSTALLATION ### 46 | 47 | if [ "$BOOTMODE" != true ]; then 48 | ui_print "-----------------------------------------------------------" 49 | ui_print "! Please install in Magisk Manager or KernelSU Manager" 50 | ui_print "! Install from recovery is NOT supported" 51 | abort "-----------------------------------------------------------" 52 | elif [ "$KSU" = true ] && [ "$KSU_VER_CODE" -lt 10670 ]; then 53 | abort "ERROR: Please update your KernelSU and KernelSU Manager" 54 | fi 55 | 56 | # check android 57 | if [ "$API" -lt 21 ]; then 58 | ui_print "! Unsupported sdk: $API" 59 | abort "! Minimal supported sdk is 21 (Android 5)" 60 | else 61 | ui_print "- Device sdk: $API" 62 | fi 63 | 64 | # check version 65 | service_dir="/data/adb/service.d" 66 | if [ "$KSU" = true ]; then 67 | ui_print "- kernelSU version: $KSU_VER ($KSU_VER_CODE)" 68 | [ "$KSU_VER_CODE" -lt 10683 ] && service_dir="/data/adb/ksu/service.d" 69 | else 70 | ui_print "- Magisk version: $MAGISK_VER ($MAGISK_VER_CODE)" 71 | fi 72 | 73 | if [ ! -d "${service_dir}" ]; then 74 | mkdir -p "${service_dir}" 75 | fi 76 | 77 | install_module 78 | -------------------------------------------------------------------------------- /docs/tubot.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import asyncio 4 | import telegram 5 | from telegram import helpers 6 | 7 | 8 | BOT_TOKEN = os.environ.get("BOT_TOKEN") 9 | CHAT_ID = os.environ.get("CHAT_ID") 10 | CACHE_CHAT_ID = os.environ.get("CACHE_CHAT_ID") 11 | MESSAGE_THREAD_ID = os.environ.get("MESSAGE_THREAD_ID") 12 | COMMIT_URL = os.environ.get("COMMIT_URL") 13 | COMMIT_MESSAGE = os.environ.get("COMMIT_MESSAGE") 14 | RUN_URL = os.environ.get("RUN_URL") 15 | TITLE = os.environ.get("TITLE") 16 | VERSION = os.environ.get("VERSION") 17 | MSG_TEMPLATE = """ 18 | *{title}* 19 | [workflow run]({run_url}) 20 | """.strip() 21 | 22 | 23 | def get_caption(): 24 | msg = MSG_TEMPLATE.format( 25 | title=helpers.escape_markdown(TITLE, 2), 26 | version=helpers.escape_markdown(VERSION, 2), 27 | commit_message=helpers.escape_markdown(COMMIT_MESSAGE, 2, telegram.MessageEntity.PRE), 28 | commit_url=helpers.escape_markdown(COMMIT_URL, 2, telegram.MessageEntity.TEXT_LINK), 29 | run_url=helpers.escape_markdown(RUN_URL, 2, telegram.MessageEntity.TEXT_LINK) 30 | ) 31 | if len(msg) > telegram.constants.MessageLimit.CAPTION_LENGTH: 32 | return COMMIT_URL 33 | return msg 34 | 35 | 36 | def check_environ(): 37 | if BOT_TOKEN is None: 38 | print("[-] Invalid BOT_TOKEN") 39 | exit(1) 40 | if CHAT_ID is None: 41 | print("[-] Invalid CHAT_ID") 42 | exit(1) 43 | if CACHE_CHAT_ID is None: 44 | print("[-] Invalid CACHE_CHAT_ID") 45 | exit(1) 46 | if COMMIT_URL is None: 47 | print("[-] Invalid COMMIT_URL") 48 | exit(1) 49 | if COMMIT_MESSAGE is None: 50 | print("[-] Invalid COMMIT_MESSAGE") 51 | exit(1) 52 | if RUN_URL is None: 53 | print("[-] Invalid RUN_URL") 54 | exit(1) 55 | if TITLE is None: 56 | print("[-] Invalid TITLE") 57 | exit(1) 58 | if VERSION is None: 59 | print("[-] Invalid VERSION") 60 | exit(1) 61 | 62 | 63 | async def main(): 64 | print("[+] Uploading to telegram") 65 | check_environ() 66 | print("[+] Files:", sys.argv[1:]) 67 | bot = telegram.Bot(BOT_TOKEN) 68 | files = [] 69 | paths = sys.argv[1:] 70 | caption = get_caption() 71 | print("[+] Caption: ") 72 | print("---") 73 | print(caption) 74 | print("---") 75 | for one in paths: 76 | if not os.path.exists(one): 77 | print("[-] File not exist: " + one) 78 | continue 79 | print("[+] Upload: " + one) 80 | msg = await bot.send_document(CACHE_CHAT_ID, one, write_timeout=60, connect_timeout=30) 81 | if one == paths[-1]: 82 | files.append(telegram.InputMediaDocument(msg.document, 83 | caption=caption, 84 | parse_mode=telegram.constants.ParseMode.MARKDOWN_V2)) 85 | else: 86 | files.append(telegram.InputMediaDocument(msg.document)) 87 | await bot.delete_message(CACHE_CHAT_ID, msg.message_id) 88 | print("[+] Sending") 89 | await bot.send_media_group(CHAT_ID, files, message_thread_id=MESSAGE_THREAD_ID) 90 | print("[+] Done!") 91 | 92 | 93 | if __name__ == "__main__": 94 | loops = asyncio.new_event_loop() 95 | loops.run_until_complete(asyncio.wait([main()])) 96 | 97 | -------------------------------------------------------------------------------- /module.prop: -------------------------------------------------------------------------------- 1 | id=cache_cleaner 2 | name=Cache Cleaner 3 | version=v4.1 4 | versionCode=20241103 5 | author=taamarin.t.me 6 | description=This will clear the cache of all apps if the total exceeds 1GB 7 | updateJson=https://github.com/taamarin/cleaner/raw/master/update.json 8 | -------------------------------------------------------------------------------- /uninstall.sh: -------------------------------------------------------------------------------- 1 | #!/system/bin/sh 2 | 3 | uninstall_cleaner() { 4 | if [ -d /data/adb/cleaner ]; then 5 | rm -rf /data/adb/cleaner 6 | fi 7 | if [ -f /data/adb/service.d/cleaner_service.sh ]; then 8 | rm -rf /data/adb/service.d/cleaner_service.sh 9 | fi 10 | } 11 | 12 | uninstall_cleaner -------------------------------------------------------------------------------- /update.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": "v4.1", 3 | "versionCode": "20241103", 4 | "zipUrl": "https://github.com/taamarin/cleaner/releases/download/v4.1/CCforKSUM-v4.1.zip", 5 | "changelog": "https://github.com/taamarin/cleaner/raw/master/CHANGELOG.md" 6 | } 7 | --------------------------------------------------------------------------------