From 46add00fbfeebefb2cf7ac5f05f3f36f959cad69 Mon Sep 17 00:00:00 2001 From: Your Name Date: Thu, 19 Dec 2024 01:55:50 +0300 Subject: [PATCH] shlex totally fucked up updater, trying use file as input via pipe --- src/updatenotif.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/updatenotif.py b/src/updatenotif.py index 5002e88..26f11ce 100644 --- a/src/updatenotif.py +++ b/src/updatenotif.py @@ -1,7 +1,6 @@ from loguru import logger import os import asyncio -import shlex async def git_notifications_update(): @@ -14,14 +13,16 @@ async def git_notifications_update(): logger.info('Checking for updates...') fetching_git = os.system('git fetch') if fetching_git == 0: + os.system("printf 'For apply tap button Get update and restart bot\nChanges:\n' > upd_info") commits = os.popen( "git log --pretty=format:'%h %s%n%b' HEAD..origin/$(git rev-parse --abbrev-ref HEAD)").read() + os.popen( + "git log --pretty=format:'%h %s%n%b' HEAD..origin/$(git rev-parse --abbrev-ref HEAD) >> upd_info") if len(commits) <= 5: logger.info('updates not found, nothing to do') else: - commits = shlex.quote(commits) os.system( - f"termux-notification -i ub4tgupd --title 'ub4tg: update avalaible!' --content 'For apply tap button Get update and restart bot\nChanges:\n{commits}' --button1 'Get update' --button1-action 'termux-notification-remove ub4tgupd; cd {cwd}; git pull; termux-toast 'ub4tg updated, now restart it for apply update'") + f"cat upd_info | termux-notification -i ub4tgupd --title 'ub4tg: update avalaible!' --button1 'Get update' --button1-action 'termux-notification-remove ub4tgupd; cd {cwd}; git pull; termux-toast 'ub4tg updated, now restart it for apply update'") else: os.system( "termux-toast '[ub4tg]: failed fetching update, maybe connection error, check console log for more info'")