diff --git a/plugins/f-provider/.github/assets/code-translate.gif b/plugins/f-provider/.github/assets/code-translate.gif new file mode 100644 index 00000000..eafc30f8 Binary files /dev/null and b/plugins/f-provider/.github/assets/code-translate.gif differ diff --git a/plugins/f-provider/.github/assets/img-translate.gif b/plugins/f-provider/.github/assets/img-translate.gif new file mode 100644 index 00000000..61d37c85 Binary files /dev/null and b/plugins/f-provider/.github/assets/img-translate.gif differ diff --git a/plugins/f-provider/.github/assets/screenshot-ocr.gif b/plugins/f-provider/.github/assets/screenshot-ocr.gif new file mode 100644 index 00000000..b7b3c178 Binary files /dev/null and b/plugins/f-provider/.github/assets/screenshot-ocr.gif differ diff --git a/plugins/f-provider/.github/workflows/release.yml b/plugins/f-provider/.github/workflows/release.yml new file mode 100644 index 00000000..817abbd3 --- /dev/null +++ b/plugins/f-provider/.github/workflows/release.yml @@ -0,0 +1,69 @@ +# Build the native OCR runtime (wechat_ocr.node + wco_data) on Windows, bundle +# it into native.zip, and publish native.zip as a GitHub Release asset. +# +# Scope: this workflow ONLY builds & ships the native bits. The frontend plugin +# is released independently (npm run build) — its plugin.json carries the +# native.downloadUrl / sha256 / version, maintained by hand there. +# +# Triggered by pushing a `v*` tag (e.g. v1.0.1). The tag becomes the Release +# name; the Release carries a single asset: dist/native.zip. +name: Release + +on: + push: + tags: + - 'v*' + +permissions: + contents: write # required to create the Release and upload the asset + +jobs: + release: + # Pin to windows-2022 (VS 2022). windows-latest now ships VS 2026, which + # node-gyp 10.x (bundled in Node 20) cannot detect — see node-gyp #3282. + runs-on: windows-2022 + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'npm' + + - name: Setup Python (for node-gyp) + uses: actions/setup-python@v5 + with: + python-version: '3.11' + + - name: Install frontend dependencies + run: npm install + + # copy:native writes into dist/, so produce it first (vite empties dist + # on build — run frontend BEFORE the native copy step, never after). + - name: Build frontend (produces dist/) + run: npm run build + + - name: Build native (fetch wco_data + compile wechat_ocr.node) + run: npm run build:native + shell: bash + + - name: Copy native assets into dist/ and bundle native.zip + run: npm run copy:native + + - name: Resolve version + id: ver + shell: bash + run: | + # v1.0.1 -> 1.0.1 + ver="${GITHUB_REF_NAME#v}" + echo "version=$ver" >> "$GITHUB_OUTPUT" + + - name: Upload native.zip to a GitHub Release + uses: softprops/action-gh-release@v2 + with: + name: ${{ steps.ver.outputs.version }} + tag_name: ${{ github.ref_name }} + files: | + dist/native.zip diff --git a/plugins/f-provider/.gitignore b/plugins/f-provider/.gitignore new file mode 100644 index 00000000..2186b30c --- /dev/null +++ b/plugins/f-provider/.gitignore @@ -0,0 +1,20 @@ +node_modules/ +dist/ + +# Native OCR build output & dependencies +native/build/ +native/node_modules/ + +# Compiled native addon (product of build; do not commit) +native/**/*.node +*.node + +# Tencent proprietary runtime files — never committed. Obtain locally +# (see native/wco_data/README.md) and drop here before building/running. +native/wco_data/*.dll +native/wco_data/*.exe +native/wco_data/*.nas +native/wco_data/*.xnet +native/wco_data/RecDict +native/wco_data/sohu_simp.txt +native/wco_data/x64.config diff --git a/plugins/f-provider/README.md b/plugins/f-provider/README.md new file mode 100644 index 00000000..dd45bffa --- /dev/null +++ b/plugins/f-provider/README.md @@ -0,0 +1,241 @@ +# ztools-f-provider + +
+
+**一个 ZTools 提供商插件,把本地 OCR 与多家翻译封装为可复用的「OCR / 翻译提供商」**
+
+_微信 OCR 离线识别 · 百度 / 谷歌 / 有道 / 微软翻译 · 代码命名翻译_
+
+[](./LICENSE)
+[](#-平台与限制)
+[](https://github.com/ZToolsCenter/ZTools)
+
+
+
+ 截图识别 - 进入即截屏 → OCR → 文字悬浮可复制 + |
+
+
+ 图片识别与翻译 - 拖图识别 + 多提供商对比 + |
+
+
+ 代码翻译 - 中文 → 英文 → 8 种命名风格,↑↓ 切换、回车粘贴 + |
+ |