check termux api status not only in updates
This commit is contained in:
parent
425edbfde3
commit
2e4eaa499c
2 changed files with 7 additions and 1 deletions
6
s.py
6
s.py
|
@ -8,6 +8,7 @@ import json
|
|||
|
||||
|
||||
is_termux = os.environ.get('TERMUX_APP__PACKAGE_NAME') or os.environ.get('TERMUX_APK_RELEASE')
|
||||
termux_api = False
|
||||
if is_termux:
|
||||
logger.info('Termux detected, checking permissions...')
|
||||
logger.info('Prevent killing termux by android, getting wakelock...')
|
||||
|
@ -39,6 +40,11 @@ if is_termux:
|
|||
default_directory = '/sdcard/ub4tg'
|
||||
os.system(f'mkdir -p {default_directory}')
|
||||
default_config_file_path = f'{default_directory}/config.json'
|
||||
termux_api = os.system('termux_api_start') == 0
|
||||
if termux_api:
|
||||
logger.success('termux API works')
|
||||
else:
|
||||
logger.warning('termux API not installed or broken')
|
||||
if not os.path.exists(default_config_file_path):
|
||||
logger.info('config not found, first launch setup...')
|
||||
api_id = int(input('enter api_id from https://my.telegram.org/ : '))
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from s import termux_api
|
||||
from loguru import logger
|
||||
import os
|
||||
import asyncio
|
||||
|
@ -8,7 +9,6 @@ async def git_notifications_update():
|
|||
cwd = os.getcwd()
|
||||
os.chdir(cwd)
|
||||
while True:
|
||||
termux_api = os.system('termux-api-start')
|
||||
if termux_api == 0:
|
||||
logger.info('Checking for updates...')
|
||||
fetching_git = os.system('git fetch')
|
||||
|
|
Loading…
Reference in a new issue