diff --git a/Cleanup.py b/Cleanup.py index e0d406d..94f8aaf 100644 --- a/Cleanup.py +++ b/Cleanup.py @@ -23,6 +23,7 @@ def move_apps(appstate): pass # sys.exit('There was an error moving the final apk files!') + # Do some cleanup, keep only the last 3 build's worth of files and a week worth of logs files = [] dir = os.scandir('archive') for f in dir: diff --git a/Notifications.py b/Notifications.py index d11cce1..5d1c7d7 100644 --- a/Notifications.py +++ b/Notifications.py @@ -1,6 +1,7 @@ import json import re import requests as req +import subprocess def send_notif(appstate, error=False): timestamp = appstate['timestamp'] @@ -21,6 +22,8 @@ def send_notif(appstate, error=False): msg = msg.replace(build_config[app]['apk'], build_config[app]['pretty_name']) msg += '\nTimestamp: ' + timestamp + if appstate['microg_updated']: + msg += '\nVanced microG was updated.' config = appstate['notification_config'] for entry in config: @@ -30,7 +33,7 @@ def send_notif(appstate, error=False): match entry: case 'ntfy': - print('Sending notification through nfty.sh') + print('Sending notification through ntfy.sh...') try: url = config[entry]['url'] topic = config[entry]['topic'] @@ -45,7 +48,7 @@ def send_notif(appstate, error=False): print('Failed!' + str(e)) case 'gotify': - print('Sending notification through nfty.sh') + print('Sending notification through Gotify...') try: url = config[entry]['url'] token = config[entry]['token'] @@ -60,16 +63,16 @@ def send_notif(appstate, error=False): case 'telegram': # TODO: Finish this! - print('Sending notification through telegram') + print('Sending notification through Telegram...') try: chat = config[entry]['chat'] token = config[entry]['token'] except: print('CHAT or TOKEN not provided!') continue - data = {'Title': encoded_title, 'message': msg, 'priority': '5'} + cmd = f"./telegram.sh -t {token} -c {chat} -T {encoded_title} -M \"{msg}\"" try: - req.post(f"{url}/message?token={token}", data) + subprocess.run(cmd, shell=True) except Exception as e: print('Failed!' + str(e)) diff --git a/ReVancedBuilder.py b/ReVancedBuilder.py index 6450231..c3ad1f9 100755 --- a/ReVancedBuilder.py +++ b/ReVancedBuilder.py @@ -17,6 +17,7 @@ from Cleanup import * # TODO: Run post_script (preferably in any language) # TODO: README # TODO: PATCHES_GUIDE.md (maybe delete it?) +# TODO: Make it PIP installable # Update the ReVanced tools, if needed def update_tools(appstate): @@ -70,6 +71,7 @@ def update_microg(appstate): f.write(chunk) appstate['present_vers'].update({'VancedMicroG': str(latest_ver)}) print("Done!") + appstate['microg_updated'] = True return appstate @@ -100,6 +102,7 @@ except: flag = None appstate['flag'] = flag +appstate['microg_updated'] = False try: appstate['build_config']=cp.ConfigParser()