From 8ec559012d0df6a89e3dd44e7f832551cf8e8d4a Mon Sep 17 00:00:00 2001 From: Sebastian Danielsson Date: Sun, 4 Oct 2026 18:48:04 +0200 Subject: [PATCH] fix(explainshell, ocr-image): honour the configured mirrors Offline, explainshell now always uses the configured explainchain.url. Before, a URL the browser had stored earlier (the public explainshell.com) overrode it. ocr-image's lang-url template may now name the file (.../{lang}.traineddata.gz). tesseract.js appends that file name itself, so the template is reduced to its directory instead of requesting a duplicated path. Co-Authored-By: Claude Opus 5.5 (1M context) --- README.md | 2 +- src/tools/explainshell/explainshell.vue | 10 +++++-- src/tools/ocr-image/lang-path.test.ts | 38 +++++++++++++++++++++++++ src/tools/ocr-image/lang-path.ts | 12 ++++++++ src/tools/ocr-image/ocr-image.vue | 6 ++-- 5 files changed, 63 insertions(+), 5 deletions(-) create mode 100644 src/tools/ocr-image/lang-path.test.ts create mode 100644 src/tools/ocr-image/lang-path.ts diff --git a/README.md b/README.md index 9c675b21..44f26201 100644 --- a/README.md +++ b/README.md @@ -262,7 +262,7 @@ Some tools work offline once you point them at an intranet mirror; without one, | Setting | Used by | Expected content | | --- | --- | --- | | `transformers.models-url` | translator, remove-background, math-ocr | A mirror of the Hugging Face model repos with the same layout: `///resolve/main/`, e.g. `Xenova/opus-mt-en-fr/resolve/main/onnx/encoder_model_quantized.onnx`. Relative URLs resolve against the app. | -| `ocr-image.lang-url` | ocr-image | A directory of `.traineddata.gz` files (the `4.0.0_best_int` variant from the `@tesseract.js-data/` npm packages), or a URL containing a `{lang}` placeholder. | +| `ocr-image.lang-url` | ocr-image | A directory of `.traineddata.gz` files (the `4.0.0_best_int` variant from the `@tesseract.js-data/` npm packages). The path may contain a `{lang}` placeholder, e.g. `https://intranet.example/npm/@tesseract.js-data/{lang}/4.0.0_best_int` for a mirror of jsDelivr. | | `json-schemas.catalog-url` | json-viewer, yaml-viewer, json-editor, json-linter | A copy of the [SchemaStore](https://www.schemastore.org) catalog. The schema URLs listed in it must be reachable too. | | `currency-converter.url` | currency-converter | A mirror of the `@fawazahmed0/currency-api` npm package, serving `v1/currencies/.json`. | | `geo-coordinates-converter.tile-url` | geo-coordinates-converter | A Leaflet tile URL template; `tile-attribution` is optional. | diff --git a/src/tools/explainshell/explainshell.vue b/src/tools/explainshell/explainshell.vue index 54a1b558..aed1342b 100644 --- a/src/tools/explainshell/explainshell.vue +++ b/src/tools/explainshell/explainshell.vue @@ -1,11 +1,17 @@