pake-cli 0.1.1 → 0.1.2
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 +34 -27
- package/dist/cli.js +32 -21
- package/package.json +3 -4
- package/src-tauri/Cargo.lock +11 -69
- package/src-tauri/Cargo.toml +1 -1
- package/src-tauri/icons/chatgpt.icns +0 -0
- package/src-tauri/png/chatgpt_256.ico +0 -0
- package/src-tauri/png/chatgpt_32.ico +0 -0
- package/src-tauri/png/chatgpt_512.png +0 -0
- package/src-tauri/src/main.rs +88 -132
- package/src-tauri/src/pake.js +17 -5
- package/src-tauri/tauri.linux.conf.json +1 -1
- package/pake-default.icns +0 -0
- package/src-tauri/tauri.conf.json.bak +0 -30
package/README.md
CHANGED
|
@@ -44,59 +44,57 @@
|
|
|
44
44
|
<td><img src=https://cdn.fliggy.com/upic/mc41xq.jpg width=600/></td>
|
|
45
45
|
</tr>
|
|
46
46
|
<tr>
|
|
47
|
-
<td>
|
|
48
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
49
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
50
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
47
|
+
<td>ChatGPT
|
|
48
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT.dmg">Mac</a>
|
|
49
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT_amd64.deb">Linux</a>
|
|
50
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/ChatGPT_x64.msi">Windows</a>
|
|
51
51
|
</td>
|
|
52
|
-
|
|
53
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
54
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
55
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
52
|
+
<td>Qwerty
|
|
53
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty.dmg">Mac</a>
|
|
54
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_amd64.deb">Linux</a>
|
|
55
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Qwerty_x64.msi">Windows</a>
|
|
56
56
|
</td>
|
|
57
57
|
</tr>
|
|
58
58
|
<tr>
|
|
59
|
-
<td><img src=https://cdn.fliggy.com/upic/
|
|
60
|
-
<td><img src=https://cdn.fliggy.com/upic/
|
|
59
|
+
<td><img src=https://cdn.fliggy.com/upic/sfnTXf.png width=600/></td>
|
|
60
|
+
<td><img src=https://cdn.fliggy.com/upic/CJjagn.jpg width=600/></td>
|
|
61
61
|
</tr>
|
|
62
62
|
<tr>
|
|
63
|
-
<td>Code
|
|
63
|
+
<td>Code
|
|
64
64
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Code.dmg">Mac</a>
|
|
65
65
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Code_amd64.deb">Linux</a>
|
|
66
66
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Code_x64.msi">Windows</a>
|
|
67
67
|
</td>
|
|
68
|
-
|
|
69
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
70
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
71
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/
|
|
68
|
+
<td>Reference
|
|
69
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference.dmg">Mac</a>
|
|
70
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference_amd64.deb">Linux</a>
|
|
71
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/Reference_x64.msi">Windows</a>
|
|
72
72
|
</td>
|
|
73
73
|
</tr>
|
|
74
74
|
<tr>
|
|
75
75
|
<td><img src=https://cdn.fliggy.com/upic/EB1OYP.jpg width=600/></td>
|
|
76
|
-
<td><img src=https://cdn.fliggy.com/upic/
|
|
76
|
+
<td><img src=https://cdn.fliggy.com/upic/KFsZIY.png width=600/></td>
|
|
77
77
|
</tr>
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
<tr>
|
|
79
|
+
<td>YouTube
|
|
80
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube.dmg">Mac</a>
|
|
81
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_amd64.deb">Linux</a>
|
|
82
|
+
<a href="https://github.com/tw93/Pake/releases/latest/download/YouTube_x64.msi">Windows</a>
|
|
83
|
+
</td>
|
|
84
|
+
<td>Flomo
|
|
80
85
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo.dmg">Mac</a>
|
|
81
86
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo_amd64.deb">Linux</a>
|
|
82
87
|
<a href="https://github.com/tw93/Pake/releases/latest/download/Flomo_x64.msi">Windows</a>
|
|
83
88
|
</td>
|
|
84
|
-
<td>YuQue
|
|
85
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/YuQue.dmg">Mac</a>
|
|
86
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/YuQue_amd64.deb">Linux</a>
|
|
87
|
-
<a href="https://github.com/tw93/Pake/releases/latest/download/YuQue_x64.msi">Windows</a>
|
|
88
|
-
</td>
|
|
89
89
|
</tr>
|
|
90
90
|
<tr>
|
|
91
|
+
<td><img src=https://cdn.fliggy.com/upic/Ea5ZRw.png width=600/></td>
|
|
91
92
|
<td><img src=https://cdn.fliggy.com/upic/jg9Eeu.jpg width=600/></td>
|
|
92
|
-
<td><img src=https://cdn.fliggy.com/upic/02SZQl.png width=600/></td>
|
|
93
93
|
</tr>
|
|
94
94
|
</table>
|
|
95
95
|
|
|
96
96
|
注意:Windows 下不能安装到 `C:\Program File`,会直接闪退,建议安装到其他非管理员权限目录,比如 `D:\Program Files (x86)` 。
|
|
97
97
|
|
|
98
|
-
对于轻度使用用户,使用 **GitHub Actions 在线编译多系统版本** 也是一个不错的选择,可查看[文档](/docs/README.md)。
|
|
99
|
-
|
|
100
98
|
## 命令行打包
|
|
101
99
|
|
|
102
100
|
<kbd>
|
|
@@ -117,6 +115,8 @@ pake url [options]
|
|
|
117
115
|
pake https://weekly.tw93.fun --name Weekly --transparent
|
|
118
116
|
```
|
|
119
117
|
|
|
118
|
+
假如你是不太会使用命令行的小白,使用 **GitHub Actions 在线编译多系统版本** 也是一个不错的选择,可查看[文档](./.github/workflows/docs/README.md)。
|
|
119
|
+
|
|
120
120
|
## 快捷键
|
|
121
121
|
|
|
122
122
|
| Mac | Windows/Linux | 功能 |
|
|
@@ -146,7 +146,7 @@ npm i
|
|
|
146
146
|
npm run dev
|
|
147
147
|
|
|
148
148
|
// 打包应用
|
|
149
|
-
npm run build
|
|
149
|
+
npm run build
|
|
150
150
|
|
|
151
151
|
```
|
|
152
152
|
|
|
@@ -249,6 +249,13 @@ Pake 的发展离不开这些 Hacker 们,一起贡献了大量能力,也欢
|
|
|
249
249
|
<sub><b>Aiello</b></sub>
|
|
250
250
|
</a>
|
|
251
251
|
</td>
|
|
252
|
+
<td align="center">
|
|
253
|
+
<a href="https://github.com/nekomeowww">
|
|
254
|
+
<img src="https://avatars.githubusercontent.com/u/11081491?v=4" width="90;" alt="nekomeowww"/>
|
|
255
|
+
<br />
|
|
256
|
+
<sub><b>Ayaka Neko</b></sub>
|
|
257
|
+
</a>
|
|
258
|
+
</td>
|
|
252
259
|
<td align="center">
|
|
253
260
|
<a href="https://github.com/houhoz">
|
|
254
261
|
<img src="https://avatars.githubusercontent.com/u/19684376?v=4" width="90;" alt="houhoz"/>
|
package/dist/cli.js
CHANGED
|
@@ -1678,6 +1678,10 @@ const logger = {
|
|
|
1678
1678
|
}
|
|
1679
1679
|
};
|
|
1680
1680
|
|
|
1681
|
+
const IS_MAC = process.platform === 'darwin';
|
|
1682
|
+
const IS_WIN = process.platform === 'win32';
|
|
1683
|
+
const IS_LINUX = process.platform === 'linux';
|
|
1684
|
+
|
|
1681
1685
|
function handleIcon(options, url) {
|
|
1682
1686
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1683
1687
|
if (options.icon) {
|
|
@@ -1689,15 +1693,21 @@ function handleIcon(options, url) {
|
|
|
1689
1693
|
}
|
|
1690
1694
|
}
|
|
1691
1695
|
if (!options.icon) {
|
|
1692
|
-
return
|
|
1696
|
+
return getDefaultIcon();
|
|
1693
1697
|
}
|
|
1694
1698
|
});
|
|
1695
1699
|
}
|
|
1696
|
-
function
|
|
1700
|
+
function getDefaultIcon() {
|
|
1697
1701
|
return __awaiter(this, void 0, void 0, function* () {
|
|
1698
1702
|
logger.info('You have not provided an app icon, use the default icon.(use --icon option to assign an icon)');
|
|
1699
|
-
|
|
1700
|
-
|
|
1703
|
+
let iconPath = 'src-tauri/icons/icon.icns';
|
|
1704
|
+
if (IS_WIN) {
|
|
1705
|
+
iconPath = 'src-tauri/png/icon_256.ico';
|
|
1706
|
+
}
|
|
1707
|
+
else if (IS_LINUX) {
|
|
1708
|
+
iconPath = 'src-tauri/png/icon_512.png';
|
|
1709
|
+
}
|
|
1710
|
+
return path.join(npmDirectory, iconPath);
|
|
1701
1711
|
});
|
|
1702
1712
|
}
|
|
1703
1713
|
// export async function getIconFromPageUrl(url: string) {
|
|
@@ -1773,10 +1783,6 @@ function handleOptions(options, url) {
|
|
|
1773
1783
|
});
|
|
1774
1784
|
}
|
|
1775
1785
|
|
|
1776
|
-
const IS_MAC = process.platform === 'darwin';
|
|
1777
|
-
const IS_WIN = process.platform === 'win32';
|
|
1778
|
-
const IS_LINUX = process.platform === 'linux';
|
|
1779
|
-
|
|
1780
1786
|
function shellExec(command) {
|
|
1781
1787
|
return new Promise((resolve, reject) => {
|
|
1782
1788
|
shelljs.exec(command, { async: true, silent: false }, (code) => {
|
|
@@ -1943,7 +1949,8 @@ var tauri = {
|
|
|
1943
1949
|
],
|
|
1944
1950
|
shortDescription: "",
|
|
1945
1951
|
targets: [
|
|
1946
|
-
"deb"
|
|
1952
|
+
"deb",
|
|
1953
|
+
"appimage"
|
|
1947
1954
|
]
|
|
1948
1955
|
}
|
|
1949
1956
|
};
|
|
@@ -1996,7 +2003,7 @@ class MacBuilder {
|
|
|
1996
2003
|
log.debug('PakeAppOptions', options);
|
|
1997
2004
|
const { name } = options;
|
|
1998
2005
|
yield mergeTauriConfig(url, options, tauriConf);
|
|
1999
|
-
yield shellExec(`cd ${npmDirectory} && npm install && npm run build
|
|
2006
|
+
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
|
|
2000
2007
|
let arch = "x64";
|
|
2001
2008
|
if (process.arch === "arm64") {
|
|
2002
2009
|
arch = "aarch64";
|
|
@@ -2046,7 +2053,7 @@ class WinBuilder {
|
|
|
2046
2053
|
logger.debug('PakeAppOptions', options);
|
|
2047
2054
|
const { name } = options;
|
|
2048
2055
|
yield mergeTauriConfig(url, options, tauriConf);
|
|
2049
|
-
yield shellExec(`cd ${npmDirectory} && npm install && npm run build
|
|
2056
|
+
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
|
|
2050
2057
|
const language = tauriConf.tauri.bundle.windows.wix.language[0];
|
|
2051
2058
|
const arch = process.arch;
|
|
2052
2059
|
const msiName = `${name}_${tauriConf.package.version}_${arch}_${language}.msi`;
|
|
@@ -2106,7 +2113,7 @@ Terminal=false
|
|
|
2106
2113
|
Type=Application
|
|
2107
2114
|
`;
|
|
2108
2115
|
yield fs.writeFile(assertPath, desktopStr);
|
|
2109
|
-
yield shellExec(`cd ${npmDirectory} && npm install && npm run build
|
|
2116
|
+
yield shellExec(`cd ${npmDirectory} && npm install && npm run build`);
|
|
2110
2117
|
let arch = "";
|
|
2111
2118
|
if (process.arch === "x64") {
|
|
2112
2119
|
arch = "amd64";
|
|
@@ -2115,22 +2122,27 @@ Type=Application
|
|
|
2115
2122
|
arch = process.arch;
|
|
2116
2123
|
}
|
|
2117
2124
|
const debName = `${name}_${tauriConf.package.version}_${arch}.deb`;
|
|
2118
|
-
const appPath = this.getBuildedAppPath(npmDirectory, debName);
|
|
2125
|
+
const appPath = this.getBuildedAppPath(npmDirectory, "deb", debName);
|
|
2119
2126
|
const distPath = path.resolve(`${name}.deb`);
|
|
2120
2127
|
yield fs.copyFile(appPath, distPath);
|
|
2121
2128
|
yield fs.unlink(appPath);
|
|
2129
|
+
const appImageName = `${name}_${tauriConf.package.version}_${arch}.AppImage`;
|
|
2130
|
+
const appImagePath = this.getBuildedAppPath(npmDirectory, "appimage", appImageName);
|
|
2131
|
+
const distAppPath = path.resolve(`${name}.AppImage`);
|
|
2132
|
+
yield fs.copyFile(appImagePath, distAppPath);
|
|
2133
|
+
yield fs.unlink(appImagePath);
|
|
2122
2134
|
logger.success('Build success!');
|
|
2123
|
-
logger.success('You can find the app installer in', distPath);
|
|
2135
|
+
logger.success('You can find the deb app installer in', distPath);
|
|
2136
|
+
logger.success('You can find the Appimage app installer in', distAppPath);
|
|
2124
2137
|
});
|
|
2125
2138
|
}
|
|
2126
|
-
getBuildedAppPath(npmDirectory,
|
|
2127
|
-
return path.join(npmDirectory, 'src-tauri/target/release/bundle/
|
|
2139
|
+
getBuildedAppPath(npmDirectory, packageType, packageName) {
|
|
2140
|
+
return path.join(npmDirectory, 'src-tauri/target/release/bundle/', packageType, packageName);
|
|
2128
2141
|
}
|
|
2129
2142
|
}
|
|
2130
2143
|
|
|
2131
2144
|
class BuilderFactory {
|
|
2132
2145
|
static create() {
|
|
2133
|
-
console.log("now platform is ", process.platform);
|
|
2134
2146
|
if (IS_MAC) {
|
|
2135
2147
|
return new MacBuilder();
|
|
2136
2148
|
}
|
|
@@ -2145,7 +2157,7 @@ class BuilderFactory {
|
|
|
2145
2157
|
}
|
|
2146
2158
|
|
|
2147
2159
|
var name = "pake-cli";
|
|
2148
|
-
var version = "0.1.
|
|
2160
|
+
var version = "0.1.2";
|
|
2149
2161
|
var description = "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.";
|
|
2150
2162
|
var bin = {
|
|
2151
2163
|
pake: "./cli.js"
|
|
@@ -2161,14 +2173,13 @@ var author = {
|
|
|
2161
2173
|
var files = [
|
|
2162
2174
|
"dist",
|
|
2163
2175
|
"src-tauri",
|
|
2164
|
-
"cli.js"
|
|
2165
|
-
"pake-default.icns"
|
|
2176
|
+
"cli.js"
|
|
2166
2177
|
];
|
|
2167
2178
|
var scripts = {
|
|
2168
2179
|
start: "npm run dev",
|
|
2169
2180
|
dev: "npm run tauri dev",
|
|
2170
2181
|
"dev:debug": "npm run tauri dev -- --features devtools",
|
|
2171
|
-
|
|
2182
|
+
build: "npm run tauri build --release",
|
|
2172
2183
|
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",
|
|
2173
2184
|
"build:all-windows": ".\\script\\build.bat",
|
|
2174
2185
|
tauri: "tauri",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pake-cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "🤱🏻 很简单的用 Rust 打包网页生成很小的桌面 App 🤱🏻 A simple way to make any web page a desktop application using Rust.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"pake": "./cli.js"
|
|
@@ -16,14 +16,13 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist",
|
|
18
18
|
"src-tauri",
|
|
19
|
-
"cli.js"
|
|
20
|
-
"pake-default.icns"
|
|
19
|
+
"cli.js"
|
|
21
20
|
],
|
|
22
21
|
"scripts": {
|
|
23
22
|
"start": "npm run dev",
|
|
24
23
|
"dev": "npm run tauri dev",
|
|
25
24
|
"dev:debug": "npm run tauri dev -- --features devtools",
|
|
26
|
-
"build
|
|
25
|
+
"build": "npm run tauri build --release",
|
|
27
26
|
"build:all-unix": "chmod +x ./script/build.sh && ./script/build.sh",
|
|
28
27
|
"build:all-windows": ".\\script\\build.bat",
|
|
29
28
|
"tauri": "tauri",
|
package/src-tauri/Cargo.lock
CHANGED
|
@@ -49,7 +49,7 @@ dependencies = [
|
|
|
49
49
|
"tauri-build",
|
|
50
50
|
"tauri-utils",
|
|
51
51
|
"webbrowser",
|
|
52
|
-
"wry 0.
|
|
52
|
+
"wry 0.23.1",
|
|
53
53
|
]
|
|
54
54
|
|
|
55
55
|
[[package]]
|
|
@@ -1262,20 +1262,6 @@ dependencies = [
|
|
|
1262
1262
|
"system-deps 5.0.0",
|
|
1263
1263
|
]
|
|
1264
1264
|
|
|
1265
|
-
[[package]]
|
|
1266
|
-
name = "jni"
|
|
1267
|
-
version = "0.19.0"
|
|
1268
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
1269
|
-
checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec"
|
|
1270
|
-
dependencies = [
|
|
1271
|
-
"cesu8",
|
|
1272
|
-
"combine",
|
|
1273
|
-
"jni-sys",
|
|
1274
|
-
"log",
|
|
1275
|
-
"thiserror",
|
|
1276
|
-
"walkdir",
|
|
1277
|
-
]
|
|
1278
|
-
|
|
1279
1265
|
[[package]]
|
|
1280
1266
|
name = "jni"
|
|
1281
1267
|
version = "0.20.0"
|
|
@@ -2474,52 +2460,6 @@ dependencies = [
|
|
|
2474
2460
|
"version-compare 0.1.1",
|
|
2475
2461
|
]
|
|
2476
2462
|
|
|
2477
|
-
[[package]]
|
|
2478
|
-
name = "tao"
|
|
2479
|
-
version = "0.14.0"
|
|
2480
|
-
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
2481
|
-
checksum = "43336f5d1793543ba96e2a1e75f3a5c7dcd592743be06a0ab3a190f4fcb4b934"
|
|
2482
|
-
dependencies = [
|
|
2483
|
-
"bitflags",
|
|
2484
|
-
"cairo-rs",
|
|
2485
|
-
"cc",
|
|
2486
|
-
"cocoa",
|
|
2487
|
-
"core-foundation",
|
|
2488
|
-
"core-graphics",
|
|
2489
|
-
"crossbeam-channel",
|
|
2490
|
-
"dispatch",
|
|
2491
|
-
"gdk",
|
|
2492
|
-
"gdk-pixbuf",
|
|
2493
|
-
"gdk-sys",
|
|
2494
|
-
"gdkx11-sys",
|
|
2495
|
-
"gio",
|
|
2496
|
-
"glib",
|
|
2497
|
-
"glib-sys",
|
|
2498
|
-
"gtk",
|
|
2499
|
-
"image",
|
|
2500
|
-
"instant",
|
|
2501
|
-
"jni 0.19.0",
|
|
2502
|
-
"lazy_static",
|
|
2503
|
-
"libc",
|
|
2504
|
-
"log",
|
|
2505
|
-
"ndk",
|
|
2506
|
-
"ndk-context",
|
|
2507
|
-
"ndk-sys",
|
|
2508
|
-
"objc",
|
|
2509
|
-
"once_cell",
|
|
2510
|
-
"parking_lot",
|
|
2511
|
-
"paste",
|
|
2512
|
-
"png",
|
|
2513
|
-
"raw-window-handle",
|
|
2514
|
-
"scopeguard",
|
|
2515
|
-
"serde",
|
|
2516
|
-
"unicode-segmentation",
|
|
2517
|
-
"uuid 1.2.2",
|
|
2518
|
-
"windows 0.39.0",
|
|
2519
|
-
"windows-implement",
|
|
2520
|
-
"x11-dl",
|
|
2521
|
-
]
|
|
2522
|
-
|
|
2523
2463
|
[[package]]
|
|
2524
2464
|
name = "tao"
|
|
2525
2465
|
version = "0.15.6"
|
|
@@ -2544,7 +2484,7 @@ dependencies = [
|
|
|
2544
2484
|
"gtk",
|
|
2545
2485
|
"image",
|
|
2546
2486
|
"instant",
|
|
2547
|
-
"jni
|
|
2487
|
+
"jni",
|
|
2548
2488
|
"lazy_static",
|
|
2549
2489
|
"libc",
|
|
2550
2490
|
"log",
|
|
@@ -3149,7 +3089,7 @@ version = "0.8.2"
|
|
|
3149
3089
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3150
3090
|
checksum = "2a0cc7962b5aaa0dfcebaeef0161eec6edf5f4606c12e6777fd7d392f52033a5"
|
|
3151
3091
|
dependencies = [
|
|
3152
|
-
"jni
|
|
3092
|
+
"jni",
|
|
3153
3093
|
"ndk-context",
|
|
3154
3094
|
"objc",
|
|
3155
3095
|
"raw-window-handle",
|
|
@@ -3474,15 +3414,16 @@ dependencies = [
|
|
|
3474
3414
|
|
|
3475
3415
|
[[package]]
|
|
3476
3416
|
name = "wry"
|
|
3477
|
-
version = "0.
|
|
3417
|
+
version = "0.22.5"
|
|
3478
3418
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3479
|
-
checksum = "
|
|
3419
|
+
checksum = "e3b4906cc7b3c5959893f3984bb60882ec94539eb14622077e6529f5b3d008ee"
|
|
3480
3420
|
dependencies = [
|
|
3481
3421
|
"base64",
|
|
3482
3422
|
"block",
|
|
3483
3423
|
"cocoa",
|
|
3484
3424
|
"core-graphics",
|
|
3485
3425
|
"crossbeam-channel",
|
|
3426
|
+
"dunce",
|
|
3486
3427
|
"gdk",
|
|
3487
3428
|
"gio",
|
|
3488
3429
|
"glib",
|
|
@@ -3498,7 +3439,8 @@ dependencies = [
|
|
|
3498
3439
|
"serde",
|
|
3499
3440
|
"serde_json",
|
|
3500
3441
|
"sha2",
|
|
3501
|
-
"
|
|
3442
|
+
"soup2",
|
|
3443
|
+
"tao",
|
|
3502
3444
|
"thiserror",
|
|
3503
3445
|
"url",
|
|
3504
3446
|
"webkit2gtk",
|
|
@@ -3510,9 +3452,9 @@ dependencies = [
|
|
|
3510
3452
|
|
|
3511
3453
|
[[package]]
|
|
3512
3454
|
name = "wry"
|
|
3513
|
-
version = "0.
|
|
3455
|
+
version = "0.23.1"
|
|
3514
3456
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
3515
|
-
checksum = "
|
|
3457
|
+
checksum = "a76c9236a810d4af02213f89f5bc55bf3262d40c4407b13a9fc847156ef8b856"
|
|
3516
3458
|
dependencies = [
|
|
3517
3459
|
"base64",
|
|
3518
3460
|
"block",
|
|
@@ -3536,7 +3478,7 @@ dependencies = [
|
|
|
3536
3478
|
"serde_json",
|
|
3537
3479
|
"sha2",
|
|
3538
3480
|
"soup2",
|
|
3539
|
-
"tao
|
|
3481
|
+
"tao",
|
|
3540
3482
|
"thiserror",
|
|
3541
3483
|
"url",
|
|
3542
3484
|
"webkit2gtk",
|
package/src-tauri/Cargo.toml
CHANGED
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/src-tauri/src/main.rs
CHANGED
|
@@ -2,109 +2,76 @@
|
|
|
2
2
|
#![windows_subsystem = "windows"]
|
|
3
3
|
extern crate image;
|
|
4
4
|
use tauri_utils::config::{Config, WindowConfig};
|
|
5
|
-
#[cfg(target_os = "macos")]
|
|
6
|
-
use wry::application::platform::macos::WindowBuilderExtMacOS;
|
|
7
|
-
|
|
8
|
-
#[cfg(target_os = "macos")]
|
|
9
5
|
use wry::{
|
|
10
6
|
application::{
|
|
11
|
-
accelerator::{Accelerator, SysMods},
|
|
12
7
|
event::{Event, StartCause, WindowEvent},
|
|
13
8
|
event_loop::{ControlFlow, EventLoop},
|
|
14
|
-
|
|
15
|
-
menu::{MenuBar as Menu, MenuItem, MenuItemAttributes, MenuType},
|
|
9
|
+
menu::MenuType,
|
|
16
10
|
window::{Fullscreen, Window, WindowBuilder},
|
|
17
11
|
},
|
|
18
12
|
webview::WebViewBuilder,
|
|
19
13
|
};
|
|
20
14
|
|
|
21
|
-
#[cfg(target_os = "
|
|
22
|
-
use wry::{
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
window::{Fullscreen, Icon, Window, WindowBuilder},
|
|
28
|
-
},
|
|
29
|
-
webview::WebViewBuilder,
|
|
15
|
+
#[cfg(target_os = "macos")]
|
|
16
|
+
use wry::application::{
|
|
17
|
+
accelerator::{Accelerator, SysMods},
|
|
18
|
+
keyboard::KeyCode,
|
|
19
|
+
menu::{MenuBar as Menu, MenuItem, MenuItemAttributes},
|
|
20
|
+
platform::macos::WindowBuilderExtMacOS,
|
|
30
21
|
};
|
|
31
22
|
|
|
23
|
+
#[cfg(target_os = "windows")]
|
|
24
|
+
use wry::application::window::Icon;
|
|
25
|
+
|
|
32
26
|
#[cfg(target_os = "linux")]
|
|
33
|
-
use wry::
|
|
34
|
-
application::{
|
|
35
|
-
event::{Event, StartCause, WindowEvent},
|
|
36
|
-
event_loop::{ControlFlow, EventLoop},
|
|
37
|
-
menu::MenuType,
|
|
38
|
-
window::{Fullscreen, Window, WindowBuilder},
|
|
39
|
-
},
|
|
40
|
-
webview::{WebContext, WebViewBuilder},
|
|
41
|
-
};
|
|
27
|
+
use wry::webview::WebContext;
|
|
42
28
|
|
|
43
29
|
fn main() -> wry::Result<()> {
|
|
44
30
|
#[cfg(target_os = "macos")]
|
|
45
|
-
let
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
first_menu.add_native_item(MenuItem::SelectAll);
|
|
68
|
-
#[cfg(target_os = "macos")]
|
|
69
|
-
first_menu.add_native_item(MenuItem::Separator);
|
|
70
|
-
|
|
71
|
-
#[cfg(target_os = "macos")]
|
|
72
|
-
let close_item = first_menu.add_item(
|
|
73
|
-
MenuItemAttributes::new("CloseWindow")
|
|
74
|
-
.with_accelerators(&Accelerator::new(SysMods::Cmd, KeyCode::KeyW)),
|
|
75
|
-
);
|
|
76
|
-
|
|
77
|
-
#[cfg(target_os = "macos")]
|
|
78
|
-
first_menu.add_native_item(MenuItem::Quit);
|
|
79
|
-
|
|
80
|
-
#[cfg(target_os = "macos")]
|
|
81
|
-
menu_bar_menu.add_submenu("App", true, first_menu);
|
|
82
|
-
#[cfg(target_os = "linux")]
|
|
83
|
-
let (package_name, windows_config) = get_windows_config();
|
|
31
|
+
let (menu_bar_menu, close_item) = {
|
|
32
|
+
let mut menu_bar_menu = Menu::new();
|
|
33
|
+
let mut first_menu = Menu::new();
|
|
34
|
+
first_menu.add_native_item(MenuItem::Hide);
|
|
35
|
+
first_menu.add_native_item(MenuItem::EnterFullScreen);
|
|
36
|
+
first_menu.add_native_item(MenuItem::Minimize);
|
|
37
|
+
first_menu.add_native_item(MenuItem::Separator);
|
|
38
|
+
first_menu.add_native_item(MenuItem::Copy);
|
|
39
|
+
first_menu.add_native_item(MenuItem::Cut);
|
|
40
|
+
first_menu.add_native_item(MenuItem::Paste);
|
|
41
|
+
first_menu.add_native_item(MenuItem::Undo);
|
|
42
|
+
first_menu.add_native_item(MenuItem::Redo);
|
|
43
|
+
first_menu.add_native_item(MenuItem::SelectAll);
|
|
44
|
+
first_menu.add_native_item(MenuItem::Separator);
|
|
45
|
+
let close_item = first_menu.add_item(
|
|
46
|
+
MenuItemAttributes::new("CloseWindow")
|
|
47
|
+
.with_accelerators(&Accelerator::new(SysMods::Cmd, KeyCode::KeyW)),
|
|
48
|
+
);
|
|
49
|
+
first_menu.add_native_item(MenuItem::Quit);
|
|
50
|
+
menu_bar_menu.add_submenu("App", true, first_menu);
|
|
51
|
+
(menu_bar_menu, close_item)
|
|
52
|
+
};
|
|
84
53
|
|
|
85
|
-
#[cfg(target_os = "linux")]
|
|
86
|
-
let
|
|
54
|
+
#[cfg(any(target_os = "linux", target_os = "windows"))]
|
|
55
|
+
let (
|
|
56
|
+
package_name,
|
|
57
|
+
WindowConfig {
|
|
58
|
+
url,
|
|
59
|
+
width,
|
|
60
|
+
height,
|
|
61
|
+
resizable,
|
|
62
|
+
fullscreen,
|
|
63
|
+
..
|
|
64
|
+
},
|
|
65
|
+
) = {
|
|
66
|
+
let (package_name, windows_config) = get_windows_config();
|
|
67
|
+
(
|
|
68
|
+
package_name
|
|
69
|
+
.expect("can't get package name in config file")
|
|
70
|
+
.to_lowercase(),
|
|
71
|
+
windows_config.unwrap_or_default(),
|
|
72
|
+
)
|
|
73
|
+
};
|
|
87
74
|
|
|
88
|
-
#[cfg(target_os = "linux")]
|
|
89
|
-
let WindowConfig {
|
|
90
|
-
url,
|
|
91
|
-
width,
|
|
92
|
-
height,
|
|
93
|
-
resizable,
|
|
94
|
-
fullscreen,
|
|
95
|
-
..
|
|
96
|
-
} = windows_config.unwrap_or_default();
|
|
97
|
-
#[cfg(target_os = "windows")]
|
|
98
|
-
let (package_name, windows_config) = get_windows_config();
|
|
99
|
-
#[cfg(target_os = "windows")]
|
|
100
|
-
let WindowConfig {
|
|
101
|
-
url,
|
|
102
|
-
width,
|
|
103
|
-
height,
|
|
104
|
-
resizable,
|
|
105
|
-
fullscreen,
|
|
106
|
-
..
|
|
107
|
-
} = windows_config.unwrap_or_default();
|
|
108
75
|
#[cfg(target_os = "macos")]
|
|
109
76
|
let WindowConfig {
|
|
110
77
|
url,
|
|
@@ -127,19 +94,15 @@ fn main() -> wry::Result<()> {
|
|
|
127
94
|
})
|
|
128
95
|
.with_inner_size(wry::application::dpi::LogicalSize::new(width, height));
|
|
129
96
|
#[cfg(target_os = "windows")]
|
|
130
|
-
let
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
.with_decorations(true)
|
|
140
|
-
.with_window_icon(Some(icon))
|
|
141
|
-
.build(&event_loop)
|
|
142
|
-
.unwrap();
|
|
97
|
+
let window = {
|
|
98
|
+
let icon_path = format!("png/{}_32.ico", package_name);
|
|
99
|
+
let icon = load_icon(std::path::Path::new(&icon_path));
|
|
100
|
+
common_window
|
|
101
|
+
.with_decorations(true)
|
|
102
|
+
.with_window_icon(Some(icon))
|
|
103
|
+
.build(&event_loop)
|
|
104
|
+
.unwrap()
|
|
105
|
+
};
|
|
143
106
|
|
|
144
107
|
#[cfg(target_os = "linux")]
|
|
145
108
|
let window = common_window.build(&event_loop).unwrap();
|
|
@@ -177,12 +140,11 @@ fn main() -> wry::Result<()> {
|
|
|
177
140
|
#[cfg(target_os = "macos")]
|
|
178
141
|
let webview = WebViewBuilder::new(window)?
|
|
179
142
|
// .with_user_agent(user_agent_string)
|
|
180
|
-
// .with_accept_first_mouse(true)
|
|
181
143
|
.with_url(&url.to_string())?
|
|
182
144
|
.with_devtools(cfg!(feature = "devtools"))
|
|
183
145
|
.with_initialization_script(include_str!("pake.js"))
|
|
184
146
|
.with_ipc_handler(handler)
|
|
185
|
-
|
|
147
|
+
.with_back_forward_navigation_gestures(true)
|
|
186
148
|
.build()?;
|
|
187
149
|
|
|
188
150
|
#[cfg(target_os = "windows")]
|
|
@@ -193,42 +155,36 @@ fn main() -> wry::Result<()> {
|
|
|
193
155
|
.with_devtools(cfg!(feature = "devtools"))
|
|
194
156
|
.with_initialization_script(include_str!("pake.js"))
|
|
195
157
|
.with_ipc_handler(handler)
|
|
196
|
-
// .with_back_forward_navigation_gestures(true)
|
|
197
158
|
.build()?;
|
|
159
|
+
|
|
198
160
|
// 自定义cookie文件夹,仅用于Linux
|
|
199
161
|
// Custom Cookie folder, only for Linux
|
|
200
|
-
// #[cfg(target_os = "linux")]
|
|
201
|
-
// let config_path = format!("/home/{}/.config/{}", env!("USER"), package_name);
|
|
202
|
-
#[cfg(target_os = "linux")]
|
|
203
|
-
let user = std::env::var_os("USER");
|
|
204
162
|
#[cfg(target_os = "linux")]
|
|
205
|
-
let
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
163
|
+
let webview = {
|
|
164
|
+
let user = std::env::var_os("USER");
|
|
165
|
+
let config_path = match user {
|
|
166
|
+
Some(v) => format!(
|
|
167
|
+
"/home/{}/.config/{}",
|
|
168
|
+
v.into_string().unwrap(),
|
|
169
|
+
package_name,
|
|
170
|
+
),
|
|
171
|
+
None => panic!("can't found any user"),
|
|
172
|
+
};
|
|
173
|
+
let data_path = std::path::PathBuf::from(&config_path);
|
|
174
|
+
if !std::path::Path::new(&data_path).exists() {
|
|
175
|
+
std::fs::create_dir(&data_path)
|
|
176
|
+
.unwrap_or_else(|_| panic!("can't create dir {}", &config_path));
|
|
177
|
+
}
|
|
178
|
+
let mut web_content = WebContext::new(Some(data_path));
|
|
179
|
+
WebViewBuilder::new(window)?
|
|
180
|
+
// .with_user_agent(user_agent_string)
|
|
181
|
+
.with_url(&url.to_string())?
|
|
182
|
+
.with_devtools(cfg!(feature = "devtools"))
|
|
183
|
+
.with_initialization_script(include_str!("pake.js"))
|
|
184
|
+
.with_ipc_handler(handler)
|
|
185
|
+
.with_web_context(&mut web_content)
|
|
186
|
+
.build()?
|
|
210
187
|
};
|
|
211
|
-
#[cfg(target_os = "linux")]
|
|
212
|
-
let data_path = std::path::PathBuf::from(&config_path);
|
|
213
|
-
#[cfg(target_os = "linux")]
|
|
214
|
-
if !std::path::Path::new(&data_path).exists() {
|
|
215
|
-
std::fs::create_dir(&data_path)
|
|
216
|
-
.unwrap_or_else(|_| panic!("can't create dir {}", &config_path));
|
|
217
|
-
}
|
|
218
|
-
#[cfg(target_os = "linux")]
|
|
219
|
-
let mut web_content = WebContext::new(Some(data_path));
|
|
220
|
-
#[cfg(target_os = "linux")]
|
|
221
|
-
let webview = WebViewBuilder::new(window)?
|
|
222
|
-
// .with_user_agent(user_agent_string)
|
|
223
|
-
// .with_accept_first_mouse(true)
|
|
224
|
-
.with_url(&url.to_string())?
|
|
225
|
-
.with_devtools(cfg!(feature = "devtools"))
|
|
226
|
-
.with_initialization_script(include_str!("pake.js"))
|
|
227
|
-
.with_ipc_handler(handler)
|
|
228
|
-
.with_web_context(&mut web_content)
|
|
229
|
-
// .with_back_forward_navigation_gestures(true)
|
|
230
|
-
.build()?;
|
|
231
|
-
|
|
232
188
|
#[cfg(feature = "devtools")]
|
|
233
189
|
{
|
|
234
190
|
webview.open_devtools();
|
package/src-tauri/src/pake.js
CHANGED
|
@@ -55,6 +55,18 @@ window.addEventListener("DOMContentLoaded", (_event) => {
|
|
|
55
55
|
padding-top: 20px;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
#__next .overflow-hidden .flex.flex-1.flex-col {
|
|
59
|
+
padding-left: 0;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#__next .overflow-hidden>.hidden.bg-gray-900 {
|
|
63
|
+
display: none;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
#__next .overflow-hidden main .absolute .text-xs{
|
|
67
|
+
visibility: hidden;
|
|
68
|
+
}
|
|
69
|
+
|
|
58
70
|
.lark > .dashboard-sidebar, .lark > .dashboard-sidebar > .sidebar-user-info , .lark > .dashboard-sidebar .index-module_wrapper_F-Wbq{
|
|
59
71
|
padding-top:15px;
|
|
60
72
|
}
|
|
@@ -306,16 +318,16 @@ window.addEventListener("DOMContentLoaded", (_event) => {
|
|
|
306
318
|
document.addEventListener("click", (e) => {
|
|
307
319
|
const origin = e.target.closest("a");
|
|
308
320
|
if (origin && origin.href) {
|
|
321
|
+
const target = origin.target
|
|
309
322
|
origin.target = "_self";
|
|
323
|
+
const hrefUrl = new URL(origin.href)
|
|
310
324
|
|
|
311
|
-
//额外处理下 twitter 的外跳,对于其他需要外跳的可以改这里成对应域名
|
|
312
|
-
const href = origin.href;
|
|
313
325
|
if (
|
|
314
|
-
location.host
|
|
315
|
-
|
|
326
|
+
window.location.host !== hrefUrl.host && // 如果 a 标签内链接的域名和当前页面的域名不一致 且
|
|
327
|
+
target === '_blank' // a 标签内链接的 target 属性为 _blank 时
|
|
316
328
|
) {
|
|
317
329
|
e.preventDefault();
|
|
318
|
-
window.ipc.postMessage(`open_browser:${href}`);
|
|
330
|
+
window.ipc.postMessage(`open_browser:${origin.href}`);
|
|
319
331
|
}
|
|
320
332
|
}
|
|
321
333
|
});
|
package/pake-default.icns
DELETED
|
Binary file
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"package": {
|
|
3
|
-
"productName": "WeRead",
|
|
4
|
-
"version": "1.0.0"
|
|
5
|
-
},
|
|
6
|
-
"tauri": {
|
|
7
|
-
"windows": [
|
|
8
|
-
{
|
|
9
|
-
"url": "https://weread.qq.com/",
|
|
10
|
-
"transparent": true,
|
|
11
|
-
"fullscreen": false,
|
|
12
|
-
"width": 1200,
|
|
13
|
-
"height": 728,
|
|
14
|
-
"resizable": true
|
|
15
|
-
}
|
|
16
|
-
],
|
|
17
|
-
"security": {
|
|
18
|
-
"csp": null
|
|
19
|
-
},
|
|
20
|
-
"updater": {
|
|
21
|
-
"active": false
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"build": {
|
|
25
|
-
"devPath": "../dist",
|
|
26
|
-
"distDir": "../dist",
|
|
27
|
-
"beforeBuildCommand": "",
|
|
28
|
-
"beforeDevCommand": ""
|
|
29
|
-
}
|
|
30
|
-
}
|