Development¶
Bug reports and feature ideas go to the issues, and code
changes as a pull request against master. If a website doesn't play on Kodi, the cause is usually in the
Kodi add-on (yt-dlp), not in this extension.
Tech stack¶
TypeScript · Solid.js · Vite with CRXJS · Tailwind CSS v4 · Biome · Vitest
The UI follows the shadcn/ui look: the design tokens live in src/index.css, the primitives
(Button, Input, Switch, Alert, …) in src/components/ui.tsx, and the icons are from Lucide.
Setup¶
Requirements: Bun (the version in packageManager in package.json; CI uses the same).
git clone https://github.com/firsttris/chrome.sendtokodi.git
cd chrome.sendtokodi
bun install
# Development build with hot reload
bun run start
bun run start:firefox # Firefox variant
# Production builds into dist/
bun run build
bun run build:firefox
Load the extension¶
- Open
chrome://extensions/(edge://extensions/in Edge). - Turn on Developer mode (top right).
- Click Load unpacked and pick the
distfolder.
- Open
about:debugging. - Click This Firefox → Load Temporary Add-on….
- Pick
dist/manifest.json.
During bun run start the extension reloads automatically when you change code. A temporary add-on in Firefox is
removed when the browser closes; load it again next time.
Checks and tests¶
bun run check # lint & format (Biome)
bun run format # apply Biome's formatting
bun run typecheck # tsc
bun run test # Vitest
CI runs the same checks, both builds and web-ext lint on the Firefox build for every pull request (see
Releases). The unit tests cover the JSON-RPC client (src/lib/kodi.test.ts)
and the connection handling (src/lib/connections.test.ts); add tests next to the code you change.
Project structure¶
| Path | Contents |
|---|---|
manifest.json |
The extension manifest (Manifest V3). The version comes from package.json at build time; vite.config.ts adapts it for Firefox. |
popup.html, options.html |
The two HTML entry points |
src/popup.tsx, src/options.tsx, src/renderApp.tsx |
Mount the popup and the settings page with the providers |
src/background.ts |
Service worker (event page in Firefox): context menu, keyboard shortcuts, badge |
src/components/ |
UI components: Popup, Settings, Form, ConnectionManager, SelectOne, StatusMessage, the primitives in ui.tsx and the icons |
src/provider/ |
State: saved connections (StoreProvider) and Kodi actions (ApiProvider) |
src/lib/ |
kodi.ts (JSON-RPC client, plugin URLs, permissions), connections.ts (storage, defaults, names), types.ts, with tests |
src/utils/i18n.ts |
t() for chrome.i18n and the error message mapping |
src/index.css |
Tailwind and the design tokens |
public/_locales/ |
Translations (en, de) |
public/icons/ |
Extension icons |
store-assets/ |
Banners, screenshots and the store description |
docs/, mkdocs.yml |
This documentation |
.github/workflows/ |
CI, version bump, release and docs workflows |
Translations¶
Texts live in public/_locales/<language>/messages.json. Add new keys to every language. To add a language, copy
en/messages.json into a new folder named after the
locale code and translate the message
values. The extension name and description in the stores come from extName and extDescription.
Conventions¶
- Biome formats and lints; run
bun run formatbefore committing. Single quotes, 120 columns, two spaces. - No content scripts and no new permissions without a strong reason; the permission list is part of what users trust.
- Keep the Kodi protocol in
src/lib/kodi.tsand test it. UI components should not build plugin URLs themselves. - Error messages are keys in
messages.json(error_<code>), so every newKodiErrorCodeneeds a message in every language.
Writing documentation¶
The documentation is Markdown in docs/, built with MkDocs Material
and published at firsttris.github.io/chrome.sendtokodi.
pip install -r requirements-docs.txt
mkdocs serve # live preview at http://127.0.0.1:8000
mkdocs build --strict
mkdocs.yml holds the navigation; add new pages there. Every page starts with a description in its front matter,
which becomes the page's meta description for search engines. Links between pages are relative Markdown links
(setup.md#several-kodi-devices), which work on GitHub and on the site alike. Screenshots live in docs/ next to the
pages (copies of store-assets/screenshots/). --strict fails on broken links; CI runs it on every pull request that
touches the docs. The README on GitHub stays the short overview and links here for details.
Screenshots¶
The pictures of the popup and the options page (docs/*.png and store-assets/screenshots/) are
taken by screenshots/screenshots.spec.ts: the built pages run as plain pages in Chromium, with a
stand-in for the extension API (screenshots/chrome-stub.ts: two Kodi connections, the English
messages, a YouTube video in the active tab) and Kodi's JSON-RPC answered by the test.
After a change to the look, run Update screenshots (Actions → Run workflow,
.github/workflows/screenshots.yml) on the branch: it takes the pictures in the official
Playwright image and commits the ones that changed. The banners in store-assets/banner/ are made
by hand.