Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b1d461a18e | ||
|
|
4370e36628 | ||
|
|
839bffd000 | ||
|
|
27e704fe4f | ||
|
|
db11ce0f6e | ||
|
|
8bbecd14bd |
No files matched your search
@@ -24,7 +24,7 @@ jobs:
|
||||
steps:
|
||||
- name: Create draft release
|
||||
id: create-release
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v9
|
||||
with:
|
||||
script: |
|
||||
const tag = context.ref.replace('refs/tags/', '').replace('refs/heads/', '');
|
||||
@@ -201,7 +201,7 @@ jobs:
|
||||
run: npm run tauri -- android build --apk
|
||||
|
||||
- name: Upload APK to release
|
||||
uses: actions/github-script@v7
|
||||
uses: actions/github-script@v9
|
||||
with:
|
||||
script: |
|
||||
const fs = require('fs');
|
||||
|
||||
@@ -8,6 +8,13 @@ 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
|
||||
|
||||
@@ -109,6 +109,17 @@ Output:
|
||||
|
||||
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.
|
||||
|
||||
@@ -109,6 +109,17 @@ Output:
|
||||
|
||||
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
-2
@@ -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) |
|
||||
|
||||
+5
-4
@@ -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`.
|
||||
|
||||
@@ -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
@@ -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,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": {
|
||||
|
||||
Generated
+12
-12
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "jsonprism",
|
||||
"version": "1.7.0",
|
||||
"version": "1.7.2",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "jsonprism",
|
||||
"version": "1.7.0",
|
||||
"version": "1.7.2",
|
||||
"license": "Apache-2.0",
|
||||
"dependencies": {
|
||||
"@codemirror/lang-json": "^6.0.0",
|
||||
@@ -31,8 +31,8 @@
|
||||
"@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.25.10",
|
||||
"bson": "^7.2.0",
|
||||
"cbor-x": "^1.6.4",
|
||||
@@ -3133,6 +3133,15 @@
|
||||
"@tauri-apps/api": "^2.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/plugin-opener": {
|
||||
"version": "2.5.4",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-opener/-/plugin-opener-2.5.4.tgz",
|
||||
"integrity": "sha512-1HnPkb+AmgO29HBazm4uPLKB+r7zzcTBW1d0fyYp1uP+jwtpoiNDGKMMzz58SFp49nOIrxdE3aUJtT57lfO9CQ==",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.11.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/plugin-os": {
|
||||
"version": "2.3.2",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-os/-/plugin-os-2.3.2.tgz",
|
||||
@@ -3142,15 +3151,6 @@
|
||||
"@tauri-apps/api": "^2.8.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@tauri-apps/plugin-shell": {
|
||||
"version": "2.3.5",
|
||||
"resolved": "https://registry.npmjs.org/@tauri-apps/plugin-shell/-/plugin-shell-2.3.5.tgz",
|
||||
"integrity": "sha512-jewtULhiQ7lI7+owCKAjc8tYLJr92U16bPOeAa472LHJdgaibLP83NcfAF2e+wkEcA53FxKQAZ7byDzs2eeizg==",
|
||||
"license": "MIT OR Apache-2.0",
|
||||
"dependencies": {
|
||||
"@tauri-apps/api": "^2.10.1"
|
||||
}
|
||||
},
|
||||
"node_modules/@testing-library/dom": {
|
||||
"version": "10.4.1",
|
||||
"resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-10.4.1.tgz",
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "jsonprism",
|
||||
"private": true,
|
||||
"version": "1.7.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>",
|
||||
@@ -59,8 +59,8 @@
|
||||
"@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.25.10",
|
||||
"bson": "^7.2.0",
|
||||
"cbor-x": "^1.6.4",
|
||||
|
||||
Generated
+24
-74
@@ -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.7.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"
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "jsonprism"
|
||||
version = "1.7.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"
|
||||
|
||||
|
||||
@@ -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",
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "JSONPrism",
|
||||
"version": "1.7.0",
|
||||
"version": "1.7.2",
|
||||
"identifier": "com.poli0981.jsonprism",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm run dev",
|
||||
@@ -78,7 +78,7 @@
|
||||
},
|
||||
"android": {
|
||||
"minSdkVersion": 31,
|
||||
"versionCode": 10700
|
||||
"versionCode": 10702
|
||||
}
|
||||
},
|
||||
"plugins": {
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -116,7 +116,14 @@ export function InputPanel({
|
||||
}
|
||||
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 }));
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}, []);
|
||||
}
|
||||
@@ -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": {
|
||||
|
||||
@@ -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": {
|
||||
|
||||
@@ -152,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,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());
|
||||
}
|
||||
|
||||
|
||||
Vendored
+1
@@ -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;
|
||||
+5
-1
@@ -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),
|
||||
},
|
||||
@@ -134,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',
|
||||
],
|
||||
},
|
||||
}));
|
||||
@@ -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"',
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user