Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,19 @@ Conventional Commits by release-please.

- The dashboard's Add words sheet no longer shows a stray "null" beside "Learning" when you
read one language.
- With your words kept in this browser, the dashboard's Recently deleted now shows a word as
soon as you delete it, here or from the popup, and drops it when you restore it or press
Undo, without reloading the page.
- On the dashboard, moving a word to another language with M or Move to… no longer loses
your place: the keyboard focus stays on that word in the list, on the next word if it
left the list, or on the inspector's Move button. Choosing from any of the dashboard's
menus now returns focus to the button that opened it.
- In the popup's language picker, pressing Enter in the search box now picks the first
language it lists, as the dashboard's picker does.
- The warnings about a server address that starts with http://, in the extension and when
the server starts, now say what actually travels unencrypted: your words and the server's
answers. Your access key never does; Kotiko signs each request with it instead of sending
it.

## [1.0.1](https://github.com/ScriptKittyOS/kotiko/compare/v1.0.0...v1.0.1) (2026-10-08)

Expand Down
2 changes: 1 addition & 1 deletion SECURITY.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Supported versions

Only the latest release gets security fixes: from 1.0.0 on (the first store release, still pending), the latest 1.x. Release candidates (`vX.Y.Z-rc.N` pre-releases, for review) and versions older than 1.0.0 get none.
Only the latest release gets security fixes: from 1.0.0 on, the latest 1.x. Release candidates (`vX.Y.Z-rc.N` pre-releases, for review) and versions older than 1.0.0 get none.

## Reporting a vulnerability

