4 Commits
Author SHA1 Message Date
poli0981andClaude Opus 4.7 58ef7e739a fix(tauri): port batch extension filter to native drag-drop (v1.3.2) (#24)
The v1.3.0/v1.3.1 desktop bundles accepted any file dropped from File
Explorer / Finder / Nautilus into the workspace, because
`ConverterWorkspace.handleMultiFileDrop` (called by `useTauriDragDrop`
on `tauri://drag-drop` events) ran `batchStore.addFiles` directly and
skipped the `direction × format` extension whitelist that the
`react-dropzone` path in `BatchPanel` / `InputPanel` enforced. Files
like `.cs` / `.py` leaked into the queue with no `wrong_format` toast.

Extract `src/lib/file-filter.ts` exposing `getAllowedExtensions`,
`extOf`, and `filterByExtension` so all three drop entry points share
one implementation. The web `react-dropzone` paths keep their previous
behavior; the Tauri callback now filters + toasts before calling
`addFiles`.

Bump package / Cargo / Tauri version to 1.3.2.

7 new unit tests cover the helper. Total: 190.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 20:05:44 +07:00
poli0981andClaude Opus 4.7 4bf239e089 fix(workflow): announce-discussion unbound var + literal $VAR text (#21)
Two bugs in `.github/workflows/announce-discussion.yml` surfaced when
v1.3.1 published:

1. `DEPLOY_URL: unbound variable` when triggered by `release` event.
   `${{ github.event.workflow_run.* }}` evaluates to null on a release
   event, and the resulting env-var assignment leaves the variable
   unset (not empty), which `set -u` then trips on. Guard every
   dynamic value with `|| ''` so each env var is always at least an
   empty string.

2. Body strings used `$'...'` ANSI-C quoting (which expands backslash
   escapes but NOT variables), so the discussion body would have
   contained literal `$RELEASE_TAG` text. Rewrite to plain double-quoted
   strings, using `$'\n'` only for embedded newlines.

Also pass dynamic values (REPO_ID / CAT_ID / TITLE / BODY) into the
Create Discussion step through env vars instead of literal `${{ ... }}`
substitution — protects against titles/bodies containing quotes or
other shell-special characters that would otherwise break the command
line.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 18:32:59 +07:00
poli0981andClaude Opus 4.7 6b9cc64331 chore(release): v1.3.1 (#19)
Same feature set as v1.3.0 (Đợt 2 + 3 + 4) plus two fixes:

- GitHub Pages 404 — Vite base / React Router basename / all repo URLs
  rebased from `/jsonprism/` to `/jsonPrism/` to match the existing
  repo name case.
- Release workflow — macOS Intel runner replaced with a universal2
  build on macos-14, since macos-13 runners no longer pick up jobs.

v1.3.0 was drafted but never published.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:38:24 +07:00
poli0981andClaude Opus 4.7 50521881f0 fix(release): GH Pages 404 + macOS Intel runner unavailable (#18)
GitHub Pages serves at /jsonPrism/ (case-sensitive, mirrors the repo
name `poli0981/jsonPrism`). Our Vite `base` was set to `/jsonprism/`
(lowercase), so index.html referenced `/jsonprism/assets/*.js` and
every asset 404'd — the deployed page rendered blank. Rebase all
GitHub URLs / Vite base / React Router basename to match the existing
repo case `jsonPrism`. Renaming the repo to all-lowercase is the
cleaner long-term fix, but that's a user-side action.

GitHub Actions `macos-13` runners no longer pick up jobs (the macOS
Intel build sat queued for >18 min, then was cancelled). Replace the
two-entry matrix (macos-14 ARM + macos-13 Intel) with a single
universal2 build on `macos-14` using `--target universal-apple-darwin`.
The resulting `.app` / `.dmg` runs on both Apple Silicon and Intel.

Storage keys, package name, Tauri identifier remain lowercase
(`jsonprism`) — unaffected.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 17:26:20 +07:00
29 changed files with 224 additions and 89 deletions

No files matched your search

+1 -1
View File
@@ -38,7 +38,7 @@ What actually happened. Include the error message and target format.
- Browser: [e.g. Chrome 130, Firefox 132, Safari 18]
- OS: [e.g. Windows 11, macOS 15, Ubuntu 24.04]
- JSONPrism version: [e.g. 0.1.0 — check the footer]
- Is this on the hosted version (poli0981.github.io/jsonprism/) or local dev?
- Is this on the hosted version (poli0981.github.io/jsonPrism/) or local dev?
## Screenshots
+3 -3
View File
@@ -1,11 +1,11 @@
blank_issues_enabled: false
contact_links:
- name: Questions & general discussion
url: https://github.com/poli0981/jsonprism/discussions
url: https://github.com/poli0981/jsonPrism/discussions
about: Ask about usage, share workflows, or propose ideas before opening an issue.
- name: Security vulnerability
url: https://github.com/poli0981/jsonprism/security/advisories/new
url: https://github.com/poli0981/jsonPrism/security/advisories/new
about: Report security issues privately via GitHub Security Advisory (not in public issues).
- name: Live demo
url: https://poli0981.github.io/jsonprism/
url: https://poli0981.github.io/jsonPrism/
about: Try the latest deployed build in your browser before filing a bug.
+31 -16
View File
@@ -76,30 +76,38 @@ jobs:
id: msg
env:
EVENT: ${{ github.event_name }}
RELEASE_TAG: ${{ github.event.release.tag_name }}
RELEASE_URL: ${{ github.event.release.html_url }}
RELEASE_BODY: ${{ github.event.release.body }}
DEPLOY_SHA: ${{ github.event.workflow_run.head_sha }}
DEPLOY_URL: ${{ github.event.workflow_run.html_url }}
DISPATCH_MSG: ${{ inputs.message }}
# `|| ''` guards each value so the env var is always set to an
# empty string (not unset) when the source field is missing for
# the active event type. Without this, `set -u` blows up below.
RELEASE_TAG: ${{ github.event.release.tag_name || '' }}
RELEASE_URL: ${{ github.event.release.html_url || '' }}
RELEASE_BODY: ${{ github.event.release.body || '' }}
DEPLOY_SHA: ${{ github.event.workflow_run.head_sha || '' }}
DEPLOY_URL: ${{ github.event.workflow_run.html_url || '' }}
DISPATCH_MSG: ${{ inputs.message || '' }}
run: |
set -euo pipefail
# NL is a literal newline used to assemble multi-line bodies
# without breaking the YAML literal-block-scalar indentation.
# Concatenating "$VAR""$NL""$NL""$OTHER" gives both interpolation
# AND embedded blank lines.
NL=$'\n'
case "$EVENT" in
release)
title="Release $RELEASE_TAG"
body=$'## $RELEASE_TAG\n\n$RELEASE_BODY\n\n[View release →]($RELEASE_URL)'
title="Release ${RELEASE_TAG}"
body="## ${RELEASE_TAG}${NL}${NL}${RELEASE_BODY}${NL}${NL}[View release →](${RELEASE_URL})"
;;
workflow_run)
short_sha="${DEPLOY_SHA:0:7}"
title="Deploy succeeded — $short_sha"
body=$'Latest commit deployed to GitHub Pages.\n\n[Deploy run →]($DEPLOY_URL)'
title="Deploy succeeded — ${short_sha}"
body="Latest commit deployed to GitHub Pages.${NL}${NL}[Deploy run →](${DEPLOY_URL})"
;;
workflow_dispatch)
title="Announcement"
body="$DISPATCH_MSG"
body="${DISPATCH_MSG}"
;;
*)
echo "::error::Unsupported event: $EVENT"
echo "::error::Unsupported event: ${EVENT}"
exit 1
;;
esac
@@ -115,6 +123,13 @@ jobs:
- name: Create Discussion
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Pass dynamic values through env vars (not literal `${{ ... }}`
# substitution) so a title/body containing quotes, backticks, or
# other shell-special characters doesn't break the command line.
REPO_ID: ${{ steps.ids.outputs.repo_id }}
CAT_ID: ${{ steps.ids.outputs.cat_id }}
TITLE: ${{ steps.msg.outputs.title }}
BODY: ${{ steps.msg.outputs.body }}
run: |
set -euo pipefail
MUTATION='mutation($repo: ID!, $cat: ID!, $title: String!, $body: String!) {
@@ -124,8 +139,8 @@ jobs:
}'
gh api graphql \
-f query="$MUTATION" \
-F repo="${{ steps.ids.outputs.repo_id }}" \
-F cat="${{ steps.ids.outputs.cat_id }}" \
-F title="${{ steps.msg.outputs.title }}" \
-F body="${{ steps.msg.outputs.body }}" \
-F repo="$REPO_ID" \
-F cat="$CAT_ID" \
-F title="$TITLE" \
-F body="$BODY" \
--jq '.data.createDiscussion.discussion.url'
+5 -7
View File
@@ -22,12 +22,9 @@ jobs:
- name: Windows
runner: windows-latest
args: ''
- name: macOS (Apple Silicon)
- name: macOS (universal)
runner: macos-14
args: '--target aarch64-apple-darwin'
- name: macOS (Intel)
runner: macos-13
args: '--target x86_64-apple-darwin'
args: '--target universal-apple-darwin'
- name: Linux
runner: ubuntu-22.04
args: ''
@@ -57,7 +54,8 @@ jobs:
- name: Setup Rust (stable)
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.platform.runner == 'macos-14' && 'aarch64-apple-darwin' || matrix.platform.runner == 'macos-13' && 'x86_64-apple-darwin' || '' }}
# macOS universal2 build needs both aarch64 + x86_64 targets installed.
targets: ${{ matrix.platform.runner == 'macos-14' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }}
- name: Cache Cargo build artifacts
uses: swatinem/rust-cache@v2
@@ -86,7 +84,7 @@ jobs:
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.
See the [CHANGELOG](https://github.com/poli0981/jsonPrism/blob/main/CHANGELOG.md) for what's new.
releaseDraft: true
prerelease: false
args: ${{ matrix.platform.args }}
+21
View File
@@ -8,6 +8,27 @@ 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 Phase 3".
## [1.3.2] — 2026-05-13
### Fixed
- **Tauri native drag-drop bypassed the batch extension filter**. v1.3.0/v1.3.1 desktop bundles accepted any file dropped from File Explorer / Finder / Nautilus into the workspace, because `ConverterWorkspace.handleMultiFileDrop` called `batchStore.addFiles` directly — skipping the `direction × format` extension whitelist that the web `react-dropzone` path enforced. Files like `.cs`/`.py` leaked into the queue with no warning. Extracted `src/lib/file-filter.ts` (`getAllowedExtensions` + `extOf` + `filterByExtension`) and routed the Tauri callback, `BatchPanel`, and `InputPanel` through it so the wrong-format toast surfaces in all three entry points.
### Tests
- 7 new unit tests for `getAllowedExtensions`, `extOf`, and `filterByExtension` in `src/lib/__tests__/file-filter.test.ts`. Total tests: **190**.
## [1.3.1] — 2026-05-13
### Fixed
- **GitHub Pages deploy 404**. The deployed page rendered blank because every asset URL 404'd. Root cause: GitHub Pages serves at `https://poli0981.github.io/jsonPrism/` (case-sensitive, mirrors the repo name), but Vite `base` was `/jsonprism/` (lowercase), so `index.html` referenced `/jsonprism/assets/*.js`. Rebased Vite `base`, React Router basename, and all GitHub URLs in code/docs to match the existing repo case `jsonPrism`. Storage keys / package name / Tauri identifier remain lowercase.
- **Release workflow macOS Intel build cancelled**. GitHub Actions `macos-13` runners no longer pick up jobs (jobs queue indefinitely then auto-cancel after timeout). Replaced the two-entry macOS matrix (Apple Silicon + Intel) with a single `macos-14` build using `--target universal-apple-darwin`. The resulting `.dmg` / `.app` runs on both Apple Silicon and Intel via the universal2 binary.
### Note on v1.3.0
The v1.3.0 tag was published with a draft GitHub Release containing partial bundles (Windows + macOS Apple Silicon + Linux; macOS Intel missing). It was never un-drafted because of the two bugs above. v1.3.1 carries the same feature set plus the fixes — please use v1.3.1.
## [1.3.0] — 2026-05-13
### Added — Đợt sửa lỗi 4: editor UX, batch hygiene, workspace persistence, TERMS
+1 -1
View File
@@ -12,7 +12,7 @@ In short:
The maintainer ([@poli0981](https://github.com/poli0981)) is responsible
for enforcement. Reports of misconduct can be sent through:
- A [private Discussion](https://github.com/poli0981/jsonprism/discussions) addressed to the maintainer, or
- A [private Discussion](https://github.com/poli0981/jsonPrism/discussions) addressed to the maintainer, or
- Email via the address on the GitHub profile.
Reports are handled confidentially. Possible outcomes include: a warning,
+4 -4
View File
@@ -5,7 +5,7 @@ Thanks for considering a contribution! JSONPrism is an open-source project under
## Quick start
```bash
git clone https://github.com/poli0981/jsonprism.git
git clone https://github.com/poli0981/jsonPrism.git
cd jsonprism
npm install
npm run dev
@@ -36,7 +36,7 @@ Open <http://localhost:5173>.
### 🐛 Bug reports
Use the [Bug Report](https://github.com/poli0981/jsonprism/issues/new?template=bug_report.md) template. Include:
Use the [Bug Report](https://github.com/poli0981/jsonPrism/issues/new?template=bug_report.md) template. Include:
- Browser + OS
- Steps to reproduce
@@ -45,7 +45,7 @@ Use the [Bug Report](https://github.com/poli0981/jsonprism/issues/new?template=b
### 💡 Feature requests
Use the [Feature Request](https://github.com/poli0981/jsonprism/issues/new?template=feature_request.md) template. We prioritize features that:
Use the [Feature Request](https://github.com/poli0981/jsonPrism/issues/new?template=feature_request.md) template. We prioritize features that:
- Fit the "one JSON → many formats" core mission
- Don't require server-side processing (we're client-only by design)
@@ -123,7 +123,7 @@ This project adopts the [Contributor Covenant v2.1](CODE_OF_CONDUCT.md).
Be kind. Assume good faith. Disagreements about technical choices are
fine; personal attacks and harassment are not.
Reports to the maintainer via the [private Security Advisory flow](https://github.com/poli0981/jsonprism/security/advisories/new) for sensitive matters, or a private GitHub Discussion otherwise.
Reports to the maintainer via the [private Security Advisory flow](https://github.com/poli0981/jsonPrism/security/advisories/new) for sensitive matters, or a private GitHub Discussion otherwise.
## License
+3 -3
View File
@@ -32,7 +32,7 @@ This project openly uses AI tools during development:
and reviewing PRs.
- All AI-generated code is reviewed by the maintainer before being
merged. Errors that slip through are bugs — please report them via
[GitHub Issues](https://github.com/poli0981/jsonprism/issues).
[GitHub Issues](https://github.com/poli0981/jsonPrism/issues).
### Translations
@@ -57,6 +57,6 @@ key — it surfaces this disclaimer to users at runtime.
## Reporting concerns
- Bugs: [GitHub Issues](https://github.com/poli0981/jsonprism/issues)
- Security: [Private Security Advisory](https://github.com/poli0981/jsonprism/security/advisories/new)
- Bugs: [GitHub Issues](https://github.com/poli0981/jsonPrism/issues)
- Security: [Private Security Advisory](https://github.com/poli0981/jsonPrism/security/advisories/new)
- Translation accuracy: GitHub Discussions
+3 -3
View File
@@ -10,9 +10,9 @@ merged PR.
## Contact
- Bug reports & feature requests: [GitHub Issues](https://github.com/poli0981/jsonprism/issues)
- Discussion / Q&A: [GitHub Discussions](https://github.com/poli0981/jsonprism/discussions)
- Security: [Private Security Advisory](https://github.com/poli0981/jsonprism/security/advisories/new)
- Bug reports & feature requests: [GitHub Issues](https://github.com/poli0981/jsonPrism/issues)
- Discussion / Q&A: [GitHub Discussions](https://github.com/poli0981/jsonPrism/discussions)
- Security: [Private Security Advisory](https://github.com/poli0981/jsonPrism/security/advisories/new)
## Becoming a maintainer
+2 -2
View File
@@ -67,5 +67,5 @@ The Tauri build inlines these fonts and never makes the request.
## Questions
Open a [GitHub Discussion](https://github.com/poli0981/jsonprism/discussions) if anything here is unclear.
For security-relevant reports, use the [private Security Advisory flow](https://github.com/poli0981/jsonprism/security/advisories/new).
Open a [GitHub Discussion](https://github.com/poli0981/jsonPrism/discussions) if anything here is unclear.
For security-relevant reports, use the [private Security Advisory flow](https://github.com/poli0981/jsonPrism/security/advisories/new).
+5 -5
View File
@@ -6,11 +6,11 @@
One JSON input. Eight target formats. Fully in your browser.
[![CI](https://github.com/poli0981/jsonprism/actions/workflows/ci.yml/badge.svg)](https://github.com/poli0981/jsonprism/actions/workflows/ci.yml)
[![Deploy](https://github.com/poli0981/jsonprism/actions/workflows/deploy.yml/badge.svg)](https://github.com/poli0981/jsonprism/actions/workflows/deploy.yml)
[![CI](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml/badge.svg)](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml)
[![Deploy](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml/badge.svg)](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[Live demo](https://poli0981.github.io/jsonprism/) · [Tiếng Việt](README.vi.md) · [Roadmap](docs/ROADMAP.md)
[Live demo](https://poli0981.github.io/jsonPrism/) · [Tiếng Việt](README.vi.md) · [Roadmap](docs/ROADMAP.md)
</div>
@@ -59,7 +59,7 @@ JSONPrism is a refracting tool for developers. It takes a single JSON input and
**Requirements**: Node.js **22 LTS** or newer.
```bash
git clone https://github.com/poli0981/jsonprism.git
git clone https://github.com/poli0981/jsonPrism.git
cd jsonprism
npm install
npm run dev # http://localhost:5173
@@ -187,7 +187,7 @@ See [`docs/ROADMAP.md`](docs/ROADMAP.md) for the full phase plan.
Pull requests welcome — please read [`CONTRIBUTING.md`](CONTRIBUTING.md) first. PRs that match the **auto-ignored** patterns described there (suspicious code, off-topic preamble, no description, etc.) get closed without review.
For bug reports and feature requests, use [GitHub Issues](https://github.com/poli0981/jsonprism/issues). For security vulnerabilities, use the [private Security Advisory flow](https://github.com/poli0981/jsonprism/security/advisories/new).
For bug reports and feature requests, use [GitHub Issues](https://github.com/poli0981/jsonPrism/issues). For security vulnerabilities, use the [private Security Advisory flow](https://github.com/poli0981/jsonPrism/security/advisories/new).
## Project docs
+5 -5
View File
@@ -6,11 +6,11 @@
Một JSON đầu vào. Tám định dạng đích. Chạy hoàn toàn trong trình duyệt.
[![CI](https://github.com/poli0981/jsonprism/actions/workflows/ci.yml/badge.svg)](https://github.com/poli0981/jsonprism/actions/workflows/ci.yml)
[![Deploy](https://github.com/poli0981/jsonprism/actions/workflows/deploy.yml/badge.svg)](https://github.com/poli0981/jsonprism/actions/workflows/deploy.yml)
[![CI](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml/badge.svg)](https://github.com/poli0981/jsonPrism/actions/workflows/ci.yml)
[![Deploy](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml/badge.svg)](https://github.com/poli0981/jsonPrism/actions/workflows/deploy.yml)
[![License: Apache 2.0](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](LICENSE)
[Bản demo](https://poli0981.github.io/jsonprism/) · [English](README.md) · [Lộ trình](docs/ROADMAP.md)
[Bản demo](https://poli0981.github.io/jsonPrism/) · [English](README.md) · [Lộ trình](docs/ROADMAP.md)
</div>
@@ -56,7 +56,7 @@ JSONPrism là công cụ "tán sắc" cho developer. Nhận một JSON đầu v
**Yêu cầu**: Node.js **22 LTS** trở lên.
```bash
git clone https://github.com/poli0981/jsonprism.git
git clone https://github.com/poli0981/jsonPrism.git
cd jsonprism
npm install
npm run dev # http://localhost:5173
@@ -184,7 +184,7 @@ Xem [`docs/ROADMAP.md`](docs/ROADMAP.md) để biết kế hoạch phase đầy
Welcome pull request — vui lòng đọc [`CONTRIBUTING.md`](CONTRIBUTING.md) trước. PR thuộc nhóm **auto-ignored** (code đáng ngờ, lan man không vào vấn đề, không mô tả…) sẽ bị đóng không review.
Báo bug hoặc đề xuất tính năng tại [GitHub Issues](https://github.com/poli0981/jsonprism/issues). Vấn đề bảo mật vui lòng dùng [Security Advisory riêng tư](https://github.com/poli0981/jsonprism/security/advisories/new).
Báo bug hoặc đề xuất tính năng tại [GitHub Issues](https://github.com/poli0981/jsonPrism/issues). Vấn đề bảo mật vui lòng dùng [Security Advisory riêng tư](https://github.com/poli0981/jsonPrism/security/advisories/new).
## Tài liệu project
+1 -1
View File
@@ -16,7 +16,7 @@ latest minor of the current major receives security fixes.
Use GitHub's private vulnerability reporting:
→ <https://github.com/poli0981/jsonprism/security/advisories/new>
→ <https://github.com/poli0981/jsonPrism/security/advisories/new>
This routes the report directly to the maintainer through a private
channel. You can include a proof-of-concept, suggested fix, and your
+1 -1
View File
@@ -15,7 +15,7 @@ not agree, stop using it.
## 1. Acceptance
Accessing the web app at <https://poli0981.github.io/jsonprism/>,
Accessing the web app at <https://poli0981.github.io/jsonPrism/>,
running the Tauri desktop bundle, cloning or downloading the repository,
or otherwise interacting with the project constitutes acceptance of
these terms.
+1 -1
View File
@@ -39,7 +39,7 @@ the broader dev environment knows what's around:
```bash
# One-time
git clone https://github.com/poli0981/jsonprism.git
git clone https://github.com/poli0981/jsonPrism.git
cd jsonprism
npm install
+1 -1
View File
@@ -39,7 +39,7 @@ trường tương đương:
```bash
# Một lần
git clone https://github.com/poli0981/jsonprism.git
git clone https://github.com/poli0981/jsonPrism.git
cd jsonprism
npm install
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "jsonprism",
"version": "1.3.0",
"version": "1.3.2",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "jsonprism",
"version": "1.3.0",
"version": "1.3.2",
"license": "Apache-2.0",
"dependencies": {
"@codemirror/lang-json": "^6.0.0",
+3 -3
View File
@@ -1,15 +1,15 @@
{
"name": "jsonprism",
"private": true,
"version": "1.3.0",
"version": "1.3.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>",
"license": "Apache-2.0",
"homepage": "https://poli0981.github.io/jsonprism/",
"homepage": "https://poli0981.github.io/jsonPrism/",
"repository": {
"type": "git",
"url": "https://github.com/poli0981/jsonprism.git"
"url": "https://github.com/poli0981/jsonPrism.git"
},
"engines": {
"node": ">=22.11.0"
+2 -2
View File
@@ -1,10 +1,10 @@
[package]
name = "jsonprism"
version = "1.3.0"
version = "1.3.2"
description = "Disperse JSON into many formats."
authors = ["poli0981 <https://github.com/poli0981>"]
license = "Apache-2.0"
repository = "https://github.com/poli0981/jsonprism"
repository = "https://github.com/poli0981/jsonPrism"
edition = "2021"
rust-version = "1.77"
+2 -2
View File
@@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "JSONPrism",
"version": "1.3.0",
"version": "1.3.2",
"identifier": "com.poli0981.jsonprism",
"build": {
"beforeDevCommand": "npm run dev",
@@ -44,7 +44,7 @@
"longDescription": "JSONPrism is a refracting tool for developers. It takes a single JSON input and disperses it into many target formats — JSONL, CSV/TSV, YAML, XML, TOML, Markdown, SQL INSERT — fully on your machine.",
"copyright": "Copyright (c) 2026 poli0981",
"publisher": "poli0981",
"homepage": "https://github.com/poli0981/jsonprism",
"homepage": "https://github.com/poli0981/jsonPrism",
"windows": {
"wix": {
"language": "en-US"
+6 -10
View File
@@ -13,6 +13,7 @@ import {
import { toast } from '@/components/ui/sonner';
import { useBatchStore, BATCH_MAX_FILES, type BatchItem } from '@/stores/batchStore';
import { processBatch, zipOutputs, downloadBlob } from '@/lib/batch-processor';
import { filterByExtension, getAllowedExtensions } from '@/lib/file-filter';
import { isTauri, nativeOpenFiles, nativeSaveBlob, fileFromNativePath } from '@/lib/tauri';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
@@ -68,19 +69,14 @@ export function BatchPanel({ format, direction, options, open, onOpenChange }: B
// Whitelist of file extensions that match the current direction × format.
// The browser's native `<input accept>` is only a hint, so we re-validate
// in JS to reject files chosen via "Browse" with "All files" filter.
const allowedExtensions = useMemo(() => {
return isReverse ? [converter.meta.extension.toLowerCase(), 'txt'] : ['json', 'txt'];
}, [isReverse, converter.meta.extension]);
const allowedExtensions = useMemo(
() => getAllowedExtensions(isReverse ? 'reverse' : 'forward', converter.meta.extension),
[isReverse, converter.meta.extension],
);
const handleAddFiles = useCallback(
(files: File[]) => {
const valid: File[] = [];
let wrongFormat = 0;
for (const f of files) {
const ext = (f.name.split('.').pop() ?? '').toLowerCase();
if (allowedExtensions.includes(ext)) valid.push(f);
else wrongFormat += 1;
}
const { valid, wrongFormat } = filterByExtension(files, allowedExtensions);
if (wrongFormat > 0) {
toast.warning(t('batch.toast.wrong_format', { count: wrongFormat }));
}
@@ -4,6 +4,7 @@ import { toast } from '@/components/ui/sonner';
import { getConverter } from '@/converters/registry';
import type { FormatId } from '@/converters/types';
import { parseJsonInput } from '@/lib/detect';
import { filterByExtension, getAllowedExtensions } from '@/lib/file-filter';
import { useKeyboardShortcuts } from '@/hooks/useKeyboardShortcuts';
import { useTauriDragDrop } from '@/hooks/useTauriDragDrop';
import { useBatchStore } from '@/stores/batchStore';
@@ -39,7 +40,16 @@ export function ConverterWorkspace() {
const handleMultiFileDrop = useCallback(
(files: File[]) => {
const result = addBatchFiles(files);
const allowed = getAllowedExtensions(
direction === 'reverse' ? 'reverse' : 'forward',
getConverter(format).meta.extension,
);
const { valid, wrongFormat } = filterByExtension(files, allowed);
if (wrongFormat > 0) {
toast.warning(t('batch.toast.wrong_format', { count: wrongFormat }));
}
if (valid.length === 0) return;
const result = addBatchFiles(valid);
if (result.added > 0) {
toast.success(t('batch.toast.added', { count: result.added }));
setBatchOpen(true);
@@ -52,7 +62,7 @@ export function ConverterWorkspace() {
}
}
},
[addBatchFiles, t],
[addBatchFiles, direction, format, t],
);
// Native OS drag-drop bridge (no-op outside Tauri).
+3 -5
View File
@@ -3,6 +3,7 @@ import { useTranslation } from 'react-i18next';
import { useDropzone } from 'react-dropzone';
import { Eraser, FileText, FolderOpen } from 'lucide-react';
import { toast } from '@/components/ui/sonner';
import { extOf, getAllowedExtensions } from '@/lib/file-filter';
import { SAMPLE_JSON } from '@/lib/sample';
import { isTauri, nativeOpenFiles, fileFromNativePath } from '@/lib/tauri';
import { getConverter } from '@/converters/registry';
@@ -70,15 +71,12 @@ export function InputPanel({
// Allowed extensions for the single-file "Open" / drag-drop path.
// `<input accept>` is only a hint to the OS picker — re-validate in JS.
const allowedExtensions = useMemo(
() => (isReverse ? [converter.meta.extension.toLowerCase(), 'txt'] : ['json', 'txt']),
() => getAllowedExtensions(isReverse ? 'reverse' : 'forward', converter.meta.extension),
[isReverse, converter.meta.extension],
);
const hasAllowedExt = useCallback(
(name: string) => {
const ext = (name.split('.').pop() ?? '').toLowerCase();
return allowedExtensions.includes(ext);
},
(name: string) => allowedExtensions.includes(extOf(name)),
[allowedExtensions],
);
+1 -1
View File
@@ -29,7 +29,7 @@ export function Header() {
<LanguageSwitcher />
<ThemeToggle />
<a
href="https://github.com/poli0981/jsonprism"
href="https://github.com/poli0981/jsonPrism"
target="_blank"
rel="noreferrer"
className="text-muted-foreground hover:bg-muted hover:text-foreground inline-flex h-9 w-9 items-center justify-center rounded-md transition"
+54
View File
@@ -0,0 +1,54 @@
import { describe, expect, it } from 'vitest';
import { extOf, filterByExtension, getAllowedExtensions } from '../file-filter';
function f(name: string): File {
return new File(['x'], name);
}
describe('getAllowedExtensions', () => {
it('returns json + txt for forward direction regardless of format', () => {
expect(getAllowedExtensions('forward', 'yaml')).toEqual(['json', 'txt']);
expect(getAllowedExtensions('forward', 'resx')).toEqual(['json', 'txt']);
});
it('returns format extension + txt for reverse direction, lowercased', () => {
expect(getAllowedExtensions('reverse', 'yaml')).toEqual(['yaml', 'txt']);
expect(getAllowedExtensions('reverse', 'RESX')).toEqual(['resx', 'txt']);
expect(getAllowedExtensions('reverse', 'toml')).toEqual(['toml', 'txt']);
});
});
describe('extOf', () => {
it('lowercases the trailing extension', () => {
expect(extOf('foo.JSON')).toBe('json');
expect(extOf('a.b.cs')).toBe('cs');
});
it('returns empty string for names with no extension', () => {
expect(extOf('noext')).toBe('');
expect(extOf('trailing.')).toBe('');
expect(extOf('.hidden')).toBe('hidden');
});
});
describe('filterByExtension', () => {
it('partitions by extension whitelist (case-insensitive)', () => {
const cs = f('a.cs');
const json = f('b.json');
const yaml = f('c.yaml');
const result = filterByExtension([cs, json, yaml], ['json', 'txt']);
expect(result.valid).toEqual([json]);
expect(result.wrongFormat).toBe(2);
});
it('accepts uppercase extensions because whitelist comparison is lowercased', () => {
const upper = f('FOO.JSON');
const result = filterByExtension([upper], ['json', 'txt']);
expect(result.valid).toEqual([upper]);
expect(result.wrongFormat).toBe(0);
});
it('returns empty result for empty input', () => {
expect(filterByExtension([], ['json'])).toEqual({ valid: [], wrongFormat: 0 });
});
});
+41
View File
@@ -0,0 +1,41 @@
export type FileFilterDirection = 'forward' | 'reverse';
/**
* Allowed file extensions for a given direction × format combo.
* Forward: JSON-only input. Reverse: the format's native extension.
* `.txt` is always accepted as a freeform escape hatch.
*
* Returned extensions are lowercase, without the leading dot.
*/
export function getAllowedExtensions(
direction: FileFilterDirection,
formatExtension: string,
): string[] {
if (direction === 'reverse') {
return [formatExtension.toLowerCase(), 'txt'];
}
return ['json', 'txt'];
}
/** Lowercase extension of a filename, empty string if there's no dot. */
export function extOf(name: string): string {
const idx = name.lastIndexOf('.');
if (idx < 0 || idx === name.length - 1) return '';
return name.slice(idx + 1).toLowerCase();
}
export interface FilterByExtensionResult {
valid: File[];
wrongFormat: number;
}
/** Split files into (accepted, wrong-format count) by extension whitelist. */
export function filterByExtension(files: File[], allowed: string[]): FilterByExtensionResult {
const valid: File[] = [];
let wrongFormat = 0;
for (const f of files) {
if (allowed.includes(extOf(f.name))) valid.push(f);
else wrongFormat += 1;
}
return { valid, wrongFormat };
}
+5 -4
View File
@@ -11,10 +11,11 @@ if (!rootEl) {
}
// Tauri serves the bundle from `tauri://localhost/` regardless of the web
// deploy path. Web prod ships at `/jsonprism/` on GitHub Pages. The split
// is build-time, so use a Vite `define` flag instead of `isTauri()` runtime
// (which is false at module load before Tauri injects __TAURI__).
const basename = __IS_TAURI_BUILD__ ? '/' : import.meta.env.PROD ? '/jsonprism' : '/';
// deploy path. Web prod ships at `/jsonPrism/` on GitHub Pages (path mirrors
// the repo name case). The split is build-time, so use a Vite `define`
// flag instead of `isTauri()` runtime (which is false at module load before
// Tauri injects __TAURI__).
const basename = __IS_TAURI_BUILD__ ? '/' : import.meta.env.PROD ? '/jsonPrism' : '/';
createRoot(rootEl).render(
<StrictMode>
+2 -2
View File
@@ -2,7 +2,7 @@ import { useTranslation } from 'react-i18next';
import { ExternalLink, Heart } from 'lucide-react';
import { cn } from '@/lib/utils';
const REPO_URL = 'https://github.com/poli0981/jsonprism';
const REPO_URL = 'https://github.com/poli0981/jsonPrism';
interface DonatePlatform {
key: 'github' | 'ko_fi' | 'buy_me_a_coffee' | 'patreon' | 'paypal';
@@ -202,7 +202,7 @@ export function About() {
<LinkRow href={REPO_URL} label={t('about.links.repo')} />
<LinkRow href={`${REPO_URL}/issues`} label={t('about.links.issues')} />
<LinkRow href={`${REPO_URL}/discussions`} label={t('about.links.discussions')} />
<LinkRow href="https://poli0981.github.io/jsonprism/" label={t('about.links.demo')} />
<LinkRow href="https://poli0981.github.io/jsonPrism/" label={t('about.links.demo')} />
<LinkRow href={`${REPO_URL}/blob/main/LICENSE`} label={t('about.links.license')} />
</ul>
</section>
+3 -2
View File
@@ -25,8 +25,9 @@ const appBuildDate = new Date().toISOString().slice(0, 10);
// https://vite.dev/config/
export default defineConfig(({ mode }) => ({
// Web prod build deploys to /jsonprism/. Tauri bundles serve from '/'.
base: isTauriContext ? '/' : mode === 'production' ? '/jsonprism/' : '/',
// Web prod build deploys to /jsonPrism/ (GH Pages mirrors the repo name
// case). Tauri bundles serve from '/'.
base: isTauriContext ? '/' : mode === 'production' ? '/jsonPrism/' : '/',
define: {
__APP_VERSION__: JSON.stringify(pkg.version),