Skip to content

Latest commit

 

History

History
33 lines (24 loc) · 2.27 KB

File metadata and controls

33 lines (24 loc) · 2.27 KB

一修 · 打包壳工程

网页版是完整体,这里只是两层"方便使用"的包装。GitHub Actions(.github/workflows/build-apps.yml)在打 tag(v*)或手动触发时自动构建并挂到 Releases。

desktop/ — PC 桌面版(Tauri 2,轻量)

  • 系统 WebView(Windows 上是 WebView2/Chromium),不打包浏览器内核——exe 只有几 MB,对比 Electron 的 70+MB
  • 不用 file:// 直载:页面跑在 tauri.localhost 虚拟域,origin 稳定,localStorage / IndexedDB 持久可靠
  • dragDropEnabled: false 关掉 Tauri 的拖放拦截,把 HTML5 拖拽上传还给页面
  • 本地构建:cd packaging/desktop && npm i && npm run build(需要 Rust;产物在 src-tauri/target/release/)
  • Windows 出两种:yixiu-portable.exe(免安装双击即用,需系统已有 WebView2,Win10/11 基本都有)+ yixiu-setup.exe(安装版,缺 WebView2 会自动补装)
  • 图标由 npx tauri icon ../../assets/icon/icon-1024.png 生成,已提交

android/ — 安卓 App(Capacitor)

壳层四个要点(都不是改存储,全部已落实):

  1. 不用 file:// 加载 HTML——Capacitor 虚拟域方案,capacitor.config.jsonandroidScheme: "https",页面跑在 https://localhost:origin 稳定,IndexedDB 不踩老 WebView 的 file:// 坑,请求网关时 Origin 是正经 https,CORS 好配
  2. domStorageEnabled——Capacitor 默认已开,localStorage 直接可用
  3. navigator.share 桥接——裸 WebView 没有它,网页版按能力检测自动隐藏「存到手机」;壳内用 native-bridge.js(注入在 <head> 最前,主脚本之前执行)以 @capacitor/filesystem 写缓存文件 + @capacitor/share 唤起原生分享面板接回来,应用主体零改动
  4. 换机/备份边界——Android 自动备份通常不覆盖 WebView 存储目录;「整册导出」(打包 zip / 批量写系统相册)作为迁移通道排在路线图上,网页版同样受益,届时一起做

构建:

cd packaging/android
npm i
npm run prepare-www      # 拷 index.html 进 www/ 并注入 native-bridge
npx cap sync android
cd android && ./gradlew assembleDebug   # 需要 Android SDK;CI 上自动完成

图标由 npx @capacitor/assets generate --android --assetPath assetsassets/(取自 assets/icon/ 的自适应前景/背景层)生成,48 个规格已提交。