Build (no Node.js needed):
cargo tauri build
Dev:
cargo tauri dev
Frontend lives in src/ and is served directly (no bundler). No package.json.
CI triggers on v* tags and manual dispatch. Requires cargo install tauri-cli --locked first.
- Lib crate is
viewstage_lib(_libsuffix avoids Cargo issue #8519 on Windows, seeCargo.toml:10-14). main.rscallsviewstage_lib::run().- All Tauri commands registered in
lib.rs:2928-2971— check there before adding new ones. - Logging:
simplelogwrites to%APPDATA%/SECTL/ViewPDF/log/viewpdf_{date}.log. - Config:
%APPDATA%/SECTL/ViewPDF/config.json, with a config version migration system (migrate_config/get_migrations). - Image save path:
~/Pictures/ViewPDF/.
- Entrypoint:
src/index.htmlloadsJS/pdf.min.js,JS/pdf.worker.min.js,i18n.js, then module scriptsthemes/theme.js,main.js,init.js. - No bundler — ES modules loaded directly; use
type="module"for imports. - Init flow:
init.jsDOMContentLoaded → init i18n → initDOM → initCanvas → bindAllEvents → load settings → openCamera. - Architecture: image layer (
<img>) + annotation layer (<canvas>) in acanvas-wrapper. tauri.conf.jsonenables"withGlobalTauri": true— access viawindow.__TAURI__.- State management: global
stateobject + globaldomcache onwindow. - Tauri v2 IPC:
window.__TAURI__.core.invoke(...). - CSP currently allows
'unsafe-inline'and'unsafe-eval'.
oobe.html— first-run setup window (500×520, no decorations).settings.html— settings popup (600×600).doc-scan/index.html— document scanning sub-app (fullscreen, undecorated).
Locale files in src/locales/{zh-CN,zh-TW,en-US}.json. Setting stored in config.json under language key. i18n.init() called in init.js before anything else.
None found. No test framework is configured.
- Office document conversion uses PowerShell COM interop (Word/WPS/LibreOffice) — Windows only.
tauri.conf.json:bundle.targetsis"all"— produces both MSI and NSIS installers.- NSIS installer hooks at
installer-hooks.nsh— runsViewPDF.exe --uninstall-cleanupon uninstall. model/andcache/dirs are gitignored; ONNX model files go under%APPDATA%/SECTL/ViewPDF/models/.gen/undersrc-tauri/is generated by Tauri build (schema files).
ViewPDF.exe --uninstall-cleanup(or--cleanup) runs cleanup and exits without Tauri init.- Called automatically via NSIS uninstall hook (
installer-hooks.nsh→NSIS_HOOK_PREUNINSTALL). - Cleans up: file association registry entries (ProgIDs, OpenWithProgids, UserChoice for .pdf/.docx/.doc) + deletes
ViewPDF_MemCleanscheduled task. - Implementation in
lib.rs:3540-3558(uninstall_cleanup_perform).