Expand Down
42 changes: 21 additions & 21 deletions docs/best-practices.md

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions docs/reference/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,10 @@ The address the server listens on.
- Example: your Tailscale address, to use the extension on another computer.
- At start, the server logs who can reach it. For a local network address, `0.0.0.0` or a
public address, that line is a warning: the server speaks plain HTTP, so anyone on the way
can read the token. Use Tailscale or put HTTPS in front (README, "Browse on another
machine"). Tailscale addresses (100.64.0.0/10) get an informational line.
can read your words and the server's answers (not the token: the extension signs each
request with it, though a `Bearer` token sent with `curl` would show). Use Tailscale or put
HTTPS in front ([Using the server from another machine](https://kotiko.org/server/remote-access/)).
Tailscale addresses (100.64.0.0/10) get an informational line.
- Wrong: a name that doesn't resolve stops the server.

### `ALLOWED_HOSTS`
Expand Down
8 changes: 5 additions & 3 deletions docs/security/requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Kotiko has two parts: the browser extension, and an optional server you run your
- **It listens only on your computer** unless you change `BIND`, on both loopback
addresses (`127.0.0.1` and `::1`), so no other account on the computer can listen on the
one a browser tries for `localhost` and receive your token. When you change `BIND`, it
says at startup who can now reach it, and warns when your token would cross a network in plain
says at startup who can now reach it, and warns when your words would cross a network in plain
HTTP (repeating that warning daily when the address is reachable from the internet).
- **It answers only to names it knows**, so a web page can't reach it by pointing its own
domain at your computer (DNS rebinding). Unknown names get `421`. You add names with
Expand Down Expand Up @@ -107,8 +107,10 @@ Kotiko has two parts: the browser extension, and an optional server you run your
your words wherever they like; so the server refuses to start in a folder others can
write in, when one of its files is a link, or when the folder or one of its files
belongs to another account.
- **Privacy on a network if you use plain HTTP** to a server on another machine. The token
and your words travel unencrypted. Use Tailscale or HTTPS through a reverse proxy.
- **Privacy on a network if you use plain HTTP** to a server on another machine. Your words
and the server's answers travel unencrypted. The token doesn't: the extension signs each
request with it instead of sending it (a `Bearer` token you send yourself, as with `curl`,
does travel). Use Tailscale or HTTPS through a reverse proxy.
- **Privacy from the model provider you chose.** Lookups go to it under its terms.
- **That pages can't tell Kotiko changed their text.** A page's own scripts can see swapped
words.
Expand Down
18 changes: 8 additions & 10 deletions docs/stores.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,14 @@ The pipeline is [slice 30](../slices/30-release-pipeline/SPEC.md); the workflow

## Versions

The first public release is **v1.0.0** (DECISIONS 2026-10-05). 0.2.0 was the last version of
the personal tool, so `main` keeps saying 0.2.0 until 1.0.0 is released; the work since is
under `## Unreleased` in the CHANGELOG. `release-please-config.json` pins the next release
with `"release-as": "1.0.0"`, so the release PR proposes 1.0.0 whatever the commits say.
Before launch, builds for slice 54's review are release candidates on the release PR's head:
`v1.0.0-rc.1`, `v1.0.0-rc.2`, and so on (below). The stores get `v1.0.0` only.

**After v1.0.0 ships, remove `"release-as"`** (one line, in the PR that follows the
release); from then on release-please picks the version from the commits: `fix` gives
1.0.1, `feat` 1.1.0, a breaking change 2.0.0.
The first public release was **v1.0.0** (DECISIONS 2026-10-05), on 2026-10-08, with v1.0.1
the same day; 0.2.0 was the last version of the personal tool, and nothing was released in
between. Before launch, builds for slice 54's review were release candidates on the release
PR's head, `v1.0.0-rc.1` to `v1.0.0-rc.4` (below); candidates never go to the stores.
`release-please-config.json` pinned the first release with `"release-as": "1.0.0"`; the pin
was removed once it shipped, so release-please now picks the version from the commits: `fix`
gives the next patch (after 1.0.1, 1.0.2), `feat` the next minor (1.1.0), a breaking change
2.0.0. Work not yet released is under `## Unreleased` in the CHANGELOG.

## How a release happens

Expand Down
12 changes: 7 additions & 5 deletions docs/verify.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,20 @@ You need `git`, `sha256sum` (macOS: `shasum -a 256`) and the [GitHub CLI](https:

## 1. The tag

The release manager signs each tag with their own key, listed in `.github/allowed_signers`
(SSH) or `.github/release-keys.asc` (GPG), and in [MAINTAINERS.md](../MAINTAINERS.md).
The release manager signs each tag with their own SSH key, listed in `.github/allowed_signers`
and in [MAINTAINERS.md](../MAINTAINERS.md).

```sh
git clone https://github.com/ScriptKittyOS/kotiko.git && cd kotiko
git fetch --tags
git -c gpg.ssh.allowedSignersFile=.github/allowed_signers verify-tag v1.0.0
```

The output starts with `Good "git" signature for <maintainer>`. For a GPG-signed tag, import
the release keys first: `gpg --import .github/release-keys.asc`, then `git verify-tag v1.0.0`
shows "Good signature".
The output starts with `Good "git" signature for <maintainer>`. Every release so far is
signed with an SSH key. The release workflow would also accept a GPG key from
`.github/release-keys.asc`, but no release key is GPG, so that file doesn't exist; if one is
ever added, import it first (`gpg --import .github/release-keys.asc`) and `git verify-tag
v1.0.0` shows "Good signature".

Then check that the signed tag carries this tag's name. The signature covers the tag object,
not the name you fetched it under, so a release candidate's signed object could be pushed
Expand Down
4 changes: 2 additions & 2 deletions extension/_locales/en/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -4953,8 +4953,8 @@
"description": "Warning under the address of a lookup service (\"Another service\", Ollama, LM Studio) in Settings and on the welcome page, when the address uses http:// and isn't on this computer or a Tailscale network. Lookups still work. Keep http:// and https:// as they are."
},
"server_url_unencrypted": {
"message": "This address starts with http://, so your access key travels unencrypted. If anyone else shares this network, use an https:// address (for example with tailscale serve).",
"description": "Warning under the server address field when the address uses http:// and isn't on this computer or a Tailscale network. The connection still works. Keep http://, https:// and \"tailscale serve\" as they are."
"message": "This address starts with http://, so your words and your server's answers travel unencrypted (your access key itself is never sent). If anyone else shares this network, use an https:// address (for example with tailscale serve).",
"description": "Warning under the server address field when the address uses http:// and isn't on this computer or a Tailscale network. The connection still works. Kotiko signs each request with the access key instead of sending it, so only the words and the server's answers are readable on the network. Keep http://, https:// and \"tailscale serve\" as they are."
},
"error_address_changed": {
"message": "Where Kotiko sends your words was changed outside its settings, so it sent nothing there. Open Settings, check your word lookups and server address, and save them again.",
Expand Down
7 changes: 5 additions & 2 deletions extension/background.js
Original file line number Diff line number Diff line change
Expand Up @@ -978,8 +978,11 @@ const refresh = globalThis.KotikoRefreshJob.createRefreshJob({
now,
});

// Every committed write updates the pages' list once, 100 ms later.
getStore().then((store) => store.onCommit((info) => projector.schedule({ by: info?.by ?? null }))).catch(() => {});
// Every committed write updates the pages' list once, 100 ms later. Writes that can delete
// or restore a word say so, for the dashboard's Recently deleted (tombstones live in the
// store, so no storage key changes with them).
const TOMBSTONE_WRITES = new Set(["remove", "restore", "import", "undo-import"]);
getStore().then((store) => store.onCommit((info) => projector.schedule({ by: info?.by ?? null, deleted: TOMBSTONE_WRITES.has(info?.reason) }))).catch(() => {});

// ── moving words between this browser and a server (slice 11 section 6) ────────────

Expand Down
50 changes: 44 additions & 6 deletions extension/dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,12 +289,18 @@
return loading;
}

// Reloads can overlap (a delete, then Undo right away): only the newest answer counts.
let deletedSeq = 0;
async function loadDeleted() {
const seq = ++deletedSeq;
let entries;
try {
state.deleted = await source.deleted();
entries = await source.deleted();
} catch {
state.deleted = [];
entries = [];
}
if (seq !== deletedSeq) return;
state.deleted = entries;
rebuildDeleted();
if (isDeletedView()) {
resort();
Expand Down Expand Up @@ -446,6 +452,7 @@
restored.push(res.word);
} else problem ??= res;
});
deletedSeq++; // a reload already under way may have read the list before the restore
state.deleted = state.deleted.filter((e) => !recordIds.includes(e.id) || !restored.some((w) => w.id === e.id));
rebuildDeleted();
rebuild();
Expand Down Expand Up @@ -1134,13 +1141,41 @@
function moveMenu(anchor, ids) {
const current = new Set(ids.map((id) => state.byId.get(id)?.lang));
const langs = M.shelf(state.groups, { languageName: (l) => languageName(l), uiLocale: I18n.locale() }).map((e) => e.lang).filter((l) => !(current.size === 1 && current.has(l)));
const recordIds = ids.flatMap((id) => state.byId.get(id)?.records.map((r) => r.id) ?? []);
// Where focus goes once a language is chosen (27 §3, WCAG 2.4.3): back to the
// inspector's Move button it came from, else the list, on the moved word's row while
// it's listed (else the row now in its place). After the move re-renders, again, unless
// the learner has gone elsewhere meanwhile.
const fromInspector = !!anchor.closest?.("#inspector");
const refocus = () => {
const back = fromInspector && state.open ? $("inspector").querySelector(".insp-move") : null;
if (back) back.focus();
else focusListOn(recordIds);
};
const move = async (lang) => {
const done = moveGroups(ids, lang);
const settle = () => [document.body, $("grid"), null].includes(document.activeElement) && refocus();
settle();
await done;
settle();
};
openMenu(anchor, [
...langs.map((l) => ({ label: languageName(l), lang: l, run: () => moveGroups(ids, l) })),
...langs.map((l) => ({ label: languageName(l), lang: l, run: () => move(l) })),
{ label: t("dash_move_elsewhere"), run: async () => {
const lang = await pickLanguage({ title: t("dash_move_title"), exclude: current });
if (lang) moveGroups(ids, lang);
if (lang) move(lang);
} },
]);
], { focus: refocus });
}

