commits with descriptions in updater

This commit is contained in:
Your Name 2024-12-18 13:11:54 +03:00
parent 7cb57d45d6
commit c9052d8234

View file

@ -13,13 +13,13 @@ async def git_notifications_update():
logger.info('Checking for updates...') logger.info('Checking for updates...')
fetching_git = os.system('git fetch') fetching_git = os.system('git fetch')
if fetching_git == 0: if fetching_git == 0:
commits = os.popen('git log --oneline HEAD..origin/$(git rev-parse --abbrev-ref HEAD)').read() commits = os.popen("git log --pretty=format:'%h %s%n%b' HEAD..origin/$(git rev-parse --abbrev-ref HEAD)").read()
if len(commits) <= 5: if len(commits) <= 5:
logger.info('updates not found, nothing to do') logger.info('updates not found, nothing to do')
else: else:
os.system(f"termux-notification --title 'ub4tg: update avalaible!' --content 'For apply tap button Get update and restart bot\nChanges:\n{commits}' --button1 'Get update' --button1-action 'cd {cwd}; git pull'") os.system(f"termux-notification --title 'ub4tg: update avalaible!' --content 'For apply tap button Get update and restart bot\nChanges:\n{commits}' --button1 'Get update' --button1-action 'cd {cwd}; git pull'")
else: else:
os.system("termux-toast '[ub4tg]: failed fetching update, maybe connection error'") os.system("termux-toast '[ub4tg]: failed fetching update, maybe connection error, check console log for more info'")
else: else:
logger.warning('For getting updates via notifications, you should:') logger.warning('For getting updates via notifications, you should:')
logger.warning('pkg install termux-api') logger.warning('pkg install termux-api')