13 Commits
Author SHA1 Message Date
poli0981andClaude Opus 4.8 b1d461a18e fix(android): open external links via opener plugin (shell.open broke on Android) (#105)
The v1.7.2 global link interceptor routed external URLs through
`@tauri-apps/plugin-shell`'s `open()`, but that throws on Android:
"Scoped shell IO error: No such file or directory (os error 2)" — the
shell plugin has no native URL handler on mobile, so every tapped link
did nothing. (The earlier ConsentGate per-link shell.open from #98 had
the same flaw; it was simply never tap-tested on Android.)

Switch to `@tauri-apps/plugin-opener`'s `openUrl()`, whose `open_url` has
a real cfg(mobile) split that routes to the native Intent.ACTION_VIEW
handler. Plain `openUrl(url)` — no inAppBrowser (that option regressed
os-error-2 on Android 16, plugins-workspace#2913).

Wiring: tauri-plugin-opener crate + init, @tauri-apps/plugin-opener npm,
"opener:default" capability (its allow-open-url permits any URL). Shell
plugin removed entirely (openExternal was its only consumer) — also from
vite optimizeDeps, knip ignore, and the THIRD-PARTY/TAURI-NOTES docs.

Verified on emulator API 33 (Android 13, WebView Chromium 109): tapping
the consent-gate License link and footer X link both fire ActivityManager
START ACTION_VIEW and open Chrome; no shell error.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 18:58:28 +07:00
poli0981andClaude Opus 4.8 4370e36628 fix(android): open external links via system browser + release v1.7.2 (#103)
Tapping any external link did nothing on the Android build: Tauri's
WebView (Android especially) silently ignores `target="_blank"`, so the
plain anchors in Header, Footer and About never opened. Only ConsentGate
had a per-link workaround (PR #98).

Replace that with one app-wide delegated click interceptor
(`useExternalLinkInterceptor`, mounted at the App root): when `isTauri()`
it catches clicks on any `a[href^=http]` and hands the URL to the system
browser via `openExternal()` / plugin-shell. The web build is untouched —
the listener is gated behind `isTauri()` so it is never installed there,
and in-app router links keep relative hrefs so they aren't intercepted
(reads `getAttribute('href')`, not the absolutising `.href` property).

Removes the now-redundant onClick handler from ConsentGate.

No Tauri/Rust/manifest/CSP changes were needed — shell:allow-open and
plugin-shell were already correct (ConsentGate proved it on Android).

Bumps version to 1.7.2 (Android versionCode 10702).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 18:12:43 +07:00
poli0981andClaude Opus 4.8 839bffd000 chore(release): v1.7.1 — Android legal gate + file-load toast fixes (#100)
Bump version to 1.7.1 across package.json, lockfiles, Cargo.toml, and
tauri.conf.json (android versionCode 10700 -> 10701), and add the CHANGELOG
entry for the Android fix round (#98).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 16:28:00 +07:00
poli0981andClaude Opus 4.8 27e704fe4f fix(android): show legal gate on first launch + clean file-load toast (#98)
The Android sideload APK never showed the consent gate and the file-load
toast surfaced opaque content-URI document ids:

1. Legal gate: `consentStore` skipped the gate for ALL Tauri builds, justified
   by the desktop installer's license page — which the sideload APK doesn't
   have, so Android users never saw or accepted the terms. Add a build-time
   `__IS_ANDROID_BUILD__` define (`TAURI_ENV_PLATFORM === 'android'`) and gate
   only on desktop Tauri (`__IS_TAURI_BUILD__ && !__IS_ANDROID_BUILD__`); Android
   now shows the gate like the web build. Acceptance persists in the Android
   WebView's localStorage, so it asks only once.

2. Legal links: add an `openExternal()` helper that routes through
   `@tauri-apps/plugin-shell` inside Tauri (web keeps `window.open`), and wire
   the gate's License/Terms/Privacy/Disclaimer links to it — plain
   `target="_blank"` is swallowed by the Android WebView.

3. File-load toast: when the picked name has no usable extension (opaque Android
   content URIs like `msf:1000000123`), fall back to a count-based
   "N file(s) loaded" via new `toast.files_loaded` keys; keep the clean
   "Loaded <name>" when a real filename is available. Desktop/web are unchanged.

Also reword `consent.intro` "in your browser" -> "on your device" (accurate on
the native app). typecheck / lint / 215 tests / web build all green; verified on
the Android emulator (gate shows once, links open the system browser, toast).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 16:23:07 +07:00
dependabot[bot] db11ce0f6e build(deps): Bump actions/github-script from 7 to 9 (#81)
Bumps [actions/github-script](https://github.com/actions/github-script) from 7 to 9.
- [Release notes](https://github.com/actions/github-script/releases)
- [Commits](https://github.com/actions/github-script/compare/v7...v9)

---
updated-dependencies:
- dependency-name: actions/github-script
  dependency-version: '9'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-16 15:18:01 +07:00
poli0981andClaude Opus 4.8 8bbecd14bd docs(android): add System Requirements (WebView/Android/RAM/storage) (#95)
Add a "System requirements" table to the README Android section (EN + VI):
Android 12+ (API 31), Android System WebView Chromium 111+, supported ABIs,
RAM, storage, and offline/no-network note — with guidance to update WebView
if the UI looks broken. Refresh the now-stale Android testing note in
docs/pc_spec.md (EN + VI) to reflect emulator-based build + smoke testing.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 14:57:37 +07:00
poli0981andClaude Opus 4.8 5249f92c10 chore(release): v1.7.0 — Android sideload APK (Tauri 2, Android 12+) (#92)
Bump version 1.6.1 -> 1.7.0 (Android versionCode 10700) and document the
release. Highlights: signed universal Android APK (minSdk 31), self-hosted
fonts for full offline rendering, robust SAF content-URI file open. See
CHANGELOG.md for details.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-16 14:01:31 +07:00
poli0981andClaude Opus 4.8 40c8c81028 feat(android): build & package a sideloadable APK (Tauri 2, Android 12+) (#90)
Add an Android target alongside the desktop bundles. Users download a signed
universal .apk and sideload it; minSdk 31 blocks Android < 12 at install time.

- tauri.conf.json: bundle.android (minSdkVersion 31, versionCode 10601)
- commit the generated src-tauri/gen/android Gradle project (source only; build
  outputs + keystore stay gitignored) with release signing wired from a
  gitignored keystore.properties (graceful unsigned fallback when absent)
- self-host fonts via @fontsource (drop Google Fonts <link>, tighten CSP) so the
  app renders fully offline
- robust native file open: basenameFromPath() recovers a filename from Android
  content:// URIs; the native-open path filters extensions leniently so opaque
  MediaStore URIs the dialog already vetted are not wrongly rejected
- npm scripts tauri:android:{init,dev,build}; android job in release.yml signs
  from secrets and uploads the APK to the same draft release
- docs: README/README.vi Android sections, TAURI-NOTES maintainer notes (incl.
  the WebView Chromium >= 111 requirement), ROADMAP phase 7

Validated on emulators: signed APK installs on Android 12+, blocked on API < 31
(INSTALL_FAILED_OLDER_SDK), launches, renders, runs converters, reads files via
the SAF picker, fully offline. New unit tests for basenameFromPath + lenient
filterByExtension; full gate green (format/typecheck/lint/knip/215 tests).

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-15 22:54:34 +07:00
poli0981andClaude Opus 4.8 2c2f8ca7ec ci(release): create the draft release once to stop duplicate-draft race (#79)
Each matrix platform ran tauri-action's find-or-create-release
concurrently; with no release present yet they raced to create it,
yielding two draft releases that split the assets (Linux bundles in one,
macOS/Windows in the other). This was hit on the v1.6.1 release and had
to be reconciled by hand.

Add a `create-release` job that makes the draft release once and outputs
its id; the build matrix now `needs` it and uploads via `releaseId`
instead of each job finding/creating its own. One release, all platforms'
bundles together. The maintainer still un-drafts manually.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 22:26:46 +07:00
poli0981andClaude Opus 4.8 3657e21f11 chore(release): v1.6.1 — CodeMirror chunk split + web source-map removal (#76)
Patch release bundling the build-only changes since 1.6.0:
- Split the CodeMirror core chunk (cm-view + cm-core) so no chunk trips
  Vite's 500 kB warning; migrated to Rolldown advancedChunks (#74).
- Stopped shipping source maps on the public web build (#72).
- 27 grouped npm minor/patch dependency updates (#67).

Bumps package.json, package-lock.json, src-tauri/Cargo.toml,
src-tauri/Cargo.lock, src-tauri/tauri.conf.json to 1.6.1 and moves the
CHANGELOG [Unreleased] section to [1.6.1].

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 21:59:53 +07:00
poli0981andClaude Opus 4.8 3d424f7c0b perf(build): split CodeMirror core chunk to clear 500 kB warning (#74)
Migrate vite.config.ts chunking from the deprecated manualChunks
function form to advancedChunks.groups. Rolldown's optimizer silently
re-merged manualChunks sub-chunks, so a cm-core split was ignored.

Split the ~614 kB cm-core into cm-view (~245 kB, the @codemirror/view
engine) + cm-core (~362 kB, state/language/lezer/@uiw); cm-langs is
unchanged (~60 kB). No chunk now exceeds Vite's 500 kB warning limit.
Same total/gzip bytes — the editor still loads all three behind its
existing React.lazy boundary, so this is finer file granularity for
better cross-deploy caching. No converter or UI behavior changed.

Verified: clean build (no warning), 209 tests pass, production preview
renders/highlights/converts with all cm-* chunks 200 OK, no console errors.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 21:44:18 +07:00
poli0981andClaude Opus 4.8 29eace4302 fix(build): stop shipping source maps on the public web build (#72)
The web production build emitted .js.map files into dist/, and deploy.yml
uploads the whole dist/ to GitHub Pages — exposing full original source via
DevTools on the public site. Nothing consumes the maps (PRIVACY.md: no remote
error reporting), so gate them to local non-production web builds only; prod
web and Tauri now emit none.

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-14 21:06:53 +07:00
dependabot[bot] 4c25ea1c07 build(deps): Bump the npm-minor-patch group across 1 directory with 27 updates (#67)
Bumps the npm-minor-patch group with 24 updates in the / directory:

| Package | From | To |
| --- | --- | --- |
| [@codemirror/legacy-modes](https://github.com/codemirror/legacy-modes) | `6.5.2` | `6.5.3` |
| [@codemirror/lint](https://github.com/codemirror/lint) | `6.9.6` | `6.9.7` |
| [@codemirror/view](https://github.com/codemirror/view) | `6.42.1` | `6.43.1` |
| [@radix-ui/react-dialog](https://github.com/radix-ui/primitives/tree/HEAD/packages/react/dialog) | `1.1.15` | `1.1.16` |
| [@radix-ui/react-switch](https://github.com/radix-ui/primitives/tree/HEAD/packages/react/switch) | `1.2.6` | `1.3.0` |
| [@radix-ui/react-tabs](https://github.com/radix-ui/primitives/tree/HEAD/packages/react/tabs) | `1.1.13` | `1.1.14` |
| [@uiw/react-codemirror](https://github.com/uiwjs/react-codemirror) | `4.25.9` | `4.25.10` |
| [fflate](https://github.com/101arrowz/fflate) | `0.8.2` | `0.8.3` |
| [js-yaml](https://github.com/nodeca/js-yaml) | `4.1.1` | `4.2.0` |
| [react](https://github.com/facebook/react/tree/HEAD/packages/react) | `19.2.6` | `19.2.7` |
| [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react) | `19.2.14` | `19.2.17` |
| [react-dom](https://github.com/facebook/react/tree/HEAD/packages/react-dom) | `19.2.6` | `19.2.7` |
| [react-router-dom](https://github.com/remix-run/react-router/tree/HEAD/packages/react-router-dom) | `7.15.0` | `7.17.0` |
| [zustand](https://github.com/pmndrs/zustand) | `5.0.13` | `5.0.14` |
| [@tailwindcss/vite](https://github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-vite) | `4.3.0` | `4.3.1` |
| [@tauri-apps/cli](https://github.com/tauri-apps/tauri) | `2.11.1` | `2.11.2` |
| [@vitejs/plugin-react](https://github.com/vitejs/vite-plugin-react/tree/HEAD/packages/plugin-react) | `6.0.1` | `6.0.2` |
| [@vitest/coverage-v8](https://github.com/vitest-dev/vitest/tree/HEAD/packages/coverage-v8) | `4.1.6` | `4.1.8` |
| [eslint-plugin-react-refresh](https://github.com/ArnaudBarre/eslint-plugin-react-refresh) | `0.4.26` | `0.5.2` |
| [knip](https://github.com/webpro-nl/knip/tree/HEAD/packages/knip) | `6.14.1` | `6.16.1` |
| [prettier](https://github.com/prettier/prettier) | `3.8.3` | `3.8.4` |
| [prettier-plugin-tailwindcss](https://github.com/tailwindlabs/prettier-plugin-tailwindcss) | `0.6.14` | `0.8.0` |
| [typescript-eslint](https://github.com/typescript-eslint/typescript-eslint/tree/HEAD/packages/typescript-eslint) | `8.59.3` | `8.61.0` |
| [vite](https://github.com/vitejs/vite/tree/HEAD/packages/vite) | `8.0.12` | `8.0.16` |



Updates `@codemirror/legacy-modes` from 6.5.2 to 6.5.3
- [Changelog](https://github.com/codemirror/legacy-modes/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/legacy-modes/commits)

Updates `@codemirror/lint` from 6.9.6 to 6.9.7
- [Changelog](https://github.com/codemirror/lint/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/lint/commits)

Updates `@codemirror/view` from 6.42.1 to 6.43.1
- [Changelog](https://github.com/codemirror/view/blob/main/CHANGELOG.md)
- [Commits](https://github.com/codemirror/view/commits)

Updates `@radix-ui/react-dialog` from 1.1.15 to 1.1.16
- [Changelog](https://github.com/radix-ui/primitives/blob/main/packages/react/dialog/CHANGELOG.md)
- [Commits](https://github.com/radix-ui/primitives/commits/HEAD/packages/react/dialog)

Updates `@radix-ui/react-slot` from 1.2.4 to 1.2.5
- [Changelog](https://github.com/radix-ui/primitives/blob/main/packages/react/slot/CHANGELOG.md)
- [Commits](https://github.com/radix-ui/primitives/commits/HEAD/packages/react/slot)

Updates `@radix-ui/react-switch` from 1.2.6 to 1.3.0
- [Changelog](https://github.com/radix-ui/primitives/blob/main/packages/react/switch/CHANGELOG.md)
- [Commits](https://github.com/radix-ui/primitives/commits/HEAD/packages/react/switch)

Updates `@radix-ui/react-tabs` from 1.1.13 to 1.1.14
- [Changelog](https://github.com/radix-ui/primitives/blob/main/packages/react/tabs/CHANGELOG.md)
- [Commits](https://github.com/radix-ui/primitives/commits/HEAD/packages/react/tabs)

Updates `@uiw/react-codemirror` from 4.25.9 to 4.25.10
- [Release notes](https://github.com/uiwjs/react-codemirror/releases)
- [Commits](https://github.com/uiwjs/react-codemirror/compare/v4.25.9...v4.25.10)

Updates `fflate` from 0.8.2 to 0.8.3
- [Release notes](https://github.com/101arrowz/fflate/releases)
- [Changelog](https://github.com/101arrowz/fflate/blob/master/CHANGELOG.md)
- [Commits](https://github.com/101arrowz/fflate/compare/v0.8.2...v0.8.3)

Updates `js-yaml` from 4.1.1 to 4.2.0
- [Changelog](https://github.com/nodeca/js-yaml/blob/master/CHANGELOG.md)
- [Commits](https://github.com/nodeca/js-yaml/commits)

Updates `react` from 19.2.6 to 19.2.7
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v19.2.7/packages/react)

Updates `@types/react` from 19.2.14 to 19.2.17
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Updates `react-dom` from 19.2.6 to 19.2.7
- [Release notes](https://github.com/facebook/react/releases)
- [Changelog](https://github.com/react/react/blob/main/CHANGELOG.md)
- [Commits](https://github.com/facebook/react/commits/v19.2.7/packages/react-dom)

Updates `react-router-dom` from 7.15.0 to 7.17.0
- [Release notes](https://github.com/remix-run/react-router/releases)
- [Changelog](https://github.com/remix-run/react-router/blob/main/packages/react-router-dom/CHANGELOG.md)
- [Commits](https://github.com/remix-run/react-router/commits/react-router-dom@7.17.0/packages/react-router-dom)

Updates `zustand` from 5.0.13 to 5.0.14
- [Release notes](https://github.com/pmndrs/zustand/releases)
- [Commits](https://github.com/pmndrs/zustand/compare/v5.0.13...v5.0.14)

Updates `@tailwindcss/vite` from 4.3.0 to 4.3.1
- [Release notes](https://github.com/tailwindlabs/tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/tailwindcss/commits/v4.3.1/packages/@tailwindcss-vite)

Updates `@tauri-apps/cli` from 2.11.1 to 2.11.2
- [Release notes](https://github.com/tauri-apps/tauri/releases)
- [Commits](https://github.com/tauri-apps/tauri/compare/@tauri-apps/cli-v2.11.1...@tauri-apps/cli-v2.11.2)

Updates `@types/react` from 19.2.14 to 19.2.17
- [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases)
- [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react)

Updates `@vitejs/plugin-react` from 6.0.1 to 6.0.2
- [Release notes](https://github.com/vitejs/vite-plugin-react/releases)
- [Changelog](https://github.com/vitejs/vite-plugin-react/blob/main/packages/plugin-react/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite-plugin-react/commits/plugin-react@6.0.2/packages/plugin-react)

Updates `@vitest/coverage-v8` from 4.1.6 to 4.1.8
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.8/packages/coverage-v8)

Updates `eslint-plugin-react-refresh` from 0.4.26 to 0.5.2
- [Release notes](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/releases)
- [Changelog](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/blob/main/CHANGELOG.md)
- [Commits](https://github.com/ArnaudBarre/eslint-plugin-react-refresh/compare/v0.4.26...v0.5.2)

Updates `knip` from 6.14.1 to 6.16.1
- [Release notes](https://github.com/webpro-nl/knip/releases)
- [Commits](https://github.com/webpro-nl/knip/commits/knip@6.16.1/packages/knip)

Updates `prettier` from 3.8.3 to 3.8.4
- [Release notes](https://github.com/prettier/prettier/releases)
- [Changelog](https://github.com/prettier/prettier/blob/main/CHANGELOG.md)
- [Commits](https://github.com/prettier/prettier/compare/3.8.3...3.8.4)

Updates `prettier-plugin-tailwindcss` from 0.6.14 to 0.8.0
- [Release notes](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/prettier-plugin-tailwindcss/compare/v0.6.14...v0.8.0)

Updates `tailwindcss` from 4.3.0 to 4.3.1
- [Release notes](https://github.com/tailwindlabs/tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/main/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/tailwindcss/commits/v4.3.1/packages/tailwindcss)

Updates `typescript-eslint` from 8.59.3 to 8.61.0
- [Release notes](https://github.com/typescript-eslint/typescript-eslint/releases)
- [Changelog](https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/typescript-eslint/CHANGELOG.md)
- [Commits](https://github.com/typescript-eslint/typescript-eslint/commits/v8.61.0/packages/typescript-eslint)

Updates `vite` from 8.0.12 to 8.0.16
- [Release notes](https://github.com/vitejs/vite/releases)
- [Changelog](https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md)
- [Commits](https://github.com/vitejs/vite/commits/v8.0.16/packages/vite)

Updates `vitest` from 4.1.6 to 4.1.8
- [Release notes](https://github.com/vitest-dev/vitest/releases)
- [Changelog](https://github.com/vitest-dev/vitest/blob/main/docs/releases.md)
- [Commits](https://github.com/vitest-dev/vitest/commits/v4.1.8/packages/vitest)

---
updated-dependencies:
- dependency-name: "@codemirror/legacy-modes"
  dependency-version: 6.5.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@codemirror/lint"
  dependency-version: 6.9.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@codemirror/view"
  dependency-version: 6.43.1
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: "@radix-ui/react-dialog"
  dependency-version: 1.1.16
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@radix-ui/react-slot"
  dependency-version: 1.2.5
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@radix-ui/react-switch"
  dependency-version: 1.3.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: "@radix-ui/react-tabs"
  dependency-version: 1.1.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@uiw/react-codemirror"
  dependency-version: 4.25.10
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: fflate
  dependency-version: 0.8.3
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: js-yaml
  dependency-version: 4.2.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: react
  dependency-version: 19.2.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@types/react"
  dependency-version: 19.2.17
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: react-dom
  dependency-version: 19.2.7
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: react-router-dom
  dependency-version: 7.17.0
  dependency-type: direct:production
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: zustand
  dependency-version: 5.0.14
  dependency-type: direct:production
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@tailwindcss/vite"
  dependency-version: 4.3.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@tauri-apps/cli"
  dependency-version: 2.11.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@types/react"
  dependency-version: 19.2.17
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@vitejs/plugin-react"
  dependency-version: 6.0.2
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: "@vitest/coverage-v8"
  dependency-version: 4.1.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: eslint-plugin-react-refresh
  dependency-version: 0.5.2
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: knip
  dependency-version: 6.16.1
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: prettier
  dependency-version: 3.8.4
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: prettier-plugin-tailwindcss
  dependency-version: 0.8.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: tailwindcss
  dependency-version: 4.3.1
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: typescript-eslint
  dependency-version: 8.61.0
  dependency-type: direct:development
  update-type: version-update:semver-minor
  dependency-group: npm-minor-patch
- dependency-name: vite
  dependency-version: 8.0.16
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
- dependency-name: vitest
  dependency-version: 4.1.8
  dependency-type: direct:development
  update-type: version-update:semver-patch
  dependency-group: npm-minor-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2026-06-14 17:53:33 +07:00
64 changed files with 2600 additions and 1140 deletions

No files matched your search

+140 -9
View File
@@ -10,8 +10,44 @@ permissions:
contents: write
jobs:
# Create the draft release ONCE, up front, so every platform in the matrix
# below uploads into the same release. Previously each matrix job ran
# tauri-action's "find or create release" concurrently; with no release yet,
# they raced to create it and produced duplicate drafts that split the assets
# (Linux bundles in one draft, macOS/Windows in another). A single
# pre-created release referenced by `releaseId` removes the race.
create-release:
name: Create draft release
runs-on: ubuntu-latest
outputs:
release_id: ${{ steps.create-release.outputs.result }}
steps:
- name: Create draft release
id: create-release
uses: actions/github-script@v9
with:
script: |
const tag = context.ref.replace('refs/tags/', '').replace('refs/heads/', '');
const { data } = await github.rest.repos.createRelease({
owner: context.repo.owner,
repo: context.repo.repo,
tag_name: tag,
name: `JSONPrism ${tag}`,
body: [
'Native desktop builds for Windows, macOS, and Linux, plus an Android APK (sideload, Android 12+).',
'',
'Android: download the `.apk`, then enable "install unknown apps" for your browser/file manager to sideload.',
'',
'See the [CHANGELOG](https://github.com/poli0981/jsonPrism/blob/main/CHANGELOG.md) for details.',
].join('\n'),
draft: true,
prerelease: false,
});
return data.id;
build:
name: Build · ${{ matrix.platform.name }}
needs: create-release
runs-on: ${{ matrix.platform.runner }}
timeout-minutes: 40
@@ -74,17 +110,112 @@ jobs:
run: npm run tauri:icon
shell: pwsh
- name: Build, sign, and create release
- name: Build, sign, and upload to release
uses: tauri-apps/tauri-action@v0
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tagName: ${{ github.ref_name }}
releaseName: 'JSONPrism ${{ github.ref_name }}'
releaseBody: |
Native desktop builds for Windows, macOS, and Linux.
See the [CHANGELOG](https://github.com/poli0981/jsonPrism/blob/main/CHANGELOG.md) for what's new.
releaseDraft: true
prerelease: false
# Upload into the single draft created by the create-release job above
# instead of finding/creating one per matrix job (which caused
# duplicate drafts + split assets). The maintainer un-drafts manually.
releaseId: ${{ needs.create-release.outputs.release_id }}
args: ${{ matrix.platform.args }}
# Android is built separately: tauri-action does not build mobile targets, so
# this job drives the Tauri CLI directly (Java + Android SDK/NDK + Rust android
# targets), signs with the release keystore from secrets, and uploads the
# universal APK into the same draft release as the desktop bundles.
#
# Requires these repository secrets (see docs/TAURI-NOTES.md):
# ANDROID_KEYSTORE_BASE64 base64 of upload-keystore.jks
# ANDROID_KEYSTORE_PASSWORD the keystore (store) password
# ANDROID_KEY_PASSWORD the key password (optional; defaults to store password)
# ANDROID_KEY_ALIAS the key alias (optional; defaults to "upload")
android:
name: Build · Android (APK)
needs: create-release
runs-on: ubuntu-latest
timeout-minutes: 40
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Java 17
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: '17'
- name: Setup Android SDK
uses: android-actions/setup-android@v3
- name: Install SDK platform + NDK
run: |
sdkmanager "platforms;android-36" "ndk;27.2.12479018"
echo "NDK_HOME=$ANDROID_HOME/ndk/27.2.12479018" >> "$GITHUB_ENV"
- name: Setup Rust (stable) + Android targets
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-linux-android,armv7-linux-androideabi,i686-linux-android,x86_64-linux-android
- name: Cache Cargo build artifacts
uses: swatinem/rust-cache@v2
with:
workspaces: './src-tauri -> target'
key: android
- name: Setup Node 22
uses: actions/setup-node@v6
with:
node-version: 22.x
cache: npm
- name: Install npm dependencies
run: npm ci --no-audit --no-fund
- name: Generate icons
run: npm run tauri:icon
- name: Decode release keystore
env:
ANDROID_KEYSTORE_BASE64: ${{ secrets.ANDROID_KEYSTORE_BASE64 }}
ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
ANDROID_KEY_PASSWORD: ${{ secrets.ANDROID_KEY_PASSWORD }}
ANDROID_KEY_ALIAS: ${{ secrets.ANDROID_KEY_ALIAS }}
run: |
if [ -z "$ANDROID_KEYSTORE_BASE64" ]; then
echo "::error::ANDROID_KEYSTORE_BASE64 secret is not set — cannot sign the release APK."
exit 1
fi
KEYSTORE_PATH="$RUNNER_TEMP/upload-keystore.jks"
echo "$ANDROID_KEYSTORE_BASE64" | base64 -d > "$KEYSTORE_PATH"
{
echo "storePassword=$ANDROID_KEYSTORE_PASSWORD"
echo "keyPassword=${ANDROID_KEY_PASSWORD:-$ANDROID_KEYSTORE_PASSWORD}"
echo "keyAlias=${ANDROID_KEY_ALIAS:-upload}"
echo "storeFile=$KEYSTORE_PATH"
} > src-tauri/gen/android/keystore.properties
- name: Build signed universal APK
run: npm run tauri -- android build --apk
- name: Upload APK to release
uses: actions/github-script@v9
with:
script: |
const fs = require('fs');
const tag = context.ref.replace('refs/tags/', '').replace('refs/heads/', '');
const dir = 'src-tauri/gen/android/app/build/outputs/apk/universal/release';
const apks = fs.readdirSync(dir).filter((f) => f.endsWith('.apk'));
if (apks.length === 0) throw new Error(`No APK found in ${dir}`);
const src = `${dir}/${apks[0]}`;
const name = `JSONPrism-${tag}-android-universal.apk`;
await github.rest.repos.uploadReleaseAsset({
owner: context.repo.owner,
repo: context.repo.repo,
release_id: ${{ needs.create-release.outputs.release_id }},
name,
data: fs.readFileSync(src),
});
core.info(`Uploaded ${name} from ${src}`);
+7 -1
View File
@@ -32,13 +32,19 @@ dist-ssr
# Tauri (Phase 2C)
src-tauri/target
src-tauri/gen
# gen/android is committed (source). Build outputs inside it are ignored by its own
# nested .gitignore files. Only the generated JSON schemas are ignored here.
src-tauri/gen/schemas
src-tauri/icons/*.png
src-tauri/icons/*.ico
src-tauri/icons/*.icns
src-tauri/icons/android/
src-tauri/icons/ios/
# Android signing keystore — never commit the keystore binary.
*.jks
*.keystore
# Test artifacts
coverage
.nyc_output
+36
View File
@@ -8,6 +8,42 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and
No unreleased changes at this time. Future work tracked in `docs/ROADMAP.md` under "Beyond".
## [1.7.1] — 2026-06-16
### Fixed
- **First-launch legal gate now appears on the Android app.** The consent gate (added in 1.6.0) was skipped on *every* Tauri build — correct for desktop, where the installer's license page already gates acceptance, but the Android sideload APK has no installer step, so Android users never saw or accepted the License / Terms / Privacy / Disclaimer. A new build-time `__IS_ANDROID_BUILD__` define (`TAURI_ENV_PLATFORM === 'android'`, mirrored as `false` in `vitest.config.ts` so tests still run) makes the gate skip **only** on desktop (`__IS_TAURI_BUILD__ && !__IS_ANDROID_BUILD__`); Android and web both show it. Acceptance persists in the WebView's `localStorage` like the web build, so it asks once. The gate's links also gained an `openExternal()` helper (`src/lib/tauri.ts`) that routes through `@tauri-apps/plugin-shell` inside Tauri — the Android WebView swallows plain `target="_blank"`, so the legal links were previously unreachable there. The intro copy now reads "runs entirely on your device" (was "in your browser", inaccurate on the native app).
- **File-load toast no longer shows opaque Android document ids.** Android's Storage Access Framework often returns a `content://` URI whose document id carries no real filename (e.g. `msf:1000000123`), so the native-open success toast read "Loaded 1000000123". It now falls back to a count-based "N file(s) loaded" message (new `toast.files_loaded` keys, EN + VI) when the picked name has no usable extension, and keeps the clean "Loaded <name>" when a real filename is available. Desktop and web are unchanged. `bundle.android.versionCode` bumps to 10701 (`1.7.1` → `MAJOR*10000 + MINOR*100 + PATCH`).
## [1.7.0] — 2026-06-16
### Added
- **Android app (sideload APK).** JSONPrism now ships as an Android app built with Tauri 2 — download a signed **universal `.apk`** from Releases and sideload it. **Requires Android 12 (API 31) or newer**; the OS refuses to install on older versions (`bundle.android.minSdkVersion = 31`, verified: `INSTALL_FAILED_OLDER_SDK` on API 24). The same React UI runs in the Android System WebView, with the native Storage Access Framework file picker wired into the existing open/batch flows via `plugin-dialog` + `plugin-fs` (no behavior change to the converters). The generated Gradle project lives in `src-tauri/gen/android/` (committed — source only; build outputs + signing material gitignored); release signing reads a gitignored `keystore.properties` with a graceful unsigned fallback. New `npm run tauri:android:{init,dev,build}` scripts, and an `android` job in `.github/workflows/release.yml` builds + signs the APK and attaches it to the same draft release as the desktop bundles. `bundle.android.versionCode` is derived from the version as `MAJOR*10000 + MINOR*100 + PATCH` (1.7.0 → 10700). **Note:** the layout needs a WebView of **Chromium ≥ 111** (an existing Tailwind v4 requirement) — current Android 12+ devices satisfy this via the Play-updated System WebView; see `docs/TAURI-NOTES.md`.
### Changed
- **Self-hosted fonts (offline-ready).** Geist, Instrument Serif, and JetBrains Mono are now bundled via `@fontsource` (imported in `src/main.tsx`) instead of fetched from Google Fonts. The `<link>` tags are gone and the CSP no longer allows `fonts.googleapis.com` / `fonts.gstatic.com`, so the app renders with the correct fonts **fully offline** — required for the sideloaded Android build and a privacy win for the web build. CJK still falls back to system fonts as before.
- **Robust native file open on Android.** `fileFromNativePath()` recovers a usable filename from Android `content://` URIs via a new `basenameFromPath()` helper, and the native-open path filters extensions leniently so opaque MediaStore document URIs — which carry no filename — that the user explicitly picked through the native dialog are no longer wrongly rejected. Desktop and web drag-drop behavior is unchanged.
### Tests
- **+6 unit tests (215 total).** New coverage for `basenameFromPath` (desktop paths, `content://` `raw:` + `msf:` URIs, malformed escapes) and the lenient `filterByExtension` mode. Format / typecheck / lint / `knip` / tests all green. The signed APK was validated on emulators: installs on Android 12+, blocked on API < 31, launches, renders (CodeMirror + self-hosted fonts), runs converters, reads files via the SAF picker, fully offline.
## [1.6.1] — 2026-06-14
### Changed
- **Split the CodeMirror core chunk to clear the 500 kB build warning.** The `cm-core` chunk was ~614 kB raw (210 kB gzip) and tripped Vite's `chunkSizeWarningLimit` on every build, even though it is already lazy-loaded behind the editor. Vite 8 / Rolldown deprecates the `manualChunks` function form (its optimizer silently merged sub-chunks back together), so `vite.config.ts` now uses `advancedChunks.groups` with explicit `priority`-ordered, honored boundaries. The CodeMirror core splits into `cm-view` (~245 kB, the `@codemirror/view` DOM engine) + `cm-core` (~362 kB, state/language/lezer/`@uiw` wrapper); `cm-langs` is unchanged (~60 kB). No chunk now exceeds 500 kB. Total bytes and gzip size are unchanged — the editor still loads all three pieces together behind its existing `React.lazy` boundary, so this is purely finer file granularity (better cache reuse across deploys). No converter or UI behavior changed; verified in a production preview build (editor renders, highlights, and converts; all `cm-*` chunks 200 OK, no console errors).
### Fixed
- **Stop shipping source maps on the public web build.** `vite.config.ts` now emits source maps only for local non-production web builds (`sourcemap: !isTauriContext && mode !== 'production'`) — never for the GitHub Pages deploy or Tauri bundles. The entire `dist/` is uploaded to Pages, so earlier production builds exposed the full original source via `.map` files even though nothing consumes them (`PRIVACY.md`: no remote error reporting). Smaller deploy, no source exposure.
### Dependencies
- **27 npm minor/patch updates** (the grouped `npm-minor-patch` Dependabot bump).
## [1.6.0] — 2026-06-14
### Added
+48
View File
@@ -105,6 +105,54 @@ Output:
**Automated releases**: pushing a `v*` tag triggers `.github/workflows/release.yml`, which builds for all platforms in parallel and creates a draft GitHub release.
## Android app (Tauri 2)
JSONPrism also ships as an Android app you sideload from a `.apk`. Same React UI; native file picker via the dialog plugin. **Requires Android 12 (API 31) or newer** — the OS refuses to install it on older versions.
### System requirements
| Requirement | Detail |
| --- | --- |
| **Android version** | **12 (API 31)** or newer — older versions are blocked at install time (`INSTALL_FAILED_OLDER_SDK`) |
| **System WebView** | **Chromium 111+** (Android System WebView / Chrome). Kept current by the Play Store on most devices; a much older WebView renders the layout incorrectly — update "Android System WebView" and Chrome from the Play Store if the UI looks broken. |
| **CPU / ABI** | arm64-v8a, armeabi-v7a, x86, or x86_64 — the single universal APK runs on all of them (modern phones are arm64-v8a) |
| **RAM** | 2 GB minimum; 4 GB recommended for large or batch (up to 500 files) conversions |
| **Storage** | ~27 MB to download; ~100 MB free recommended (install + temporary working files) |
| **Network** | None — the app runs fully offline and sends nothing off the device |
### Install (users)
1. Download `JSONPrism-<version>-android-universal.apk` from the [Releases](https://github.com/poli0981/jsonPrism/releases) page.
2. Open it; Android will ask you to allow "install unknown apps" for your browser/file manager — enable it, then install.
3. Needs Android 12+. The app runs fully offline.
### Build (developers)
**Additional requirements** (on top of the desktop Rust toolchain):
- **Android Studio** with SDK Platform **31+**, Build-Tools, Platform-Tools, Command-line Tools, and an **NDK**
- **JDK** — the JBR bundled with Android Studio is fine
- Environment variables: `JAVA_HOME`, `ANDROID_HOME`, `NDK_HOME` (see [`docs/TAURI-NOTES.md`](docs/TAURI-NOTES.md))
- Rust Android targets: `rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android`
The Android Gradle project lives in `src-tauri/gen/android/` and is committed. You do **not** need to run `tauri android init` for a normal build.
**Run on a device/emulator** (Android 12+):
```bash
npm run tauri:android:dev
```
**Build a universal release APK**:
```bash
npm run tauri:android:build
```
Output: `src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk`. Release signing is read from `src-tauri/gen/android/keystore.properties` (gitignored); without it the APK builds unsigned. See [`docs/TAURI-NOTES.md`](docs/TAURI-NOTES.md) for keystore setup and the CI signing secrets.
**Automated releases**: the same `v*` tag also runs the `android` job in `release.yml`, which signs the APK with the keystore from repository secrets and attaches it to the draft release.
### Scripts
| Script | What it does |
+48
View File
@@ -105,6 +105,54 @@ Output:
**Release tự động**: push tag `v*` sẽ trigger `.github/workflows/release.yml`, build cho tất cả platform song song và tạo draft GitHub release.
## Bản Android (Tauri 2)
JSONPrism còn có bản Android để bạn sideload từ file `.apk`. Cùng React UI; chọn file qua dialog native. **Yêu cầu Android 12 (API 31) trở lên** — máy cũ hơn sẽ bị hệ điều hành chặn cài.
### Yêu cầu hệ thống
| Yêu cầu | Chi tiết |
| --- | --- |
| **Phiên bản Android** | **12 (API 31)** trở lên — máy cũ hơn bị chặn ngay khi cài (`INSTALL_FAILED_OLDER_SDK`) |
| **System WebView** | **Chromium 111+** (Android System WebView / Chrome). Đa số máy được Play Store cập nhật sẵn; WebView quá cũ sẽ render giao diện sai — nếu UI bị vỡ, hãy cập nhật "Android System WebView" và Chrome trong Play Store. |
| **CPU / ABI** | arm64-v8a, armeabi-v7a, x86 hoặc x86_64 — một file APK universal chạy được trên tất cả (máy hiện đại là arm64-v8a) |
| **RAM** | Tối thiểu 2 GB; khuyến nghị 4 GB cho file lớn hoặc xử lý hàng loạt (tối đa 500 file) |
| **Dung lượng** | ~27 MB để tải; nên có ~100 MB trống (cài đặt + file tạm khi làm việc) |
| **Mạng** | Không cần — app chạy hoàn toàn offline, không gửi gì ra ngoài |
### Cài đặt (người dùng)
1. Tải `JSONPrism-<version>-android-universal.apk` từ trang [Releases](https://github.com/poli0981/jsonPrism/releases).
2. Mở file; Android sẽ hỏi cho phép "cài app không rõ nguồn" cho trình duyệt/trình quản lý file — bật lên rồi cài.
3. Cần Android 12+. App chạy hoàn toàn offline.
### Build (lập trình viên)
**Yêu cầu thêm** (ngoài Rust toolchain của bản desktop):
- **Android Studio** với SDK Platform **31+**, Build-Tools, Platform-Tools, Command-line Tools và một bản **NDK**
- **JDK** — dùng JBR đi kèm Android Studio là được
- Biến môi trường: `JAVA_HOME`, `ANDROID_HOME`, `NDK_HOME` (xem [`docs/TAURI-NOTES.md`](docs/TAURI-NOTES.md))
- Rust Android targets: `rustup target add aarch64-linux-android armv7-linux-androideabi i686-linux-android x86_64-linux-android`
Project Gradle nằm ở `src-tauri/gen/android/` và đã được commit. Bạn **không** cần chạy `tauri android init` cho build thường.
**Chạy trên thiết bị/emulator** (Android 12+):
```bash
npm run tauri:android:dev
```
**Build APK release universal**:
```bash
npm run tauri:android:build
```
Output: `src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk`. Thông tin ký lấy từ `src-tauri/gen/android/keystore.properties` (gitignored); thiếu file này thì APK build ra chưa ký. Xem [`docs/TAURI-NOTES.md`](docs/TAURI-NOTES.md) để biết cách tạo keystore và các secret ký trong CI.
**Release tự động**: cùng tag `v*` cũng chạy job `android` trong `release.yml`, ký APK bằng keystore từ repository secrets và đính vào draft release.
### Các script
| Script | Chức năng |
+2 -2
View File
@@ -84,8 +84,8 @@ installed as a runtime dependency.
| `@tauri-apps/api` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
| `@tauri-apps/plugin-dialog` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
| `@tauri-apps/plugin-fs` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
| `@tauri-apps/plugin-opener` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
| `@tauri-apps/plugin-os` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
| `@tauri-apps/plugin-shell` | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
| `@tauri-apps/cli` (devDep) | ^2.0.0 | Apache-2.0 OR MIT | [tauri.app](https://tauri.app/) |
### Rust crates (`src-tauri/Cargo.toml`)
@@ -96,8 +96,8 @@ installed as a runtime dependency.
| `tauri-build` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-build](https://crates.io/crates/tauri-build) |
| `tauri-plugin-dialog` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-dialog](https://crates.io/crates/tauri-plugin-dialog) |
| `tauri-plugin-fs` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-fs](https://crates.io/crates/tauri-plugin-fs) |
| `tauri-plugin-opener` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-opener](https://crates.io/crates/tauri-plugin-opener) |
| `tauri-plugin-os` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-os](https://crates.io/crates/tauri-plugin-os) |
| `tauri-plugin-shell` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-shell](https://crates.io/crates/tauri-plugin-shell) |
| `tauri-plugin-single-instance` | 2 | Apache-2.0 OR MIT | [crates.io/crates/tauri-plugin-single-instance](https://crates.io/crates/tauri-plugin-single-instance) |
| `serde` | 1 | Apache-2.0 OR MIT | [serde.rs](https://serde.rs/) |
| `serde_json` | 1 | Apache-2.0 OR MIT | [github.com/serde-rs/json](https://github.com/serde-rs/json) |
+28
View File
@@ -259,6 +259,34 @@ Compliance + reliability + first-paint performance. No converter behavior change
---
## Phase 7 — Android (sideload APK) 🔜
**Status**: in progress
Goal: ship JSONPrism as an Android app users sideload from a `.apk`. Same React UI, no behavior change to the converters. **Minimum Android 12 (API 31)** — older devices are blocked by the OS.
### Tasks
- [x] `bundle.android` in `tauri.conf.json`: `minSdkVersion: 31`, deterministic `versionCode` (`MAJOR*10000+MINOR*100+PATCH`)
- [x] `tauri android init` → Android Gradle project at `src-tauri/gen/android/`, **committed** (source only; build outputs + secrets gitignored via nested + root `.gitignore`)
- [x] Verified `minSdk = 31` propagated to `app/build.gradle.kts`; Rust compiles for all 4 ABIs (validated against NDK r27/r30)
- [x] Release signing wired in `app/build.gradle.kts` from a gitignored `keystore.properties` (graceful unsigned fallback when absent)
- [x] Self-hosted fonts via `@fontsource` (Geist / Instrument Serif / JetBrains Mono) — removed Google Fonts `<link>`, tightened CSP, app renders correctly **offline**
- [x] Local scripts: `tauri:android:init` / `tauri:android:dev` / `tauri:android:build` (universal APK; chains `tauri:icon`)
- [x] CI: `android` job in `release.yml` builds + signs (keystore from secrets) + uploads the universal APK to the same draft release
- [x] Docs: README / README.vi "Android" sections + maintainer notes in `docs/TAURI-NOTES.md`
- [x] Emulator-validated: signed APK installs on Android 12+, **blocked on API < 31** (`INSTALL_FAILED_OLDER_SDK`), launches, renders (CodeMirror + self-hosted fonts), runs converters, fully offline
- [x] Native file open works — `plugin-dialog` fires the SAF picker, `plugin-fs` reads the `content://` URI; `basenameFromPath()` recovers a clean filename (unit-tested)
- [x] Found: layout needs WebView **Chromium ≥ 111** (Tailwind v4); fine on updated Android 12+ devices, broken on the API 31 emulator's stock Chromium 91 — see `docs/TAURI-NOTES.md`
- [ ] Add CI signing secrets (`ANDROID_KEYSTORE_BASE64`, `ANDROID_KEYSTORE_PASSWORD`, …) — maintainer action
- [ ] Remaining manual checks: save `.zip` via SAF, all 12 converters end-to-end, theme + 4 locales, upgrade-in-place on a real device
### Deliverable
A signed universal `.apk` attached to each GitHub release, installable on Android 12+. Same converter feature set as web/desktop, fully offline.
---
## Beyond — Ideas (no commitment)
- **JSON → Excel (.xlsx)** via SheetJS — possible if Markdown/CSV doesn't cover the use case
+157 -4
View File
@@ -15,8 +15,8 @@ process from outliving the main webview:
any spawned shell children (none today, but the hook is in place) are
signaled before the process exits.
If you ever add long-running spawned commands (e.g. via `tauri_plugin_shell`),
remember to track their handles and kill them in the same hook.
If you ever add long-running spawned commands (e.g. via a shell/command
plugin), remember to track their handles and kill them in the same hook.
## WebView2 GDI leak (Windows, upstream)
@@ -45,8 +45,9 @@ See `src-tauri/capabilities/default.json`. Scope is intentionally narrow:
- Filesystem reads/writes only inside `$HOME`, `$DOCUMENT`, `$DOWNLOAD`,
`$DESKTOP`.
- Dialog plugin for open/save.
- Shell plugin restricted to `shell:allow-open` (URL opening only — no
arbitrary command spawn).
- Opener plugin (`opener:default`) for handing external URLs to the system
browser — `shell:open` has no native Android URL handler, so the opener
plugin's `openUrl` is used instead.
Widening the scope requires both a capability edit and a CSP review in
`tauri.conf.json`.
@@ -61,3 +62,155 @@ Widening the scope requires both a capability edit and a CSP review in
The release matrix in `.github/workflows/release.yml` builds all four
combinations (Linux, macOS Intel, macOS Apple Silicon, Windows) on a `v*`
tag push.
## Android (sideload APK)
JSONPrism ships an Android APK that users sideload. **Minimum Android 12
(API 31)** — set via `bundle.android.minSdkVersion` in `tauri.conf.json`; the
OS installer refuses older devices. The build target is a **universal APK**
(all ABIs in one file) so users only ever download one `.apk`.
### Toolchain (local, Windows)
Environment variables Tauri's CLI reads:
- `JAVA_HOME` → Android Studio's JBR, e.g. `C:\Jetbrains\Android Studio\jbr`
- `ANDROID_HOME` → `C:\Users\<you>\AppData\Local\Android\Sdk`
- `NDK_HOME` → `…\Android\Sdk\ndk\<version>`
Rust targets: `rustup target add aarch64-linux-android armv7-linux-androideabi
i686-linux-android x86_64-linux-android`. Verify with `npm run tauri info`.
> **NDK selection.** The CLI auto-picks the **highest** NDK under
> `$ANDROID_HOME/ndk`, regardless of `NDK_HOME`. If you keep multiple NDKs and
> want a specific one, leave only that version installed. Builds are validated
> against NDK r27+; CI pins `ndk;27.2.12479018`.
### The `gen/android` project
`src-tauri/gen/android/` (the Gradle project from `tauri android init`) is
**committed** — source only. Its nested `.gitignore` files exclude build
outputs (`build/`, `.gradle/`, `.cxx/`, `*.so`, `local.properties`,
`keystore.properties`). Committing it keeps the signing edits in
`app/build.gradle.kts` and `minSdkVersion` stable, and makes CI reproducible.
You normally do **not** run `tauri android init` again. Only re-run it after a
major `@tauri-apps/cli` bump, and re-apply the signing block + verify
`minSdk = 31` in `app/build.gradle.kts` afterward (the init overwrites it).
Launcher icons (`res/mipmap-*/ic_launcher*.png`) are generated by
`npm run tauri:icon` and gitignored, like the desktop icons — both the local
`tauri:android:build` script and CI regenerate them before building.
### versionCode
`bundle.android.versionCode` in `tauri.conf.json` must increase monotonically
(needed for in-place upgrades). Derive it deterministically from semver:
```
versionCode = MAJOR*10000 + MINOR*100 + PATCH
```
e.g. `1.6.1 → 10601`, `1.7.0 → 10700`. Bump it together with `version` in
`package.json` / `Cargo.toml` / `tauri.conf.json` at release time.
### Signing
Release signing is read from `src-tauri/gen/android/keystore.properties`
(gitignored), which points at a keystore `.jks` (also gitignored, kept outside
the repo). If the file is absent the release variant builds **unsigned** — fine
for contributors, but a release APK must be signed so it installs and so future
versions can upgrade in place.
Generate a keystore once:
```powershell
& "$env:JAVA_HOME\bin\keytool.exe" -genkeypair -v `
-keystore "$env:USERPROFILE\jsonprism-upload-keystore.jks" -storetype JKS `
-keyalg RSA -keysize 2048 -validity 10000 -alias upload
```
Then create `src-tauri/gen/android/keystore.properties`:
```
storePassword=…
keyPassword=…
keyAlias=upload
storeFile=C:/Users/<you>/jsonprism-upload-keystore.jks
```
> Use forward slashes in `storeFile` — `.properties` treats `\` as an escape.
> **Back up the `.jks` and its passwords** (password manager). Losing the key
> means users can no longer upgrade in place — they'd have to uninstall first.
### CI signing secrets
The `android` job in `release.yml` needs these repository secrets:
| Secret | Value |
| --- | --- |
| `ANDROID_KEYSTORE_BASE64` | base64 of the `.jks` (required) |
| `ANDROID_KEYSTORE_PASSWORD` | the store password (required) |
| `ANDROID_KEY_PASSWORD` | the key password (optional; defaults to store password) |
| `ANDROID_KEY_ALIAS` | the alias (optional; defaults to `upload`) |
Produce the base64 (PowerShell):
```powershell
[Convert]::ToBase64String([IO.File]::ReadAllBytes("$env:USERPROFILE\jsonprism-upload-keystore.jks")) | Set-Clipboard
```
CI decodes it to a temp path, writes `keystore.properties`, builds with
`tauri android build --apk`, and uploads the universal APK to the same draft
release as the desktop bundles. If `ANDROID_KEYSTORE_BASE64` is unset the job
fails fast rather than shipping an unsigned APK.
### Output
`src-tauri/gen/android/app/build/outputs/apk/universal/release/app-universal-release.apk`
### Offline fonts
Fonts (Geist / Instrument Serif / JetBrains Mono) are self-hosted via
`@fontsource` (imported in `src/main.tsx`), not loaded from Google Fonts, so the
app renders correctly offline. The CSP in `tauri.conf.json` no longer allows the
Google Fonts hosts — keep it that way unless fonts move back to a CDN.
### WebView version requirement (important)
The Android app renders inside the device's **Android System WebView**, which is
Chromium. Tailwind v4 (our CSS) requires **Chromium ≥ 111** (`@layer`, `oklch()`,
`@property`). On an older WebView the layout breaks badly (giant icons, unhidden
elements, no responsive layout) even though the app installs and runs.
- Real Android 12+ devices keep WebView updated via Play Store → modern Chromium
→ renders correctly. This is the normal case.
- The bundled WebView in the **API 31 emulator system image is Chromium 91** and
shows the broken layout. Use a newer emulator image (e.g. `android-34`+, which
ships Chromium ≥ 120) or update the emulator's WebView via Play to test
rendering. The `android-31` install/`minSdk` gate can still be tested on the
stock API 31 image.
This is inherent to the Tailwind v4 stack (the web app has the same requirement);
it is not Android-specific code. No action needed unless you must support devices
with a very outdated WebView.
### Native file I/O on Android
`plugin-dialog` `open()` returns a percent-encoded `content://` URI on Android
(not a filesystem path). `plugin-fs` `readTextFile()` reads it fine — validated on
an emulator for both URI flavours. `fileFromNativePath()` (`src/lib/tauri.ts`)
runs the URI through `basenameFromPath()` to recover a filename for the editor,
the extension filter, and toasts. `stat()` on a content URI is unreliable, so
`lastModified` falls back to a deterministic path hash — dedup still works.
Two URI flavours show up:
- **`raw:` URIs** (most local/Downloads files) embed the real path →
`basenameFromPath()` recovers `data.json`.
- **`msf:` URIs** (MediaStore-indexed files) are opaque document ids with no
filename → they collapse to a numeric id (e.g. `18`) and **carry no
extension**. The native open path therefore filters leniently
(`filterByExtension(..., true)` / the `extOf(name) && !allowed` guard in
`InputPanel`) so a file the user explicitly picked is never wrongly rejected.
The real display name would need a content-resolver `DISPLAY_NAME` query via a
custom Rust command — not worth it; the file content loads correctly either way.
+6 -2
View File
@@ -25,8 +25,12 @@ Dùng để kiểm tra bản web (chủ yếu là deploy lên GitHub Pages) trê
- iPhone 14 Pro — iOS 26.x — Chrome, Brave
- iPhone 13 Pro Max — iOS 26.x — Chrome, Brave
Test Android là cơ hội (không có thiết bị chuyên dụng); bản web vẫn nên
chạy được với các phiên bản WebView phổ thông.
Android: app được build và smoke-test trên emulator (API 31 cho cổng chặn
cài / min-SDK, API 36 với WebView Chromium 134 cho phần render) — chưa có
thiết bị thật chuyên dụng. **Yêu cầu hệ thống cho người dùng cuối** (Android
12+, WebView Chromium 111+, RAM, dung lượng) nằm ở mục "Yêu cầu hệ thống"
trong README; chi tiết build / ký nằm ở
[docs/TAURI-NOTES.md](../../TAURI-NOTES.md).
## Tài liệu liên quan
+6 -2
View File
@@ -26,8 +26,12 @@ form factors:
- iPhone 14 Pro — iOS 26.x — Chrome, Brave
- iPhone 13 Pro Max — iOS 26.x — Chrome, Brave
Android testing is opportunistic (no dedicated device); the web build
should still work given mainstream WebView versions.
Android: the app is built and smoke-tested on emulators (API 31 for the
install / min-SDK gate, API 36 with a Chromium 134 WebView for rendering) —
no dedicated physical device yet. **End-user system requirements** (Android
12+, WebView Chromium 111+, RAM, storage) live in the README "System
requirements" section; build / signing details are in
[docs/TAURI-NOTES.md](TAURI-NOTES.md).
## Related docs
+5 -7
View File
@@ -36,13 +36,11 @@
<meta property="og:description" content="A refracting tool for developers. One JSON input, eight target formats, fully in-browser." />
<meta property="og:type" content="website" />
<!-- Fonts: Instrument Serif (display) + Geist (body) + JetBrains Mono (code) -->
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Geist:wght@300;400;500;600;700&family=Instrument+Serif:ital@0;1&family=JetBrains+Mono:wght@400;500;700&display=swap"
rel="stylesheet"
/>
<!--
Fonts: Instrument Serif (display) + Geist (body) + JetBrains Mono (code).
Self-hosted via @fontsource and imported in src/main.tsx so the app works
fully offline (desktop + Android sideload) with no third-party requests.
-->
<title>JSONPrism · Disperse JSON</title>
</head>
+1 -1
View File
@@ -5,8 +5,8 @@
"@radix-ui/react-slot",
"tailwindcss",
"tw-animate-css",
"@tauri-apps/plugin-opener",
"@tauri-apps/plugin-os",
"@tauri-apps/plugin-shell",
"@testing-library/user-event"
],
"rules": {
+827 -943
View File
File diff suppressed because it is too large. Load diff
+33 -27
View File
@@ -1,7 +1,7 @@
{
"name": "jsonprism",
"private": true,
"version": "1.6.0",
"version": "1.7.2",
"type": "module",
"description": "Disperse JSON into many formats — JSONL, CSV, YAML, XML, TOML, RESX, Markdown, SQL — fully client-side.",
"author": "poli0981 <https://github.com/poli0981>",
@@ -31,7 +31,10 @@
"tauri": "tauri",
"tauri:dev": "tauri dev",
"tauri:build": "tauri build",
"tauri:icon": "tauri icon src-tauri/icons/icon.svg"
"tauri:icon": "tauri icon src-tauri/icons/icon.svg",
"tauri:android:init": "tauri android init",
"tauri:android:dev": "npm run tauri:icon && tauri android dev",
"tauri:android:build": "npm run tauri:icon && tauri android build --apk"
},
"dependencies": {
"@codemirror/lang-json": "^6.0.0",
@@ -40,70 +43,73 @@
"@codemirror/lang-xml": "^6.1.0",
"@codemirror/lang-yaml": "^6.1.3",
"@codemirror/language": "^6.10.0",
"@codemirror/legacy-modes": "^6.5.2",
"@codemirror/lint": "^6.8.0",
"@codemirror/legacy-modes": "^6.5.3",
"@codemirror/lint": "^6.9.7",
"@codemirror/state": "^6.4.0",
"@codemirror/view": "^6.34.0",
"@codemirror/view": "^6.43.1",
"@fontsource-variable/geist": "^5.2.9",
"@fontsource-variable/jetbrains-mono": "^5.2.8",
"@fontsource/instrument-serif": "^5.2.8",
"@lezer/highlight": "^1.2.0",
"@msgpack/msgpack": "^3.1.3",
"@radix-ui/react-dialog": "^1.1.0",
"@radix-ui/react-dialog": "^1.1.16",
"@radix-ui/react-slot": "^1.1.0",
"@radix-ui/react-switch": "^1.1.0",
"@radix-ui/react-tabs": "^1.1.13",
"@radix-ui/react-switch": "^1.3.0",
"@radix-ui/react-tabs": "^1.1.14",
"@tauri-apps/api": "^2.0.0",
"@tauri-apps/plugin-dialog": "^2.0.0",
"@tauri-apps/plugin-fs": "^2.0.0",
"@tauri-apps/plugin-opener": "^2.0.0",
"@tauri-apps/plugin-os": "^2.0.0",
"@tauri-apps/plugin-shell": "^2.0.0",
"@uiw/react-codemirror": "^4.23.0",
"@uiw/react-codemirror": "^4.25.10",
"bson": "^7.2.0",
"cbor-x": "^1.6.4",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.0",
"fast-xml-parser": "^5.8.0",
"fflate": "^0.8.2",
"fflate": "^0.8.3",
"i18next": "^23.0.0",
"i18next-browser-languagedetector": "^8.0.0",
"js-yaml": "^4.1.0",
"js-yaml": "^4.2.0",
"lucide-react": "^0.460.0",
"papaparse": "^5.4.0",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react": "^19.2.7",
"react-dom": "^19.2.7",
"react-dropzone": "^14.3.0",
"react-i18next": "^15.0.0",
"react-router-dom": "^7.0.0",
"react-router-dom": "^7.17.0",
"smol-toml": "^1.3.0",
"sonner": "^2.0.7",
"tailwind-merge": "^2.5.0",
"zustand": "^5.0.0"
"zustand": "^5.0.14"
},
"devDependencies": {
"@eslint/js": "^9.15.0",
"@tailwindcss/vite": "^4.0.0",
"@tauri-apps/cli": "^2.0.0",
"@tailwindcss/vite": "^4.3.1",
"@tauri-apps/cli": "^2.11.2",
"@testing-library/jest-dom": "^6.6.0",
"@testing-library/react": "^16.1.0",
"@testing-library/user-event": "^14.5.0",
"@types/js-yaml": "^4.0.0",
"@types/node": "^22.0.0",
"@types/papaparse": "^5.3.0",
"@types/react": "^19.0.0",
"@types/react": "^19.2.17",
"@types/react-dom": "^19.0.0",
"@vitejs/plugin-react": "^6.0.0",
"@vitest/coverage-v8": "^4.1.6",
"@vitejs/plugin-react": "^6.0.2",
"@vitest/coverage-v8": "^4.1.8",
"eslint": "^9.15.0",
"eslint-plugin-react-hooks": "^5.0.0",
"eslint-plugin-react-refresh": "^0.4.0",
"eslint-plugin-react-refresh": "^0.5.2",
"globals": "^14.0.0",
"jsdom": "^29.0.0",
"knip": "^6.14.1",
"prettier": "^3.4.0",
"prettier-plugin-tailwindcss": "^0.6.0",
"knip": "^6.16.1",
"prettier": "^3.8.4",
"prettier-plugin-tailwindcss": "^0.8.0",
"tailwindcss": "^4.0.0",
"tw-animate-css": "^1.2.0",
"typescript": "^5.7.0",
"typescript-eslint": "^8.15.0",
"vite": "^8.0.0",
"typescript-eslint": "^8.61.0",
"vite": "^8.0.16",
"vitest": "^4.1.6"
}
}
+11
View File
@@ -4,9 +4,20 @@
# Icon binaries are generated from icon.svg via `npm run tauri:icon`.
# Comment these out and commit the binaries if your CI doesn't run the generation step.
icons/32x32.png
icons/64x64.png
icons/128x128.png
icons/128x128@2x.png
icons/icon.png
icons/icon.icns
icons/icon.ico
icons/Square*.png
icons/StoreLogo.png
icons/ios/
# Android launcher icons are also generated by `npm run tauri:icon` (run before each Android build).
gen/android/app/src/main/res/mipmap-*/ic_launcher*.png
# Android signing — never commit the keystore binary.
# (keystore.properties / key.properties are already ignored by gen/android/.gitignore)
*.jks
*.keystore
+24 -74
View File
@@ -860,15 +860,6 @@ version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4ef6b89e5b37196644d8796de5268852ff179b44e96276cf4290264843743bb7"
[[package]]
name = "encoding_rs"
version = "0.8.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3"
dependencies = [
"cfg-if",
]
[[package]]
name = "endi"
version = "1.1.1"
@@ -1867,7 +1858,7 @@ dependencies = [
[[package]]
name = "jsonprism"
version = "1.6.0"
version = "1.7.2"
dependencies = [
"serde",
"serde_json",
@@ -1875,8 +1866,8 @@ dependencies = [
"tauri-build",
"tauri-plugin-dialog",
"tauri-plugin-fs",
"tauri-plugin-opener",
"tauri-plugin-os",
"tauri-plugin-shell",
"tauri-plugin-single-instance",
]
@@ -2391,16 +2382,6 @@ dependencies = [
"windows-sys 0.61.2",
]
[[package]]
name = "os_pipe"
version = "1.2.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7d8fae84b431384b68627d0f9b3b1245fcf9f46f6c0e3dc902e9dce64edd1967"
dependencies = [
"libc",
"windows-sys 0.61.2",
]
[[package]]
name = "pango"
version = "0.18.3"
@@ -3150,44 +3131,12 @@ dependencies = [
"digest",
]
[[package]]
name = "shared_child"
version = "1.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e362d9935bc50f019969e2f9ecd66786612daae13e8f277be7bfb66e8bed3f7"
dependencies = [
"libc",
"sigchld",
"windows-sys 0.60.2",
]
[[package]]
name = "shlex"
version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba"
[[package]]
name = "sigchld"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "47106eded3c154e70176fc83df9737335c94ce22f821c32d17ed1db1f83badb1"
dependencies = [
"libc",
"os_pipe",
"signal-hook",
]
[[package]]
name = "signal-hook"
version = "0.3.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d881a16cf4426aa584979d30bd82cb33429027e42122b169753d6ef1085ed6e2"
dependencies = [
"libc",
"signal-hook-registry",
]
[[package]]
name = "signal-hook-registry"
version = "1.4.8"
@@ -3618,6 +3567,28 @@ dependencies = [
"url",
]
[[package]]
name = "tauri-plugin-opener"
version = "2.5.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "17e1bea14edce6b793a04e2417e3fd924b9bc4faae83cdee7d714156cceeed29"
dependencies = [
"dunce",
"glob",
"objc2-app-kit",
"objc2-foundation",
"open",
"schemars 0.8.22",
"serde",
"serde_json",
"tauri",
"tauri-plugin",
"thiserror 2.0.18",
"url",
"windows",
"zbus",
]
[[package]]
name = "tauri-plugin-os"
version = "2.3.2"
@@ -3636,27 +3607,6 @@ dependencies = [
"thiserror 2.0.18",
]
[[package]]
name = "tauri-plugin-shell"
version = "2.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8457dbf9e2bab1edd8df22bb2c20857a59a9868e79cb3eac5ed639eec4d0c73b"
dependencies = [
"encoding_rs",
"log",
"open",
"os_pipe",
"regex",
"schemars 0.8.22",
"serde",
"serde_json",
"shared_child",
"tauri",
"tauri-plugin",
"thiserror 2.0.18",
"tokio",
]
[[package]]
name = "tauri-plugin-single-instance"
version = "2.4.2"
+2 -2
View File
@@ -1,6 +1,6 @@
[package]
name = "jsonprism"
version = "1.6.0"
version = "1.7.2"
description = "Disperse JSON into many formats."
authors = ["poli0981 <https://github.com/poli0981>"]
license = "Apache-2.0"
@@ -20,8 +20,8 @@ tauri-build = { version = "2", features = [] }
tauri = { version = "2", features = [] }
tauri-plugin-dialog = "2"
tauri-plugin-fs = "2"
tauri-plugin-opener = "2"
tauri-plugin-os = "2"
tauri-plugin-shell = "2"
serde = { version = "1", features = ["derive"] }
serde_json = "1"
+1 -1
View File
@@ -10,7 +10,7 @@
"core:webview:default",
"core:window:default",
"core:window:allow-set-title",
"shell:allow-open",
"opener:default",
"os:default",
"dialog:default",
"dialog:allow-open",
+12
View File
@@ -0,0 +1,12 @@
# EditorConfig is awesome: https://EditorConfig.org
# top-most EditorConfig file
root = true
[*]
indent_style = space
indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
+20
View File
@@ -0,0 +1,20 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
build
/captures
.externalNativeBuild
.cxx
local.properties
key.properties
keystore.properties
/.tauri
/tauri.settings.gradle
+6
View File
@@ -0,0 +1,6 @@
/src/main/**/generated
/src/main/jniLibs/**/*.so
/src/main/assets/tauri.conf.json
/tauri.build.gradle.kts
/proguard-tauri.pro
/tauri.properties
@@ -0,0 +1,97 @@
import java.io.FileInputStream
import java.util.Properties
plugins {
id("com.android.application")
id("org.jetbrains.kotlin.android")
id("rust")
}
val tauriProperties = Properties().apply {
val propFile = file("tauri.properties")
if (propFile.exists()) {
propFile.inputStream().use { load(it) }
}
}
// Release signing — loaded from `keystore.properties` at the gen/android root.
// That file (and the .jks it points to) is gitignored; it lives only on the
// maintainer's machine and is decoded from GitHub Secrets in CI. When it's
// absent (e.g. a contributor build) the release variant simply stays unsigned.
val keystorePropertiesFile = rootProject.file("keystore.properties")
val hasReleaseKeystore = keystorePropertiesFile.exists()
val keystoreProperties = Properties().apply {
if (hasReleaseKeystore) {
FileInputStream(keystorePropertiesFile).use { load(it) }
}
}
android {
compileSdk = 36
namespace = "com.poli0981.jsonprism"
defaultConfig {
manifestPlaceholders["usesCleartextTraffic"] = "false"
applicationId = "com.poli0981.jsonprism"
minSdk = 31
targetSdk = 36
versionCode = tauriProperties.getProperty("tauri.android.versionCode", "1").toInt()
versionName = tauriProperties.getProperty("tauri.android.versionName", "1.0")
}
signingConfigs {
if (hasReleaseKeystore) {
create("release") {
keyAlias = keystoreProperties.getProperty("keyAlias")
keyPassword = keystoreProperties.getProperty("keyPassword")
storeFile = file(keystoreProperties.getProperty("storeFile"))
storePassword = keystoreProperties.getProperty("storePassword")
}
}
}
buildTypes {
getByName("debug") {
manifestPlaceholders["usesCleartextTraffic"] = "true"
isDebuggable = true
isJniDebuggable = true
isMinifyEnabled = false
packaging { jniLibs.keepDebugSymbols.add("*/arm64-v8a/*.so")
jniLibs.keepDebugSymbols.add("*/armeabi-v7a/*.so")
jniLibs.keepDebugSymbols.add("*/x86/*.so")
jniLibs.keepDebugSymbols.add("*/x86_64/*.so")
}
}
getByName("release") {
isMinifyEnabled = true
proguardFiles(
*fileTree(".") { include("**/*.pro") }
.plus(getDefaultProguardFile("proguard-android-optimize.txt"))
.toList().toTypedArray()
)
if (hasReleaseKeystore) {
signingConfig = signingConfigs.getByName("release")
}
}
}
kotlinOptions {
jvmTarget = "1.8"
}
buildFeatures {
buildConfig = true
}
}
rust {
rootDirRel = "../../../"
}
dependencies {
implementation("androidx.webkit:webkit:1.14.0")
implementation("androidx.appcompat:appcompat:1.7.1")
implementation("androidx.activity:activity-ktx:1.10.1")
implementation("com.google.android.material:material:1.12.0")
implementation("androidx.lifecycle:lifecycle-process:2.10.0")
testImplementation("junit:junit:4.13.2")
androidTestImplementation("androidx.test.ext:junit:1.1.4")
androidTestImplementation("androidx.test.espresso:espresso-core:3.5.0")
}
apply(from = "tauri.build.gradle.kts")
+21
View File
@@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile
@@ -0,0 +1,37 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET" />
<!-- AndroidTV support -->
<uses-feature android:name="android.software.leanback" android:required="false" />
<application
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:theme="@style/Theme.jsonprism"
android:usesCleartextTraffic="${usesCleartextTraffic}">
<activity
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|smallestScreenSize|screenLayout|uiMode"
android:launchMode="singleTask"
android:label="@string/main_activity_title"
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
<!-- AndroidTV support -->
<category android:name="android.intent.category.LEANBACK_LAUNCHER" />
</intent-filter>
</activity>
<provider
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
<meta-data
android:name="android.support.FILE_PROVIDER_PATHS"
android:resource="@xml/file_paths" />
</provider>
</application>
</manifest>
@@ -0,0 +1,11 @@
package com.poli0981.jsonprism
import android.os.Bundle
import androidx.activity.enableEdgeToEdge
class MainActivity : TauriActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
enableEdgeToEdge()
super.onCreate(savedInstanceState)
}
}
@@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>
@@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Hello World!"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<foreground android:drawable="@mipmap/ic_launcher_foreground"/>
<background android:drawable="@color/ic_launcher_background"/>
</adaptive-icon>
@@ -0,0 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.jsonprism" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
</resources>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#fff</color>
</resources>
@@ -0,0 +1,4 @@
<resources>
<string name="app_name">JSONPrism</string>
<string name="main_activity_title">JSONPrism</string>
</resources>
@@ -0,0 +1,6 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.jsonprism" parent="Theme.MaterialComponents.DayNight.NoActionBar">
<!-- Customize your theme here. -->
</style>
</resources>
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<paths xmlns:android="http://schemas.android.com/apk/res/android">
<external-path name="my_images" path="." />
<cache-path name="my_cache_images" path="." />
</paths>
+22
View File
@@ -0,0 +1,22 @@
buildscript {
repositories {
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:8.11.0")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.25")
}
}
allprojects {
repositories {
google()
mavenCentral()
}
}
tasks.register("clean").configure {
delete("build")
}
@@ -0,0 +1,23 @@
plugins {
`kotlin-dsl`
}
gradlePlugin {
plugins {
create("pluginsForCoolKids") {
id = "rust"
implementationClass = "RustPlugin"
}
}
}
repositories {
google()
mavenCentral()
}
dependencies {
compileOnly(gradleApi())
implementation("com.android.tools.build:gradle:8.11.0")
}
@@ -0,0 +1,68 @@
import java.io.File
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.DefaultTask
import org.gradle.api.GradleException
import org.gradle.api.logging.LogLevel
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.TaskAction
open class BuildTask : DefaultTask() {
@Input
var rootDirRel: String? = null
@Input
var target: String? = null
@Input
var release: Boolean? = null
@TaskAction
fun assemble() {
val executable = """npm""";
try {
runTauriCli(executable)
} catch (e: Exception) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
// Try different Windows-specific extensions
val fallbacks = listOf(
"$executable.exe",
"$executable.cmd",
"$executable.bat",
)
var lastException: Exception = e
for (fallback in fallbacks) {
try {
runTauriCli(fallback)
return
} catch (fallbackException: Exception) {
lastException = fallbackException
}
}
throw lastException
} else {
throw e;
}
}
}
fun runTauriCli(executable: String) {
val rootDirRel = rootDirRel ?: throw GradleException("rootDirRel cannot be null")
val target = target ?: throw GradleException("target cannot be null")
val release = release ?: throw GradleException("release cannot be null")
val args = listOf("run", "--", "tauri", "android", "android-studio-script");
project.exec {
workingDir(File(project.projectDir, rootDirRel))
executable(executable)
args(args)
if (project.logger.isEnabled(LogLevel.DEBUG)) {
args("-vv")
} else if (project.logger.isEnabled(LogLevel.INFO)) {
args("-v")
}
if (release) {
args("--release")
}
args(listOf("--target", target))
}.assertNormalExitValue()
}
}
@@ -0,0 +1,85 @@
import com.android.build.api.dsl.ApplicationExtension
import org.gradle.api.DefaultTask
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.get
const val TASK_GROUP = "rust"
open class Config {
lateinit var rootDirRel: String
}
open class RustPlugin : Plugin<Project> {
private lateinit var config: Config
override fun apply(project: Project) = with(project) {
config = extensions.create("rust", Config::class.java)
val defaultAbiList = listOf("arm64-v8a", "armeabi-v7a", "x86", "x86_64");
val abiList = (findProperty("abiList") as? String)?.split(',') ?: defaultAbiList
val defaultArchList = listOf("arm64", "arm", "x86", "x86_64");
val archList = (findProperty("archList") as? String)?.split(',') ?: defaultArchList
val targetsList = (findProperty("targetList") as? String)?.split(',') ?: listOf("aarch64", "armv7", "i686", "x86_64")
extensions.configure<ApplicationExtension> {
@Suppress("UnstableApiUsage")
flavorDimensions.add("abi")
productFlavors {
create("universal") {
dimension = "abi"
ndk {
abiFilters += abiList
}
}
defaultArchList.forEachIndexed { index, arch ->
create(arch) {
dimension = "abi"
ndk {
abiFilters.add(defaultAbiList[index])
}
}
}
}
}
afterEvaluate {
for (profile in listOf("debug", "release")) {
val profileCapitalized = profile.replaceFirstChar { it.uppercase() }
val buildTask = tasks.maybeCreate(
"rustBuildUniversal$profileCapitalized",
DefaultTask::class.java
).apply {
group = TASK_GROUP
description = "Build dynamic library in $profile mode for all targets"
}
tasks["mergeUniversal${profileCapitalized}JniLibFolders"].dependsOn(buildTask)
for (targetPair in targetsList.withIndex()) {
val targetName = targetPair.value
val targetArch = archList[targetPair.index]
val targetArchCapitalized = targetArch.replaceFirstChar { it.uppercase() }
val targetBuildTask = project.tasks.maybeCreate(
"rustBuild$targetArchCapitalized$profileCapitalized",
BuildTask::class.java
).apply {
group = TASK_GROUP
description = "Build dynamic library in $profile mode for $targetArch"
rootDirRel = config.rootDirRel
target = targetName
release = profile == "release"
}
buildTask.dependsOn(targetBuildTask)
tasks["merge$targetArchCapitalized${profileCapitalized}JniLibFolders"].dependsOn(
targetBuildTask
)
}
}
}
}
}
+24
View File
@@ -0,0 +1,24 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Kotlin code style for this project: "official" or "obsolete":
kotlin.code.style=official
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true
android.nonFinalResIds=false
Binary file not shown.
@@ -0,0 +1,6 @@
#Tue May 10 19:22:52 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.14.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
+185
View File
@@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
+89
View File
@@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
+3
View File
@@ -0,0 +1,3 @@
include ':app'
apply from: 'tauri.settings.gradle'
+1 -1
View File
@@ -42,7 +42,7 @@ pub fn run() {
}
let app = builder
.plugin(tauri_plugin_shell::init())
.plugin(tauri_plugin_opener::init())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_fs::init())
.plugin(tauri_plugin_os::init())
+6 -2
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "JSONPrism",
"version": "1.6.0",
"version": "1.7.2",
"identifier": "com.poli0981.jsonprism",
"build": {
"beforeDevCommand": "npm run dev",
@@ -26,7 +26,7 @@
}
],
"security": {
"csp": "default-src 'self'; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; font-src 'self' data: https://fonts.gstatic.com; script-src 'self'; connect-src 'self' ipc: http://ipc.localhost https://fonts.googleapis.com https://fonts.gstatic.com"
"csp": "default-src 'self'; img-src 'self' data: blob:; style-src 'self' 'unsafe-inline'; font-src 'self' data:; script-src 'self'; connect-src 'self' ipc: http://ipc.localhost"
}
},
"bundle": {
@@ -75,6 +75,10 @@
"deb": {
"depends": []
}
},
"android": {
"minSdkVersion": 31,
"versionCode": 10702
}
},
"plugins": {
+3
View File
@@ -5,6 +5,7 @@ import { ErrorBoundary } from '@/components/common/ErrorBoundary';
import { ConsentGate } from '@/components/common/ConsentGate';
import { Layout } from '@/components/layout/Layout';
import { Toaster } from '@/components/ui/sonner';
import { useExternalLinkInterceptor } from '@/hooks/useExternalLinkInterceptor';
// Routes are code-split so the entry chunk stays small and the consent gate +
// app shell paint before any page's heavy graph (editor, parsers) loads.
@@ -14,6 +15,8 @@ const NotFound = lazy(() => import('@/pages/errors/NotFound'));
const ErrorRoute = lazy(() => import('@/pages/errors/ErrorRoute'));
export function App() {
useExternalLinkInterceptor();
return (
<ThemeProvider defaultTheme="system">
<ErrorBoundary>
+5 -4
View File
@@ -20,10 +20,11 @@ const LEGAL_LINKS = [
] as const;
/**
* First-launch legal gate (web only). Blocks the app behind a non-dismissible
* modal until the user accepts. On desktop the store seeds `accepted = true`
* (the installer's license page already gated acceptance), so this renders its
* children straight through.
* First-launch legal gate (web + Android). Blocks the app behind a
* non-dismissible modal until the user accepts. On desktop the store seeds
* `accepted = true` (the installer's license page already gated acceptance), so
* this renders its children straight through; the Android sideload APK has no
* such installer step, so it shows the gate like the web build.
*/
export function ConsentGate({ children }: { children: ReactNode }) {
const accepted = useConsentStore((s) => s.accepted);
+5 -3
View File
@@ -54,8 +54,8 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
const { start, cancel, downloadZip } = useBatchActions(format, direction, options);
const handleAddFiles = useCallback(
(files: File[]) => {
const { valid, wrongFormat } = filterByExtension(files, allowedExtensions);
(files: File[], lenientExt = false) => {
const { valid, wrongFormat } = filterByExtension(files, allowedExtensions, lenientExt);
if (wrongFormat > 0) {
toast.warning(t('batch.toast.wrong_format', { count: wrongFormat }));
}
@@ -108,7 +108,9 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
const paths = await nativeOpenFiles({ multiple: true });
if (!paths || paths.length === 0) return;
const files = await Promise.all(paths.map(fileFromNativePath));
handleAddFiles(files);
// The native dialog already filtered; Android content URIs may carry no
// extension, so don't re-reject them here.
handleAddFiles(files, true);
return;
}
fileInputRef.current?.click();
+13 -2
View File
@@ -106,13 +106,24 @@ export function InputPanel({
if (!paths || paths.length === 0) return;
try {
const file = await fileFromNativePath(paths[0]!);
if (!hasAllowedExt(file.name)) {
// The native dialog already filtered; reject only when the name carries
// a recognizable, disallowed extension. Android content URIs often have
// no extension at all (opaque document ids) — don't reject those.
const pickedExt = extOf(file.name);
if (pickedExt && !allowedExtensions.includes(pickedExt)) {
toast.warning(t('batch.toast.wrong_format', { count: 1 }));
return;
}
const text = await file.text();
onChange(text);
toast.success(t('toast.file_loaded', { name: file.name }));
// Android content URIs sometimes yield an opaque document id with no
// real filename (e.g. `msf:1000000123`). When there's no usable
// extension to show a clean name, fall back to a count-based message.
toast.success(
pickedExt
? t('toast.file_loaded', { name: file.name })
: t('toast.files_loaded', { count: 1 }),
);
} catch (err) {
toast.error(t('toast.file_failed', { message: (err as Error).message }));
}
+32
View File
@@ -0,0 +1,32 @@
import { useEffect } from 'react';
import { isTauri, openExternal } from '@/lib/tauri';
/**
* Route external-link clicks to the system browser inside Tauri.
*
* Tauri webviews (notably Android) silently ignore `target="_blank"`, so a
* tapped `<a href="https://…">` does nothing. A single delegated listener
* catches every external anchor app-wide and hands the URL to the OS browser
* via the shell plugin. No-op on the web build (browsers open new tabs
* natively) and for in-app router links (relative hrefs don't match).
*/
export function useExternalLinkInterceptor(): void {
useEffect(() => {
if (!isTauri()) return;
const handler = (e: MouseEvent) => {
if (e.button !== 0 || e.defaultPrevented) return;
const anchor = (e.target as Element | null)?.closest('a');
if (!anchor) return;
// Raw attribute, NOT `anchor.href`: the property absolutises relative
// router links ("/about" → "http://…/about") and would match.
const href = anchor.getAttribute('href');
if (!href || !/^https?:\/\//i.test(href)) return;
e.preventDefault();
void openExternal(href);
};
document.addEventListener('click', handler);
return () => document.removeEventListener('click', handler);
}, []);
}
+3 -1
View File
@@ -174,6 +174,8 @@
"copy_failed": "Couldn't copy to clipboard",
"downloaded": "Downloaded {{filename}}",
"file_loaded": "Loaded {{name}}",
"files_loaded": "{{count}} file loaded",
"files_loaded_other": "{{count}} files loaded",
"file_failed": "Failed to load file: {{message}}",
"options_reset": "Options reset to defaults"
},
@@ -331,7 +333,7 @@
},
"consent": {
"title": "Before you start",
"intro": "JSONPrism runs entirely in your browser — your data never leaves your device. Please review and accept the terms:",
"intro": "JSONPrism runs entirely on your device — your data never leaves it. Please review and accept the terms:",
"agree": "I have read and agree to the License, Terms (EULA), Privacy Policy, and Disclaimer.",
"continue": "Continue",
"links": {
+3 -1
View File
@@ -174,6 +174,8 @@
"copy_failed": "Không thể chép vào clipboard",
"downloaded": "Đã tải {{filename}}",
"file_loaded": "Đã nạp {{name}}",
"files_loaded": "Đã nạp {{count}} file",
"files_loaded_other": "Đã nạp {{count}} file",
"file_failed": "Không nạp được file: {{message}}",
"options_reset": "Đã khôi phục tuỳ chọn mặc định"
},
@@ -331,7 +333,7 @@
},
"consent": {
"title": "Trước khi bắt đầu",
"intro": "JSONPrism chạy hoàn toàn trong trình duyệt của bạn — dữ liệu không bao giờ rời khỏi thiết bị. Vui lòng đọc và chấp nhận các điều khoản:",
"intro": "JSONPrism chạy hoàn toàn trên thiết bị của bạn — dữ liệu không bao giờ rời khỏi máy. Vui lòng đọc và chấp nhận các điều khoản:",
"agree": "Tôi đã đọc và đồng ý với Giấy phép, Điều khoản (EULA), Chính sách bảo mật và Tuyên bố miễn trừ trách nhiệm.",
"continue": "Tiếp tục",
"links": {
+17
View File
@@ -51,4 +51,21 @@ describe('filterByExtension', () => {
it('returns empty result for empty input', () => {
expect(filterByExtension([], ['json'])).toEqual({ valid: [], wrongFormat: 0 });
});
it('rejects extensionless names by default', () => {
const opaque = f('1000000123');
const result = filterByExtension([opaque], ['json', 'txt']);
expect(result.valid).toEqual([]);
expect(result.wrongFormat).toBe(1);
});
it('accepts extensionless names when lenient (Android content URIs)', () => {
const opaque = f('1000000123');
const json = f('b.json');
const png = f('c.png');
const result = filterByExtension([opaque, json, png], ['json', 'txt'], true);
// opaque (no ext) + json pass; png has a recognizable, disallowed ext.
expect(result.valid).toEqual([opaque, json]);
expect(result.wrongFormat).toBe(1);
});
});
+26 -1
View File
@@ -1,5 +1,5 @@
import { describe, expect, it } from 'vitest';
import { pathHashAsMillis } from '../tauri';
import { basenameFromPath, pathHashAsMillis } from '../tauri';
describe('pathHashAsMillis', () => {
it('is deterministic for the same input', () => {
@@ -20,3 +20,28 @@ describe('pathHashAsMillis', () => {
expect(h).toBeLessThanOrEqual(0xffffffff);
});
});
describe('basenameFromPath', () => {
it('returns the basename of a desktop path unchanged', () => {
expect(basenameFromPath('C:\\Users\\me\\data.json')).toBe('data.json');
expect(basenameFromPath('/home/me/data.json')).toBe('data.json');
expect(basenameFromPath('data.json')).toBe('data.json');
});
it('decodes an Android content URI with an embedded raw path', () => {
// What plugin-dialog returns for a file picked from Downloads.
const uri =
'content://com.android.providers.downloads.documents/document/' +
'raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Ftest-open.json';
expect(basenameFromPath(uri)).toBe('test-open.json');
});
it('collapses an opaque document id to a short token', () => {
const uri = 'content://com.android.providers.media.documents/document/msf%3A1000000123';
expect(basenameFromPath(uri)).toBe('1000000123');
});
it('survives a malformed percent-escape by falling back to the raw basename', () => {
expect(basenameFromPath('/tmp/100%-done.json')).toBe('100%-done.json');
});
});
+16 -3
View File
@@ -29,12 +29,25 @@ export interface FilterByExtensionResult {
wrongFormat: number;
}
/** Split files into (accepted, wrong-format count) by extension whitelist. */
export function filterByExtension(files: File[], allowed: string[]): FilterByExtensionResult {
/**
* Split files into (accepted, wrong-format count) by extension whitelist.
*
* `treatUnknownExtAsValid` accepts files whose name has no detectable
* extension. Android's native picker returns opaque `content://` document ids
* (e.g. `…/document/msf:1000000123`) that carry no filename, so re-filtering a
* file the user already chose through the native dialog would wrongly reject
* it. Use it only on the native-open path — web drag-drop stays strict.
*/
export function filterByExtension(
files: File[],
allowed: string[],
treatUnknownExtAsValid = false,
): FilterByExtensionResult {
const valid: File[] = [];
let wrongFormat = 0;
for (const f of files) {
if (allowed.includes(extOf(f.name))) valid.push(f);
const ext = extOf(f.name);
if (allowed.includes(ext) || (treatUnknownExtAsValid && ext === '')) valid.push(f);
else wrongFormat += 1;
}
return { valid, wrongFormat };
+44 -2
View File
@@ -99,6 +99,29 @@ export function pathHashAsMillis(path: string): number {
return h >>> 0;
}
/**
* Derive a clean basename from a native path or an Android content URI.
*
* Desktop paths (`C:\…\data.json`, `/home/…/data.json`) pass through
* unchanged. Android's dialog returns a percent-encoded `content://` URI
* whose document id usually embeds the real path
* (e.g. `…/document/raw%3A%2Fstorage%2Femulated%2F0%2FDownload%2Fdata.json`).
* Decode it, then strip everything up to the last `/` or `:` so the editor,
* the format-extension filter, and toasts see `data.json` instead of the raw
* URI. Providers that hand back an opaque id (e.g. `msf:1000000123`) still
* collapse to a short, stable token.
*/
export function basenameFromPath(path: string): string {
let decoded = path;
try {
decoded = decodeURIComponent(path);
} catch {
// malformed %-escape — fall back to the raw string
}
const afterSlash = decoded.replace(/^.*[\\/]/, '');
return afterSlash.replace(/^.*:/, '') || afterSlash;
}
/**
* Convert a native file path to a browser-style File so the
* existing batch store and editor flows can consume it unchanged.
@@ -106,11 +129,12 @@ export function pathHashAsMillis(path: string): number {
* `lastModified` is read from the file's real mtime via `stat()` so that
* re-dropping the same file dedups correctly (batchStore keys on
* name|size|lastModified). Falling back to `Date.now()` would break dedup
* because every drop produces a fresh timestamp.
* because every drop produces a fresh timestamp. On Android `stat()` on a
* content URI is unreliable, so the hash fallback covers it.
*/
export async function fileFromNativePath(path: string): Promise<File> {
const text = await nativeReadText(path);
const name = path.replace(/^.*[\\/]/, ''); // basename
const name = basenameFromPath(path);
const ext = (name.split('.').pop() ?? '').toLowerCase();
const type = TYPE_BY_EXT[ext] ?? 'application/octet-stream';
@@ -128,6 +152,24 @@ export async function fileFromNativePath(path: string): Promise<File> {
return new File([text], name, { type, lastModified });
}
/**
* Open an external URL. In Tauri the webview won't honour `target="_blank"`
* (Android in particular swallows it), so hand the URL to the system browser
* via the opener plugin's `openUrl`. On the web, open a new tab as usual.
*
* NB: the shell plugin's `open()` throws "Scoped shell IO error: No such file
* or directory (os error 2)" on Android — it has no native URL handler there.
* The opener plugin routes through the platform's Intent/openURL API instead.
*/
export async function openExternal(url: string): Promise<void> {
if (!isTauri()) {
window.open(url, '_blank', 'noopener,noreferrer');
return;
}
const { openUrl } = await import('@tauri-apps/plugin-opener');
await openUrl(url);
}
/**
* Diagnostic info from the Rust side (OS, arch, app version).
* Not currently shown in the UI but useful for bug reports.
+7
View File
@@ -1,6 +1,13 @@
import { StrictMode } from 'react';
import { createRoot } from 'react-dom/client';
import { BrowserRouter } from 'react-router-dom';
// Self-hosted fonts (bundled into the build) so the app renders correctly
// offline — required for the desktop/Android sideload builds and a privacy win
// for web. Replaces the former Google Fonts <link> tags in index.html.
import '@fontsource-variable/geist/index.css';
import '@fontsource-variable/jetbrains-mono/index.css';
import '@fontsource/instrument-serif/400.css';
import '@fontsource/instrument-serif/400-italic.css';
import './styles/globals.css';
import './i18n';
import { App } from './app/App';
+4 -3
View File
@@ -7,9 +7,10 @@ interface ConsentState {
}
function initialAccepted(): boolean {
// Desktop builds gate acceptance through the installer's license page, so the
// in-app web gate is a no-op there.
if (__IS_TAURI_BUILD__) return true;
// Desktop installers gate acceptance through their license page, so the in-app
// gate is a no-op there. The Android sideload APK has no installer license
// step, so it must show the gate just like the web build.
if (__IS_TAURI_BUILD__ && !__IS_ANDROID_BUILD__) return true;
return isConsentValid(loadConsent());
}
+6 -3
View File
@@ -10,10 +10,13 @@
*/
@theme inline {
/* Fonts */
/* Fonts — self-hosted via @fontsource (imported in src/main.tsx).
Family names match the @fontsource packages: variable fonts expose the
"… Variable" family; the static Instrument Serif keeps its plain name. */
--font-display: 'Instrument Serif', ui-serif, Georgia, serif;
--font-sans: 'Geist', ui-sans-serif, system-ui, sans-serif;
--font-mono: 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
--font-sans: 'Geist Variable', 'Geist', ui-sans-serif, system-ui, sans-serif;
--font-mono:
'JetBrains Mono Variable', 'JetBrains Mono', ui-monospace, 'SF Mono', Menlo, monospace;
/* Core shadcn tokens — map to CSS vars below */
--color-background: var(--background);
+1
View File
@@ -2,5 +2,6 @@
declare const __APP_VERSION__: string;
declare const __IS_TAURI_BUILD__: boolean;
declare const __IS_ANDROID_BUILD__: boolean;
declare const __APP_COMMIT__: string;
declare const __APP_BUILD_DATE__: string;
+58 -39
View File
@@ -7,6 +7,9 @@ import pkg from './package.json';
// Tauri exposes env vars during dev/build; presence indicates a Tauri context.
const isTauriContext = !!process.env.TAURI_ENV_PLATFORM;
// `android` during `tauri android build`. The Android sideload APK has no
// installer license page, so it must show the in-app consent gate (web does).
const isAndroidBuild = process.env.TAURI_ENV_PLATFORM === 'android';
const tauriHost = process.env.TAURI_DEV_HOST;
// Resolve commit SHA + build date once per Vite config load. The About page
@@ -32,6 +35,7 @@ export default defineConfig(({ mode }) => ({
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
__IS_TAURI_BUILD__: JSON.stringify(isTauriContext),
__IS_ANDROID_BUILD__: JSON.stringify(isAndroidBuild),
__APP_COMMIT__: JSON.stringify(appCommit),
__APP_BUILD_DATE__: JSON.stringify(appBuildDate),
},
@@ -49,49 +53,64 @@ export default defineConfig(({ mode }) => ({
build: {
target: 'es2022',
sourcemap: !isTauriContext,
// Source maps would expose full original source on the public GH Pages
// deploy (the whole dist/ is uploaded), and nothing consumes them
// (PRIVACY.md: no remote error reporting). Emit them only for local,
// non-production web builds; never for the prod web deploy or Tauri.
sourcemap: !isTauriContext && mode !== 'production',
// Vite 8 uses Rolldown + Oxc minifier by default; legacy `esbuild` requires
// installing esbuild separately.
minify: 'oxc',
rollupOptions: {
output: {
// Vite 8 / Rolldown only accepts the function form here. Split into the
// smallest sensible vendor chunks so a stale deploy only re-downloads
// the pieces that actually changed, and so heavy parsers/lang-packs are
// their own files (loaded lazily once their format/editor is needed).
// Clause order matters: react must win before react-router/react-i18next.
manualChunks(id) {
if (!id.includes('node_modules')) return undefined;
// React core (react, react-dom, scheduler) — exclude react-router /
// react-i18next / @uiw/react-codemirror which match their own clauses.
if (id.includes('/react-dom/') || /\/react\//.test(id) || id.includes('/scheduler/')) {
return 'react';
}
if (id.includes('react-router')) return 'router';
if (id.includes('i18next')) return 'i18n';
// CodeMirror: language packs split from the core editor.
if (id.includes('@codemirror/lang-') || id.includes('@codemirror/legacy-modes')) {
return 'cm-langs';
}
if (
id.includes('@codemirror/') ||
id.includes('@uiw/react-codemirror') ||
id.includes('@lezer/')
) {
return 'cm-core';
}
// One chunk per parser library.
if (id.includes('js-yaml')) return 'p-yaml';
if (id.includes('papaparse')) return 'p-csv';
if (id.includes('fast-xml-parser')) return 'p-xml';
if (id.includes('smol-toml')) return 'p-toml';
if (id.includes('node_modules/bson/')) return 'p-bson';
if (id.includes('node_modules/cbor-x/')) return 'p-cbor';
if (id.includes('node_modules/@msgpack/')) return 'p-msgpack';
if (id.includes('fflate')) return 'fflate';
// Radix primitives + icon set.
if (id.includes('@radix-ui') || id.includes('lucide-react')) return 'ui';
return undefined;
// Rolldown deprecates the `manualChunks` function form — its optimizer
// silently merges small manual chunks back together (it folded a
// `@codemirror/view` split straight back into `cm-core`).
// `advancedChunks.groups` are explicit, honored boundaries; higher
// `priority` wins when a module matches several groups.
//
// CodeMirror gotcha: a group captures its matched modules AND their deps
// recursively, so the leaf groups (`cm-kit`, `cm-langs`) would otherwise
// drag the shared core (view/state/language) in with them — that ballooned
// `cm-langs` to ~600 kB. Fix: give `cm-core` the highest cm priority so it
// claims the shared modules first, scope each cm test so it can't match
// another's packages, and put a `maxSize` on `cm-core` so Rolldown peels
// the heavy `@codemirror/view` engine into its own file. Net: every chunk
// stays under the 500 kB warning, the pieces still load together behind
// the editor's lazy boundary (same total bytes), and a stale deploy
// re-downloads only the part that moved.
advancedChunks: {
groups: [
// React core (react, react-dom, scheduler) — `[\\/]react[\\/]`
// excludes react-router / react-i18next / @uiw/react-codemirror.
{ name: 'react', priority: 100, test: /[\\/](?:react-dom|react|scheduler)[\\/]/ },
{ name: 'router', priority: 95, test: /react-router/ },
{ name: 'i18n', priority: 95, test: /i18next/ },
// `@codemirror/view` is the ~370 kB DOM/render engine — the single
// heaviest module and the reason the old `cm-core` tripped 500 kB.
// Pin it (highest cm priority) so nothing drags it elsewhere.
{ name: 'cm-view', priority: 93, test: /@codemirror[\\/]view[\\/]/ },
// The rest of the core: state + language + lezer + the @uiw wrapper
// (whose recursive deps also pull in autocomplete/commands/search/lint).
// Outranks cm-langs so the lang packs' dep capture can't steal it.
{
name: 'cm-core',
priority: 92,
test: /@codemirror[\\/](?:state|language|theme-|autocomplete|commands|search|lint)|@lezer[\\/]|@uiw[\\/]react-codemirror/,
},
{ name: 'cm-langs', priority: 90, test: /@codemirror[\\/](?:lang-|legacy-modes)/ },
// One chunk per parser library.
{ name: 'p-yaml', priority: 70, test: /js-yaml/ },
{ name: 'p-csv', priority: 70, test: /papaparse/ },
{ name: 'p-xml', priority: 70, test: /fast-xml-parser/ },
{ name: 'p-toml', priority: 70, test: /smol-toml/ },
{ name: 'p-bson', priority: 70, test: /node_modules[\\/]bson[\\/]/ },
{ name: 'p-cbor', priority: 70, test: /node_modules[\\/]cbor-x[\\/]/ },
{ name: 'p-msgpack', priority: 70, test: /node_modules[\\/]@msgpack[\\/]/ },
{ name: 'fflate', priority: 70, test: /fflate/ },
// Radix primitives + icon set.
{ name: 'ui', priority: 60, test: /(?:@radix-ui|lucide-react)/ },
],
},
},
},
@@ -119,8 +138,8 @@ export default defineConfig(({ mode }) => ({
'@tauri-apps/api',
'@tauri-apps/plugin-dialog',
'@tauri-apps/plugin-fs',
'@tauri-apps/plugin-opener',
'@tauri-apps/plugin-os',
'@tauri-apps/plugin-shell',
],
},
}));
+1
View File
@@ -8,6 +8,7 @@ export default defineConfig({
define: {
__APP_VERSION__: JSON.stringify(pkg.version),
__IS_TAURI_BUILD__: 'false',
__IS_ANDROID_BUILD__: 'false',
__APP_COMMIT__: '"test"',
__APP_BUILD_DATE__: '"1970-01-01"',
},