Packaging contract
MikuTV discovers repositories tagged mikutv-plugin and installs only plugin.zip from non-draft GitHub Releases. Unknown manifest fields fail decoding immediately.
| Rule | Requirement |
|---|---|
topic | mikutv-plugin (plus mikutv-theme or mikutv-locale) |
asset | Release asset named plugin.zip, up to 8 MiB |
tag | Must match v<version> against plugin.json version |
root | plugin.json at archive root, no wrapping directory, no symlinks |
sha256 | Pinned by SHA-256 and repo ownership; updates cannot switch kind |
Content sources
Source plugins declare kind: "source" with an ES module entry executed inside moejs. Every outbound host belongs in permissions.network; self-hosted servers may declare credentials and serverURL: "required" for single-origin LAN access.
{
"id": "example-source",
"name": "Example Source",
"kind": "source",
"version": "1.0.0",
"apiVersion": 1,
"minAppVersion": "0.1.0",
"license": "Apache-2.0",
"main": "index.js",
"permissions": { "network": ["api.example.com"] },
"capabilities": ["catalog.browse", "catalog.item", "playback.resolve"]
}Sandbox host API
Inside moejs, plugins have standard ES syntax, allowlist-enforced fetch, and globalThis.host:
host.storage.get / set / delete | Per-plugin persistent KV store, 8 KiB total quota |
host.locale.current() | Active normalized BCP-47 language tag (zh-Hans, en, ja) |
host.crypto.sha256 / encryptRSAOAEP | Hex SHA-256 and RSA-OAEP-SHA256 helpers |
host.compress.inflateZlib(bytes) | Zlib inflate capped at 4 MiB output |
Capabilities
Every declared capability requires its named export(s) in main. Missing exports fail package open.
| Capability | Exports | Requires |
|---|---|---|
catalog.browse | browse | — |
catalog.item | getItem | — |
catalog.search | search | — |
catalog.searchSuggest | searchSuggest | catalog.search |
catalog.series | readSeries | — |
catalog.live | readLive | — |
catalog.creator | readCreator | — |
catalog.videoComments | videoComments | — |
catalog.following | readFollowing | account.signIn |
catalog.library | readAccount | account.signIn |
playback.resolve | resolvePlayback | — |
playback.progress | reportPlayback | account.signIn |
playback.danmaku | readDanmaku | — |
playback.subtitles | readSubtitles | — |
live.chat | connectLiveChat | — |
live.chatWrite | sendLiveChat | live.chat + account.signIn |
account.signIn | restoreAccount, signOut, beginSignIn/pollSignIn or signInWithCredentials | authentication.methods |
account.videoInteraction | editVideo | account.signIn |
account.videoFavorites | videoFavoriteFolders, editVideoFavoriteFolders | account.signIn |
account.danmaku | postDanmaku | account.signIn |
account.danmakuRules | readDanmakuRules, addDanmakuRule, removeDanmakuRule | account.signIn |
account.followCreator | followCreator | account.signIn |
account.trackSeries | trackSeries | — |
account.history / watchLater / favorites / tracking / courses / notifications | readAccount | account.signIn |
account.editFavoriteFolders | editFavoriteFolder | account.favorites |
account.editHistory / editWatchLater / editTracking | removeAccountItems | matching read capability |
account.privateMessages | readPrivateConversations, readPrivateMessages | account.signIn |
account.writePrivateMessages | sendPrivateMessage, markPrivateMessagesRead | account.privateMessages |
Themes
Themes run no JavaScript — only plugin.json and theme.json (≤ 64 KiB) overriding 46 semantic tokens. Contrast ratios (4.5:1 text, 3.0:1 focus ring) are checked on open.
{
"schemaVersion": 1,
"base": "mikutv-dark",
"appearance": "dark",
"colors": {
"surface": {
"canvas": "#16161E",
"sidebar": "#13131A",
"panel": "#1A1B26"
},
"accent": {
"primary": "#7AA2F7",
"soft": "#89B4FA"
}
}
}Language packs
Language packs are pure JSON (locale.json ≤ 256 KiB) mirroring internal/ui/assets/labels.en.json; omitted keys fall back to English. Reference: yuchanns/mikutv-locale-ja.
{
"id": "mikutv-locale-ja",
"name": "Japanese (日本語)",
"kind": "locale",
"version": "1.0.0",
"apiVersion": 1,
"minAppVersion": "0.1.0",
"license": "Apache-2.0",
"language": "ja",
"nativeName": "日本語",
"locale": "locale.json"
}Verify & publish
zip -r -X plugin.zip plugin.json LICENSE index.js
# Validate via internal/plugin:
# InspectPackage / Open / OpenTheme / OpenLocale
# Tag v1.0.0 -> GitHub Release -> attach plugin.zip
# Add repository topic: mikutv-plugin