Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(marketplace): read the wallpaper URL the registry actually publishes

Haraldb09864a5a956
diff --git a/jarvis/marketplace/community_source.py b/jarvis/marketplace/community_source.py
index c1e5362d07..25a800bf30 100644
--- a/jarvis/marketplace/community_source.py
+++ b/jarvis/marketplace/community_source.py
@@ -114,23 +114,36 @@ class CommunityWallpaperEntry(_Tolerant):
published_at: str | None = None
categories: list[str] = Field(default_factory=list)
source_url: str | None = None
- # Direct download of the image itself.
+ license: str | None = None
+ #: Full-size picture. This is what the published registry actually emits;
+ #: ``raw_url`` is accepted alongside it so the field name the other two
+ #: kinds use keeps working for a hand-written entry.
+ image_url: str | None = None
raw_url: str | None = None
+ #: Small preview, for showing the picture before anything is installed.
+ thumb_url: str | None = None
+ width: int | None = None
+ height: int | None = None
# Light/dark hint from the publisher. Only a hint: the server re-derives
# the theme from the actual pixels, exactly as it does for an upload, so a
# wrong or absent value costs nothing.
theme: str | None = None
- @field_validator("raw_url")
+ @field_validator("image_url", "raw_url", "thumb_url")
@classmethod
def _https_only(cls, value: str | None) -> str | None:
# Same reasoning as the skill raw_url above: the backend fetches this
# server-side, so anything but https is an SSRF vector.
if value is not None and not value.lower().startswith("https://"):
- logger.warning("community index: dropping non-https wallpaper raw_url %r", value)
+ logger.warning("community index: dropping non-https wallpaper url %r", value)
return None
return value
+ @property
+ def download_url(self) -> str | None:
+ """The picture to fetch, whichever field the publisher used."""
+ return self.image_url or self.raw_url
+
class CommunityIndex(_Tolerant):
revision: int = 0
diff --git a/tests/unit/marketplace/test_community_install_kinds.py b/tests/unit/marketplace/test_community_install_kinds.py
index 0e7596284c..e4897169d6 100644
--- a/tests/unit/marketplace/test_community_install_kinds.py
+++ b/tests/unit/marketplace/test_community_install_kinds.py
@@ -67,7 +67,15 @@ def _index_payload() -> dict[str, Any]:
"description": "A dark wave under a full moon",
"publisher": "octocat",
"version": "1.0.0",
- "raw_url": "https://raw.example/wallpapers/moonlit-wave.png",
+ # The published registry emits `image_url` + `thumb_url` and
+ # leaves `raw_url` null — pinned here because reading the
+ # wrong field made every published wallpaper uninstallable.
+ "image_url": "https://pages.example/wallpapers/moonlit-wave/wallpaper.webp",
+ "thumb_url": "https://pages.example/wallpapers/moonlit-wave/thumb.webp",
+ "raw_url": None,
+ "license": "CC0-1.0",
+ "width": 1920,
+ "height": 1080,
"source_url": "https://github.com/PersonalJarvis/marketplace",
"theme": "dark",
}
@@ -150,6 +158,35 @@ async def test_browse_lists_published_wallpapers(env: Path) -> None:
assert paper["name"] == "moonlit-wave"
assert paper["title"] == "Moonlit Wave"
assert paper["installed"] is False
+ # The picture the install would fetch, whichever field the publisher used.
+ assert paper["image_url"].endswith("wallpaper.webp")
+ assert paper["raw_url"] == paper["image_url"]
+ assert paper["thumb_url"].endswith("thumb.webp")
+
+
+async def test_the_download_url_comes_from_the_published_field(env: Path) -> None:
+ """Regression: the registry emits `image_url`, not `raw_url`.
+
+ Reading only `raw_url` left every published wallpaper with no download at
+ all — browsable, and refused the moment anyone pressed install.
+ """
+ index, _ = await community_source.get_index()
+ paper = index.wallpapers[0]
+ assert paper.raw_url is None
+ assert paper.download_url == paper.image_url
+
+
+async def test_a_non_https_image_url_is_dropped(monkeypatch: pytest.MonkeyPatch) -> None:
+ """The server fetches this URL — plain http would be an SSRF primitive."""
+ from jarvis.marketplace.community_source import CommunityWallpaperEntry
+
+ entry = CommunityWallpaperEntry(
+ name="x", image_url="http://plain.example/a.webp", thumb_url="http://plain.example/t.webp"
+ )
+ assert entry.image_url is None
+ assert entry.download_url is None
@pytest.mark.asyncio