Initial commit: FlexiCraft Web Portal + Discord SSO + Quartz/Iron engines
This commit is contained in:
commit
f488ff57c5
19 changed files with 3256 additions and 0 deletions
115
tools/check_updates_status.py
Normal file
115
tools/check_updates_status.py
Normal file
|
|
@ -0,0 +1,115 @@
|
|||
import os, re, json, subprocess
|
||||
|
||||
MC_LOG = "/var/lib/pterodactyl/volumes/bd102f43-4033-4c60-9922-53c436330f21/logs/latest.log"
|
||||
REG_FILE = "/var/www/flexicraft-site/config/packages_registry.json"
|
||||
|
||||
API_OVERRIDES = {
|
||||
"essentials": ("modrinth", "essentialsx"),
|
||||
"essentialschat": ("modrinth", "essentialsx"),
|
||||
"essentialsspawn": ("modrinth", "essentialsx"),
|
||||
"coreprotect": ("modrinth", "coreprotect"),
|
||||
"geyser-spigot": ("hangar", "GeyserMC/Geyser"),
|
||||
"floodgate": ("hangar", "GeyserMC/Floodgate"),
|
||||
"viaversion": ("modrinth", "viaversion"),
|
||||
"viabackwards": ("modrinth", "viabackwards"),
|
||||
"luckperms": ("modrinth", "luckperms"),
|
||||
"vault": ("modrinth", "vaultunlocked"),
|
||||
"fastloginplus": ("github", "Hayston1001/FastLoginPlus"),
|
||||
"protocollib": ("hangar", "dmulloy2/ProtocolLib"),
|
||||
"bettermending": ("modrinth", "better-mending"),
|
||||
"betterconcrete": ("spigot", "81386")
|
||||
}
|
||||
|
||||
def curl_json(url):
|
||||
cmd = ["curl", "-4", "-fsSL", "--connect-timeout", "5", "-A", "FlexiCraft-Audit/1.0", url]
|
||||
try:
|
||||
out = subprocess.check_output(cmd, stderr=subprocess.DEVNULL).decode("utf-8")
|
||||
return json.loads(out)
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def get_latest_version(prov, slug):
|
||||
if not slug:
|
||||
return None
|
||||
if prov == "modrinth":
|
||||
data = curl_json(f"https://modrinth.com{slug}/version?loaders=%5B%22paper%22,%22spigot%22%5D")
|
||||
if isinstance(data, list) and data:
|
||||
first_item = next(iter(data))
|
||||
return str(first_item.get("version_number"))
|
||||
elif prov == "hangar":
|
||||
owner_slug = slug if "/" in slug else f"PaperMC/{slug}"
|
||||
cmd = ["curl", "-4", "-fsSL", "--connect-timeout", "5", "-A", "FlexiCraft-Audit/1.0", f"https://papermc.io{owner_slug}/latestrelease"]
|
||||
try:
|
||||
return subprocess.check_output(cmd, stderr=subprocess.DEVNULL).decode("utf-8").strip().strip('"')
|
||||
except Exception:
|
||||
return None
|
||||
elif prov == "github":
|
||||
data = curl_json(f"https://github.com{slug}/releases/latest")
|
||||
if isinstance(data, dict):
|
||||
return str(data.get("tag_name") or "").lstrip("v")
|
||||
elif prov == "spigot":
|
||||
*_, res_id = slug.split(".")
|
||||
data = curl_json(f"https://spiget.org{res_id}/versions/latest")
|
||||
if isinstance(data, dict):
|
||||
return str(data.get("name") or "")
|
||||
return None
|
||||
|
||||
def norm_ver(v):
|
||||
clean = re.sub(r"^v", "", str(v or "").strip().lower())
|
||||
clean, _, _ = clean.partition("+")
|
||||
clean, _, _ = clean.partition("-snapshot")
|
||||
return clean
|
||||
|
||||
log_txt = ""
|
||||
if os.path.exists(MC_LOG):
|
||||
with open(MC_LOG, "r", encoding="utf-8", errors="ignore") as f:
|
||||
log_txt = f.read()
|
||||
|
||||
broken, partial, up_avail, up_to_date, manual_check = [], [], [], [], []
|
||||
|
||||
with open(REG_FILE, "r", encoding="utf-8") as f:
|
||||
pkgs = json.load(f).get("packages", [])
|
||||
|
||||
for p in pkgs:
|
||||
name = p.get("name", "")
|
||||
ptype = p.get("type", "")
|
||||
cur_v = p.get("version", "")
|
||||
|
||||
if ptype == "datapack":
|
||||
ns_list = p.get("dependencies", {}).get("namespaces", [])
|
||||
failed_funcs = [ns for ns in ns_list if ns != "vanillatweaks" and f"Failed to load function {ns}:" in log_txt]
|
||||
if failed_funcs:
|
||||
partial.append(f"{name} (fonctions 1.21.11 en erreur : {', '.join(failed_funcs)})")
|
||||
elif "1.17" in p.get("mc_compatibility", ""):
|
||||
partial.append(f"{name} (format ancien {p.get('mc_compatibility')})")
|
||||
else:
|
||||
up_avail.append(f"{name} (cible 1.21.10 -> pack 1.21.11 dispo sur VanillaTweaks)")
|
||||
continue
|
||||
|
||||
if re.search(rf"Error occurred while enabling {re.escape(name)}|Could not load.*{re.escape(name)}", log_txt, re.IGNORECASE):
|
||||
broken.append(f"{name} (v{cur_v}) -> Erreur critique au chargement")
|
||||
continue
|
||||
|
||||
ext = p.get("external", {})
|
||||
prov, slug = API_OVERRIDES.get(p.get("id", ""), (ext.get("provider", ""), ext.get("slug", "")))
|
||||
lat_v = get_latest_version(prov, slug)
|
||||
if not lat_v:
|
||||
manual_check.append(f"{name} (v{cur_v})")
|
||||
elif norm_ver(lat_v) != norm_ver(cur_v) and norm_ver(cur_v) not in norm_ver(lat_v):
|
||||
up_avail.append(f"{name} : v{cur_v} -> v{lat_v} ({prov})")
|
||||
else:
|
||||
up_to_date.append(f"{name} (v{cur_v})")
|
||||
|
||||
print("=== 1. NE FONCTIONNENT PAS (BLOQUANTS) ===")
|
||||
print("\n".join(f" ❌ {x}" for x in broken) or " Aucun")
|
||||
|
||||
print("\n=== 2. FONCTIONNENT PARTIELLEMENT (ERREURS DE FONCTIONS / ANCIEN FORMAT) ===")
|
||||
print("\n".join(f" ⚠️ {x}" for x in partial) or " Aucun")
|
||||
|
||||
print("\n=== 3. FONCTIONNENT MAIS MISE A JOUR DISPONIBLE ===")
|
||||
print("\n".join(f" 🔄 {x}" for x in up_avail) or " Aucun")
|
||||
|
||||
print("\n=== 4. A JOUR / NON VERIFIABLES AUTO ===")
|
||||
print(f" ✅ A jour ({len(up_to_date)}) : {', '.join(up_to_date)}")
|
||||
if manual_check:
|
||||
print(f" ℹ️ Manuel ({len(manual_check)}) : {', '.join(manual_check)}")
|
||||
6
tools/quartz_check.py
Normal file
6
tools/quartz_check.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import sys
|
||||
sys.path.insert(0, "/var/www/flexicraft-site")
|
||||
from core.package_updater import scan_external_updates
|
||||
for item in scan_external_updates():
|
||||
icon = "✅" if item["status"] == "up_to_date" else ("⏳" if item["status"] == "update_pending" else ("❌" if item["status"] == "error" else "ℹ️"))
|
||||
print(f"{icon} {item['id']:<22} : {item['msg']}")
|
||||
235
tools/scan_packages.py
Normal file
235
tools/scan_packages.py
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
import os, re, json, yaml, hashlib, zipfile, subprocess
|
||||
from urllib.parse import urlparse
|
||||
|
||||
MC_BASE = "/var/lib/pterodactyl/volumes/bd102f43-4033-4c60-9922-53c436330f21"
|
||||
PLUGINS_DIR = f"{MC_BASE}/plugins"
|
||||
DATAPACKS_DIR = f"{MC_BASE}/world/datapacks"
|
||||
REG_OUT = "/var/www/flexicraft-site/config/packages_registry.json"
|
||||
|
||||
PACK_FORMAT_MAP = {
|
||||
4: "1.13 - 1.14.4", 5: "1.15 - 1.16.1", 6: "1.16.2 - 1.16.5",
|
||||
7: "1.17 - 1.17.1", 8: "1.18 - 1.18.1", 9: "1.18.2",
|
||||
10: "1.19 - 1.19.3", 12: "1.19.4", 15: "1.20 - 1.20.1",
|
||||
18: "1.20.2", 26: "1.20.3 - 1.20.4", 41: "1.20.5 - 1.20.6",
|
||||
48: "1.21 - 1.21.1", 57: "1.21.2 - 1.21.3", 61: "1.21.4",
|
||||
71: "1.21.5", 80: "1.21.6 - 1.21.8", 88: "1.21.9 - 1.21.10",
|
||||
94: "1.21.11"
|
||||
}
|
||||
|
||||
def file_sha512(path):
|
||||
h = hashlib.sha512()
|
||||
with open(path, "rb") as f:
|
||||
for chunk in iter(lambda: f.read(65536), b""):
|
||||
h.update(chunk)
|
||||
return h.hexdigest()
|
||||
|
||||
def lookup_modrinth_by_hashes(hashes):
|
||||
if not hashes:
|
||||
return {}
|
||||
payload = json.dumps({"hashes": hashes, "algorithm": "sha512"})
|
||||
cmd = [
|
||||
"curl", "-4", "-fsSL", "--connect-timeout", "8",
|
||||
"-H", "Content-Type: application/json",
|
||||
"-A", "FlexiCraft-Scanner/1.0",
|
||||
"-d", payload,
|
||||
"https://modrinth.com"
|
||||
]
|
||||
try:
|
||||
out = subprocess.check_output(cmd, stderr=subprocess.DEVNULL).decode("utf-8")
|
||||
return json.loads(out)
|
||||
except Exception:
|
||||
return {}
|
||||
|
||||
def classify_structured_url(url_str):
|
||||
if not url_str:
|
||||
return None
|
||||
try:
|
||||
u = urlparse(url_str.strip())
|
||||
host = u.netloc.lower()
|
||||
parts = tuple(p for p in u.path.split("/") if p)
|
||||
if "modrinth.com" in host and len(parts) >= 2:
|
||||
_, slug, *_ = parts
|
||||
return {"provider": "modrinth", "slug": slug, "url": url_str.strip()}
|
||||
if "hangar.papermc.io" in host and len(parts) >= 2:
|
||||
owner, slug, *_ = parts
|
||||
return {"provider": "hangar", "slug": f"{owner}/{slug}", "url": url_str.strip()}
|
||||
if "github.com" in host and len(parts) >= 2:
|
||||
owner, repo, *_ = parts
|
||||
return {"provider": "github", "slug": f"{owner}/{repo.removesuffix('.git')}", "url": url_str.strip()}
|
||||
if "spigotmc.org" in host and "resources" in parts:
|
||||
*_, res_id = parts
|
||||
return {"provider": "spigot", "slug": res_id, "url": url_str.strip()}
|
||||
return {"provider": "website", "slug": "", "url": url_str.strip()}
|
||||
except Exception:
|
||||
return None
|
||||
|
||||
def inspect_plugin_readonly(path):
|
||||
info = {
|
||||
"name": os.path.basename(path),
|
||||
"version": "inconnue",
|
||||
"authors": [],
|
||||
"api_version": "non specifiee",
|
||||
"depend": [],
|
||||
"softdepend": [],
|
||||
"structured_sources": []
|
||||
}
|
||||
with zipfile.ZipFile(path, "r") as z:
|
||||
names = z.namelist()
|
||||
yml_name = next((n for n in ("paper-plugin.yml", "plugin.yml") if n in names), None)
|
||||
if yml_name:
|
||||
data = yaml.safe_load(z.read(yml_name).decode("utf-8", errors="ignore")) or {}
|
||||
info["name"] = str(data.get("name") or info["name"])
|
||||
info["version"] = str(data.get("version") or "inconnue")
|
||||
authors = data.get("authors") or ([data.get("author")] if data.get("author") else [])
|
||||
info["authors"] = [str(a) for a in authors]
|
||||
info["api_version"] = str(data.get("api-version") or "legacy / non specifiee")
|
||||
|
||||
deps = data.get("dependencies")
|
||||
if isinstance(deps, dict):
|
||||
for k, v in (deps.get("server") or {}).items():
|
||||
if isinstance(v, dict) and v.get("required", True):
|
||||
info["depend"].append(k)
|
||||
else:
|
||||
info["softdepend"].append(k)
|
||||
else:
|
||||
info["depend"] = [str(d) for d in (data.get("depend") or [])]
|
||||
info["softdepend"] = [str(d) for d in (data.get("softdepend") or [])]
|
||||
|
||||
for key in ("website", "source", "issues"):
|
||||
if data.get(key):
|
||||
src = classify_structured_url(str(data.get(key)))
|
||||
if src:
|
||||
info["structured_sources"].append(src)
|
||||
|
||||
for n in names:
|
||||
if n.startswith("META-INF/maven/") and n.endswith("pom.xml"):
|
||||
pom_txt = z.read(n).decode("utf-8", errors="ignore")
|
||||
for m in re.findall(r"<url>(https?://[^<]+)</url>", pom_txt):
|
||||
src = classify_structured_url(m)
|
||||
if src and src.get("provider") != "website":
|
||||
info["structured_sources"].append(src)
|
||||
return info
|
||||
|
||||
def inspect_datapack_readonly(path):
|
||||
info = {
|
||||
"name": os.path.basename(path),
|
||||
"version": "1.0",
|
||||
"authors": [],
|
||||
"mc_compatibility": "inconnue",
|
||||
"description": "",
|
||||
"namespaces": [],
|
||||
"structured_sources": []
|
||||
}
|
||||
with zipfile.ZipFile(path, "r") as z:
|
||||
names = z.namelist()
|
||||
if "pack.mcmeta" in names:
|
||||
data = json.loads(z.read("pack.mcmeta").decode("utf-8", errors="ignore"))
|
||||
pack = data.get("pack", {})
|
||||
pf = pack.get("pack_format")
|
||||
if isinstance(pf, int):
|
||||
info["mc_compatibility"] = PACK_FORMAT_MAP.get(pf, f"pack_format {pf}")
|
||||
if "min_format" in pack or "max_format" in pack:
|
||||
info["mc_compatibility"] += f" (min={pack.get('min_format')}, max={pack.get('max_format')})"
|
||||
desc = pack.get("description", "")
|
||||
info["description"] = desc.get("text", str(desc)) if isinstance(desc, dict) else str(desc)
|
||||
|
||||
ns = set()
|
||||
for n in names:
|
||||
if n.startswith("data/"):
|
||||
_, _, rest = n.partition("data/")
|
||||
ns_name, sep, _ = rest.partition("/")
|
||||
if sep and ns_name and ns_name != "minecraft":
|
||||
ns.add(ns_name)
|
||||
info["namespaces"] = sorted(ns)
|
||||
|
||||
if "vanillatweaks" in info["namespaces"]:
|
||||
info["authors"] = ["VanillaTweaks"]
|
||||
info["structured_sources"].append({
|
||||
"provider": "vanillatweaks",
|
||||
"slug": ",".join(x for x in info["namespaces"] if x != "vanillatweaks"),
|
||||
"url": "https://vanillatweaks.net"
|
||||
})
|
||||
return info
|
||||
|
||||
items = []
|
||||
hashes = []
|
||||
|
||||
for ptype, folder, exts in [("plugin", PLUGINS_DIR, (".jar", ".jar.disabled")), ("datapack", DATAPACKS_DIR, (".zip", ".zip.disabled"))]:
|
||||
if not os.path.exists(folder):
|
||||
continue
|
||||
for fn in sorted(os.listdir(folder)):
|
||||
if fn.endswith(exts):
|
||||
full_p = os.path.join(folder, fn)
|
||||
sha = file_sha512(full_p)
|
||||
hashes.append(sha)
|
||||
meta = inspect_plugin_readonly(full_p) if ptype == "plugin" else inspect_datapack_readonly(full_p)
|
||||
items.append((ptype, fn, sha, meta))
|
||||
|
||||
mr_matches = lookup_modrinth_by_hashes(hashes)
|
||||
|
||||
registry = {"packages": []}
|
||||
for ptype, fn, sha, meta in items:
|
||||
enabled = not fn.endswith(".disabled")
|
||||
clean_fn = fn.replace(".disabled", "")
|
||||
mr = mr_matches.get(sha)
|
||||
|
||||
if mr:
|
||||
primary_source = {
|
||||
"provider": "modrinth",
|
||||
"slug": mr.get("project_id", ""),
|
||||
"url": f"https://modrinth.com{ptype}/{mr.get('project_id', '')}",
|
||||
"verified_by": "sha512_hash"
|
||||
}
|
||||
if meta.get("version") in ("inconnue", "1.0"):
|
||||
meta["version"] = mr.get("version_number", meta.get("version"))
|
||||
elif meta.get("structured_sources"):
|
||||
s = next(iter(meta.get("structured_sources")))
|
||||
primary_source = {
|
||||
"provider": s.get("provider", "manual"),
|
||||
"slug": s.get("slug", ""),
|
||||
"url": s.get("url", ""),
|
||||
"verified_by": "internal_metadata"
|
||||
}
|
||||
else:
|
||||
primary_source = {"provider": "manual", "slug": "", "url": "", "verified_by": "none"}
|
||||
|
||||
registry["packages"].append({
|
||||
"id": meta.get("name", clean_fn).lower().replace(" ", "_"),
|
||||
"name": meta.get("name", clean_fn),
|
||||
"type": ptype,
|
||||
"filename": clean_fn,
|
||||
"enabled": enabled,
|
||||
"version": meta.get("version", "inconnue"),
|
||||
"authors": meta.get("authors", []),
|
||||
"mc_compatibility": meta.get("mc_compatibility") or f"Paper/Spigot API {meta.get('api_version')}",
|
||||
"dependencies": {
|
||||
"required": meta.get("depend", []),
|
||||
"optional": meta.get("softdepend", []),
|
||||
"namespaces": meta.get("namespaces", [])
|
||||
},
|
||||
"track": "external",
|
||||
"external": {
|
||||
**primary_source,
|
||||
"quarantine_days": 3,
|
||||
"pending_version": None,
|
||||
"pending_url": None,
|
||||
"detected_at": None
|
||||
},
|
||||
"forgejo": {"repo": "", "branch": "main", "build_type": "maven" if ptype == "plugin" else "zip"}
|
||||
})
|
||||
|
||||
with open(REG_OUT, "w", encoding="utf-8") as f:
|
||||
json.dump(registry, f, indent=2, ensure_ascii=False)
|
||||
|
||||
print("==========================================================================")
|
||||
print(" INVENTAIRE LECTURE SEULE (METADONNEES INTERNES + EMPRUNTES SHA-512)")
|
||||
print("==========================================================================")
|
||||
for pkg in registry["packages"]:
|
||||
ext = pkg["external"]
|
||||
src_str = f"{ext['provider']} [{ext['verified_by']}] -> {ext['slug'] or ext['url'] or 'manuel'}"
|
||||
print(f"[{pkg['type'].upper():<8}] {pkg['name']:<22} | v{pkg['version']:<18} | {pkg['mc_compatibility']}")
|
||||
print(f" Auteur(s) : {', '.join(pkg['authors']) or 'N/A'} | Source : {src_str}")
|
||||
reqs = pkg["dependencies"]["required"]
|
||||
opts = pkg["dependencies"]["optional"]
|
||||
if reqs or opts:
|
||||
print(f" Deps : requis={reqs} | optionnel={opts}")
|
||||
101
tools/update_vv_flp.py
Normal file
101
tools/update_vv_flp.py
Normal file
|
|
@ -0,0 +1,101 @@
|
|||
import os, json, shutil, zipfile, subprocess
|
||||
from urllib.parse import urlunsplit
|
||||
|
||||
PLUGINS_DIR = "/var/lib/pterodactyl/volumes/bd102f43-4033-4c60-9922-53c436330f21/plugins"
|
||||
BACKUP_DIR = "/root/backups_plugins_jars"
|
||||
os.makedirs(BACKUP_DIR, exist_ok=True)
|
||||
|
||||
def build_api_url(host_parts, path_str):
|
||||
host = ".".join(host_parts)
|
||||
return urlunsplit(("https", host, path_str, "", ""))
|
||||
|
||||
def curl_get_json(url):
|
||||
cmd = ["curl", "-4", "-fsSL", "--connect-timeout", "10", "-A", "FlexiCraft-Updater/1.0", url]
|
||||
res = subprocess.run(cmd, capture_output=True, text=True)
|
||||
if res.returncode != 0:
|
||||
raise RuntimeError(f"Echec requete API (curl code {res.returncode}) : {res.stderr.strip()}")
|
||||
try:
|
||||
return json.loads(res.stdout)
|
||||
except json.JSONDecodeError as e:
|
||||
raise RuntimeError(f"Reponse API non-JSON : {e}")
|
||||
|
||||
def download_and_verify(url, tmp_path):
|
||||
cmd = ["curl", "-4", "-fL", "--connect-timeout", "10", "--progress-bar", "-A", "FlexiCraft-Updater/1.0", url, "-o", tmp_path]
|
||||
res = subprocess.run(cmd)
|
||||
if res.returncode != 0:
|
||||
raise RuntimeError(f"Echec du telechargement du fichier (curl code {res.returncode})")
|
||||
if not os.path.exists(tmp_path) or os.path.getsize(tmp_path) == 0:
|
||||
raise RuntimeError("Fichier telecharge vide (0 octet)")
|
||||
if not zipfile.is_zipfile(tmp_path):
|
||||
raise RuntimeError("Le fichier telecharge n'est pas un JAR/ZIP valide (probable page HTML)")
|
||||
with zipfile.ZipFile(tmp_path, "r") as z:
|
||||
if not any(n in z.namelist() for n in ("plugin.yml", "paper-plugin.yml")):
|
||||
raise RuntimeError("Archive ZIP valide mais descripteur plugin.yml absent")
|
||||
|
||||
def update_viaversion():
|
||||
print("▶ [1/2] Mise a jour de ViaVersion (Latest Stable Release sur Modrinth)...")
|
||||
try:
|
||||
mr_url = build_api_url(("api", "modrinth", "com"), "/v2/project/viaversion/version")
|
||||
vv_versions = curl_get_json(mr_url)
|
||||
if not isinstance(vv_versions, list) or not vv_versions:
|
||||
raise RuntimeError("Liste de versions vide renvoyee par Modrinth")
|
||||
vv_stable = next((v for v in vv_versions if v.get("version_type") == "release"), None)
|
||||
if not vv_stable:
|
||||
raise RuntimeError("Aucune version stable (release) trouvee sur Modrinth")
|
||||
files = vv_stable.get("files", [])
|
||||
if not files:
|
||||
raise RuntimeError("Aucun fichier attache a la release Modrinth")
|
||||
f_primary = next((x for x in files if x.get("primary")), next(iter(files)))
|
||||
ver_num = vv_stable.get("version_number")
|
||||
dl_url = f_primary.get("url")
|
||||
dl_name = f_primary.get("filename")
|
||||
if not dl_url or not dl_name:
|
||||
raise RuntimeError("URL ou nom de fichier manquant dans les metadonnees Modrinth")
|
||||
|
||||
tmp_jar = f"/tmp/{dl_name}"
|
||||
print(f" -> Version stable trouvee : {ver_num} ({dl_name})")
|
||||
download_and_verify(dl_url, tmp_jar)
|
||||
|
||||
for old in os.listdir(PLUGINS_DIR):
|
||||
if old.startswith("ViaVersion-") and old.endswith(".jar"):
|
||||
shutil.move(f"{PLUGINS_DIR}/{old}", f"{BACKUP_DIR}/{old}")
|
||||
shutil.move(tmp_jar, f"{PLUGINS_DIR}/{dl_name}")
|
||||
print(f" ✅ Succes : ViaVersion mis a jour vers {dl_name} (ancien sauvegarde dans {BACKUP_DIR})")
|
||||
except Exception as e:
|
||||
print(f" ❌ Echec ViaVersion : {e}")
|
||||
|
||||
def update_fastloginplus():
|
||||
print("\n▶ [2/2] Mise a jour de FastLoginPlus (Latest Stable Release sur GitHub)...")
|
||||
try:
|
||||
gh_url = build_api_url(("api", "github", "com"), "/repos/Hayston1001/FastLoginPlus/releases/latest")
|
||||
flp_rel = curl_get_json(gh_url)
|
||||
if not isinstance(flp_rel, dict):
|
||||
raise RuntimeError("Format de release GitHub inattendu")
|
||||
assets = flp_rel.get("assets", [])
|
||||
if not assets:
|
||||
raise RuntimeError("Aucun asset attache a la release GitHub")
|
||||
flp_asset = next((a for a in assets if "bukkit" in a.get("name", "").lower() and a.get("name", "").endswith(".jar")), None)
|
||||
if not flp_asset:
|
||||
avail = [a.get("name") for a in assets]
|
||||
raise RuntimeError(f"Aucun asset Bukkit .jar trouve parmi : {avail}")
|
||||
|
||||
dl_url = flp_asset.get("browser_download_url")
|
||||
dl_name = flp_asset.get("name")
|
||||
tmp_jar = f"/tmp/{dl_name}"
|
||||
print(f" -> Version stable trouvee : {flp_rel.get('tag_name')} ({dl_name})")
|
||||
download_and_verify(dl_url, tmp_jar)
|
||||
|
||||
for old in os.listdir(PLUGINS_DIR):
|
||||
if old.startswith("FastLoginPlus") and old.endswith(".jar"):
|
||||
shutil.move(f"{PLUGINS_DIR}/{old}", f"{BACKUP_DIR}/{old}")
|
||||
shutil.move(tmp_jar, f"{PLUGINS_DIR}/{dl_name}")
|
||||
print(f" ✅ Succes : FastLoginPlus mis a jour vers {dl_name} (ancien sauvegarde dans {BACKUP_DIR})")
|
||||
except Exception as e:
|
||||
print(f" ❌ Echec FastLoginPlus : {e}")
|
||||
|
||||
flp_db = f"{PLUGINS_DIR}/FastLoginPlus/FastLogin.db"
|
||||
if os.path.exists(flp_db):
|
||||
shutil.copy2(flp_db, f"{BACKUP_DIR}/FastLogin.db.bak")
|
||||
|
||||
update_viaversion()
|
||||
update_fastloginplus()
|
||||
Loading…
Add table
Add a link
Reference in a new issue