Repository navigation
feat(desktop): embed Vazirmatn + self-heal the asar patch after updates - #2
Merged
programmer-1998 merged 1 commit intoOct 15, 2026
Conversation
Desktop: embed Vazirmatn (OFL) via @font-face and override --font-family-sans with !important so the whole UI uses it, with no system font install and no network. Engine (patch/lib/patch-asar.mjs): - inject a data-rtl-version marker and upgrade an existing bidi-only patch in place instead of no-op'ing - write <asar>.rtl-stamp = v<ver>:<size>:<mtimeMs> so the guard can tell whether the current asar is fully patched Plugin (src/desktop.ts): - new ensureDesktopPatch guard: probes writability (the asar is locked while the Desktop runs) and re-applies the patch on a slow timer, so it self-heals after every app update - new `desktop` option (default true); false leaves app files alone Tests: fix patch-engine test on Windows (path separator) and add font + version-marker assertions. Docs: README.md / README.en.md / README.ar.md — the only viable route is the asar patch (no plugin hook reaches the renderer), self-heal behavior, the `desktop` option and the Vazirmatn credit.
programmer-1998
added a commit
that referenced
this pull request
Oct 15, 2026
Owner
|
Thank you @sadegh19b! Merged. Great work — the embedded Vazirmatn, the version-aware upgrade, and especially the self-heal guard solve the biggest pain point of the desktop patch (re-applying after every auto-update). I did a full review: all 19 tests pass, no security concerns. Small touch-ups on top: removed a stray candidate path, fixed the Windows default path in all three READMEs, and credited you in the fa/en READMEs. Thanks again for the contribution! 🙏 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
@font-faceand overrides--font-family-sanswith!important(the app sets that variable inline, so!importantis required to win).--font-family-monois left untouched, so code / diffs / shell output stay monospace.data-rtl-version="N"; the engine strips a previous patch and re-injects it, so an existing bidi-only patch is upgraded in place instead of being treated as "already patched".<asar>.rtl-stamp(v<version>:<size>:<mtimeMs>) records the patched state and invalidates stale stamps.src/desktop.ts,ensureDesktopPatch). Becauseapp.asaris locked while the Desktop runs, the guard probes writability first and only patches when the app is closed, retrying on a slow timer - so the fix is re-applied automatically after every Desktop auto-update. Wired into the v1 server/CLI plugins and the v2 server/CLI plugins.desktopoption (defaulttrue) to opt out of touching app files at all.Why
No plugin hook reaches the Desktop renderer (server hooks are server-side, the CLI plugin is terminal-only, and the "GUI extensions" system is dev-builds-only in the released app), so patching
app.asaris the only route. This change keeps that patch applied across updates and gives the UI a proper Persian/Arabic font with no system font install and no network.Test
npm test-> 19/19 (build + core + patch-engine).Notes
nodeto run the engine).patch/fonts/Vazirmatn-Variable.woff2is SIL OFL 1.1;patch/fonts/OFL.txtis included.