diff --git a/backend/app/data/registry_index.json b/backend/app/data/registry_index.json index 623e03e7..edd65ab9 100644 --- a/backend/app/data/registry_index.json +++ b/backend/app/data/registry_index.json @@ -42,7 +42,8 @@ "repo": "https://github.com/jhd3197/serverkit-crowdsec", "homepage": "https://github.com/jhd3197/serverkit-crowdsec", "featured": false, - "feature_score": 0 + "feature_score": 0, + "logo": "assets/serverkit-crowdsec/logo.png" }, { "slug": "serverkit-dns-server", @@ -64,7 +65,8 @@ "repo": "https://github.com/jhd3197/serverkit-dns-server", "homepage": "https://github.com/jhd3197/serverkit-dns-server", "featured": false, - "feature_score": 0 + "feature_score": 0, + "logo": "assets/serverkit-dns-server/logo.png" }, { "slug": "serverkit-gpu", @@ -85,7 +87,8 @@ "repo": "https://github.com/jhd3197/serverkit-gpu", "homepage": "https://github.com/jhd3197/serverkit-gpu", "featured": true, - "feature_score": 60 + "feature_score": 60, + "logo": "assets/serverkit-gpu/logo.png" }, { "slug": "serverkit-mail", @@ -109,7 +112,8 @@ "repo": "https://github.com/jhd3197/serverkit-mail", "homepage": "https://github.com/jhd3197/serverkit-mail", "featured": false, - "feature_score": 0 + "feature_score": 0, + "logo": "assets/serverkit-mail/logo.png" }, { "slug": "serverkit-k8s", @@ -132,7 +136,8 @@ "repo": "https://github.com/jhd3197/serverkit-k8s", "homepage": "https://github.com/jhd3197/serverkit-k8s", "featured": false, - "feature_score": 0 + "feature_score": 0, + "logo": "assets/serverkit-k8s/logo.png" }, { "slug": "serverkit-tramo", @@ -156,7 +161,8 @@ "repo": "https://github.com/jhd3197/serverkit-tramo", "homepage": "https://github.com/jhd3197/serverkit-tramo", "featured": true, - "feature_score": 90 + "feature_score": 90, + "logo": "assets/serverkit-tramo/logo.png" }, { "slug": "serverkit-analytics", @@ -179,7 +185,8 @@ "repo": "https://github.com/jhd3197/serverkit-analytics", "homepage": "https://github.com/jhd3197/serverkit-analytics", "featured": true, - "feature_score": 88 + "feature_score": 88, + "logo": "assets/serverkit-analytics/logo.png" }, { "slug": "serverkit-faro", @@ -198,7 +205,8 @@ "repo": "https://github.com/jhd3197/serverkit-faro", "homepage": "https://github.com/jhd3197/serverkit-faro", "featured": true, - "feature_score": 100 + "feature_score": 100, + "logo": "assets/serverkit-faro/logo.png" } ] } diff --git a/backend/app/services/registry_service.py b/backend/app/services/registry_service.py index 68c7305c..a62de3ac 100644 --- a/backend/app/services/registry_service.py +++ b/backend/app/services/registry_service.py @@ -32,14 +32,12 @@ _BUNDLED_INDEX = os.path.join( # The curated public index (one JSON file, PR-reviewed, checksum-verified # installs). Panels fall back to cache → bundled copy when unreachable. # -# NOTE (plan 40 task 11): once serverkit.ai/ext/index.json is deployed (Phase 4 -# endpoints), flip this default to 'https://serverkit.ai/ext/index.json' — that -# endpoint proxies this same raw index with caching + logo URL rewriting. The -# raw-GitHub URL below stays the documented manual fallback -# (SERVERKIT_REGISTRY_URL). Deferred here: flipping before the domain is live -# would break Marketplace Browse everywhere. +# The default goes through serverkit.ai, which proxies the raw-GitHub index +# with caching, serves logo art locally, and rewrites relative logo paths to +# absolute serverkit.ai URLs. The raw-GitHub index stays available as a +# manual fallback via SERVERKIT_REGISTRY_URL. DEFAULT_REGISTRY_URL = ( - 'https://raw.githubusercontent.com/jhd3197/serverkit-extensions/main/index.json' + 'https://serverkit.ai/ext/index.json' ) diff --git a/backend/tests/test_registry.py b/backend/tests/test_registry.py index 3283bbca..e98f0ed5 100644 --- a/backend/tests/test_registry.py +++ b/backend/tests/test_registry.py @@ -240,11 +240,12 @@ def test_update_preserves_builtin_source_type(app, plugin_dirs, monkeypatch): # --------------------------------------------------------------------------- # def test_registry_url_defaults_to_public_index(monkeypatch): - """Unset env → the curated serverkit-extensions raw index (the go-live - default). conftest pins it EMPTY suite-wide, so simulate unset here.""" + """Unset env → the curated index via serverkit.ai (the go-live default; + it proxies the raw serverkit-extensions index with caching + logo URL + rewriting). conftest pins it EMPTY suite-wide, so simulate unset here.""" monkeypatch.delenv('SERVERKIT_REGISTRY_URL', raising=False) assert registry_service._registry_url() == registry_service.DEFAULT_REGISTRY_URL - assert 'serverkit-extensions' in registry_service.DEFAULT_REGISTRY_URL + assert registry_service.DEFAULT_REGISTRY_URL == 'https://serverkit.ai/ext/index.json' def test_registry_url_empty_disables_remote(monkeypatch): @@ -279,13 +280,20 @@ def test_v2_entry_normalizes_logo_and_repo(): def test_relative_logo_resolved_against_index_base(): """A repo-relative logo becomes absolute against the index URL it came - from (raw-GitHub index → raw asset URL).""" - base = registry_service.DEFAULT_REGISTRY_URL # .../main/index.json - e = registry_service._normalize({ + from (serverkit.ai index → /ext/assets URL; raw-GitHub index → raw asset + URL when used as a manual fallback).""" + entry = { 'slug': 'gui', 'display_name': 'GUI', 'version': '1.0.0', 'source': 'https://x/gui.zip', 'logo': 'assets/gui/logo.svg', - }, base_url=base) + } + e = registry_service._normalize( + entry, base_url=registry_service.DEFAULT_REGISTRY_URL) + assert e['logo'] == 'https://serverkit.ai/ext/assets/gui/logo.svg' + + e = registry_service._normalize( + entry, + base_url='https://raw.githubusercontent.com/jhd3197/serverkit-extensions/main/index.json') assert e['logo'] == ( 'https://raw.githubusercontent.com/jhd3197/serverkit-extensions/' 'main/assets/gui/logo.svg' diff --git a/docs/EXTENSIONS_REGISTRY.md b/docs/EXTENSIONS_REGISTRY.md index 3516ecd3..29c91b1d 100644 --- a/docs/EXTENSIONS_REGISTRY.md +++ b/docs/EXTENSIONS_REGISTRY.md @@ -12,9 +12,10 @@ This document is the format spec (task #16) and the publisher guide (task #21). ## How a panel consumes the registry - The panel fetches the index from `SERVERKIT_REGISTRY_URL` (env var). When unset - it defaults to the curated public registry - (`https://raw.githubusercontent.com/jhd3197/serverkit-extensions/main/index.json`); - set it **empty** to disable remote fetching entirely (air-gapped panels). When + it defaults to the curated public registry via serverkit.ai + (`https://serverkit.ai/ext/index.json`, which proxies and caches the raw + `serverkit-extensions` index and serves its logo art); set it **empty** to + disable remote fetching entirely (air-gapped panels). When the fetch fails (offline), it falls back to the **last good cache**, then to a **bundled copy** shipped at `backend/app/data/registry_index.json`. The Marketplace never blanks.