about summary refs log tree commit diff stats
path: root/fungus
diff options
context:
space:
mode:
authorAndrew Dolgov <fox@fakecake.org>2026-07-04 13:35:47 +0300
committerAndrew Dolgov <fox@fakecake.org>2026-07-04 13:35:47 +0300
commit4a64a67380ee91a0cc5b655afd3bc05b38d90e06 (patch)
treec39952600121dae7f9541d679908cd16c8d6d6ef /fungus
parenta2594fbd38afc711560aed2e9b4e703a2b57dcbe (diff)
downloadfungus-launcher-4a64a67380ee91a0cc5b655afd3bc05b38d90e06.tar.gz
fungus-launcher-4a64a67380ee91a0cc5b655afd3bc05b38d90e06.tar.xz
move more non-UI code into backend class
Diffstat (limited to 'fungus')
-rw-r--r--fungus/proton_manager.py50
1 files changed, 50 insertions, 0 deletions
diff --git a/fungus/proton_manager.py b/fungus/proton_manager.py
index 2d360d9..e726cfc 100644
--- a/fungus/proton_manager.py
+++ b/fungus/proton_manager.py
@@ -3,6 +3,7 @@
 
 __all__ = [
     "CACHE_TTL",
+    "DEFAULT_UPSTREAM_URLS",
     "MACHINE_ARCH",
     "RATE_LIMITED_MSG",
     "STEAM_COMPATIBILITY_PATH",
@@ -10,7 +11,9 @@ __all__ = [
     "RateLimited",
     "_cache_key",
     "_fetch_with_cache",
+    "clear_cache",
     "download_and_extract",
+    "fetch_all_releases",
     "fetch_releases",
     "get_arch_asset",
     "get_cache_dir",
@@ -42,6 +45,11 @@ log = get_logger(__name__)
 STEAM_COMPATIBILITY_PATH = Path(PathManager.user_data("Steam/compatibilitytools.d"))
 MACHINE_ARCH = platform.machine().lower()  # e.g. "x86_64", "aarch64"
 
+DEFAULT_UPSTREAM_URLS = [
+    "https://api.github.com/repos/GloriousEggroll/proton-ge-custom/releases",
+    "https://api.github.com/repos/Etaash-mathamsetty/Proton/releases",
+]
+
 RATE_LIMITED_MSG = (
     "GitHub API rate limit reached. Please try again later or use the refresh button."
 )
@@ -204,6 +212,48 @@ def fetch_releases(url):
 
 
 # ---------------------------------------------------------------------------
+# Cache management
+# ---------------------------------------------------------------------------
+
+def clear_cache(urls=None):
+    """Remove cached release data for given upstream URLs.
+
+    Parameters
+    ----------
+    urls : list[str], optional
+        URLs to clear cache for. Defaults to all known upstreams.
+    """
+    if urls is None:
+        urls = DEFAULT_UPSTREAM_URLS
+    for url in urls:
+        cache_path = get_cache_dir() / _cache_key(url)
+        try:
+            cache_path.unlink(missing_ok=True)
+            log.debug("Cache removed: %s", url)
+        except OSError as exc:
+            log.warning("Cache removal failed: %s", exc)
+
+
+# ---------------------------------------------------------------------------
+# Fetch all upstreams
+# ---------------------------------------------------------------------------
+
+
+def fetch_all_releases():
+    """Fetch releases from all known upstreams.
+
+    Returns
+    -------
+    dict[str, list[dict]]
+        Mapping from upstream URL to its list of release dicts.
+    """
+    results = {}
+    for url in DEFAULT_UPSTREAM_URLS:
+        results[url] = _fetch_with_cache(url)
+    return results
+
+
+# ---------------------------------------------------------------------------
 # Asset selection
 # ---------------------------------------------------------------------------