pake-cli 1.2.1 → 1.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,11 +1,12 @@
1
- <p align="left"><strong>中文</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_EN.md">English</a></p>
1
+ <h4 align="right"><strong>English</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_CN.md">简体中文</a></h4>
2
2
  <p align="center">
3
3
  <img src=https://gw.alipayobjects.com/zos/k/fa/logo-modified.png width=138/>
4
4
  </p>
5
5
  <h1 align="center">Pake</h1>
6
+ <p align="center"><strong>Turn any webpage into a desktop app with Rust <em>with ease</em>.</strong></p>
6
7
  <div align="center">
7
8
  <a href="https://twitter.com/HiTw93" target="_blank">
8
- <img alt="twitter" src="https://img.shields.io/twitter/follow/Hitw93?color=%231D9BF0&label=Pake%20%F0%9F%93%A2%20&logo=Twitter&style=flat-square"></a>
9
+ <img alt="twitter" src="https://img.shields.io/badge/follow-Tw93-red?style=flat-square&logo=Twitter"></a>
9
10
  <a href="https://t.me/miaoyan" target="_blank">
10
11
  <img alt="telegram" src="https://img.shields.io/badge/chat-telegram-blueviolet?style=flat-square&logo=Telegram"></a>
11
12
  <a href="https://github.com/tw93/Pake/releases" target="_blank">
@@ -15,25 +16,26 @@
15
16
  <a href="https://github.com/tw93/Pake/issues?q=is%3Aissue+is%3Aclosed" target="_blank">
16
17
  <img alt="GitHub closed issues" src="https://img.shields.io/github/issues-closed/tw93/Pake.svg?style=flat-square"></a>
17
18
  </div>
18
- <div align="left">很简单的用 Rust 打包网页生成很小的桌面 App,支持 Mac / Windows / Linux 系统,常用包下载、<a href="#命令行一键打包">命令行一键打包</a>、<a href="#定制开发">定制开发</a> 可见下面文档,也欢迎去 <a href=https://github.com/tw93/Pake/discussions>讨论区</a> 交流。</div>
19
19
 
20
- ## 特征
20
+ <div align="left">Pake supports Mac, Windows, and Linux. Check out README for <a href="#popular-packages">Popular Packages</a>, <a href="#command-line-packaging">Command-Line Packaging</a>, and <a href="#development">Customized Development</a> information. Feel free to share your suggestions in <a href=https://github.com/tw93/Pake/discussions>Discussions</a>.</div>
21
21
 
22
- 🏂 **小**:相比传统的 Electron 套壳打包,要小将近 40 倍,不到 3M。
23
- 😂 **快**:Pake 的底层使用的 Rust Tauri 框架,性能体验较 JS 框架要轻快不少,内存小很多。
24
- 🩴 **特**:不是单纯打包,实现了快捷键的透传、沉浸式的窗口、拖动、样式改写、去广告、产品的极简风格定制。
25
- 🐶 **玩**:只是一个很简单的小玩具,用 Rust 替代之前套壳网页打包的老思路,其实 PWA 也很好。
22
+ ## Features
26
23
 
27
- ## 常用包下载
24
+ - 🎐 Nearly 40 times smaller than an Electron package (less than 3M!)
25
+ - 🚀 With Rust Tauri, Pake is much more lightweight and faster than JS-based frameworks.
26
+ - 📦 Battery-included package — shortcut pass-through, immersive windows, and minimalist customization.
27
+ - 👻 Pake is just a simple tool — replace the old bundle approach with Rust (though PWA is good enough).
28
+
29
+ ## Popular Packages
28
30
 
29
31
  <table>
30
32
  <tr>
31
- <td>WeRead
33
+ <td>WeRead
32
34
  <a href="https://github.com/tw93/Pake/releases/latest/download/WeRead.dmg">Mac</a>
33
35
  <a href="https://github.com/tw93/Pake/releases/latest/download/WeRead_x64.msi">Windows</a>
34
36
  <a href="https://github.com/tw93/Pake/releases/latest/download/WeRead_amd64.deb">Linux</a>
35
37
  </td>
36
- <td>Twitter
38
+ <td>Twitter
37
39
  <a href="https://github.com/tw93/Pake/releases/latest/download/Twitter.dmg">Mac</a>
38
40
  <a href="https://github.com/tw93/Pake/releases/latest/download/Twitter_x64.msi">Windows</a>
39
41
  <a href="https://github.com/tw93/Pake/releases/latest/download/Twitter_amd64.deb">Linux</a>
@@ -44,12 +46,12 @@
44
46
  <td><img src=https://cdn.fliggy.com/upic/mc41xq.jpg width=600/></td>
45
47
  </tr>
46
48
  <tr>
47
- <td>LiZhi
49
+ <td>LiZhi
48
50
  <a href="https://github.com/tw93/Pake/releases/latest/download/LiZhi.dmg">Mac</a>
49
51
  <a href="https://github.com/tw93/Pake/releases/latest/download/LiZhi_x64.msi">Windows</a>
50
52
  <a href="https://github.com/tw93/Pake/releases/latest/download/LiZhi_amd64.deb">Linux</a>
51
53
  </td>
52
- <td>YouTube
54
+ <td>YouTube
53
55
  <a href="https://github.com/tw93/Pake/releases/latest/download/YouTube.dmg">Mac</a>
54
56
  <a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_x64.msi">Windows</a>
55
57
  <a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_amd64.deb">Linux</a>
@@ -60,119 +62,116 @@
60
62
  <td><img src=https://cdn.fliggy.com/upic/Ea5ZRw.png width=600/></td>
61
63
  </tr>
62
64
  <tr>
63
- <td>ZLibrary
64
- <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary.dmg">Mac</a>
65
- <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary_x64.msi">Windows</a>
66
- <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary_amd64.deb">Linux</a>
65
+ <td>Qwerty
66
+ <a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty.dmg">Mac</a>
67
+ <a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_x64.msi">Windows</a>
68
+ <a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_amd64.deb">Linux</a>
67
69
  </td>
68
- <td>Reference
70
+ <td>Reference
69
71
  <a href="https://github.com/tw93/Pake/releases/latest/download/Reference.dmg">Mac</a>
70
72
  <a href="https://github.com/tw93/Pake/releases/latest/download/Reference_x64.msi">Windows</a>
71
73
  <a href="https://github.com/tw93/Pake/releases/latest/download/Reference_amd64.deb">Linux</a>
72
74
  </td>
73
75
  </tr>
74
76
  <tr>
75
- <td><img src=https://cdn.fliggy.com/upic/XGilgr.png width=600/></td>
77
+ <td><img src=https://cdn.fliggy.com/upic/CJjagn.jpg width=600/></td>
76
78
  <td><img src=https://cdn.fliggy.com/upic/KFsZIY.png width=600/></td>
77
79
  </tr>
78
- <tr>
79
- <td>Qwerty
80
- <a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty.dmg">Mac</a>
81
- <a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_x64.msi">Windows</a>
82
- <a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_amd64.deb">Linux</a>
80
+ <tr>
81
+ <td>Book
82
+ <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary.dmg">Mac</a>
83
+ <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary_x64.msi">Windows</a>
84
+ <a href="https://github.com/tw93/Pake/releases/latest/download/ZLibrary_amd64.deb">Linux</a>
83
85
  </td>
84
- <td>ChatGPT
86
+ <td>ChatGPT
85
87
  <a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT.dmg">Mac</a>
86
88
  <a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT_x64.msi">Windows</a>
87
89
  <a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT_amd64.deb">Linux</a>
88
90
  </td>
89
91
  </tr>
90
92
  <tr>
91
- <td><img src=https://cdn.fliggy.com/upic/CJjagn.jpg width=600/></td>
93
+ <td><img src=https://cdn.fliggy.com/upic/lJiTRc.jpg width=600/></td>
92
94
  <td><img src=https://cdn.fliggy.com/upic/sfnTXf.png width=600/></td>
93
95
  </tr>
94
96
  </table>
95
97
 
96
98
  <details>
97
-
98
- <summary>🏂 更多应用如 Flomo / 语雀 / RunCode 可去 <a href="https://github.com/tw93/Pake/releases">Release</a>下载,<b>此外点击可展开快捷键说明</b></summary>
99
+ <summary>🏂 You can download more applications (such as Flomo / YuQue / RunCode) from <a href="https://github.com/tw93/Pake/releases">Releases</a>. <b>Click here to expand the shortcuts reference!</b></summary>
99
100
 
