Release resources 0.5.0 with consistent plugin dependency metadata
This commit is contained in:
1 parent
d6cb2f140b
commit
ebb40c9e2c
41 files changed
+241
-91
No files matched your search
@@ -1,3 +1,10 @@
|
||||
# 0.5.0 — 2026-10-29
|
||||
|
||||
- Declare dependencies in every plugin manifest and catalog entry: Queue for queued media plugins and Anime Providers for Anime Search; independent providers and starter plugins declare an empty list.
|
||||
- Publish plugin 0.1.1 and starter 0.2.1 packages with matching runtime versions and dependency metadata; retain all previously published archives.
|
||||
- Validate dependency IDs, referenced packages and cycles before building the catalog; reject modifications to already published archive versions.
|
||||
- Document the framework 0.10.0 dependency dialog and Install/Ignore workflow; keep optional service integrations selectable in settings.
|
||||
|
||||
# 0.4.0 — 2026-10-29
|
||||
|
||||
- Add Watchlist with its scheduler and configurable search, thumbnails, media handoff, and notifications.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
Plugins and themes for [Web Framework](https://gitea.coreplay.eu/Dymas/web-framework).
|
||||
|
||||
In **Config → Add resources → Plugins** or **Themes**, install a resource, restart the app, then enable the plugin or select the theme. Framework 0.9.2+ shows new installs immediately in Config → Plugins with restart and dependency guidance. Settings become available after restart; enabling a plugin adds its page to the menu. Manage catalogs under **Sources** (framework 0.7.0+).
|
||||
In **Config → Add resources**, browse **Plugins** or **Themes**. Framework 0.10.0+ offers **Install** for all missing requirements or **Ignore** for just the selected package. Restart, then configure/enable plugins in **Config → Plugins** or select a theme. Manage catalogs under **Sources** (framework 0.7.0+).
|
||||
|
||||
- Plugins: Notes, Bookmarks, Workspace status, Queue, **Watchlist**, **Thumbnails**, **Anime Search**, **Anime Providers**, **Media Handoff**, **AI Subtitles**, and **Discord Notifications**.
|
||||
- Themes: Default, Ocean, and Mint.
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+56
-33
@@ -5,107 +5,130 @@
|
||||
"id": "ai-subtitles",
|
||||
"name": "AI Subtitles",
|
||||
"description": "Queued SRT/VTT translation with preserved timestamps and formatting using Ollama or OpenAI.",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-ai-subtitles-0.1.0.zip",
|
||||
"sha256": "416cf8dd4a9969dd496c5d770b1a0c0b02e1a91be84e355db29654a19ebfe18d"
|
||||
"archive": "archives/plugin-ai-subtitles-0.1.1.zip",
|
||||
"sha256": "5ddf71a1035a8cebb21e813514aa33c54c174a54ef3d540f155df9497416373b"
|
||||
},
|
||||
{
|
||||
"id": "anime-providers",
|
||||
"name": "Anime Providers",
|
||||
"description": "Kaizoku provider adapters for Anikoto, AnimePahe, and legacy AniNeko.",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-anime-providers-0.1.0.zip",
|
||||
"sha256": "d1dc26946842ed7bf8e50b7b939599fecc68b6109a7e93f6b8bd32e2101c0e6f"
|
||||
"archive": "archives/plugin-anime-providers-0.1.1.zip",
|
||||
"sha256": "d68263513cfd5c45353259e3a78a56101a7810b22a50dcaa997641832ad8aed2"
|
||||
},
|
||||
{
|
||||
"id": "anime-search",
|
||||
"name": "Anime Search",
|
||||
"description": "Anime discovery and episode metadata using a selectable anime provider plugin.",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"anime-providers"
|
||||
],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-anime-search-0.1.0.zip",
|
||||
"sha256": "0731011419e6c8fb8679a41d6198b9ba3ea859afb2a04c921cc2650fddfa081a"
|
||||
"archive": "archives/plugin-anime-search-0.1.1.zip",
|
||||
"sha256": "1baa7d3dd4fb6e19903b5633ca3a2422b31128f79d8f093c0dc5378d088848bf"
|
||||
},
|
||||
{
|
||||
"id": "bookmarks",
|
||||
"name": "Bookmarks",
|
||||
"description": "A shared collection of useful links.",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"dependencies": [],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-bookmarks-0.2.0.zip",
|
||||
"sha256": "57d8f8c4407a34722b25c0777844b043485d528eaefaa80ccf1449f2c20385ba"
|
||||
"archive": "archives/plugin-bookmarks-0.2.1.zip",
|
||||
"sha256": "f66149d38dd036a02560925950acb1763038f9e6c377e5539ef5af39e3398e31"
|
||||
},
|
||||
{
|
||||
"id": "discord-notifications",
|
||||
"name": "Discord Notifications",
|
||||
"description": "Queued Discord webhook notifications with event filtering and mention suppression.",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-discord-notifications-0.1.0.zip",
|
||||
"sha256": "1920f863fa32ca2533b2f1775adabd2243d7264def5c493a58ff2ec11acca5c1"
|
||||
"archive": "archives/plugin-discord-notifications-0.1.1.zip",
|
||||
"sha256": "391f7761ddab1360c98cff3fe27afc743ce01ccaa571ca5a7d7b25de12c00a4f"
|
||||
},
|
||||
{
|
||||
"id": "media-handoff",
|
||||
"name": "Media Handoff",
|
||||
"description": "Verified per-season media transfer with selectable watchlist, subtitle, and notification integrations.",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-media-handoff-0.1.0.zip",
|
||||
"sha256": "37e86e9c8121b450fb8a2f4566ae41e7479f26082dba0b2f79e25fd0da42f1cc"
|
||||
"archive": "archives/plugin-media-handoff-0.1.1.zip",
|
||||
"sha256": "8615dcc57c7af07f1b64ed664410a16911ca148e323f509717ecabcde4b9f932"
|
||||
},
|
||||
{
|
||||
"id": "notes",
|
||||
"name": "Notes",
|
||||
"description": "Shared notes with persistent content.",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"dependencies": [],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-notes-0.2.0.zip",
|
||||
"sha256": "5e2e37c1b81aea62c58c79c8f0280a82e2208c08a6066223a430ed443192f507"
|
||||
"archive": "archives/plugin-notes-0.2.1.zip",
|
||||
"sha256": "43f81e0605c03c48e8f085e7cd0064e152a3f37b8144e4301fa6d0d0ad6094de"
|
||||
},
|
||||
{
|
||||
"id": "queues",
|
||||
"name": "Queue",
|
||||
"description": "Persistent shared job queue with progress, logs, and an internal plugin connector.",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"dependencies": [],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-queues-0.1.0.zip",
|
||||
"sha256": "975ed9e778d4355231166ce20e7ec6770592517a0fba7b05d39a59a5df868f95"
|
||||
"archive": "archives/plugin-queues-0.1.1.zip",
|
||||
"sha256": "3dfde5178b31bd6d62ffa7e2a0331b0e21090b5fbc5ea2c9f87f7e56c3791199"
|
||||
},
|
||||
{
|
||||
"id": "status",
|
||||
"name": "Workspace status",
|
||||
"description": "Local uptime and configured integration counts. No external polling.",
|
||||
"version": "0.2.0",
|
||||
"version": "0.2.1",
|
||||
"dependencies": [],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-status-0.2.0.zip",
|
||||
"sha256": "36ea5a836209a2188a7d5394cac13cfc0feaaa665d6bb50b7e9ec7236bff6bec"
|
||||
"archive": "archives/plugin-status-0.2.1.zip",
|
||||
"sha256": "1e29d46be88cac69c48c1f48fa43d590efbaa0e639d6adb80078d225116e4bc8"
|
||||
},
|
||||
{
|
||||
"id": "thumbnails",
|
||||
"name": "Thumbnails",
|
||||
"description": "Queued anime poster lookup and an authenticated local image cache.",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-thumbnails-0.1.0.zip",
|
||||
"sha256": "16bde555accfc147c623efaf8c92b301a42dbf046cbf9d10baef75d1af42db53"
|
||||
"archive": "archives/plugin-thumbnails-0.1.1.zip",
|
||||
"sha256": "2483a5caa5da3927c8b76d9c916f2b5a8dd620286e4664f2527233780cb1c920"
|
||||
},
|
||||
{
|
||||
"id": "watchlist",
|
||||
"name": "Watchlist",
|
||||
"description": "General watchlists with integrated scheduling and selectable search, thumbnail, handoff, and notification services.",
|
||||
"version": "0.1.0",
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
],
|
||||
"type": "plugin",
|
||||
"archive": "archives/plugin-watchlist-0.1.0.zip",
|
||||
"sha256": "c9eb70b65f2eaac82e3782b10b0c7bfc14e00ec88d7dd2df0379775104b4bfc3"
|
||||
"archive": "archives/plugin-watchlist-0.1.1.zip",
|
||||
"sha256": "b78f943531484d00e883f16b8511f50534ef4489f0a11e717ac21ef15cb70a21"
|
||||
},
|
||||
{
|
||||
"id": "default",
|
||||
|
||||
@@ -69,3 +69,12 @@ Availability check on 2026-10-29: Anikoto search returned 26 results for the tes
|
||||
|
||||
|
||||
Framework 0.9.1+ opens **Settings for <plugin>** in a floating settings window. Integration selectors and Save keep their existing behavior. Long forms scroll internally; Cancel, ×, Escape or the backdrop close the window and discard unsaved edits.
|
||||
|
||||
|
||||
## Catalog dependencies (resource release 0.5.0)
|
||||
|
||||
Every plugin manifest and generated catalog entry now contains `dependencies`, an array of default required plugin IDs. Watchlist, Thumbnails, Media Handoff, AI Subtitles and Discord Notifications require `queues`; Anime Search requires `anime-providers`. Queue, Anime Providers and the three starter plugins declare `[]`. Optional Watchlist/search/thumbnail/handoff/notification integrations remain selections in settings and are not automatically installed.
|
||||
|
||||
Framework 0.10.0+ displays these requirements in a floating window before installation. Install adds all missing direct/transitive packages; Ignore installs just the selected plugin; Cancel installs nothing. Installed packages are retained and any missing dependencies of those packages are included. Restart to load newly installed code, then configure and enable providers before consumers. Earlier frameworks still install the same compatible packages but do not offer dependency groups.
|
||||
|
||||
The catalog builder validates unique slug IDs, existing local dependency targets and absence of cycles before writing the catalog. Tests compare metadata dependencies with every plugin's static requirements and mandatory service defaults, and verify runtime/manifest/archive versions match. Package metadata changes ship as new patch versions (0.1.1 for Queue/media providers; 0.2.1 for starters). Existing archives remain unchanged; changed published source must receive a new version.
|
||||
+6
-2
@@ -7,9 +7,9 @@ Open **Config → Add resources**, search, and install a plugin or theme. Restar
|
||||
|
||||
## Folder layout
|
||||
|
||||
Every resource has its own source folder: `plugins/<id>/` or `themes/<id>/`. Plugin v0.2.0 packages include `plugin.py`, `implementation.py`, `plugin.json`, README, and their page/widget templates. They depend on public framework APIs and the common shell, rather than on the shared starter implementation. Theme folders contain `theme.json` and any accompanying files; the bundled themes are presets using the framework design system.
|
||||
Every resource has its own source folder: `plugins/<id>/` or `themes/<id>/`. Starter plugin packages include `plugin.py`, `implementation.py`, `plugin.json`, README, and their page/widget templates. They depend on public framework APIs and the common shell, rather than on the shared starter implementation. Theme folders contain `theme.json` and any accompanying files; the bundled themes are presets using the framework design system.
|
||||
|
||||
Every JSON manifest declares `id`, `name`, `description`, and `version`. Themes also declare `mode` (`dark`, `light`, `system`), `accent` (`violet`, `blue`, `green`), and `density` (`comfortable`, `compact`). Versioned ZIP archives contain the entire resource with files at the archive root. Catalog entries record type, metadata, relative archive path and SHA-256.
|
||||
Every JSON manifest declares `id`, `name`, `description`, and `version`. Plugin manifests also declare `dependencies`, an array of required default provider IDs (or `[]`). The catalog copies this field unchanged into each plugin entry. Themes also declare `mode` (`dark`, `light`, `system`), `accent` (`violet`, `blue`, `green`), and `density` (`comfortable`, `compact`). Versioned ZIP archives contain the entire resource with files at the archive root. Catalog entries record type, metadata, relative archive path and SHA-256.
|
||||
|
||||
## Persistence and updates
|
||||
|
||||
@@ -41,3 +41,7 @@ Config → About lists installed plugins and themes with their versions. It incl
|
||||
## Modular media resources in 0.4.0
|
||||
|
||||
The catalog includes Watchlist, Thumbnails, Anime Search, Anime Providers, Media Handoff, AI Subtitles and Discord Notifications. Each declares `framework_version >=0.9.0` and implements a documented replaceable capability. Upgrade the framework before installing them. See [setup and contracts](media-suite.md). Provider archives include full source, upstream GPL license and attribution; local Node dependencies are excluded from archives and supplied by the image or source setup.
|
||||
|
||||
Framework 0.10.0+ previews dependencies in a floating window: **Install** adds all missing requirements, **Ignore** installs the selected plugin, and Cancel installs nothing. Existing dependencies are kept. The builder rejects invalid or missing dependency IDs, cycles, and changed contents under a previously published version. See [media dependency mapping](media-suite.md) for the current packages and required providers.
|
||||
|
||||
`tools.build_catalog.build(root)` validates metadata and the complete local plugin graph before building archives. Required IDs must exist in this catalog and cycles fail publication. Unchanged versioned archives retain their exact bytes, changed published contents require a version bump, and previous archives remain available. Tests compare declared dependencies with runtime requirements and mandatory service defaults, and verify manifest, catalog, archive and runtime versions.
|
||||
@@ -2,6 +2,9 @@
|
||||
"id": "ai-subtitles",
|
||||
"name": "AI Subtitles",
|
||||
"description": "Queued SRT/VTT translation with preserved timestamps and formatting using Ollama or OpenAI.",
|
||||
"version": "0.1.0",
|
||||
"framework_version": ">=0.9.0"
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
]
|
||||
}
|
||||
@@ -217,7 +217,7 @@ def download(identifier):
|
||||
return send_file(path, as_attachment=True)
|
||||
|
||||
|
||||
plugin = Plugin('ai-subtitles', 'AI Subtitles', description='General-language subtitle translation that preserves timings and original files.', blueprint=bp,
|
||||
plugin = Plugin('ai-subtitles', 'AI Subtitles', version='0.1.1', description='General-language subtitle translation that preserves timings and original files.', blueprint=bp,
|
||||
endpoint='plugin_ai_subtitles.index', services={'subtitles': Subtitles}, workers={'translate': lambda: run_one(service())}, settings_schema={
|
||||
'queue': QUEUE_SETTING, 'root': Setting('Subtitle library root', required=True),
|
||||
'backend': Setting('AI backend', kind='choice', choices=('ollama', 'openai'), default='ollama'),
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
"id": "anime-providers",
|
||||
"name": "Anime Providers",
|
||||
"description": "Kaizoku provider adapters for Anikoto, AnimePahe, and legacy AniNeko.",
|
||||
"version": "0.1.0",
|
||||
"framework_version": ">=0.9.0"
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": []
|
||||
}
|
||||
@@ -37,5 +37,5 @@ def index():
|
||||
return render_template('anime-providers/index.html', title='Anime Providers')
|
||||
|
||||
|
||||
plugin = Plugin('anime-providers', 'Anime Providers', description='Kaizoku anime provider adapters with a replaceable internal API.', blueprint=bp,
|
||||
plugin = Plugin('anime-providers', 'Anime Providers', version='0.1.1', description='Kaizoku anime provider adapters with a replaceable internal API.', blueprint=bp,
|
||||
endpoint='plugin_anime_providers.index', services={'anime-provider': Providers})
|
||||
@@ -2,6 +2,9 @@
|
||||
"id": "anime-search",
|
||||
"name": "Anime Search",
|
||||
"description": "Anime discovery and episode metadata using a selectable anime provider plugin.",
|
||||
"version": "0.1.0",
|
||||
"framework_version": ">=0.9.0"
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"anime-providers"
|
||||
]
|
||||
}
|
||||
@@ -63,7 +63,7 @@ def add_watchlist():
|
||||
return redirect(url_for('plugin_anime_search.index', q=request.form.get('q', '')[:200]))
|
||||
|
||||
|
||||
plugin = Plugin('anime-search', 'Anime Search', description='Search anime and read episode metadata through selectable provider plugins.', blueprint=bp,
|
||||
plugin = Plugin('anime-search', 'Anime Search', version='0.1.1', description='Search anime and read episode metadata through selectable provider plugins.', blueprint=bp,
|
||||
endpoint='plugin_anime_search.index', services={'anime-search': Search}, settings_schema={
|
||||
'provider': Setting('Anime provider plugin', kind='service', service='anime-provider', default='anime-providers', required=True),
|
||||
'backend': Setting('Anime provider', kind='choice', choices=('anikoto', 'pahe', 'anineko'), default='anikoto'),
|
||||
|
||||
@@ -35,7 +35,7 @@ def make_collection(plugin_id, name, kind="notes"):
|
||||
return redirect(url_for(blueprint.name + ".index"))
|
||||
return render_template(f"{plugin_id}/collection.html", title=name, collection=plugin_id, kind=kind, items=store().items(plugin_id), description=current_app.extensions["plugins"].configuration(plugin_id)["intro"])
|
||||
|
||||
return Plugin(plugin_id, name, version="0.2.0", settings_schema={"intro": Setting("Page introduction", default="A shared collection for your workspace.")}, description="Shared notes with persistent content." if kind == "notes" else "A shared collection of useful links.", blueprint=blueprint, endpoint=blueprint.name + ".index",
|
||||
return Plugin(plugin_id, name, version="0.2.1", settings_schema={"intro": Setting("Page introduction", default="A shared collection for your workspace.")}, description="Shared notes with persistent content." if kind == "notes" else "A shared collection of useful links.", blueprint=blueprint, endpoint=blueprint.name + ".index",
|
||||
widgets={"summary": Widget(f"{plugin_id}/collection_summary.html", context=lambda config: {"items": store().items(plugin_id)[:5], "kind": kind, "endpoint": blueprint.name + ".index"})})
|
||||
|
||||
def make_bookmarks(plugin_id="bookmarks", name="Bookmarks"):
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
"id": "bookmarks",
|
||||
"name": "Bookmarks",
|
||||
"description": "A shared collection of useful links.",
|
||||
"version": "0.2.0"
|
||||
"version": "0.2.1",
|
||||
"dependencies": []
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
"id": "discord-notifications",
|
||||
"name": "Discord Notifications",
|
||||
"description": "Queued Discord webhook notifications with event filtering and mention suppression.",
|
||||
"version": "0.1.0",
|
||||
"framework_version": ">=0.9.0"
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
]
|
||||
}
|
||||
@@ -68,7 +68,7 @@ def test_notification():
|
||||
return redirect(url_for('plugin_discord_notifications.index'))
|
||||
|
||||
|
||||
plugin = Plugin('discord-notifications', 'Discord Notifications', description='Queued webhook notifications with event filtering and no automatic mentions.', blueprint=bp,
|
||||
plugin = Plugin('discord-notifications', 'Discord Notifications', version='0.1.1', description='Queued webhook notifications with event filtering and no automatic mentions.', blueprint=bp,
|
||||
endpoint='plugin_discord_notifications.index', hooks={'validate_settings': lambda values: webhook_url(values['webhook'])}, services={'notify': Notifications}, workers={'deliver': lambda: run_one(service())}, settings_schema={
|
||||
'queue': QUEUE_SETTING,
|
||||
'webhook': Setting('Discord webhook URL', kind='secret', required=True),
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
"id": "media-handoff",
|
||||
"name": "Media Handoff",
|
||||
"description": "Verified per-season media transfer with selectable watchlist, subtitle, and notification integrations.",
|
||||
"version": "0.1.0",
|
||||
"framework_version": ">=0.9.0"
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
]
|
||||
}
|
||||
@@ -178,7 +178,7 @@ def submit():
|
||||
return redirect(url_for('plugin_media_handoff.index'))
|
||||
|
||||
|
||||
plugin = Plugin('media-handoff', 'Media Handoff', description='Verified per-season copy/move to a media library without overwriting files.', blueprint=bp,
|
||||
plugin = Plugin('media-handoff', 'Media Handoff', version='0.1.1', description='Verified per-season copy/move to a media library without overwriting files.', blueprint=bp,
|
||||
endpoint='plugin_media_handoff.index', services={'media-handoff': Handoff}, workers={'transfer': lambda: run_one(service())}, settings_schema={
|
||||
'queue': QUEUE_SETTING,
|
||||
'source-root': Setting('Source media root', required=True), 'target-root': Setting('Target library root', required=True),
|
||||
|
||||
@@ -35,7 +35,7 @@ def make_collection(plugin_id, name, kind="notes"):
|
||||
return redirect(url_for(blueprint.name + ".index"))
|
||||
return render_template(f"{plugin_id}/collection.html", title=name, collection=plugin_id, kind=kind, items=store().items(plugin_id), description=current_app.extensions["plugins"].configuration(plugin_id)["intro"])
|
||||
|
||||
return Plugin(plugin_id, name, version="0.2.0", settings_schema={"intro": Setting("Page introduction", default="A shared collection for your workspace.")}, description="Shared notes with persistent content." if kind == "notes" else "A shared collection of useful links.", blueprint=blueprint, endpoint=blueprint.name + ".index",
|
||||
return Plugin(plugin_id, name, version="0.2.1", settings_schema={"intro": Setting("Page introduction", default="A shared collection for your workspace.")}, description="Shared notes with persistent content." if kind == "notes" else "A shared collection of useful links.", blueprint=blueprint, endpoint=blueprint.name + ".index",
|
||||
widgets={"summary": Widget(f"{plugin_id}/collection_summary.html", context=lambda config: {"items": store().items(plugin_id)[:5], "kind": kind, "endpoint": blueprint.name + ".index"})})
|
||||
|
||||
def make_notes(plugin_id="notes", name="Notes"):
|
||||
|
||||
@@ -2,5 +2,6 @@
|
||||
"id": "notes",
|
||||
"name": "Notes",
|
||||
"description": "Shared notes with persistent content.",
|
||||
"version": "0.2.0"
|
||||
"version": "0.2.1",
|
||||
"dependencies": []
|
||||
}
|
||||
@@ -2,5 +2,6 @@
|
||||
"id": "queues",
|
||||
"name": "Queue",
|
||||
"description": "Persistent shared job queue with progress, logs, and an internal plugin connector.",
|
||||
"version": "0.1.0"
|
||||
"version": "0.1.1",
|
||||
"dependencies": []
|
||||
}
|
||||
@@ -61,7 +61,7 @@ def action(job_id, action):
|
||||
|
||||
|
||||
plugin = Plugin(
|
||||
'queues', 'Queue', version='0.1.0',
|
||||
'queues', 'Queue', version='0.1.1',
|
||||
description='Persistent shared job queue with progress, logs, and an internal plugin connector.',
|
||||
blueprint=bp, endpoint='plugin_queues.index',
|
||||
services={'queue': lambda: Queue(current_app._get_current_object())},
|
||||
|
||||
@@ -15,4 +15,4 @@ def make_status(plugin_id="status", name="Workspace status"):
|
||||
@blueprint.get("/")
|
||||
def index():
|
||||
return render_template(f"{plugin_id}/status.html", title=name, status=status())
|
||||
return Plugin(plugin_id, name, version="0.2.0", description="Local uptime and configured integration counts. No external polling.", blueprint=blueprint, endpoint=blueprint.name + ".index", widgets={"summary": Widget(f"{plugin_id}/status_summary.html", context=status)})
|
||||
return Plugin(plugin_id, name, version="0.2.1", description="Local uptime and configured integration counts. No external polling.", blueprint=blueprint, endpoint=blueprint.name + ".index", widgets={"summary": Widget(f"{plugin_id}/status_summary.html", context=status)})
|
||||
@@ -2,5 +2,6 @@
|
||||
"id": "status",
|
||||
"name": "Workspace status",
|
||||
"description": "Local uptime and configured integration counts. No external polling.",
|
||||
"version": "0.2.0"
|
||||
"version": "0.2.1",
|
||||
"dependencies": []
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
"id": "thumbnails",
|
||||
"name": "Thumbnails",
|
||||
"description": "Queued anime poster lookup and an authenticated local image cache.",
|
||||
"version": "0.1.0",
|
||||
"framework_version": ">=0.9.0"
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
]
|
||||
}
|
||||
@@ -134,7 +134,7 @@ def image(key):
|
||||
return send_file(path, mimetype=entry['mime'])
|
||||
|
||||
|
||||
plugin = Plugin('thumbnails', 'Thumbnails', description='Anime poster lookup and an authenticated persistent image cache.', blueprint=bp,
|
||||
plugin = Plugin('thumbnails', 'Thumbnails', version='0.1.1', description='Anime poster lookup and an authenticated persistent image cache.', blueprint=bp,
|
||||
endpoint='plugin_thumbnails.index', services={'thumbnails': Thumbnails}, workers={'download': lambda: run_one(service())}, settings_schema={
|
||||
'queue': QUEUE_SETTING,
|
||||
'source': Setting('Thumbnail source', kind='choice', choices=('animeschedule', 'provider-url'), default='animeschedule'),
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
"id": "watchlist",
|
||||
"name": "Watchlist",
|
||||
"description": "General watchlists with integrated scheduling and selectable search, thumbnail, handoff, and notification services.",
|
||||
"version": "0.1.0",
|
||||
"framework_version": ">=0.9.0"
|
||||
"version": "0.1.1",
|
||||
"framework_version": ">=0.9.0",
|
||||
"dependencies": [
|
||||
"queues"
|
||||
]
|
||||
}
|
||||
@@ -208,7 +208,7 @@ def mutate():
|
||||
return redirect(url_for('plugin_watchlist.index'))
|
||||
|
||||
|
||||
plugin = Plugin('watchlist', 'Watchlist', description='Watchlists and scheduled refreshes with selectable integrations.', blueprint=bp,
|
||||
plugin = Plugin('watchlist', 'Watchlist', version='0.1.1', description='Watchlists and scheduled refreshes with selectable integrations.', blueprint=bp,
|
||||
endpoint='plugin_watchlist.index', hooks={'validate_settings': validate_settings}, services={'watchlist': Watchlist}, workers={'jobs': lambda: run_one(service()), 'scheduler': lambda: service().run_due()}, settings_schema={
|
||||
'queue': QUEUE_SETTING,
|
||||
'search': Setting('Search plugin', kind='service', service='anime-search'),
|
||||
|
||||
@@ -3,6 +3,7 @@ import importlib.util
|
||||
import json
|
||||
from pathlib import Path
|
||||
import zipfile
|
||||
import pytest
|
||||
|
||||
spec = importlib.util.spec_from_file_location('resource_catalog', Path(__file__).resolve().parents[1] / 'tools/build_catalog.py')
|
||||
builder = importlib.util.module_from_spec(spec)
|
||||
@@ -48,3 +49,56 @@ def test_builder_preserves_published_bytes_and_previous_versions(tmp_path):
|
||||
assert published.read_bytes() == original
|
||||
assert older.read_bytes() == b'previous published version'
|
||||
assert entries[0]['sha256'] == hashlib.sha256(original).hexdigest()
|
||||
|
||||
|
||||
def test_builder_rejects_missing_dependencies_before_publishing(tmp_path):
|
||||
directory = source(tmp_path)
|
||||
manifest = directory / 'plugin.json'
|
||||
manifest.write_text(json.dumps({**json.loads(manifest.read_text()), 'dependencies': ['missing']}))
|
||||
with pytest.raises(ValueError, match='Unknown plugin dependency'):
|
||||
builder.build(tmp_path)
|
||||
assert not (tmp_path / 'archives').exists()
|
||||
assert not (tmp_path / 'catalog.json').exists()
|
||||
|
||||
|
||||
def test_builder_rejects_cycles(tmp_path):
|
||||
directory = source(tmp_path)
|
||||
manifest = directory / 'plugin.json'
|
||||
info = json.loads(manifest.read_text())
|
||||
manifest.write_text(json.dumps({**info, 'dependencies': ['second']}))
|
||||
other = tmp_path / 'plugins/second'
|
||||
other.mkdir()
|
||||
(other / 'plugin.json').write_text(json.dumps({**info, 'id': 'second', 'dependencies': ['example']}))
|
||||
with pytest.raises(ValueError, match='Dependency cycle'):
|
||||
builder.build(tmp_path)
|
||||
|
||||
|
||||
def test_builder_requires_version_bump_for_changed_published_source(tmp_path):
|
||||
directory = source(tmp_path)
|
||||
entries = builder.build(tmp_path)
|
||||
archive = tmp_path / entries[0]['archive']
|
||||
before = archive.read_bytes()
|
||||
(directory / 'plugin.py').write_text('# updated source\n')
|
||||
with pytest.raises(ValueError, match='bump the resource version'):
|
||||
builder.build(tmp_path)
|
||||
assert archive.read_bytes() == before
|
||||
|
||||
|
||||
def test_real_catalog_dependencies_match_runtime_contracts_versions_and_archives():
|
||||
from web_framework.plugins import discover
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
plugins = {plugin.id: plugin for plugin in discover(root / 'plugins')}
|
||||
for entry in json.loads((root / 'catalog.json').read_text())['resources']:
|
||||
if entry['type'] != 'plugin':
|
||||
continue
|
||||
plugin = plugins[entry['id']]
|
||||
expected = set(plugin.requires)
|
||||
expected.update(setting.default for setting in plugin.settings_schema.values()
|
||||
if setting.kind == 'service' and setting.required and setting.default)
|
||||
assert set(entry['dependencies']) == expected, entry['id']
|
||||
assert plugin.version == entry['version'], entry['id']
|
||||
assert expected <= plugins.keys()
|
||||
source_info = json.loads((root / 'plugins' / entry['id'] / 'plugin.json').read_text())
|
||||
assert source_info['dependencies'] == entry['dependencies']
|
||||
with zipfile.ZipFile(root / entry['archive']) as archive:
|
||||
assert json.loads(archive.read('plugin.json')) == source_info
|
||||
+55
-25
@@ -1,40 +1,70 @@
|
||||
"""Build reproducible archives and catalog entries for every source resource."""
|
||||
import hashlib
|
||||
import json
|
||||
import re
|
||||
from pathlib import Path
|
||||
import zipfile
|
||||
|
||||
|
||||
def build(root):
|
||||
root = Path(root)
|
||||
archives = root / 'archives'
|
||||
archives.mkdir(exist_ok=True)
|
||||
entries = []
|
||||
sources = []
|
||||
for kind in ('plugin', 'theme'):
|
||||
for directory in sorted((root / (kind + 's')).iterdir()):
|
||||
manifest = directory / (kind + '.json')
|
||||
if not manifest.is_file():
|
||||
continue
|
||||
info = json.loads(manifest.read_text())
|
||||
archive = archives / f"{kind}-{info['id']}-{info['version']}.zip"
|
||||
files = {}
|
||||
for path in sorted(directory.rglob('*')):
|
||||
relative = path.relative_to(directory)
|
||||
if path.is_file() and not {'__pycache__', 'tests', '.pytest_cache', 'node_modules', '.git', '.venv'}.intersection(relative.parts) and path.suffix != '.pyc':
|
||||
files[relative.as_posix()] = path.read_bytes()
|
||||
same = False
|
||||
if archive.exists():
|
||||
with zipfile.ZipFile(archive) as existing:
|
||||
same = {name: existing.read(name) for name in existing.namelist()} == files
|
||||
# Retain exact published bytes and checksums for unchanged versions.
|
||||
if not same:
|
||||
with zipfile.ZipFile(archive, 'w', zipfile.ZIP_DEFLATED) as output:
|
||||
for name, content in files.items():
|
||||
item = zipfile.ZipInfo(name)
|
||||
item.compress_type = zipfile.ZIP_DEFLATED
|
||||
item.external_attr = 0o100644 << 16
|
||||
output.writestr(item, content)
|
||||
entries.append({**info, 'type': kind, 'archive': archive.relative_to(root).as_posix(), 'sha256': hashlib.sha256(archive.read_bytes()).hexdigest()})
|
||||
if manifest.is_file():
|
||||
info = json.loads(manifest.read_text())
|
||||
dependencies = info.get('dependencies', [])
|
||||
if (info.get('id') != directory.name or not re.fullmatch(r'[a-z][a-z0-9-]*', directory.name)
|
||||
or any(not isinstance(info.get(key), str) or not info[key].strip() for key in ('name', 'description', 'version'))):
|
||||
raise ValueError(f'Invalid resource metadata: {manifest}')
|
||||
if (not isinstance(dependencies, list) or len(dependencies) > 100
|
||||
or any(not isinstance(key, str) or not re.fullmatch(r'[a-z][a-z0-9-]*', key) for key in dependencies)
|
||||
or len(set(dependencies)) != len(dependencies) or info['id'] in dependencies):
|
||||
raise ValueError(f'Invalid dependencies: {manifest}')
|
||||
sources.append((kind, directory, info))
|
||||
plugins = {info['id']: info for kind, _, info in sources if kind == 'plugin'}
|
||||
visiting, done = set(), set()
|
||||
def visit(key):
|
||||
if key not in plugins:
|
||||
raise ValueError(f'Unknown plugin dependency: {key}')
|
||||
if key in visiting:
|
||||
raise ValueError(f'Dependency cycle: {key}')
|
||||
if key in done:
|
||||
return
|
||||
visiting.add(key)
|
||||
for dependency in plugins[key].get('dependencies', []):
|
||||
visit(dependency)
|
||||
visiting.remove(key)
|
||||
done.add(key)
|
||||
for _, _, info in sources:
|
||||
for dependency in info.get('dependencies', []):
|
||||
visit(dependency)
|
||||
archives = root / 'archives'
|
||||
archives.mkdir(exist_ok=True)
|
||||
entries = []
|
||||
for kind, directory, info in sources:
|
||||
archive = archives / f"{kind}-{info['id']}-{info['version']}.zip"
|
||||
files = {}
|
||||
for path in sorted(directory.rglob('*')):
|
||||
relative = path.relative_to(directory)
|
||||
if path.is_file() and not {'__pycache__', 'tests', '.pytest_cache', 'node_modules', '.git', '.venv'}.intersection(relative.parts) and path.suffix != '.pyc':
|
||||
files[relative.as_posix()] = path.read_bytes()
|
||||
same = False
|
||||
if archive.exists():
|
||||
with zipfile.ZipFile(archive) as existing:
|
||||
same = {name: existing.read(name) for name in existing.namelist()} == files
|
||||
if archive.exists() and not same:
|
||||
raise ValueError(f'Published archive differs from source; bump the resource version: {archive.name}')
|
||||
# Retain exact published bytes and checksums for unchanged versions.
|
||||
if not same:
|
||||
with zipfile.ZipFile(archive, 'w', zipfile.ZIP_DEFLATED) as output:
|
||||
for name, content in files.items():
|
||||
item = zipfile.ZipInfo(name)
|
||||
item.compress_type = zipfile.ZIP_DEFLATED
|
||||
item.external_attr = 0o100644 << 16
|
||||
output.writestr(item, content)
|
||||
entries.append({**info, 'type': kind, 'archive': archive.relative_to(root).as_posix(), 'sha256': hashlib.sha256(archive.read_bytes()).hexdigest()})
|
||||
(root / 'catalog.json').write_text(json.dumps({'schema_version': 1, 'resources': entries}, indent=2) + '\n')
|
||||
return entries
|
||||
|
||||
|
||||
Reference in new issue
Block a user