feat(dictionary): add Hachidori backend support

- Add backend selection, setup gating, Anki integration, and external host support
- Add launcher flags, documentation, packaging, and focused tests
- Open on-demand overlay modals on the first attempt
This commit is contained in:
2026-09-22 00:21:19 -07:00
parent 1508863dbb
commit d9fdc7ef6d
446 changed files with 109060 additions and 244 deletions
+31
View File
@@ -0,0 +1,31 @@
// Hosts that embed Hachidori in an overlay, such as the GSM overlay, set this to true in their copy.
// SPDX-License-Identifier: GPL-3.0-or-later
import { BROWSER_KIND, IS_FIREFOX } from "./browser-api.js";
export const OVERLAY_MODE = true;
export const HOST_BROWSER = OVERLAY_MODE ? "electron" : BROWSER_KIND;
// Electron's extension host deliberately exposes less of Chrome than a normal
// browser window, and Firefox deliberately omits Chrome's recording stack.
// Keep every host-owned capability in one place so shared settings cannot make
// an unavailable control live again.
export const HOST_CAPABILITIES = Object.freeze({
browserShortcuts: !OVERLAY_MODE,
// `customLinks` is the pre-Custom-buttons host contract. Keep the alias so
// an embedding host can update its reader before updating its capability
// projection.
customLinks: true,
// Chrome MV3 `userScripts` registration; Firefox MV2 has no equivalent yet.
customJavaScript: false,
linkButtons: true,
externalLinkHost: OVERLAY_MODE,
localFileAccessPrompt: !OVERLAY_MODE,
mediaCapture: !OVERLAY_MODE && !IS_FIREFOX,
});
export const MINING_CAPABILITIES = Object.freeze({
screenshot: !OVERLAY_MODE,
browserSpeech: !OVERLAY_MODE && !IS_FIREFOX,
});