// Focus on the list, its active row on the word holding one of `recordIds` while it's
// listed; else the active row stays where it was (the next word, once one has left).
function focusListOn(recordIds) {
const i = state.view.findIndex((id) => groupById(id)?.records.some((r) => recordIds.includes(r.id)));
if (i >= 0) state.active = i;
if (state.view.length) scrollToActive();
renderWindow(false);
$("grid").focus({ preventScroll: true });
}

// ---------------------------------------------------------------------------------
Expand Down Expand Up @@ -1925,7 +1960,9 @@
// ---------------------------------------------------------------------------------
// Menus, dialogs and the language picker (27 §3 patterns).

function openMenu(anchor, items, { radio = false } = {}) {
// Choosing an item closes the menu and puts focus back on what opened it, as Esc does, or
// where `focus()` puts it, before the item runs (WCAG 2.4.3).
function openMenu(anchor, items, { radio = false, focus = () => anchor.focus() } = {}) {
closeMenus();
const menu = el("div", { class: "menu", role: "menu" });
const buttons = items.map((it) => el("button", {
Expand All @@ -1936,6 +1973,7 @@
tabindex: "-1",
onclick: () => {
closeMenus();
focus();
it.run();
},
}, radio ? el("span", { class: "menu-check", "aria-hidden": "true" }, it.checked ? icon("check", 16) : null) : null, el("span", { lang: it.lang ?? null }, it.label)));
Expand Down
22 changes: 16 additions & 6 deletions extension/lib/projection.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@
// to storage.local in one `set`. Only swappable words (active), only for the learner's
// current bases, in the compact shape the matcher and the word card read today: forms as
// the texts of enabled forms, newest first, and the optional fields left out when empty.
// `wordsVersion.deleted` is true when one of the writes deleted or restored a word, so an
// open dashboard reloads its Recently deleted list (kept in the store, not in storage).
// No DOM, so it runs in the background (globalThis.KotikoProjection) and in Node tests.
//
// KotikoProjection.project(records, bases) -> [compact word]
// const p = KotikoProjection.createProjector({ list, storage, bases, enabled, debounceMs });
// p.schedule({by: clientId}); await p.flush();
// p.schedule({by: clientId, deleted}); await p.flush();
(() => {
const SWAP = new Set(["active", "well_known"]);
const OPTIONAL = ["romanization", "note", "native_vocalized", "pronunciation", "pronunciation_careful", "pronunciation_source", "sense"];
Expand Down Expand Up @@ -44,15 +46,19 @@
// Who caused the writes since the last projection: one page's client id, or null
// (several writers, the popup, the background). The dashboard ignores its own echoes.
let by;
// Whether a write since the last projection deleted or restored a word.
let deleted = false;

async function write(writer) {
async function write(writer, tombstones) {
if (!(await enabled())) return false;
const items = async (get) => {
const b = await bases(get);
const words = project(await list(), b);
const prev = (await get({ wordsVersion: null })).wordsVersion;
n = Math.max(n, typeof prev?.n === "number" ? prev.n : 0) + 1;
return { words, baseLangs: b, wordsVersion: { n, at: now(), by: writer ?? null } };
const version = { n, at: now(), by: writer ?? null };
if (tombstones) version.deleted = true;
return { words, baseLangs: b, wordsVersion: version };
};
// The bases are read and the list for them written in one step where the storage
// can (the background's trusted copy, `update`): a change of bases while the store's
Expand All @@ -66,9 +72,11 @@
timer = null;
const done = waiters;
const writer = by;
const tombstones = deleted;
waiters = [];
by = undefined;
running = running.then(() => write(writer)).then(
deleted = false;
running = running.then(() => write(writer, tombstones)).then(
(r) => done.forEach((w) => w.resolve(r)),
(e) => {
onError(e);
Expand All @@ -80,15 +88,17 @@

return {
// Coalesces writes: one projection 100 ms after the last change.
schedule({ by: writer = null } = {}) {
schedule({ by: writer = null, deleted: d = false } = {}) {
by = by === undefined || by === writer ? writer : null;
deleted ||= d === true;
if (timer) clearTimer(timer);
timer = setTimer(run, debounceMs);
return new Promise((resolve) => waiters.push({ resolve }));
},
// Writes now (tests, mode switches); resolves once written.
flush({ by: writer = null } = {}) {
flush({ by: writer = null, deleted: d = false } = {}) {
by = by === undefined || by === writer ? writer : null;
deleted ||= d === true;
if (timer) clearTimer(timer);
const p = new Promise((resolve) => waiters.push({ resolve }));
run();
Expand Down
11 changes: 6 additions & 5 deletions extension/lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
// -> { ok: true, url: "http://192.168.1.5:4747" }
// normalizeServerUrl("http://user:pw@host")
// -> { ok: false, code: "server_address_invalid", hint: "..." }
// sendsInClear("http://192.168.1.5:4747") -> true (the token would cross the network unencrypted)
// sendsInClear("http://192.168.1.5:4747") -> true (words would cross the network unencrypted)
// pinLoopback("http://localhost:11434/v1") -> "http://127.0.0.1:11434/v1"
//
// Plain-http `localhost` always becomes 127.0.0.1 (slice 54, B-01). Browsers resolve the
Expand Down Expand Up @@ -95,10 +95,11 @@
return { ok: true, url: pinLoopback(`${u.protocol}//${u.host}${path}`) };
}

// An address whose requests (and the token in them) cross a network unencrypted: plain
// http:// to anywhere but this computer (127.0.0.0/8, ::1, localhost) or a Tailscale
// address (100.64.0.0/10, fd7a:115c:a1e0::/48, *.ts.net), whose traffic WireGuard
// encrypts (slice 28 §5). The address still works; the settings say so under the field.
// An address whose requests and answers (the words in them; never the token, which only
// signs them) cross a network unencrypted: plain http:// to anywhere but this computer
// (127.0.0.0/8, ::1, localhost) or a Tailscale address (100.64.0.0/10,
// fd7a:115c:a1e0::/48, *.ts.net), whose traffic WireGuard encrypts (slice 28 §5). The
// address still works; the settings say so under the field.
function sendsInClear(input) {
const n = normalizeServerUrl(input);
if (!n.ok) return false;
Expand Down
4 changes: 3 additions & 1 deletion extension/lib/word-source.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,9 @@
const keys = changedKeys(changes.words.oldValue, changes.words.newValue);
if (keys.size && !explainedByOwn(keys)) emit("sync");
}
if (changes.recentlyDeleted) emit("deleted");
// Server mode keeps Recently deleted in storage; local mode keeps tombstones in its
// store, and the pages' list update says when one was written (lib/projection.js).
if (changes.recentlyDeleted || changes.wordsVersion?.newValue?.deleted === true) emit("deleted");
}

return {
Expand Down
Loading