escape commits for shell

This commit is contained in:
Your Name 2024-12-18 23:38:40 +03:00
parent fc91a0bb48
commit 403a377374

View file

@ -1,6 +1,7 @@
from loguru import logger from loguru import logger
import os import os
import asyncio import asyncio
import shlex
async def git_notifications_update(): async def git_notifications_update():
@ -18,6 +19,7 @@ async def git_notifications_update():
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:
commits = shlex.quote(commits)
os.system( 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' || termux-toast 'ub4tg update failed'") 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' || termux-toast 'ub4tg update failed'")
else: else: