kokoro-web 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- kokoro_web-0.1.0/LICENSE +21 -0
- kokoro_web-0.1.0/PKG-INFO +234 -0
- kokoro_web-0.1.0/README.md +212 -0
- kokoro_web-0.1.0/pyproject.toml +54 -0
- kokoro_web-0.1.0/setup.cfg +4 -0
- kokoro_web-0.1.0/src/kokoro_web.egg-info/PKG-INFO +234 -0
- kokoro_web-0.1.0/src/kokoro_web.egg-info/SOURCES.txt +21 -0
- kokoro_web-0.1.0/src/kokoro_web.egg-info/dependency_links.txt +1 -0
- kokoro_web-0.1.0/src/kokoro_web.egg-info/entry_points.txt +3 -0
- kokoro_web-0.1.0/src/kokoro_web.egg-info/requires.txt +5 -0
- kokoro_web-0.1.0/src/kokoro_web.egg-info/top_level.txt +1 -0
- kokoro_web-0.1.0/src/system/__init__.py +1 -0
- kokoro_web-0.1.0/src/system/__main__.py +7 -0
- kokoro_web-0.1.0/src/system/config.py +28 -0
- kokoro_web-0.1.0/src/system/host/__init__.py +97 -0
- kokoro_web-0.1.0/src/system/host/paths.py +181 -0
- kokoro_web-0.1.0/src/system/host/protocol.py +38 -0
- kokoro_web-0.1.0/src/system/host/state.py +71 -0
- kokoro_web-0.1.0/src/system/host/synthesis.py +274 -0
- kokoro_web-0.1.0/src/system/install.py +444 -0
- kokoro_web-0.1.0/src/system/tests/test_install.py +288 -0
- kokoro_web-0.1.0/src/system/tests/test_model_files.py +72 -0
- kokoro_web-0.1.0/src/system/tests/test_synthesis.py +161 -0
kokoro_web-0.1.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Ajay Tripathi
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,234 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: kokoro-web
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Native messaging bridge for the Kokoro Web browser extension
|
|
5
|
+
Author: Ajay Tripathi
|
|
6
|
+
License: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/atb00ker/kokoro-web-addon
|
|
8
|
+
Project-URL: Repository, https://github.com/atb00ker/kokoro-web-addon
|
|
9
|
+
Project-URL: Issues, https://github.com/atb00ker/kokoro-web-addon/issues
|
|
10
|
+
Keywords: kokoro,tts,browser,native-messaging
|
|
11
|
+
Classifier: Programming Language :: Python :: 3
|
|
12
|
+
Classifier: License :: OSI Approved :: MIT License
|
|
13
|
+
Classifier: Operating System :: OS Independent
|
|
14
|
+
Requires-Python: >=3.11
|
|
15
|
+
Description-Content-Type: text/markdown
|
|
16
|
+
License-File: LICENSE
|
|
17
|
+
Requires-Dist: python-dotenv
|
|
18
|
+
Provides-Extra: dev
|
|
19
|
+
Requires-Dist: ruff; extra == "dev"
|
|
20
|
+
Requires-Dist: basedpyright; extra == "dev"
|
|
21
|
+
Dynamic: license-file
|
|
22
|
+
|
|
23
|
+
<div align="center">
|
|
24
|
+
|
|
25
|
+
<img src="src/assets/kokoro-web.png" alt="Kokoro Web" width="128" />
|
|
26
|
+
|
|
27
|
+
# Kokoro Web
|
|
28
|
+
|
|
29
|
+
**Read text aloud in your browser — powered by local [kokoro-tts](https://github.com/nazdridoy/kokoro-tts).**
|
|
30
|
+
|
|
31
|
+
<!-- Install Buttons -->
|
|
32
|
+
|
|
33
|
+
[](https://github.com/atb00ker/kokoro-web-addon/releases/latest)
|
|
34
|
+
[](https://addons.mozilla.org/firefox/addon/kokoro-tts/)
|
|
35
|
+
|
|
36
|
+
[](https://www.python.org/)
|
|
37
|
+
[](https://www.typescriptlang.org/)
|
|
38
|
+
[](docs/DEV.md)
|
|
39
|
+
[](docs/PRIVACY.md)
|
|
40
|
+
[](https://github.com/nazdridoy/kokoro-tts)
|
|
41
|
+
[](LICENSE)
|
|
42
|
+
|
|
43
|
+
</div>
|
|
44
|
+
|
|
45
|
+
> [!NOTE]
|
|
46
|
+
> This project stands on the shoulders of the [Kokoro TTS](https://github.com/nazdridoy/kokoro-tts) team. **Kokoro Web** is only a browser extension and native messaging bridge — the model, voices, and synthesis engine are entirely their work. Thank you to everyone who built and maintains kokoro-tts for doing the difficult part that makes this add-on possible. This project is not affiliated with the Kokoro TTS team.
|
|
47
|
+
|
|
48
|
+
> [!CAUTION]
|
|
49
|
+
> **This project does not provide TTS services.** It is a browser extension and native messaging bridge only. You must install [kokoro-tts](https://github.com/nazdridoy/kokoro-tts) and the Kokoro model files on your system — your machine runs the actual text-to-speech engine. This setup is more involved than click-and-install.
|
|
50
|
+
|
|
51
|
+
This codebase has been tested on **Linux (Debian)** with **Chromium** and **Firefox** only. If you encounter issues with other browsers or operating systems, please open an issue and I'll try to help.
|
|
52
|
+
|
|
53
|
+
## Features
|
|
54
|
+
|
|
55
|
+
- **Local and private** — synthesis runs on your machine; nothing is sent to the cloud
|
|
56
|
+
- **Popup** — paste text, pick voice and speed, play/pause/stop
|
|
57
|
+
- **Read anywhere** — select text on any page → right-click → **Read with Kokoro**
|
|
58
|
+
- **Read page** — read the main page content from the context menu, popup, or read-along sidebar
|
|
59
|
+
- **Read-along sidebar** — follow along while text is spoken (Firefox sidebar / Chrome side panel)
|
|
60
|
+
- **Flexible setup** — works with your existing `kokoro-tts` install and model files
|
|
61
|
+
|
|
62
|
+
<p align="center">
|
|
63
|
+
<img src="docs/screenshot2.png" alt="Read with Kokoro in the context menu and the read-along sidebar on a Wikipedia page" width="900" />
|
|
64
|
+
</p>
|
|
65
|
+
<p align="center"><em>Select text → <strong>Read with Kokoro</strong>, or open the read-along sidebar to read the full page.</em></p>
|
|
66
|
+
|
|
67
|
+
See our [Privacy Policy](docs/PRIVACY.md) — no cloud, no analytics, no data sent to the developer.
|
|
68
|
+
|
|
69
|
+
## Installation
|
|
70
|
+
|
|
71
|
+
### Browser Store
|
|
72
|
+
|
|
73
|
+
Install from **[Firefox Add-ons](https://addons.mozilla.org/firefox/addon/kokoro-tts/)** or the **[Chrome release](https://github.com/atb00ker/kokoro-web-addon/releases/latest)** (use the badges at the top), restart your browser, and open the extension.
|
|
74
|
+
|
|
75
|
+
### Direct Install
|
|
76
|
+
|
|
77
|
+
Prefer not to use a browser store? Download the extension zip from **[GitHub Releases](https://github.com/atb00ker/kokoro-web-addon/releases/latest)** (`kokoro-web-*-firefox.zip` or `kokoro-web-*-chrome.zip`), extract it, and load it manually.
|
|
78
|
+
|
|
79
|
+
**Firefox:** open `about:debugging` → **This Firefox** → **Load Temporary Add-on…** → select `manifest.json` inside the extracted folder.
|
|
80
|
+
|
|
81
|
+
**Chromium:** open `chrome://extensions` → enable **Developer mode** → **Load unpacked** → select the extracted folder.
|
|
82
|
+
|
|
83
|
+
If you have not run setup yet, register the native host once (covers Firefox and Chrome):
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
kokoro-web-setup
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Restart the browser, open the extension, and click **Test connection**.
|
|
90
|
+
|
|
91
|
+
## Quick start
|
|
92
|
+
|
|
93
|
+
### Step 1 — Install kokoro-tts and model files
|
|
94
|
+
|
|
95
|
+
```bash
|
|
96
|
+
uv tool install kokoro-tts
|
|
97
|
+
|
|
98
|
+
mkdir -p ~/.kokoro && cd ~/.kokoro
|
|
99
|
+
wget https://github.com/nazdridoy/kokoro-tts/releases/download/v1.0.0/voices-v1.0.bin
|
|
100
|
+
wget https://github.com/nazdridoy/kokoro-tts/releases/download/v1.0.0/kokoro-v1.0.onnx
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### Step 2 — Install the browser bridge
|
|
104
|
+
|
|
105
|
+
```bash
|
|
106
|
+
uv run pip install kokoro-web
|
|
107
|
+
uv run kokoro-web-setup
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
> The setup command registers the native host for browsers it detects (Firefox, Chrome, Chromium, Edge, Brave). To install for a specific browser, use the corresponding command below:
|
|
111
|
+
>
|
|
112
|
+
> | Browser | Command |
|
|
113
|
+
> | -------- | ---------------------------------- |
|
|
114
|
+
> | Firefox | `uv run kokoro-web-setup firefox` |
|
|
115
|
+
> | Chrome | `uv run kokoro-web-setup chrome` |
|
|
116
|
+
> | Chromium | `uv run kokoro-web-setup chromium` |
|
|
117
|
+
> | Edge | `uv run kokoro-web-setup edge` |
|
|
118
|
+
> | Brave | `uv run kokoro-web-setup brave` |
|
|
119
|
+
>
|
|
120
|
+
> To register the native host for **all** supported browsers, use:
|
|
121
|
+
> `uv run kokoro-web-setup --all`
|
|
122
|
+
|
|
123
|
+
### Step 3 — Install the extension
|
|
124
|
+
|
|
125
|
+
Install from **[Firefox Add-ons](https://addons.mozilla.org/firefox/addon/kokoro-tts/)** or the **[Chrome release](https://github.com/atb00ker/kokoro-web-addon/releases/latest)** (use the badges at the top), restart your browser, and open the extension.
|
|
126
|
+
|
|
127
|
+
> The first time you open it, click **Test connection**. If setup succeeded, you can paste text and press **Play**.
|
|
128
|
+
|
|
129
|
+
## Usage
|
|
130
|
+
|
|
131
|
+
| Where | What you can do |
|
|
132
|
+
| ---------------------- | --------------------------------------------------------------------- |
|
|
133
|
+
| **Popup** | Paste text, choose voice/speed, play/pause/stop, **Read page** |
|
|
134
|
+
| **Context menu** | Select text → **Read with Kokoro**, or **Read page with Kokoro** |
|
|
135
|
+
| **Read-along sidebar** | **Read page aloud**, play/pause/stop, search and follow along in text |
|
|
136
|
+
|
|
137
|
+
## Advanced paths
|
|
138
|
+
|
|
139
|
+
Open extension **Settings** → **Advanced paths** if kokoro-tts is not on your PATH or models live somewhere other than `~/.kokoro`. The bridge auto-detects common locations when possible.
|
|
140
|
+
|
|
141
|
+
## Why is a bridge required?
|
|
142
|
+
|
|
143
|
+
Browsers cannot run local programs directly from an extension (security). The `kokoro-web` pip package registers a tiny native messaging host that forwards requests to your installed `kokoro-tts` and streams audio back to the browser.
|
|
144
|
+
|
|
145
|
+
```mermaid
|
|
146
|
+
flowchart LR
|
|
147
|
+
Extension["Browser extension"] -->|"native messaging"| Host["kokoro-web host"]
|
|
148
|
+
Host --> CLI["kokoro-tts CLI"]
|
|
149
|
+
CLI --> Audio["Audio stream"]
|
|
150
|
+
Audio --> Extension
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Firefox and Chrome use the **same** Python host script. They only differ in where the registration JSON file is stored.
|
|
154
|
+
|
|
155
|
+
## Troubleshooting
|
|
156
|
+
|
|
157
|
+
<details>
|
|
158
|
+
<summary><strong>Setup command not run</strong></summary>
|
|
159
|
+
|
|
160
|
+
If the extension shows "One-time setup required", run:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pip install kokoro-web && kokoro-web-setup
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
By default, setup registers only browsers it detects on your system. To force a specific browser:
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
kokoro-web-setup edge
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
To register every supported browser:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
kokoro-web-setup --all
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Restart the browser, then click **Test connection**.
|
|
179
|
+
|
|
180
|
+
</details>
|
|
181
|
+
|
|
182
|
+
<details>
|
|
183
|
+
<summary><strong>Verify native host registration</strong></summary>
|
|
184
|
+
|
|
185
|
+
Firefox (Linux):
|
|
186
|
+
|
|
187
|
+
```bash
|
|
188
|
+
cat ~/.mozilla/native-messaging-hosts/com.kokoro.web.json
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
Firefox (macOS):
|
|
192
|
+
|
|
193
|
+
```bash
|
|
194
|
+
cat ~/Library/Application\ Support/Mozilla/NativeMessagingHosts/com.kokoro.web.json
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Chrome or Chromium (Linux):
|
|
198
|
+
|
|
199
|
+
```bash
|
|
200
|
+
cat ~/.config/google-chrome/NativeMessagingHosts/com.kokoro.web.json
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
Chrome (macOS):
|
|
204
|
+
|
|
205
|
+
```bash
|
|
206
|
+
cat ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.kokoro.web.json
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
Chrome (Windows):
|
|
210
|
+
|
|
211
|
+
```bat
|
|
212
|
+
reg query "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.kokoro.web"
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
If you upgraded from an older release, you can remove the legacy Firefox manifest:
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
rm -f ~/.mozilla/native-messaging-hosts/com.kokoro.web_addon.json
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
</details>
|
|
222
|
+
|
|
223
|
+
<details>
|
|
224
|
+
<summary><strong>kokoro-tts works in terminal but not the extension</strong></summary>
|
|
225
|
+
|
|
226
|
+
- Confirm model files are in the configured model directory
|
|
227
|
+
- Open **Settings** → **Advanced paths** and set the full path to your `kokoro-tts` binary
|
|
228
|
+
- Click **Test connection** again
|
|
229
|
+
|
|
230
|
+
</details>
|
|
231
|
+
|
|
232
|
+
## Developers
|
|
233
|
+
|
|
234
|
+
Want to run the extension from source, change the bridge, or contribute? <br /> See **[developer guide](docs/DEV.md)** for prerequisites, setup, and the local development workflow. Pull requests are welcome.
|
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="src/assets/kokoro-web.png" alt="Kokoro Web" width="128" />
|
|
4
|
+
|
|
5
|
+
# Kokoro Web
|
|
6
|
+
|
|
7
|
+
**Read text aloud in your browser — powered by local [kokoro-tts](https://github.com/nazdridoy/kokoro-tts).**
|
|
8
|
+
|
|
9
|
+
<!-- Install Buttons -->
|
|
10
|
+
|
|
11
|
+
[](https://github.com/atb00ker/kokoro-web-addon/releases/latest)
|
|
12
|
+
[](https://addons.mozilla.org/firefox/addon/kokoro-tts/)
|
|
13
|
+
|
|
14
|
+
[](https://www.python.org/)
|
|
15
|
+
[](https://www.typescriptlang.org/)
|
|
16
|
+
[](docs/DEV.md)
|
|
17
|
+
[](docs/PRIVACY.md)
|
|
18
|
+
[](https://github.com/nazdridoy/kokoro-tts)
|
|
19
|
+
[](LICENSE)
|
|
20
|
+
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
> [!NOTE]
|
|
24
|
+
> This project stands on the shoulders of the [Kokoro TTS](https://github.com/nazdridoy/kokoro-tts) team. **Kokoro Web** is only a browser extension and native messaging bridge — the model, voices, and synthesis engine are entirely their work. Thank you to everyone who built and maintains kokoro-tts for doing the difficult part that makes this add-on possible. This project is not affiliated with the Kokoro TTS team.
|
|
25
|
+
|
|
26
|
+
> [!CAUTION]
|
|
27
|
+
> **This project does not provide TTS services.** It is a browser extension and native messaging bridge only. You must install [kokoro-tts](https://github.com/nazdridoy/kokoro-tts) and the Kokoro model files on your system — your machine runs the actual text-to-speech engine. This setup is more involved than click-and-install.
|
|
28
|
+
|
|
29
|
+
This codebase has been tested on **Linux (Debian)** with **Chromium** and **Firefox** only. If you encounter issues with other browsers or operating systems, please open an issue and I'll try to help.
|
|
30
|
+
|
|
31
|
+
## Features
|
|
32
|
+
|
|
33
|
+
- **Local and private** — synthesis runs on your machine; nothing is sent to the cloud
|
|
34
|
+
- **Popup** — paste text, pick voice and speed, play/pause/stop
|
|
35
|
+
- **Read anywhere** — select text on any page → right-click → **Read with Kokoro**
|
|
36
|
+
- **Read page** — read the main page content from the context menu, popup, or read-along sidebar
|
|
37
|
+
- **Read-along sidebar** — follow along while text is spoken (Firefox sidebar / Chrome side panel)
|
|
38
|
+
- **Flexible setup** — works with your existing `kokoro-tts` install and model files
|
|
39
|
+
|
|
40
|
+
<p align="center">
|
|
41
|
+
<img src="docs/screenshot2.png" alt="Read with Kokoro in the context menu and the read-along sidebar on a Wikipedia page" width="900" />
|
|
42
|
+
</p>
|
|
43
|
+
<p align="center"><em>Select text → <strong>Read with Kokoro</strong>, or open the read-along sidebar to read the full page.</em></p>
|
|
44
|
+
|
|
45
|
+
See our [Privacy Policy](docs/PRIVACY.md) — no cloud, no analytics, no data sent to the developer.
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
### Browser Store
|
|
50
|
+
|
|
51
|
+
Install from **[Firefox Add-ons](https://addons.mozilla.org/firefox/addon/kokoro-tts/)** or the **[Chrome release](https://github.com/atb00ker/kokoro-web-addon/releases/latest)** (use the badges at the top), restart your browser, and open the extension.
|
|
52
|
+
|
|
53
|
+
### Direct Install
|
|
54
|
+
|
|
55
|
+
Prefer not to use a browser store? Download the extension zip from **[GitHub Releases](https://github.com/atb00ker/kokoro-web-addon/releases/latest)** (`kokoro-web-*-firefox.zip` or `kokoro-web-*-chrome.zip`), extract it, and load it manually.
|
|
56
|
+
|
|
57
|
+
**Firefox:** open `about:debugging` → **This Firefox** → **Load Temporary Add-on…** → select `manifest.json` inside the extracted folder.
|
|
58
|
+
|
|
59
|
+
**Chromium:** open `chrome://extensions` → enable **Developer mode** → **Load unpacked** → select the extracted folder.
|
|
60
|
+
|
|
61
|
+
If you have not run setup yet, register the native host once (covers Firefox and Chrome):
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
kokoro-web-setup
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
Restart the browser, open the extension, and click **Test connection**.
|
|
68
|
+
|
|
69
|
+
## Quick start
|
|
70
|
+
|
|
71
|
+
### Step 1 — Install kokoro-tts and model files
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
uv tool install kokoro-tts
|
|
75
|
+
|
|
76
|
+
mkdir -p ~/.kokoro && cd ~/.kokoro
|
|
77
|
+
wget https://github.com/nazdridoy/kokoro-tts/releases/download/v1.0.0/voices-v1.0.bin
|
|
78
|
+
wget https://github.com/nazdridoy/kokoro-tts/releases/download/v1.0.0/kokoro-v1.0.onnx
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
### Step 2 — Install the browser bridge
|
|
82
|
+
|
|
83
|
+
```bash
|
|
84
|
+
uv run pip install kokoro-web
|
|
85
|
+
uv run kokoro-web-setup
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
> The setup command registers the native host for browsers it detects (Firefox, Chrome, Chromium, Edge, Brave). To install for a specific browser, use the corresponding command below:
|
|
89
|
+
>
|
|
90
|
+
> | Browser | Command |
|
|
91
|
+
> | -------- | ---------------------------------- |
|
|
92
|
+
> | Firefox | `uv run kokoro-web-setup firefox` |
|
|
93
|
+
> | Chrome | `uv run kokoro-web-setup chrome` |
|
|
94
|
+
> | Chromium | `uv run kokoro-web-setup chromium` |
|
|
95
|
+
> | Edge | `uv run kokoro-web-setup edge` |
|
|
96
|
+
> | Brave | `uv run kokoro-web-setup brave` |
|
|
97
|
+
>
|
|
98
|
+
> To register the native host for **all** supported browsers, use:
|
|
99
|
+
> `uv run kokoro-web-setup --all`
|
|
100
|
+
|
|
101
|
+
### Step 3 — Install the extension
|
|
102
|
+
|
|
103
|
+
Install from **[Firefox Add-ons](https://addons.mozilla.org/firefox/addon/kokoro-tts/)** or the **[Chrome release](https://github.com/atb00ker/kokoro-web-addon/releases/latest)** (use the badges at the top), restart your browser, and open the extension.
|
|
104
|
+
|
|
105
|
+
> The first time you open it, click **Test connection**. If setup succeeded, you can paste text and press **Play**.
|
|
106
|
+
|
|
107
|
+
## Usage
|
|
108
|
+
|
|
109
|
+
| Where | What you can do |
|
|
110
|
+
| ---------------------- | --------------------------------------------------------------------- |
|
|
111
|
+
| **Popup** | Paste text, choose voice/speed, play/pause/stop, **Read page** |
|
|
112
|
+
| **Context menu** | Select text → **Read with Kokoro**, or **Read page with Kokoro** |
|
|
113
|
+
| **Read-along sidebar** | **Read page aloud**, play/pause/stop, search and follow along in text |
|
|
114
|
+
|
|
115
|
+
## Advanced paths
|
|
116
|
+
|
|
117
|
+
Open extension **Settings** → **Advanced paths** if kokoro-tts is not on your PATH or models live somewhere other than `~/.kokoro`. The bridge auto-detects common locations when possible.
|
|
118
|
+
|
|
119
|
+
## Why is a bridge required?
|
|
120
|
+
|
|
121
|
+
Browsers cannot run local programs directly from an extension (security). The `kokoro-web` pip package registers a tiny native messaging host that forwards requests to your installed `kokoro-tts` and streams audio back to the browser.
|
|
122
|
+
|
|
123
|
+
```mermaid
|
|
124
|
+
flowchart LR
|
|
125
|
+
Extension["Browser extension"] -->|"native messaging"| Host["kokoro-web host"]
|
|
126
|
+
Host --> CLI["kokoro-tts CLI"]
|
|
127
|
+
CLI --> Audio["Audio stream"]
|
|
128
|
+
Audio --> Extension
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
Firefox and Chrome use the **same** Python host script. They only differ in where the registration JSON file is stored.
|
|
132
|
+
|
|
133
|
+
## Troubleshooting
|
|
134
|
+
|
|
135
|
+
<details>
|
|
136
|
+
<summary><strong>Setup command not run</strong></summary>
|
|
137
|
+
|
|
138
|
+
If the extension shows "One-time setup required", run:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
pip install kokoro-web && kokoro-web-setup
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
By default, setup registers only browsers it detects on your system. To force a specific browser:
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
kokoro-web-setup edge
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
To register every supported browser:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
kokoro-web-setup --all
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
Restart the browser, then click **Test connection**.
|
|
157
|
+
|
|
158
|
+
</details>
|
|
159
|
+
|
|
160
|
+
<details>
|
|
161
|
+
<summary><strong>Verify native host registration</strong></summary>
|
|
162
|
+
|
|
163
|
+
Firefox (Linux):
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
cat ~/.mozilla/native-messaging-hosts/com.kokoro.web.json
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Firefox (macOS):
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
cat ~/Library/Application\ Support/Mozilla/NativeMessagingHosts/com.kokoro.web.json
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
Chrome or Chromium (Linux):
|
|
176
|
+
|
|
177
|
+
```bash
|
|
178
|
+
cat ~/.config/google-chrome/NativeMessagingHosts/com.kokoro.web.json
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
Chrome (macOS):
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
cat ~/Library/Application\ Support/Google/Chrome/NativeMessagingHosts/com.kokoro.web.json
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
Chrome (Windows):
|
|
188
|
+
|
|
189
|
+
```bat
|
|
190
|
+
reg query "HKCU\Software\Google\Chrome\NativeMessagingHosts\com.kokoro.web"
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
If you upgraded from an older release, you can remove the legacy Firefox manifest:
|
|
194
|
+
|
|
195
|
+
```bash
|
|
196
|
+
rm -f ~/.mozilla/native-messaging-hosts/com.kokoro.web_addon.json
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
</details>
|
|
200
|
+
|
|
201
|
+
<details>
|
|
202
|
+
<summary><strong>kokoro-tts works in terminal but not the extension</strong></summary>
|
|
203
|
+
|
|
204
|
+
- Confirm model files are in the configured model directory
|
|
205
|
+
- Open **Settings** → **Advanced paths** and set the full path to your `kokoro-tts` binary
|
|
206
|
+
- Click **Test connection** again
|
|
207
|
+
|
|
208
|
+
</details>
|
|
209
|
+
|
|
210
|
+
## Developers
|
|
211
|
+
|
|
212
|
+
Want to run the extension from source, change the bridge, or contribute? <br /> See **[developer guide](docs/DEV.md)** for prerequisites, setup, and the local development workflow. Pull requests are welcome.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "kokoro-web"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Native messaging bridge for the Kokoro Web browser extension"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
license = { text = "MIT" }
|
|
11
|
+
requires-python = ">=3.11"
|
|
12
|
+
dependencies = ["python-dotenv"]
|
|
13
|
+
authors = [{ name = "Ajay Tripathi" }]
|
|
14
|
+
keywords = ["kokoro", "tts", "browser", "native-messaging"]
|
|
15
|
+
classifiers = [
|
|
16
|
+
"Programming Language :: Python :: 3",
|
|
17
|
+
"License :: OSI Approved :: MIT License",
|
|
18
|
+
"Operating System :: OS Independent",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
[project.urls]
|
|
22
|
+
Homepage = "https://github.com/atb00ker/kokoro-web-addon"
|
|
23
|
+
Repository = "https://github.com/atb00ker/kokoro-web-addon"
|
|
24
|
+
Issues = "https://github.com/atb00ker/kokoro-web-addon/issues"
|
|
25
|
+
|
|
26
|
+
[project.optional-dependencies]
|
|
27
|
+
dev = ["ruff", "basedpyright"]
|
|
28
|
+
|
|
29
|
+
[dependency-groups]
|
|
30
|
+
dev = ["ruff", "basedpyright"]
|
|
31
|
+
|
|
32
|
+
[project.scripts]
|
|
33
|
+
kokoro-web-setup = "system.install:main"
|
|
34
|
+
kokoro-web-host = "system.host:main"
|
|
35
|
+
|
|
36
|
+
[tool.setuptools.packages.find]
|
|
37
|
+
where = ["src"]
|
|
38
|
+
include = ["system*"]
|
|
39
|
+
|
|
40
|
+
[tool.ruff]
|
|
41
|
+
target-version = "py311"
|
|
42
|
+
line-length = 80
|
|
43
|
+
src = ["src"]
|
|
44
|
+
exclude = [".venv", "node_modules", "*.egg-info"]
|
|
45
|
+
|
|
46
|
+
[tool.ruff.format]
|
|
47
|
+
quote-style = "double"
|
|
48
|
+
|
|
49
|
+
[tool.basedpyright]
|
|
50
|
+
include = ["src/system"]
|
|
51
|
+
exclude = [".venv", "node_modules", "**/__pycache__", "**/*.egg-info"]
|
|
52
|
+
pythonVersion = "3.11"
|
|
53
|
+
typeCheckingMode = "basic"
|
|
54
|
+
reportImplicitStringConcatenation = "error"
|