100
101
  <br/>
101
102
 
102
- | Mac | Windows/Linux | 功能 |
103
- | --------------------------- | ------------------------------ | ------------------ |
104
- | <kbd>⌘</kbd> + <kbd>[</kbd> | <kbd>Ctrl</kbd> + <kbd>←</kbd> | 返回上一个页面 |
105
- | <kbd>⌘</kbd> + <kbd>]</kbd> | <kbd>Ctrl</kbd> + <kbd>→</kbd> | 去下一个页面 |
106
- | <kbd>⌘</kbd> + <kbd>↑</kbd> | <kbd>Ctrl</kbd> + <kbd>↑</kbd> | 自动滚动到页面顶部 |
107
- | <kbd>⌘</kbd> + <kbd>↓</kbd> | <kbd>Ctrl</kbd> + <kbd>↓</kbd> | 自动滚动到页面底部 |
108
- | <kbd>⌘</kbd> + <kbd>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | 刷新页面 |
109
- | <kbd>⌘</kbd> + <kbd>w</kbd> | <kbd>Ctrl</kbd> + <kbd>w</kbd> | 隐藏窗口,非退出 |
110
- | <kbd>⌘</kbd> + <kbd>-</kbd> | <kbd>Ctrl</kbd> + <kbd>-</kbd> | 缩小页面 |
111
- | <kbd>⌘</kbd> + <kbd>+</kbd> | <kbd>Ctrl</kbd> + <kbd>+</kbd> | 放大页面 |
112
- | <kbd>⌘</kbd> + <kbd>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | 放大页面 |
113
- | <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | 重置页面缩放 |
114
-
115
- 此外还支持双击头部进行全屏切换,拖拽头部进行移动窗口,Mac 用户支持手势方式返回和去下一页,还有其他需求,欢迎提过来。
103
+ | Mac | Windows/Linux | Function |
104
+ | --------------------------- | ------------------------------ | ----------------------------- |
105
+ | <kbd>⌘</kbd> + <kbd>[</kbd> | <kbd>Ctrl</kbd> + <kbd>←</kbd> | Return to the previous page |
106
+ | <kbd>⌘</kbd> + <kbd>]</kbd> | <kbd>Ctrl</kbd> + <kbd>→</kbd> | Go to the next page |
107
+ | <kbd>⌘</kbd> + <kbd>↑</kbd> | <kbd>Ctrl</kbd> + <kbd>↑</kbd> | Auto scroll to top of page |
108
+ | <kbd>⌘</kbd> + <kbd>↓</kbd> | <kbd>Ctrl</kbd> + <kbd>↓</kbd> | Auto scroll to bottom of page |
109
+ | <kbd>⌘</kbd> + <kbd>r</kbd> | <kbd>Ctrl</kbd> + <kbd>r</kbd> | Refresh Page |
110
+ | <kbd>⌘</kbd> + <kbd>w</kbd> | <kbd>Ctrl</kbd> + <kbd>w</kbd> | Hide window, not quite |
111
+ | <kbd>⌘</kbd> + <kbd>-</kbd> | <kbd>Ctrl</kbd> + <kbd>-</kbd> | Zoom out the page |
112
+ | <kbd>⌘</kbd> + <kbd>+</kbd> | <kbd>Ctrl</kbd> + <kbd>+</kbd> | Zoom in the page |
113
+ | <kbd>⌘</kbd> + <kbd>=</kbd> | <kbd>Ctrl</kbd> + <kbd>=</kbd> | Zoom in the Page |
114
+ | <kbd>⌘</kbd> + <kbd>0</kbd> | <kbd>Ctrl</kbd> + <kbd>0</kbd> | Reset the page zoom |
115
+
116
+ In addition, double-click the title bar to switch to full-screen mode. For Mac users, you can also use the gesture to go to the previous or next page and drag the title bar to move the window.
116
117
 
117
118
  </details>
118
119
 
119
- ## 开始之前
120
+ ## Before starting
120
121
 
