fix: preserve legacy plugin catalogs and protect helper token initialization

This commit is contained in:
chenmingxuan committed 2026-10-28 17:53:43 +08:00
1 parent 4dc2057d43
commit e90da727d4
8 files changed
+81 -18

No files matched your search

+5 -4
View File
@@ -44,10 +44,11 @@ def download(url: str, progress: Callable[[str, int], None]) -> bytes:
def load_catalog() -> PluginCatalog:
url = settings.ARTEMIS_PLUGIN_MARKETPLACE_URL
# Older hosts reject schema-v3 entries before checking version constraints.
# Keep their index intact, and route only the exact former official URL.
if url == "https://git.playones.com/chenmingxuan/Artemis-Plugins/raw/branch/main/catalog.json":
url = url.removesuffix("catalog.json") + "catalog-v3.json"
# Strict older hosts cannot parse newer panel kinds, even if incompatible.
# Preserve their indexes; upgrade only the exact official saved addresses.
official = "https://git.playones.com/chenmingxuan/Artemis-Plugins/raw/branch/main/"
if url in {official + "catalog.json", official + "catalog-v3.json"}:
url = official + "catalog-v4.json"
data = download(url, lambda *_: None)
if len(data) > 2 * 1024 * 1024:
raise ValueError("市场索引过大")