Add files via upload

This commit is contained in:
m5rcel { Marcel }
2025-09-08 22:11:19 +02:00
committed by GitHub
parent af762526f5
commit 751062a706
21 changed files with 698 additions and 0 deletions

7
utils/downloader.py Normal file
View File

@@ -0,0 +1,7 @@
import requests, zipfile, io
def download_and_extract(url, target_dir):
resp = requests.get(url)
resp.raise_for_status()
with zipfile.ZipFile(io.BytesIO(resp.content)) as z:
z.extractall(target_dir)

14
utils/updater.py Normal file
View File

@@ -0,0 +1,14 @@
import os, requests
from utils.downloader import download_and_extract
from pathlib import Path
def check_and_update():
remote_ver = requests.get("https://yourserver.com/version.txt").text.strip()
local_ver = Path(__file__).parents[2].joinpath("version.txt").read_text().strip()
if remote_ver != local_ver:
print("Updating to", remote_ver)
download_and_extract("https://yourserver.com/m5rcode.zip", os.path.dirname(__file__))
Path(__file__).parents[2].joinpath("version.txt").write_text(remote_ver)
print("Update complete!")
else:
print("Already up to date.")