121
- 1. **小白用户**:使用 「常用包下载」 方式来把玩 Pake 的能力,可去 [讨论群](https://github.com/tw93/Pake/discussions) 寻求帮助,也可试试 [Action](https://github.com/tw93/Pake/wiki/GitHub-Actions-%E5%9C%A8%E7%BA%BF%E7%BC%96%E8%AF%91%E5%A4%9A%E7%B3%BB%E7%BB%9F%E7%89%88%E6%9C%AC) 方式。
122
- 2. **开发用户**:使用 「命令行一键打包」,对 Mac 比较友好,Windows / Linux 需折腾下 [环境配置](https://tauri.app/v1/guides/getting-started/prerequisites)
123
- 3. **折腾用户**:假如你前端和 Rust 都会,那可试试下面的 [定制开发](#定制开发)」,可深度二次开发定制你的功能。
122
+ 1. **For beginners**: Play with Popular Packages to find out Pake's capabilities, or try to pack your application with [GitHub Actions](https://github.com/tw93/Pake/wiki/GitHub-Actions-Online-Compilation-Multi-system-Version). Don't hesitate to reach for assistance at [Discussion](https://github.com/tw93/Pake/discussions)!
123
+ 2. **For developers**: “Command-Line Packaging” supports macOS fully. For Windows/Linux users, it requires some tinkering. [Configure your environment](https://tauri.app/v1/guides/getting-started/prerequisites) before getting started.
124
+ 3. **For hackers**: For people who are good at both front-end development and Rust, how about customizing your apps' function more with the following [Customized Development](#development)?
124
125
 
125
- ## 命令行一键打包
126
+ ## Command-Line Packaging
126
127
 
127
- <kbd>
128
- <img src="https://gw.alipayobjects.com/zos/k/zd/pake.gif" width="100%">
129
- </kbd>
130
- <br/><br/>
128
+ ![Pake](https://gw.alipayobjects.com/zos/k/zd/pake.gif)
131
129
 
132
- **Pake 提供了命令行工具,可以更快捷方便地一键自定义打你需要的包,详细可见 [文档](./bin/README.md)。**
130
+ **Pake provides a command line tool, making the flow of package customization quicker and easier. See [documentation](./bin/README_EN.md) for more information.**
133
131
 
134
132
  ```bash
135
- // 使用 npm 进行安装
133
+ # Install with npm
136
134
  npm install -g pake-cli
137
135
 
138
- // 命令使用
139
- pake url [options]
136
+ # Command usage
137
+ pake url [OPTIONS]...
140
138
 
141
- // 随便玩玩,首次由于安装环境会有些慢,后面就快了
139
+ # Feel free to play with Pake! It might take a while to prepare the environment the first time you launch Pake.
142
140
  pake https://weekly.tw93.fun --name Weekly --transparent
143
141
  ```
144
142
 
145
- 假如你不太会使用命令行,或许使用 **GitHub Actions 在线编译多系统版本** 是一个不错的选择,可查看 [文档](https://github.com/tw93/Pake/wiki/GitHub-Actions-%E5%9C%A8%E7%BA%BF%E7%BC%96%E8%AF%91%E5%A4%9A%E7%B3%BB%E7%BB%9F%E7%89%88%E6%9C%AC)
143
+ If you are new to the command line, you can compile packages online with _GitHub Actions_. See the [Tutorial](https://github.com/tw93/Pake/wiki/GitHub-Actions-Online-Compilation-Multi-system-Version) for more information.
146
144
 
147
- ## 定制开发
145
+ ## Development
148
146
 
149
- 开始前请确保电脑已经安装了 Rust Node 的环境,此外需参考 [Tauri 文档](https://tauri.app/v1/guides/getting-started/prerequisites) 快速配置好环境才可以开始使用,假如你太不懂,使用上面的命令行打包会更加合适。
147
+ Prepare your environment before starting. Make sure you have Rust `>=1.63` and Node `>=16` (e.g., `16.18.1`) installed on your computer. For installation guidance, see [Tauri documentation](https://tauri.app/v1/guides/getting-started/prerequisites).
148
+
149
+ If you are unfamiliar with these, it is better to try out the above tool to pack with one click.
150
150
 
151
151
  ```sh
152
- // 安装依赖
152
+ # Install Dependencies
153
153
  npm i
154
154
 
155
- // 本地开发
155
+ # Local development
156
156
  npm run dev
157
157
 
158
- // 本地调试
158
+ # Local debug
159
159
  npm run dev:debug
160
160
 
161
- // 打包应用
161
+ # Pack application
162
162
  npm run build
163
-
164
163
  ```
165
164
 
166
- ## 高级使用
165
+ ## Advanced Usage
167
166
 
168
- 1. 代码结构可参考 [文档](https://github.com/tw93/Pake/wiki/Pake-%E7%9A%84%E4%BB%A3%E7%A0%81%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E),便于你在开发前了解更多。
169
- 2. 修改 src-tauri 目录下的 `tauri.conf.json`以及 `tauri.xxx.conf.json` 中的 url、productName、icon、identifier 4 个字段,其中 icon 可以从 icons 目录选择一个,也可以去 [macOSicons](https://macosicons.com/#/) 下载符合效果的。
170
- 3. 关于窗口属性设置,可以在 `tauri.conf.json` 修改 windows 属性对应的 `width/height`,fullscreen 是否全屏,resizable 是否可以调整大小,假如想适配 Mac 沉浸式头部,可以将 transparent 设置成 `true`,找到 Header 元素加一个 padding-top 样式即可,不想适配改成 `false` 也行。
171
- 4. 此外样式改写、屏蔽广告、逻辑代码注入、容器消息通信、自定义快捷键可见 [高级用法](https://github.com/tw93/Pake/wiki/Pake-%E7%9A%84%E9%AB%98%E7%BA%A7%E7%94%A8%E6%B3%95)
167
+ 1. You can refer to the [codebase structure](https://github.com/tw93/Pake/wiki/Description-of-Pake's-code-structure) before working on Pake, which will help you much in development.
168
+ 2. Add four fields (`url`, `productName`, `icon`, and `identifier`) to the `tauri.conf.json` and `tauri.xxx.conf.json` in the `src-tauri` directory. You can select a `icon` from the `icons` directory or download one from [macOSicons](https://macosicons.com/#/) to match your product needs.
169
+ 3. For configurations on window properties, you can modify the `tauri.conf.json` file to change the value of `width`, `height`, `fullscreen` (or not), `resizable` (or not) of the `windows` property. To adapt to the immersive header on Mac, change `transparent` to `true`, look for the `Header` element, and add the `padding-top` property.
170
+ 4. For advanced usages such as style rewriting, advertisement removal, JS injection, container message communication, and user-defined shortcut keys, see [Advanced Usage of Make](https://github.com/tw93/Pake/wiki/Advanced-Usage-of-Make).
172
171
 
173
- ## 开发者
172
+ ## Developer
174
173
 
175
- Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢迎关注他们 ❤️
174
+ Pake's development can not be without these Hackers. They contributed a lot of capabilities for Pake. Also, welcome to follow them! ❤️
176
175
 
177
176
  <!-- readme: contributors -start -->
178
177
  <table>
@@ -301,9 +300,9 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
301
300
  </table>
302
301
  <!-- readme: contributors -end -->
303
302
 
304
- ## 支持
303
+ ## Support
305
304
 
306
- 1. 我有两只猫,一只叫汤圆,一只叫可乐,假如觉得 Pake 让你生活更美好,可以给汤圆可乐 <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">喂罐头 🥩🍤</a>。
307
- 2. 如果你喜欢 Pake,可以在 Github Star,更欢迎 [推荐](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=%23Pake%20%E4%B8%80%E4%B8%AA%E5%BE%88%E7%AE%80%E5%8D%95%E7%9A%84%E7%94%A8%20Rust%20%E6%89%93%E5%8C%85%E7%BD%91%E9%A1%B5%E7%94%9F%E6%88%90%20Mac%20App%20%E7%9A%84%E5%B7%A5%E5%85%B7%EF%BC%8C%E7%9B%B8%E6%AF%94%E4%BC%A0%E7%BB%9F%E7%9A%84%20Electron%20%E5%A5%97%E5%A3%B3%E6%89%93%E5%8C%85%EF%BC%8C%E5%A4%A7%E5%B0%8F%E8%A6%81%E5%B0%8F%E5%B0%86%E8%BF%91%2040%20%E5%80%8D%EF%BC%8C%E4%B8%80%E8%88%AC%202M%20%E5%B7%A6%E5%8F%B3%EF%BC%8C%E5%BA%95%E5%B1%82%E4%BD%BF%E7%94%A8Tauri%20%EF%BC%8C%E6%80%A7%E8%83%BD%E4%BD%93%E9%AA%8C%E8%BE%83%20JS%20%E6%A1%86%E6%9E%B6%E8%A6%81%E8%BD%BB%E5%BF%AB%E4%B8%8D%E5%B0%91%EF%BC%8C%E5%86%85%E5%AD%98%E5%B0%8F%E5%BE%88%E5%A4%9A%EF%BC%8C%E6%94%AF%E6%8C%81%E5%BE%AE%E4%BF%A1%E8%AF%BB%E4%B9%A6%E3%80%81Twitter%E3%80%81Youtube%E3%80%81RunCode%E3%80%81Flomo%E3%80%81%E8%AF%AD%E9%9B%80%E7%AD%89%EF%BC%8C%E5%8F%AF%E4%BB%A5%E5%BE%88%E6%96%B9%E4%BE%BF%E4%BA%8C%E6%AC%A1%E5%BC%80%E5%8F%91~) 给你志同道合的朋友使用。
308
- 3. 可以关注我的 [Twitter](https://twitter.com/HiTw93) 获取到最新的 Pake 更新消息,也欢迎加入 [Telegram](https://t.me/miaoyan) 聊天群。
309
- 4. 希望大伙玩的过程中有一种学习新技术的喜悦感,假如你发现有很适合做成桌面 App 的网页也很欢迎告诉我。
305
+ 1. I have two cats, TangYuan and Coke. If you think Pake delights your life, you can feed them <a href="https://miaoyan.app/cats.html?name=Pake" target="_blank">some canned food 🥩</a>.
306
+ 2. If you like Pake, you can star it on GitHub. Also, welcome to [recommend Pake](https://twitter.com/intent/tweet?url=https://github.com/tw93/Pake&text=%23Pake%20-%20A%20simple%20Rust%20packaged%20web%20pages%20to%20generate%20Mac%20App%20tool,%20compared%20to%20traditional%20Electron%20package,%20the%20size%20of%20nearly%2040%20times%20smaller,%20generally%20about%202M,%20the%20underlying%20use%20of%20Tauri,%20performance%20experience%20than%20the%20JS%20framework%20is%20much%20lighter~) to your friends.
307
+ 3. You can follow my [Twitter](https://twitter.com/HiTw93) to get the latest news of Pake or join our [Telegram](https://t.me/miaoyan) chat group.
308
+ 4. I hope that you enjoy playing with it. Let us know if you find a website that would be great for a Mac App!
package/dist/cli.js CHANGED
@@ -48,6 +48,7 @@ const DEFAULT_PAKE_OPTIONS = {
48
48
  resizable: true,
49
49
  transparent: false,
50
50
  debug: false,
51
+ multiArch: false,
51
52
  };
52
53
 
53
54
  const tlds = [
@@ -1642,7 +1643,7 @@ function mergeTauriConfig(url, options, tauriConf) {
1642
1643
  process.exit();
1643
1644
  }
1644
1645
  }
1645
- if (process.platform === "win32" || process.platform === "darwin") {
1646
+ if (process.platform === "win32") {
1646
1647
  const reg = new RegExp(/([0-9]*[a-zA-Z]+[0-9]*)+/);
1647
1648
  if (!reg.test(name) || reg.exec(name)[0].length != name.length) {
1648
1649
  logger.error("package name is illegal, it must be letters, numbers, and it must contain the letters");
@@ -2016,10 +2017,23 @@ class MacBuilder {
2016
2017
  log.debug('PakeAppOptions', options);
2017
2018
  const { name } = options;
2018
2019
  yield mergeTauriConfig(url, options, tauriConf);
2019
- //这里直接使用 universal-apple-darwin 的打包,而非当前系统的包
2020
- yield shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`);
2021
- const dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
2022
- const appPath = this.getBuildAppPath(npmDirectory, dmgName);
2020
+ let dmgName;
2021
+ if (options.multiArch) {
2022
+ yield shellExec(`cd ${npmDirectory} && npm install && npm run build:mac`);
2023
+ dmgName = `${name}_${tauriConf.package.version}_universal.dmg`;
2024
+ }
2025
+ else {
2026
+ yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
2027
+ let arch = "x64";
2028
+ if (process.arch === "arm64") {
2029
+ arch = "aarch64";
2030
+ }
2031
+ else {
2032
+ arch = process.arch;
2033
+ }
2034
+ dmgName = `${name}_${tauriConf.package.version}_${arch}.dmg`;
2035
+ }
2036
+ const appPath = this.getBuildAppPath(npmDirectory, dmgName, options.multiArch);
2023
2037
  const distPath = path.resolve(`${name}.dmg`);
2024
2038
  yield fs.copyFile(appPath, distPath);
2025
2039
  yield fs.unlink(appPath);
@@ -2027,8 +2041,15 @@ class MacBuilder {
2027
2041
  logger.success('You can find the app installer in', distPath);
2028
2042
  });
2029
2043
  }
2030
- getBuildAppPath(npmDirectory, dmgName) {
2031
- return path.join(npmDirectory, 'src-tauri/target/universal-apple-darwin/release/bundle/dmg', dmgName);
2044
+ getBuildAppPath(npmDirectory, dmgName, multiArch) {
2045
+ let dmgPath;
2046
+ if (multiArch) {
2047
+ dmgPath = 'src-tauri/target/universal-apple-darwin/release/bundle/dmg';
2048
+ }
2049
+ else {
2050
+ dmgPath = 'src-tauri/target/release/bundle/dmg';
2051
+ }
2052
+ return path.join(npmDirectory, dmgPath, dmgName);
2032
2053
  }
2033
2054
  }
2034
2055
 
@@ -2149,10 +2170,10 @@ class BuilderFactory {
2149
2170
  }
2150
2171
 
2151
2172
  var name = "pake-cli";
2152
- var version = "1.2.1";
2153
- var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.";
2173
+ var version = "1.2.3";
2174
+ var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。";
2154
2175
  var engines = {
2155
- node: "^14.13 || >=16.0.0"
2176
+ node: ">=16.0.0"
2156
2177
  };
2157
2178
  var bin = {
2158
2179
  pake: "./cli.js"
@@ -2252,18 +2273,19 @@ function checkUpdateTips() {
2252
2273
  });
2253
2274
  }
2254
2275
 
2255
- program.version(packageJson.version).description('A cli application can package a web page to desktop application.');
2276
+ program.version(packageJson.version).description('A cli application can turn any webpage into a desktop app with Rust.');
2256
2277
  program
2257
2278
  .showHelpAfterError()
2258
2279
  .argument('[url]', 'the web url you want to package', validateUrlInput)
2259
- .option('--name <string>', 'application name')
2260
- .option('--icon <string>', 'application icon', DEFAULT_PAKE_OPTIONS.icon)
2261
- .option('--height <number>', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
2262
- .option('--width <number>', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
2263
- .option('--no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable)
2264
- .option('--fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
2265
- .option('--transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
2266
- .option('--debug', 'debug', DEFAULT_PAKE_OPTIONS.transparent)
2280
+ .option('-n, --name <string>', 'application name')
2281
+ .option('-i, --icon <string>', 'application icon', DEFAULT_PAKE_OPTIONS.icon)
2282
+ .option('-w, --width <number>', 'window width', validateNumberInput, DEFAULT_PAKE_OPTIONS.width)
2283
+ .option('-h, --height <number>', 'window height', validateNumberInput, DEFAULT_PAKE_OPTIONS.height)
2284
+ .option('-f, --fullscreen', 'makes the packaged app start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
2285
+ .option('-t, --transparent', 'transparent title bar', DEFAULT_PAKE_OPTIONS.transparent)
2286
+ .option('-r, --no-resizable', 'whether the window can be resizable', DEFAULT_PAKE_OPTIONS.resizable)
2287
+ .option('-d, --debug', 'debug', DEFAULT_PAKE_OPTIONS.debug)
2288
+ .option('-m, --multi-arch', "Supports both Intel and m1 chips, only for Mac.", DEFAULT_PAKE_OPTIONS.multiArch)
2267
2289
  .action((url, options) => __awaiter(void 0, void 0, void 0, function* () {
2268
2290
  yield checkUpdateTips();
2269
2291
  if (!url) {
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "1.2.1",
4
- "description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.",
3
+ "version": "1.2.3",
4
+ "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App。",
5
5
  "engines": {
6
- "node": "^14.13 || >=16.0.0"
6
+ "node": ">=16.0.0"
7
7
  },
8
8
  "bin": {
9
9
  "pake": "./cli.js"
@@ -34,14 +34,15 @@ dependencies = [
34
34
 
35
35
  [[package]]
36
36
  name = "anyhow"
37
- version = "1.0.66"
37
+ version = "1.0.68"
38
38
  source = "registry+https://github.com/rust-lang/crates.io-index"
39
- checksum = "216261ddc8289130e551ddcd5ce8a064710c0d064a4d2895c67151c92b5443f6"
39
+ checksum = "2cb2f989d18dd141ab8ae82f64d1a8cdd37e0840f73a406896cf5e99502fab61"
40
40
 
41
41
  [[package]]
42
42
  name = "app"
43
43
  version = "0.1.0"
44
44
  dependencies = [
45
+ "dirs",
45
46
  "home",
46
47
  "image",
47
48
  "serde",
@@ -139,11 +140,12 @@ dependencies = [
139
140
 
140
141
  [[package]]
141
142
  name = "bstr"
142
- version = "0.2.17"
143
+ version = "1.1.0"
143
144
  source = "registry+https://github.com/rust-lang/crates.io-index"
144
- checksum = "ba3569f383e8f1598449f1a423e72e99569137b47740b1da11ef19af3d5c3223"
145
+ checksum = "b45ea9b00a7b3f2988e9a65ad3917e62123c38dba709b666506207be96d1790b"
145
146
  dependencies = [
146
147
  "memchr",
148
+ "serde",
147
149
  ]
148
150
 
149
151
  [[package]]
@@ -196,9 +198,9 @@ dependencies = [
196
198
 
197
199
  [[package]]
198
200
  name = "cargo_toml"
199
- version = "0.13.0"
201
+ version = "0.13.3"
200
202
  source = "registry+https://github.com/rust-lang/crates.io-index"
201
- checksum = "aa0e3586af56b3bfa51fca452bd56e8dbbbd5d8d81cbf0b7e4e35b695b537eb8"
203
+ checksum = "497049e9477329f8f6a559972ee42e117487d01d1e8c2cc9f836ea6fa23a9e1a"
202
204
  dependencies = [
203
205
  "serde",
204
206
  "toml",
@@ -206,9 +208,9 @@ dependencies = [
206
208
 
207
209
  [[package]]
208
210
  name = "cc"
209
- version = "1.0.77"
211
+ version = "1.0.78"
210
212
  source = "registry+https://github.com/rust-lang/crates.io-index"
211
- checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4"
213
+ checksum = "a20104e2335ce8a659d6dd92a51a767a0c062599c73b343fd152cb401e828c3d"
212
214
 
213
215
  [[package]]
214
216
  name = "cesu8"
@@ -522,6 +524,15 @@ dependencies = [
522
524
  "crypto-common",
523
525
  ]
524
526
 
527
+ [[package]]
528
+ name = "dirs"
529
+ version = "4.0.0"
530
+ source = "registry+https://github.com/rust-lang/crates.io-index"
531
+ checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
532
+ dependencies = [
533
+ "dirs-sys",
534
+ ]
535
+
525
536
  [[package]]
526
537
  name = "dirs-next"
527
538
  version = "2.0.0"
@@ -532,6 +543,17 @@ dependencies = [
532
543
  "dirs-sys-next",
533
544
  ]
534
545
 
546
+ [[package]]
547
+ name = "dirs-sys"
548
+ version = "0.3.7"
549
+ source = "registry+https://github.com/rust-lang/crates.io-index"
550
+ checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6"
551
+ dependencies = [
552
+ "libc",
553
+ "redox_users",
554
+ "winapi",
555
+ ]
556
+
535
557
  [[package]]
536
558
  name = "dirs-sys-next"
537
559
  version = "0.1.2"
@@ -860,7 +882,7 @@ dependencies = [
860
882
  "libc",
861
883
  "log",
862
884
  "rustversion",
863
- "windows",
885
+ "windows 0.39.0",
864
886
  ]
865
887
 
866
888
  [[package]]
@@ -984,15 +1006,15 @@ dependencies = [
984
1006
 
985
1007
  [[package]]
986
1008
  name = "glob"
987
- version = "0.3.0"
1009
+ version = "0.3.1"
988
1010
  source = "registry+https://github.com/rust-lang/crates.io-index"
989
- checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
1011
+ checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b"
990
1012
 
991
1013
  [[package]]
992
1014
  name = "globset"
993
- version = "0.4.9"
1015
+ version = "0.4.10"
994
1016
  source = "registry+https://github.com/rust-lang/crates.io-index"
995
- checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a"
1017
+ checksum = "029d74589adefde59de1a0c4f4732695c32805624aec7b68d91503d4dba79afc"
996
1018
  dependencies = [
997
1019
  "aho-corasick",
998
1020
  "bstr",
@@ -1069,9 +1091,9 @@ dependencies = [
1069
1091
 
1070
1092
  [[package]]
1071
1093
  name = "half"
1072
- version = "2.1.0"
1094
+ version = "2.2.0"
1073
1095
  source = "registry+https://github.com/rust-lang/crates.io-index"
1074
- checksum = "ad6a9459c9c30b177b925162351f97e7d967c7ea8bab3b8352805327daf45554"
1096
+ checksum = "6c467d36af040b7b2681f5fddd27427f6da8d3d072f575a265e181d2f8e8d157"
1075
1097
  dependencies = [
1076
1098
  "crunchy",
1077
1099
  ]
@@ -1099,9 +1121,9 @@ checksum = "2540771e65fc8cb83cd6e8a237f70c319bd5c29f78ed1084ba5d50eeac86f7f9"
1099
1121
 
1100
1122
  [[package]]
1101
1123
  name = "hermit-abi"
1102
- version = "0.1.19"
1124
+ version = "0.2.6"
1103
1125
  source = "registry+https://github.com/rust-lang/crates.io-index"
1104
- checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33"
1126
+ checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7"
1105
1127
  dependencies = [
1106
1128
  "libc",
1107
1129
  ]
@@ -1137,7 +1159,7 @@ checksum = "75f43d41e26995c17e71ee126451dd3941010b0514a81a9d11f3b341debc2399"
1137
1159
  dependencies = [
1138
1160
  "bytes",
1139
1161
  "fnv",
1140
- "itoa 1.0.4",
1162
+ "itoa 1.0.5",
1141
1163
  ]
1142
1164
 
1143
1165
  [[package]]
@@ -1174,11 +1196,10 @@ dependencies = [
1174
1196
 
1175
1197
  [[package]]
1176
1198
  name = "ignore"
1177
- version = "0.4.18"
1199
+ version = "0.4.19"
1178
1200
  source = "registry+https://github.com/rust-lang/crates.io-index"
1179
- checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d"
1201
+ checksum = "a05705bc64e0b66a806c3740bd6578ea66051b157ec42dc219c785cbf185aef3"
1180
1202
  dependencies = [
1181
- "crossbeam-utils",
1182
1203
  "globset",
1183
1204
  "lazy_static",
1184
1205
  "log",
@@ -1245,9 +1266,9 @@ checksum = "b71991ff56294aa922b450139ee08b3bfc70982c6b2c7562771375cf73542dd4"
1245
1266
 
1246
1267
  [[package]]
1247
1268
  name = "itoa"
1248
- version = "1.0.4"
1269
+ version = "1.0.5"
1249
1270
  source = "registry+https://github.com/rust-lang/crates.io-index"
1250
- checksum = "4217ad341ebadf8d8e724e264f13e593e0648f5b3e94b3896a5df283be015ecc"
1271
+ checksum = "fad582f4b9e86b6caa621cabeb0963332d92eea04729ab12892c2533951e6440"
1251
1272
 
1252
1273
  [[package]]
1253
1274
  name = "javascriptcore-rs"
@@ -1347,9 +1368,9 @@ checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
1347
1368
 
1348
1369
  [[package]]
1349
1370
  name = "libc"
1350
- version = "0.2.138"
1371
+ version = "0.2.139"
1351
1372
  source = "registry+https://github.com/rust-lang/crates.io-index"
1352
- checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8"
1373
+ checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79"
1353
1374
 
1354
1375
  [[package]]
1355
1376
  name = "line-wrap"
@@ -1562,9 +1583,9 @@ dependencies = [
1562
1583
 
1563
1584
  [[package]]
1564
1585
  name = "num_cpus"
1565
- version = "1.14.0"
1586
+ version = "1.15.0"
1566
1587
  source = "registry+https://github.com/rust-lang/crates.io-index"
1567
- checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5"
1588
+ checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b"
1568
1589
  dependencies = [
1569
1590
  "hermit-abi",
1570
1591
  "libc",
@@ -1621,9 +1642,9 @@ dependencies = [
1621
1642
 
1622
1643
  [[package]]
1623
1644
  name = "once_cell"
1624
- version = "1.16.0"
1645
+ version = "1.17.0"
1625
1646
  source = "registry+https://github.com/rust-lang/crates.io-index"
1626
- checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
1647
+ checksum = "6f61fba1741ea2b3d6a1e3178721804bb716a68a6aeba1149b5d52e3d464ea66"
1627
1648
 
1628
1649
  [[package]]
1629
1650
  name = "overload"
@@ -1681,9 +1702,9 @@ dependencies = [
1681
1702
 
1682
1703
  [[package]]
1683
1704
  name = "paste"
1684
- version = "1.0.10"
1705
+ version = "1.0.11"
1685
1706
  source = "registry+https://github.com/rust-lang/crates.io-index"
1686
- checksum = "cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b"
1707
+ checksum = "d01a5bd0424d00070b0098dd17ebca6f961a959dead1dbcbbbc1d1cd8d3deeba"
1687
1708
 
1688
1709
  [[package]]
1689
1710
  name = "percent-encoding"
@@ -1693,9 +1714,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e"
1693
1714
 
1694
1715
  [[package]]
1695
1716
  name = "pest"
1696
- version = "2.5.1"
1717
+ version = "2.5.2"
1697
1718
  source = "registry+https://github.com/rust-lang/crates.io-index"
1698
- checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0"
1719
+ checksum = "0f6e86fb9e7026527a0d46bc308b841d73170ef8f443e1807f6ef88526a816d4"
1699
1720
  dependencies = [
1700
1721
  "thiserror",
1701
1722
  "ucd-trie",
@@ -1912,24 +1933,24 @@ dependencies = [
1912
1933
 
1913
1934
  [[package]]
1914
1935
  name = "proc-macro-hack"
1915
- version = "0.5.19"
1936
+ version = "0.5.20+deprecated"
1916
1937
  source = "registry+https://github.com/rust-lang/crates.io-index"
1917
- checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5"
1938
+ checksum = "dc375e1527247fe1a97d8b7156678dfe7c1af2fc075c9a4db3690ecd2a148068"
1918
1939
 
1919
1940
  [[package]]
1920
1941
  name = "proc-macro2"
1921
- version = "1.0.47"
1942
+ version = "1.0.49"
1922
1943
  source = "registry+https://github.com/rust-lang/crates.io-index"
1923
- checksum = "5ea3d908b0e36316caf9e9e2c4625cdde190a7e6f440d794667ed17a1855e725"
1944
+ checksum = "57a8eca9f9c4ffde41714334dee777596264c7825420f521abc92b5b5deb63a5"
1924
1945
  dependencies = [
1925
1946
  "unicode-ident",
1926
1947
  ]
1927
1948
 
1928
1949
  [[package]]
1929
1950
  name = "quote"
1930
- version = "1.0.21"
1951
+ version = "1.0.23"
1931
1952
  source = "registry+https://github.com/rust-lang/crates.io-index"
1932
- checksum = "bbe448f377a7d6961e30f5955f9b8d106c3f5e449d493ee1b125c1d43c2b5179"
1953
+ checksum = "8856d8364d252a14d474036ea1358d63c9e6965c8e5c1885c18f73d70bff9c7b"
1933
1954
  dependencies = [
1934
1955
  "proc-macro2",
1935
1956
  ]
@@ -2116,20 +2137,20 @@ version = "0.4.0"
2116
2137
  source = "registry+https://github.com/rust-lang/crates.io-index"
2117
2138
  checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
2118
2139
  dependencies = [
2119
- "semver 1.0.14",
2140
+ "semver 1.0.16",
2120
2141
  ]
2121
2142
 
2122
2143
  [[package]]
2123
2144
  name = "rustversion"
2124
- version = "1.0.9"
2145
+ version = "1.0.11"
2125
2146
  source = "registry+https://github.com/rust-lang/crates.io-index"
2126
- checksum = "97477e48b4cf8603ad5f7aaf897467cf42ab4218a38ef76fb14c2d6773a6d6a8"
2147
+ checksum = "5583e89e108996506031660fe09baa5011b9dd0341b89029313006d1fb508d70"
2127
2148
 
2128
2149
  [[package]]
2129
2150
  name = "ryu"
2130
- version = "1.0.11"
2151
+ version = "1.0.12"
2131
2152
  source = "registry+https://github.com/rust-lang/crates.io-index"
2132
- checksum = "4501abdff3ae82a1c1b477a17252eb69cee9e66eb915c1abaa4f44d873df9f09"
2153
+ checksum = "7b4b9743ed687d4b4bcedf9ff5eaa7398495ae14e61cba0a295704edbc7decde"
2133
2154
 
2134
2155
  [[package]]
2135
2156
  name = "safemem"
@@ -2195,9 +2216,9 @@ dependencies = [
2195
2216
 
2196
2217
  [[package]]
2197
2218
  name = "semver"
2198
- version = "1.0.14"
2219
+ version = "1.0.16"
2199
2220
  source = "registry+https://github.com/rust-lang/crates.io-index"
2200
- checksum = "e25dfac463d778e353db5be2449d1cce89bd6fd23c9f1ea21310ce6e5a1b29c4"
2221
+ checksum = "58bc9567378fc7690d6b2addae4e60ac2eeea07becb2c64b9f218b53865cba2a"
2201
2222
  dependencies = [
2202
2223
  "serde",
2203
2224
  ]
@@ -2213,18 +2234,18 @@ dependencies = [
2213
2234
 
2214
2235
  [[package]]
2215
2236
  name = "serde"
2216
- version = "1.0.150"
2237
+ version = "1.0.152"
2217
2238
  source = "registry+https://github.com/rust-lang/crates.io-index"
2218
- checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91"
2239
+ checksum = "bb7d1f0d3021d347a83e556fc4683dea2ea09d87bccdf88ff5c12545d89d5efb"
2219
2240
  dependencies = [
2220
2241
  "serde_derive",
2221
2242
  ]
2222
2243
 
2223
2244
  [[package]]
2224
2245
  name = "serde_derive"
2225
- version = "1.0.150"
2246
+ version = "1.0.152"
2226
2247
  source = "registry+https://github.com/rust-lang/crates.io-index"
2227
- checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e"
2248
+ checksum = "af487d118eecd09402d70a5d72551860e788df87b464af30e5ea6a38c75c541e"
2228
2249
  dependencies = [
2229
2250
  "proc-macro2",
2230
2251
  "quote",
@@ -2233,20 +2254,20 @@ dependencies = [
2233
2254
 
2234
2255
  [[package]]
2235
2256
  name = "serde_json"
2236
- version = "1.0.89"
2257
+ version = "1.0.91"
2237
2258
  source = "registry+https://github.com/rust-lang/crates.io-index"
2238
- checksum = "020ff22c755c2ed3f8cf162dbb41a7268d934702f3ed3631656ea597e08fc3db"
2259
+ checksum = "877c235533714907a8c2464236f5c4b2a17262ef1bd71f38f35ea592c8da6883"
2239
2260
  dependencies = [
2240
- "itoa 1.0.4",
2261
+ "itoa 1.0.5",
2241
2262
  "ryu",
2242
2263
  "serde",
2243
2264
  ]
2244
2265
 
2245
2266
  [[package]]
2246
2267
  name = "serde_repr"
2247
- version = "0.1.9"
2268
+ version = "0.1.10"
2248
2269
  source = "registry+https://github.com/rust-lang/crates.io-index"
2249
- checksum = "1fe39d9fbb0ebf5eb2c7cb7e2a47e4f462fad1379f1166b8ae49ad9eae89a7ca"
2270
+ checksum = "9a5ec9fa74a20ebbe5d9ac23dac1fc96ba0ecfe9f50f2843b52e537b10fbcb4e"
2250
2271
  dependencies = [
2251
2272
  "proc-macro2",
2252
2273
  "quote",
@@ -2434,9 +2455,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
2434
2455
 
2435
2456
  [[package]]
2436
2457
  name = "syn"
2437
- version = "1.0.105"
2458
+ version = "1.0.107"
2438
2459
  source = "registry+https://github.com/rust-lang/crates.io-index"
2439
- checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908"
2460
+ checksum = "1f4064b5b16e03ae50984a5a8ed5d4f8803e6bc1fd170a3cda91a1be4b18e3f5"
2440
2461
  dependencies = [
2441
2462
  "proc-macro2",
2442
2463
  "quote",
@@ -2471,9 +2492,9 @@ dependencies = [
2471
2492
 
2472
2493
  [[package]]
2473
2494
  name = "tao"
2474
- version = "0.15.7"
2495
+ version = "0.15.8"
2475
2496
  source = "registry+https://github.com/rust-lang/crates.io-index"
2476
- checksum = "a1fa15735311b4816d030ff54da58560b047daca0970e1031aed5502e84231a8"
2497
+ checksum = "ac8e6399427c8494f9849b58694754d7cc741293348a6836b6c8d2c5aa82d8e6"
2477
2498
  dependencies = [
2478
2499
  "bitflags",
2479
2500
  "cairo-rs",
@@ -2510,7 +2531,7 @@ dependencies = [
2510
2531
  "serde",
2511
2532
  "unicode-segmentation",
2512
2533
  "uuid 1.2.2",
2513
- "windows",
2534
+ "windows 0.39.0",
2514
2535
  "windows-implement",
2515
2536
  "x11-dl",
2516
2537
  ]
@@ -2528,9 +2549,9 @@ dependencies = [
2528
2549
 
2529
2550
  [[package]]
2530
2551
  name = "tauri"
2531
- version = "1.2.2"
2552
+ version = "1.2.3"
2532
2553
  source = "registry+https://github.com/rust-lang/crates.io-index"
2533
- checksum = "d8ea1d785ab2164373703817bff144c4610a69ad3f659becaca0e1ea004b98d8"
2554
+ checksum = "5b48820ee3bb6a5031a83b2b6e11f8630bdc5a2f68cb841ab8ebc7a15a916679"
2534
2555
  dependencies = [
2535
2556
  "anyhow",
2536
2557
  "cocoa",
@@ -2550,7 +2571,7 @@ dependencies = [
2550
2571
  "percent-encoding",
2551
2572
  "rand 0.8.5",
2552
2573
  "raw-window-handle",
2553
- "semver 1.0.14",
2574
+ "semver 1.0.16",
2554
2575
  "serde",
2555
2576
  "serde_json",
2556
2577
  "serde_repr",
@@ -2568,7 +2589,7 @@ dependencies = [
2568
2589
  "uuid 1.2.2",
2569
2590
  "webkit2gtk",
2570
2591
  "webview2-com",
2571
- "windows",
2592
+ "windows 0.39.0",
2572
2593
  ]
2573
2594
 
2574
2595
  [[package]]
@@ -2581,7 +2602,7 @@ dependencies = [
2581
2602
  "cargo_toml",
2582
2603
  "heck 0.4.0",
2583
2604
  "json-patch",
2584
- "semver 1.0.14",
2605
+ "semver 1.0.16",
2585
2606
  "serde_json",
2586
2607
  "tauri-utils",
2587
2608
  "winres",
@@ -2601,7 +2622,7 @@ dependencies = [
2601
2622
  "png",
2602
2623
  "proc-macro2",
2603
2624
  "quote",
2604
- "semver 1.0.14",
2625
+ "semver 1.0.16",
2605
2626
  "serde",
2606
2627
  "serde_json",
2607
2628
  "sha2",
@@ -2643,7 +2664,7 @@ dependencies = [
2643
2664
  "thiserror",
2644
2665
  "uuid 1.2.2",
2645
2666
  "webview2-com",
2646
- "windows",
2667
+ "windows 0.39.0",
2647
2668
  ]
2648
2669
 
2649
2670
  [[package]]
@@ -2662,7 +2683,7 @@ dependencies = [
2662
2683
  "uuid 1.2.2",
2663
2684
  "webkit2gtk",
2664
2685
  "webview2-com",
2665
- "windows",
2686
+ "windows 0.39.0",
2666
2687
  "wry",
2667
2688
  ]
2668
2689
 
@@ -2684,14 +2705,14 @@ dependencies = [
2684
2705
  "phf 0.10.1",
2685
2706
  "proc-macro2",
2686
2707
  "quote",
2687
- "semver 1.0.14",
2708
+ "semver 1.0.16",
2688
2709
  "serde",
2689
2710
  "serde_json",
2690
2711
  "serde_with",
2691
2712
  "thiserror",
2692
2713
  "url",
2693
2714
  "walkdir",
2694
- "windows",
2715
+ "windows 0.39.0",
2695
2716
  ]
2696
2717
 
2697
2718
  [[package]]
@@ -2727,18 +2748,18 @@ checksum = "8eaa81235c7058867fa8c0e7314f33dcce9c215f535d1913822a2b3f5e289f3c"
2727
2748
 
2728
2749
  [[package]]
2729
2750
  name = "thiserror"
2730
- version = "1.0.37"
2751
+ version = "1.0.38"
2731
2752
  source = "registry+https://github.com/rust-lang/crates.io-index"
2732
- checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
2753
+ checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0"
2733
2754
  dependencies = [
2734
2755
  "thiserror-impl",
2735
2756
  ]
2736
2757
 
2737
2758
  [[package]]
2738
2759
  name = "thiserror-impl"
2739
- version = "1.0.37"
2760
+ version = "1.0.38"
2740
2761
  source = "registry+https://github.com/rust-lang/crates.io-index"
2741
- checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
2762
+ checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f"
2742
2763
  dependencies = [
2743
2764
  "proc-macro2",
2744
2765
  "quote",
@@ -2780,7 +2801,7 @@ version = "0.3.17"
2780
2801
  source = "registry+https://github.com/rust-lang/crates.io-index"
2781
2802
  checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376"
2782
2803
  dependencies = [
2783
- "itoa 1.0.4",
2804
+ "itoa 1.0.5",
2784
2805
  "serde",
2785
2806
  "time-core",
2786
2807
  "time-macros",
@@ -2818,9 +2839,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
2818
2839
 
2819
2840
  [[package]]
2820
2841
  name = "tokio"
2821
- version = "1.23.0"
2842
+ version = "1.24.1"
2822
2843
  source = "registry+https://github.com/rust-lang/crates.io-index"
2823
- checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46"
2844
+ checksum = "1d9f76183f91ecfb55e1d7d5602bd1d979e38a3a522fe900241cf195624d67ae"
2824
2845
  dependencies = [
2825
2846
  "autocfg",
2826
2847
  "bytes",
@@ -2832,9 +2853,9 @@ dependencies = [
2832
2853
 
2833
2854
  [[package]]
2834
2855
  name = "toml"
2835
- version = "0.5.9"
2856
+ version = "0.5.10"
2836
2857
  source = "registry+https://github.com/rust-lang/crates.io-index"
2837
- checksum = "8d82e1a7758622a465f8cee077614c73484dac5b836c02ff6a40d5d1010324d7"
2858
+ checksum = "1333c76748e868a4d9d1017b5ab53171dfd095f70c712fdb4653a406547f598f"
2838
2859
  dependencies = [
2839
2860
  "serde",
2840
2861
  ]
@@ -2930,9 +2951,9 @@ checksum = "099b7128301d285f79ddd55b9a83d5e6b9e97c92e0ea0daebee7263e932de992"
2930
2951
 
2931
2952
  [[package]]
2932
2953
  name = "unicode-ident"
2933
- version = "1.0.5"
2954
+ version = "1.0.6"
2934
2955
  source = "registry+https://github.com/rust-lang/crates.io-index"
2935
- checksum = "6ceab39d59e4c9499d4e5a8ee0e2735b891bb7308ac83dfb4e80cad195c9f6f3"
2956
+ checksum = "84a22b9f218b40614adcb3f4ff08b703773ad44fa9423e4e0d346d5db86e4ebc"
2936
2957
 
2937
2958
  [[package]]
2938
2959
  name = "unicode-normalization"
@@ -3095,18 +3116,20 @@ dependencies = [
3095
3116
 
3096
3117
  [[package]]
3097
3118
  name = "webbrowser"
3098
- version = "0.8.2"
3119
+ version = "0.8.4"
3099
3120
  source = "registry+https://github.com/rust-lang/crates.io-index"
3100
- checksum = "2a0cc7962b5aaa0dfcebaeef0161eec6edf5f4606c12e6777fd7d392f52033a5"
3121
+ checksum = "e74f5ff7786c4c21f61ba8e30ea29c9745f06fca0a4a02d083b3c662583399e8"
3101
3122
  dependencies = [
3123
+ "core-foundation",
3124
+ "dirs",
3102
3125
  "jni",
3126
+ "log",
3103
3127
  "ndk-context",
3104
3128
  "objc",
3105
3129
  "raw-window-handle",
3106
3130
  "url",
3107
3131
  "web-sys",
3108
- "widestring",
3109
- "winapi",
3132
+ "windows 0.43.0",
3110
3133
  ]
3111
3134
 
3112
3135
  [[package]]
@@ -3164,7 +3187,7 @@ checksum = "b4a769c9f1a64a8734bde70caafac2b96cada12cd4aefa49196b3a386b8b4178"
3164
3187
  dependencies = [
3165
3188
  "webview2-com-macros",
3166
3189
  "webview2-com-sys",
3167
- "windows",
3190
+ "windows 0.39.0",
3168
3191
  "windows-implement",
3169
3192
  ]
3170
3193
 
@@ -3189,7 +3212,7 @@ dependencies = [
3189
3212
  "serde",
3190
3213
  "serde_json",
3191
3214
  "thiserror",
3192
- "windows",
3215
+ "windows 0.39.0",
3193
3216
  "windows-bindgen",
3194
3217
  "windows-metadata",
3195
3218
  ]
@@ -3200,12 +3223,6 @@ version = "0.1.7"
3200
3223
  source = "registry+https://github.com/rust-lang/crates.io-index"
3201
3224
  checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb"
3202
3225
 
3203
- [[package]]
3204
- name = "widestring"
3205
- version = "1.0.2"
3206
- source = "registry+https://github.com/rust-lang/crates.io-index"
3207
- checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8"
3208
-
3209
3226
  [[package]]
3210
3227
  name = "winapi"
3211
3228
  version = "0.3.9"
@@ -3251,6 +3268,21 @@ dependencies = [
3251
3268
  "windows_x86_64_msvc 0.39.0",
3252
3269
  ]
3253
3270
 
3271
+ [[package]]
3272
+ name = "windows"
3273
+ version = "0.43.0"
3274
+ source = "registry+https://github.com/rust-lang/crates.io-index"
3275
+ checksum = "04662ed0e3e5630dfa9b26e4cb823b817f1a9addda855d973a9458c236556244"
3276
+ dependencies = [
3277
+ "windows_aarch64_gnullvm",
3278
+ "windows_aarch64_msvc 0.42.0",
3279
+ "windows_i686_gnu 0.42.0",
3280
+ "windows_i686_msvc 0.42.0",
3281
+ "windows_x86_64_gnu 0.42.0",
3282
+ "windows_x86_64_gnullvm",
3283
+ "windows_x86_64_msvc 0.42.0",
3284
+ ]
3285
+
3254
3286
  [[package]]
3255
3287
  name = "windows-bindgen"
3256
3288
  version = "0.39.0"
@@ -3413,7 +3445,7 @@ dependencies = [
3413
3445
  "webkit2gtk",
3414
3446
  "webkit2gtk-sys",
3415
3447
  "webview2-com",
3416
- "windows",
3448
+ "windows 0.39.0",
3417
3449
  "windows-implement",
3418
3450
  ]
3419
3451
 
@@ -7,7 +7,7 @@ license = ""
7
7
  repository = ""
8
8
  default-run = "app"
9
9
  edition = "2021"
10
- rust-version = "1.61.0"
10
+ rust-version = "1.63.0"
11
11
 
12
12
  # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
13
13
 
@@ -17,12 +17,13 @@ tauri-build = { version = "1.2.1", features = [] }
17
17
  [dependencies]
18
18
  serde_json = "1.0.89"
19
19
  serde = { version = "1.0.150", features = ["derive"] }
20
- tauri = { version = "1.2.2", features = [] }
20
+ tauri = { version = "1.2.3", features = [] }
21
21
  image = "0.24.5"
22
22
  home = "0.5"
23
23
  tauri-utils = "1.2.1"
24
24
  webbrowser = "0.8.2"
25
25
  wry = "0.23.4"
26
+ dirs = "4.0"
26
27
 
27
28
  [features]
28
29
  # by default Tauri runs in production mode
Binary file
@@ -26,6 +26,14 @@ use wry::application::window::Icon;
26
26
  #[cfg(any(target_os = "linux", target_os = "windows"))]
27
27
  use wry::webview::WebContext;
28
28
 
29
+ use dirs::download_dir;
30
+ use std::path::PathBuf;
31
+
32
+ enum UserEvent {
33
+ DownloadStarted(String, String),
34
+ DownloadComplete(Option<PathBuf>, bool),
35
+ }
36
+
29
37
  fn main() -> wry::Result<()> {
30
38
  #[cfg(target_os = "macos")]
31
39
  let (menu_bar_menu, close_item) = {
@@ -82,8 +90,9 @@ fn main() -> wry::Result<()> {
82
90
  fullscreen,
83
91
  ..
84
92
  } = get_windows_config().1.unwrap_or_default();
85
- let event_loop = EventLoop::new();
86
93
 
94
+ let event_loop: EventLoop<UserEvent> = EventLoop::with_user_event();
95
+ let proxy = event_loop.create_proxy();
87
96
  let common_window = WindowBuilder::new()
88
97
  .with_title("")
89
98
  .with_resizable(resizable)
@@ -93,9 +102,14 @@ fn main() -> wry::Result<()> {
93
102
  None
94
103
  })
95
104
  .with_inner_size(wry::application::dpi::LogicalSize::new(width, height));
105
+
96
106
  #[cfg(target_os = "windows")]
97
107
  let window = {
98
- let icon_path = format!("png/{}_32.ico", package_name);
108
+ let mut icon_path = format!("png/{}_32.ico", package_name);
109
+ // If there is no setting, use the default one.
110
+ if !std::path::Path::new(&icon_path).exists() {
111
+ icon_path = "png/icon_32.ico".to_string();
112
+ }
99
113
  let icon = load_icon(std::path::Path::new(&icon_path));
100
114
  common_window
101
115
  .with_decorations(true)
@@ -117,22 +131,40 @@ fn main() -> wry::Result<()> {
117
131
  .build(&event_loop)
118
132
  .unwrap();
119
133
 
134
+ // Handling events of JS -> Rust
120
135
  let handler = move |window: &Window, req: String| {
121
136
  if req == "drag_window" {
122
137
  let _ = window.drag_window();
123
138
  } else if req == "fullscreen" {
124
- if window.fullscreen().is_some() {
125
- window.set_fullscreen(None);
126
- } else {
127
- window.set_fullscreen(Some(Fullscreen::Borderless(None)));
128
- }
139
+ let is_maximized = window.is_maximized();
140
+ window.set_maximized(!is_maximized);
129
141
  } else if req.starts_with("open_browser") {
130
142
  let href = req.replace("open_browser:", "");
131
143
  webbrowser::open(&href).expect("no browser");
132
144
  }
133
145
  };
134
146
 
135
- // 用于欺骗部分页面对于浏览器的强检测
147
+ let download_started = {
148
+ let proxy = proxy.clone();
149
+ move |uri: String, default_path: &mut PathBuf| {
150
+ let path = download_dir()
151
+ .unwrap()
152
+ .join(default_path.display().to_string())
153
+ .as_path()
154
+ .to_path_buf();
155
+ *default_path = path.clone();
156
+ let submitted = proxy
157
+ .send_event(UserEvent::DownloadStarted(uri, path.display().to_string()))
158
+ .is_ok();
159
+ submitted
160
+ }
161
+ };
162
+
163
+ let download_completed = {
164
+ move |_uri, path, success| {
165
+ let _ = proxy.send_event(UserEvent::DownloadComplete(path, success));
166
+ }
167
+ };
136
168
 
137
169
  #[cfg(target_os = "macos")]
138
170
  let webview = {
@@ -144,6 +176,8 @@ fn main() -> wry::Result<()> {
144
176
  .with_initialization_script(include_str!("pake.js"))
145
177
  .with_ipc_handler(handler)
146
178
  .with_back_forward_navigation_gestures(true)
179
+ .with_download_started_handler(download_started)
180
+ .with_download_completed_handler(download_completed)
147
181
  .build()?
148
182
  };
149
183
 
@@ -173,6 +207,8 @@ fn main() -> wry::Result<()> {
173
207
  .with_initialization_script(include_str!("pake.js"))
174
208
  .with_ipc_handler(handler)
175
209
  .with_web_context(&mut web_content)
210
+ .with_download_started_handler(download_started)
211
+ .with_download_completed_handler(download_completed)
176
212
  .build()?
177
213
  };
178
214
  #[cfg(feature = "devtools")]
@@ -201,6 +237,18 @@ fn main() -> wry::Result<()> {
201
237
  println!("Clicked on {:?}", menu_id);
202
238
  println!("Clicked on {:?}", webview.window().is_visible());
203
239
  }
240
+ Event::UserEvent(UserEvent::DownloadStarted(uri, temp_dir)) => {
241
+ println!("Download: {}", uri);
242
+ println!("Will write to: {:?}", temp_dir);
243
+ }
244
+ Event::UserEvent(UserEvent::DownloadComplete(_, success)) => {
245
+ println!("Succeeded: {}", success);
246
+ if success {
247
+ let _ = webview.evaluate_script("window.pakeToast('Save in downloads folder')");
248
+ } else {
249
+ println!("No output path")
250
+ }
251
+ }
204
252
  _ => (),
205
253
  }
206
254
  });
@@ -51,11 +51,17 @@ window.addEventListener("DOMContentLoaded", (_event) => {
51
51
  display: none !important;
52
52
  }
53
53
 
54
- #page .main_header, .cb-layout-basic--navbar {
54
+ #page .main_header, .cb-layout-basic--navbar,
55
+ #app .splitpanes.splitpanes--horizontal.no-splitter header {
55
56
  padding-top: 20px;
56
57
  }
57
58
 
58
- .chakra-ui-light #app .chakra-heading, .chakra-ui-dark #app .chakra-heading, .chakra-ui-light #app .chakra-stack, .chakra-ui-dark #app .chakra-stack {
59
+ .chakra-ui-light #app .chakra-heading,
60
+ .chakra-ui-dark #app .chakra-heading,
61
+ .chakra-ui-light #app .chakra-stack,
62
+ .chakra-ui-dark #app .chakra-stack,
63
+ .app-main .sidebar-mouse-in-out,
64
+ .chakra-modal__content-container .chakra-modal__header > div > div {
59
65
  padding-top: 10px;
60
66
  }
61
67
 
@@ -362,3 +368,20 @@ function zoomIn() {
362
368
  function zoomOut() {
363
369
  zoomCommon((htmlZoom) => `${Math.max(parseInt(htmlZoom) - 10, 30)}%`);
364
370
  }
371
+
372
+
373
+ function pakeToast(msg) {
374
+ const m = document.createElement('div');
375
+ m.innerHTML = msg;
376
+ m.style.cssText = "max-width:60%;min-width: 180px;padding:0 8px;height: 36px;color: rgb(255, 255, 255);line-height: 36px;text-align: center;border-radius: 4px;position: fixed;bottom:16px;right: 16px;transform: translate(-50%, -50%);z-index: 999999;background: rgba(0, 0, 0,.9);font-size: 14px;";
377
+ document.body.appendChild(m);
378
+ setTimeout(function() {
379
+ const d = 0.5;
380
+ m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
381
+ m.style.opacity = '0';
382
+ setTimeout(function() {
383
+ document.body.removeChild(m)
384
+ }, d * 1000);
385
+ }, 2500);
386
+ }
387
+
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file