Gitea response improved

This commit is contained in:
Désiré Werner Menrath 2025-04-19 14:28:34 +02:00
parent 28cc423138
commit 980ce3c7a7
2 changed files with 16 additions and 11 deletions

View File

@ -97,7 +97,8 @@ class Create:
process = subprocess.run(
["pkexec", "/usr/local/bin/ssl_decrypt.py"],
stdout=subprocess.PIPE,
text=True, check=True
text=True,
check=True,
)
# print(process.stdout)
if process.returncode == 0:
@ -113,7 +114,8 @@ class Create:
process = subprocess.run(
["pkexec", "/usr/local/bin/ssl_encrypt.py"],
stdout=subprocess.PIPE,
text=True, check=True
text=True,
check=True,
)
print(process.stdout)
if process.returncode == 0:
@ -125,7 +127,7 @@ class Create:
def uos():
"""
uos = LOGIN USERNAME
uos = LOGIN USERNAME
This method displays the user name of the logged-in user,
even if you are rooted in a shell
@ -150,20 +152,22 @@ class GiteaUpdate:
Example: version = 'v. 1.1.1.1' GiteaUpdate.api_down(http://example.de, version)
"""
try:
response = requests.get(update_api_url)
response = requests.get(update_api_url, timeout=10)
response_dict = response.json()
response_dict = response_dict[0]
with open(wg_set, "r", encoding="utf-8") as set_file:
set_file = set_file.read()
if "on\n" in set_file:
if version[3:] != response_dict["tag_name"]:
return response_dict["tag_name"]
req = response_dict["tag_name"]
else:
return "No Updates"
req = "No Updates"
else:
return "False"
except requests.exceptions.ConnectionError:
return "No Internet Connection!"
req = "False"
return req
except requests.exceptions.RequestException:
req = "No Internet Connection!"
return req
@staticmethod
def download(urld, down_ok_image, down_not_ok_image, res):
@ -380,6 +384,7 @@ def if_tip(path):
with open(path, "r", encoding="utf-8") as set_file2:
lines2 = set_file2.readlines()
if "False\n" in lines2:
return False
tip = "False"
else:
return True
tip = "True"
return tip