Update pyUltroid/fns/helper.py
Browse files- pyUltroid/fns/helper.py +3 -31
pyUltroid/fns/helper.py
CHANGED
|
@@ -273,36 +273,8 @@ async def bash(cmd, run_code=0):
|
|
| 273 |
|
| 274 |
|
| 275 |
async def updater():
|
| 276 |
-
|
| 277 |
-
|
| 278 |
-
try:
|
| 279 |
-
off_repo = Repo().remotes[0].config_reader.get("url").replace(".git", "")
|
| 280 |
-
except Exception as er:
|
| 281 |
-
LOGS.exception(er)
|
| 282 |
-
return
|
| 283 |
-
try:
|
| 284 |
-
repo = Repo()
|
| 285 |
-
except NoSuchPathError as error:
|
| 286 |
-
LOGS.info(f"`directory {error} is not found`")
|
| 287 |
-
Repo().__del__()
|
| 288 |
-
return
|
| 289 |
-
except GitCommandError as error:
|
| 290 |
-
LOGS.info(f"`Early failure! {error}`")
|
| 291 |
-
Repo().__del__()
|
| 292 |
-
return
|
| 293 |
-
except InvalidGitRepositoryError:
|
| 294 |
-
repo = Repo.init()
|
| 295 |
-
origin = repo.create_remote("upstream", off_repo)
|
| 296 |
-
origin.fetch()
|
| 297 |
-
repo.create_head("main", origin.refs.main)
|
| 298 |
-
repo.heads.main.set_tracking_branch(origin.refs.main)
|
| 299 |
-
repo.heads.main.checkout(True)
|
| 300 |
-
ac_br = repo.active_branch.name
|
| 301 |
-
repo.create_remote("upstream", off_repo) if "upstream" not in repo.remotes else None
|
| 302 |
-
ups_rem = repo.remote("upstream")
|
| 303 |
-
ups_rem.fetch(ac_br)
|
| 304 |
-
changelog, tl_chnglog = await gen_chlog(repo, f"HEAD..upstream/{ac_br}")
|
| 305 |
-
return bool(changelog)
|
| 306 |
|
| 307 |
|
| 308 |
# ----------------Fast Upload/Download----------------
|
|
@@ -400,7 +372,7 @@ async def download_file(link, name, validate=False):
|
|
| 400 |
async def _download(content):
|
| 401 |
if validate and "application/json" in content.headers.get("Content-Type"):
|
| 402 |
return None, await content.json()
|
| 403 |
-
with open(
|
| 404 |
file.write(await content.read())
|
| 405 |
return name, ""
|
| 406 |
|
|
|
|
| 273 |
|
| 274 |
|
| 275 |
async def updater():
|
| 276 |
+
# Disabled: No git remote operations to avoid permission errors in containerized environments
|
| 277 |
+
return False
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 278 |
|
| 279 |
|
| 280 |
# ----------------Fast Upload/Download----------------
|
|
|
|
| 372 |
async def _download(content):
|
| 373 |
if validate and "application/json" in content.headers.get("Content-Type"):
|
| 374 |
return None, await content.json()
|
| 375 |
+
with open(name, "wb") as file:
|
| 376 |
file.write(await content.read())
|
| 377 |
return name, ""
|
| 378 |
|