pake-cli 0.0.6 → 0.1.1

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.
@@ -17,11 +17,11 @@ tauri-build = { version = "1.2.1", features = [] }
17
17
  [dependencies]
18
18
  serde_json = "1.0.88"
19
19
  serde = { version = "1.0.147", features = ["derive"] }
20
- tauri = { version = "1.2.1", features = ["api-all"] }
20
+ tauri = { version = "1.2.1", features = [] }
21
21
  image = "0.24.5"
22
22
  tauri-utils = "1.2.1"
23
23
  webbrowser = "0.8.2"
24
- wry = "0.22.5"
24
+ wry = "0.21.1"
25
25
 
26
26
  [features]
27
27
  # by default Tauri runs in production mode
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -79,6 +79,12 @@ fn main() -> wry::Result<()> {
79
79
 
80
80
  #[cfg(target_os = "macos")]
81
81
  menu_bar_menu.add_submenu("App", true, first_menu);
82
+ #[cfg(target_os = "linux")]
83
+ let (package_name, windows_config) = get_windows_config();
84
+
85
+ #[cfg(target_os = "linux")]
86
+ let package_name = package_name.expect("can't get package name in config file");
87
+
82
88
  #[cfg(target_os = "linux")]
83
89
  let WindowConfig {
84
90
  url,
@@ -87,7 +93,9 @@ fn main() -> wry::Result<()> {
87
93
  resizable,
88
94
  fullscreen,
89
95
  ..
90
- } = get_windows_config().unwrap_or_default();
96
+ } = windows_config.unwrap_or_default();
97
+ #[cfg(target_os = "windows")]
98
+ let (package_name, windows_config) = get_windows_config();
91
99
  #[cfg(target_os = "windows")]
92
100
  let WindowConfig {
93
101
  url,
@@ -96,7 +104,7 @@ fn main() -> wry::Result<()> {
96
104
  resizable,
97
105
  fullscreen,
98
106
  ..
99
- } = get_windows_config().unwrap_or_default();
107
+ } = windows_config.unwrap_or_default();
100
108
  #[cfg(target_os = "macos")]
101
109
  let WindowConfig {
102
110
  url,
@@ -106,7 +114,7 @@ fn main() -> wry::Result<()> {
106
114
  transparent,
107
115
  fullscreen,
108
116
  ..
109
- } = get_windows_config().unwrap_or_default();
117
+ } = get_windows_config().1.unwrap_or_default();
110
118
  let event_loop = EventLoop::new();
111
119
 
112
120
  let common_window = WindowBuilder::new()
@@ -119,8 +127,13 @@ fn main() -> wry::Result<()> {
119
127
  })
120
128
  .with_inner_size(wry::application::dpi::LogicalSize::new(width, height));
121
129
  #[cfg(target_os = "windows")]
122
- let icon = load_icon(std::path::Path::new("png/weread_32.ico"));
123
-
130
+ let package_name = package_name
131
+ .expect("can't get package name in config file")
132
+ .to_lowercase();
133
+ #[cfg(target_os = "windows")]
134
+ let icon_path = format!("png/{}_32.ico", package_name);
135
+ #[cfg(target_os = "windows")]
136
+ let icon = load_icon(std::path::Path::new(&icon_path));
124
137
  #[cfg(target_os = "windows")]
125
138
  let window = common_window
126
139
  .with_decorations(true)
@@ -157,50 +170,63 @@ fn main() -> wry::Result<()> {
157
170
  };
158
171
 
159
172
  // 用于欺骗部分页面对于浏览器的强检测
160
- let user_agent_string = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15";
173
+
174
+ // #[cfg(target_os = "macos")]
175
+ // let user_agent_string = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.1 Safari/605.1.15";
161
176
 
162
177
  #[cfg(target_os = "macos")]
163
178
  let webview = WebViewBuilder::new(window)?
164
- .with_user_agent(user_agent_string)
165
- .with_accept_first_mouse(true)
179
+ // .with_user_agent(user_agent_string)
180
+ // .with_accept_first_mouse(true)
166
181
  .with_url(&url.to_string())?
167
182
  .with_devtools(cfg!(feature = "devtools"))
168
183
  .with_initialization_script(include_str!("pake.js"))
169
184
  .with_ipc_handler(handler)
170
- .with_back_forward_navigation_gestures(true)
185
+ // .with_back_forward_navigation_gestures(true)
171
186
  .build()?;
172
187
 
173
188
  #[cfg(target_os = "windows")]
174
189
  let webview = WebViewBuilder::new(window)?
175
- .with_user_agent(user_agent_string)
176
- .with_accept_first_mouse(true)
190
+ // .with_user_agent(user_agent_string)
191
+ // .with_accept_first_mouse(true)
177
192
  .with_url(&url.to_string())?
178
193
  .with_devtools(cfg!(feature = "devtools"))
179
194
  .with_initialization_script(include_str!("pake.js"))
180
195
  .with_ipc_handler(handler)
181
- .with_back_forward_navigation_gestures(true)
196
+ // .with_back_forward_navigation_gestures(true)
182
197
  .build()?;
183
198
  // 自定义cookie文件夹,仅用于Linux
184
199
  // 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");
185
204
  #[cfg(target_os = "linux")]
186
- let data_path =
187
- std::path::PathBuf::from(concat!("/home/", env!("USER"), "/.config/com-tw93-weread/"));
205
+ let config_path = match user {
206
+ Some(v) => format!(
207
+ "/home/{}/.config/{}", v.into_string().unwrap(), package_name
208
+ ),
209
+ None => panic!("can't found any user")
210
+ };
211
+ #[cfg(target_os = "linux")]
212
+ let data_path = std::path::PathBuf::from(&config_path);
188
213
  #[cfg(target_os = "linux")]
189
214
  if !std::path::Path::new(&data_path).exists() {
190
- std::fs::create_dir(&data_path)?;
215
+ std::fs::create_dir(&data_path)
216
+ .unwrap_or_else(|_| panic!("can't create dir {}", &config_path));
191
217
  }
192
218
  #[cfg(target_os = "linux")]
193
219
  let mut web_content = WebContext::new(Some(data_path));
194
220
  #[cfg(target_os = "linux")]
195
221
  let webview = WebViewBuilder::new(window)?
196
- .with_user_agent(user_agent_string)
197
- .with_accept_first_mouse(true)
222
+ // .with_user_agent(user_agent_string)
223
+ // .with_accept_first_mouse(true)
198
224
  .with_url(&url.to_string())?
199
225
  .with_devtools(cfg!(feature = "devtools"))
200
226
  .with_initialization_script(include_str!("pake.js"))
201
227
  .with_ipc_handler(handler)
202
228
  .with_web_context(&mut web_content)
203
- .with_back_forward_navigation_gestures(true)
229
+ // .with_back_forward_navigation_gestures(true)
204
230
  .build()?;
205
231
 
206
232
  #[cfg(feature = "devtools")]
@@ -234,11 +260,13 @@ fn main() -> wry::Result<()> {
234
260
  });
235
261
  }
236
262
 
237
- fn get_windows_config() -> Option<WindowConfig> {
263
+ fn get_windows_config() -> (Option<String>, Option<WindowConfig>) {
238
264
  let config_file = include_str!("../tauri.conf.json");
239
265
  let config: Config = serde_json::from_str(config_file).expect("failed to parse windows config");
240
-
241
- config.tauri.windows.first().cloned()
266
+ (
267
+ config.package.product_name.clone(),
268
+ config.tauri.windows.first().cloned(),
269
+ )
242
270
  }
243
271
 
244
272
  #[cfg(target_os = "windows")]
@@ -55,6 +55,14 @@ window.addEventListener("DOMContentLoaded", (_event) => {
55
55
  padding-top: 20px;
56
56
  }
57
57
 
58
+ .lark > .dashboard-sidebar, .lark > .dashboard-sidebar > .sidebar-user-info , .lark > .dashboard-sidebar .index-module_wrapper_F-Wbq{
59
+ padding-top:15px;
60
+ }
61
+
62
+ .lark > .main-wrapper [data-testid="aside"] {
63
+ top: 15px;
64
+ }
65
+
58
66
  .panel.give_me .nav_view {
59
67
  top: 154px !important;
60
68
  }
@@ -92,23 +100,23 @@ window.addEventListener("DOMContentLoaded", (_event) => {
92
100
  margin-top:24px;
93
101
  }
94
102
 
95
- [data-testid="placementTracking"] article,
96
- a[href*="quick_promote_web"],
97
- [data-testid="AppTabBar_Explore_Link"],
98
- a[href*="/lists"][role="link"][aria-label],
99
- a[href="/i/bookmarks"] {
103
+ #react-root [data-testid="placementTracking"] article,
104
+ #react-root a[href*="quick_promote_web"],
105
+ #react-root [data-testid="AppTabBar_Explore_Link"],
106
+ #react-root a[href*="/lists"][role="link"][aria-label],
107
+ #react-root a[href="/i/bookmarks"] {
100
108
  display: none !important;
101
109
  }
102
110
 
103
- [data-testid="DMDrawer"] {
111
+ #react-root [data-testid="DMDrawer"] {
104
112
  visibility: hidden !important;
105
113
  }
106
114
 
107
- [data-testid="primaryColumn"] > div > div {
115
+ #react-root [data-testid="primaryColumn"] > div > div {
108
116
  position: relative !important;
109
117
  }
110
118
 
111
- [data-testid="sidebarColumn"] {
119
+ #react-root [data-testid="sidebarColumn"] {
112
120
  visibility: hidden !important;
113
121
  width: 0 !important;
114
122
  margin: 0 !important;
@@ -117,69 +125,69 @@ window.addEventListener("DOMContentLoaded", (_event) => {
117
125
  }
118
126
 
119
127
  @media only screen and (min-width: 1000px) {
120
- main[role="main"] {
128
+ #react-root main[role="main"] {
121
129
  align-items: center !important;
122
130
  overflow-x: clip !important;
123
131
  }
124
132
 
125
- [data-testid="primaryColumn"] {
133
+ #react-root [data-testid="primaryColumn"] {
126
134
  width: 700px !important;
127
135
  max-width: 700px !important;
128
136
  margin: 0 auto !important;
129
137
  }
130
- [data-testid="primaryColumn"] > div > div:last-child,
131
- [data-testid="primaryColumn"] > div > div:last-child div {
138
+ #react-root [data-testid="primaryColumn"] > div > div:last-child,
139
+ #react-root [data-testid="primaryColumn"] > div > div:last-child div {
132
140
  max-width: unset !important;
133
141
  }
134
142
 
135
- div[aria-label][role="group"][id^="id__"] {
143
+ #react-root div[aria-label][role="group"][id^="id__"] {
136
144
  margin-right: 81px !important;
137
145
  }
138
146
 
139
- header[role="banner"] {
147
+ #react-root header[role="banner"] {
140
148
  position: fixed !important;
141
149
  left: 0 !important;
142
150
  }
143
151
 
144
- header[role="banner"] > div > div > div {
152
+ #react-root header[role="banner"] > div > div > div {
145
153
  justify-content: center !important;
146
154
  padding-top: 0;
147
155
  }
148
156
 
149
- form[role="search"] > div:nth-child(1) > div {
157
+ #react-root form[role="search"] > div:nth-child(1) > div {
150
158
  background-color: transparent !important;
151
159
  }
152
160
 
153
- h1[role="heading"] {
161
+ #react-root h1[role="heading"] {
154
162
  padding-top: 4px !important;
155
163
  }
156
164
 
157
- header[role="banner"]
165
+ #react-root header[role="banner"]
158
166
  nav[role="navigation"]
159
167
  *
160
168
  div[dir="auto"]:not([aria-label])
161
169
  > span,
162
- [data-testid="SideNav_AccountSwitcher_Button"] > div:not(:first-child) {
170
+ #react-root [data-testid="SideNav_AccountSwitcher_Button"] > div:not(:first-child) {
163
171
  display: inline-block !important;
164
172
  opacity: 0 !important;
165
173
  transition: 0.5s cubic-bezier(0.2, 0.8, 0.2, 1);
166
174
  }
167
- header[role="banner"]
175
+ #react-root header[role="banner"]
168
176
  nav[role="navigation"]:hover
169
177
  *
170
178
  div[dir="auto"]:not([aria-label])
171
179
  > span,
172
- [data-testid="SideNav_AccountSwitcher_Button"]:hover > div:not(:first-child) {
180
+ #react-root [data-testid="SideNav_AccountSwitcher_Button"]:hover > div:not(:first-child) {
173
181
  opacity: 1 !important;
174
182
  }
175
- header[role="banner"] nav[role="navigation"]:hover > * > div {
183
+ #react-root header[role="banner"] nav[role="navigation"]:hover > * > div {
176
184
  backdrop-filter: blur(12px) !important;
177
185
  }
178
- header[role="banner"] nav[role="navigation"] > a {
186
+ #react-root header[role="banner"] nav[role="navigation"] > a {
179
187
  position: relative;
180
188
  }
181
189
 
182
- header[role="banner"] nav[role="navigation"] > a::before {
190
+ #react-root header[role="banner"] nav[role="navigation"] > a::before {
183
191
  content: "";
184
192
  position: absolute;
185
193
  top: 0px;
@@ -187,61 +195,56 @@ window.addEventListener("DOMContentLoaded", (_event) => {
187
195
  bottom: 0px;
188
196
  left: 0px;
189
197
  }
190
- [data-testid="SideNav_AccountSwitcher_Button"] {
198
+ #react-root [data-testid="SideNav_AccountSwitcher_Button"] {
191
199
  bottom: 18px !important;
192
200
  left: 1px !important;
193
201
  }
194
202
 
195
- [data-testid="SideNav_NewTweet_Button"] {
203
+ #react-root [data-testid="SideNav_NewTweet_Button"] {
196
204
  position: fixed !important;
197
205
  right: 16px !important;
198
206
  bottom: 24px !important;
199
207
  }
200
208
  }
201
209
 
202
- @media only screen and (min-width: 1000px) and (max-width: 1265px) {
203
- body {
204
- padding-left: 88px;
205
- }
206
- }
207
-
208
210
  @media only screen and (min-width: 1265px) {
209
- [data-testid="sidebarColumn"] form[role="search"] {
211
+ #react-root [data-testid="sidebarColumn"] form[role="search"] {
210
212
  visibility: visible !important;
211
213
  position: fixed !important;
212
214
  top: 12px !important;
213
215
  right: 16px !important;
214
216
  }
215
217
 
216
- [data-testid="sidebarColumn"] input[placeholder="Search Twitter"] {
218
+ #react-root [data-testid="sidebarColumn"] input[placeholder="Search Twitter"] {
217
219
  width: 150px;
218
220
  }
219
221
 
220
- [data-testid="sidebarColumn"] form[role="search"]:focus-within {
222
+ #react-root [data-testid="sidebarColumn"] form[role="search"]:focus-within {
221
223
  width: 374px !important;
222
224
  backdrop-filter: blur(12px) !important;
223
225
  }
224
226
 
225
- [data-testid="sidebarColumn"] input[placeholder="Search Twitter"]:focus {
227
+ #react-root [data-testid="sidebarColumn"] input[placeholder="Search Twitter"]:focus {
226
228
  width: 328px !important;
227
229
  }
228
230
 
229
- div[style*="left: -12px"] {
231
+ #react-root div[style*="left: -12px"] {
230
232
  left: unset !important;
231
233
  }
232
- div[style="left: -8px; width: 306px;"] {
234
+
235
+ #react-root div[style="left: -8px; width: 306px;"] {
233
236
  left: unset !important;
234
237
  width: 374px !important;
235
238
  }
236
239
 
237
- .searchFilters {
240
+ #react-root .searchFilters {
238
241
  visibility: visible !important;
239
242
  position: fixed;
240
243
  top: 12px;
241
244
  right: 16px;
242
245
  width: 240px;
243
246
  }
244
- .searchFilters > div > div:first-child {
247
+ #react-root .searchFilters > div > div:first-child {
245
248
  display: none;
246
249
  }
247
250
  }
@@ -295,7 +298,7 @@ window.addEventListener("DOMContentLoaded", (_event) => {
295
298
  }
296
299
  if (/macintosh|mac os x/i.test(navigator.userAgent)) {
297
300
  if (event.metaKey && event.key in metaKeyShortcuts) {
298
- preventDefault(ctrlKeyShortcuts[event.key]);
301
+ preventDefault(metaKeyShortcuts[event.key]);
299
302
  }
300
303
  }
301
304
  });
@@ -14,56 +14,6 @@
14
14
  "resizable": true
15
15
  }
16
16
  ],
17
- "allowlist": {
18
- "all": true
19
- },
20
- "bundle": {
21
- "icon": [
22
- "icons/weread.icns",
23
- "png/weread_256.ico",
24
- "png/weread_32.ico",
25
- "png/weread_512.png"
26
- ],
27
- "identifier": "com.tw93.weread",
28
- "active": true,
29
- "category": "DeveloperTool",
30
- "copyright": "",
31
- "deb": {
32
- "depends": [
33
- "libwebkit2gtk-4.0-dev",
34
- "build-essential",
35
- "curl",
36
- "wget",
37
- "libssl-dev",
38
- "libgtk-3-dev",
39
- "libayatana-appindicator3-dev",
40
- "librsvg2-dev"
41
- ],
42
- "files": {
43
- "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
44
- }
45
- },
46
- "externalBin": [],
47
- "longDescription": "",
48
- "macOS": {
49
- "entitlements": null,
50
- "exceptionDomain": "",
51
- "frameworks": [],
52
- "providerShortName": null,
53
- "signingIdentity": null
54
- },
55
- "resources": ["png/weread_32.ico"],
56
- "shortDescription": "",
57
- "targets": ["deb", "msi", "dmg"],
58
- "windows": {
59
- "certificateThumbprint": null,
60
- "digestAlgorithm": "sha256",
61
- "timestampUrl": "",
62
- "wix": {
63
- "language": ["en-US", "zh-CN"]
64
- }
65
- }
66
- },
67
17
  "security": {
68
18
  "csp": null
69
19
  },
@@ -0,0 +1,30 @@
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
+ }
@@ -0,0 +1,34 @@
1
+ {
2
+ "tauri": {
3
+ "bundle": {
4
+ "icon": [
5
+ "png/weread_256.ico",
6
+ "png/weread_512.png"
7
+ ],
8
+ "identifier": "com.tw93.weread",
9
+ "active": true,
10
+ "category": "DeveloperTool",
11
+ "copyright": "",
12
+ "deb": {
13
+ "depends": [
14
+ "libwebkit2gtk-4.0-dev",
15
+ "build-essential",
16
+ "curl",
17
+ "wget",
18
+ "libssl-dev",
19
+ "libgtk-3-dev",
20
+ "libayatana-appindicator3-dev",
21
+ "librsvg2-dev"
22
+ ],
23
+ "files": {
24
+ "/usr/share/applications/com-tw93-weread.desktop": "assets/com-tw93-weread.desktop"
25
+ }
26
+ },
27
+ "externalBin": [],
28
+ "longDescription": "",
29
+ "resources": [],
30
+ "shortDescription": "",
31
+ "targets": ["deb"]
32
+ }
33
+ }
34
+ }
@@ -0,0 +1,25 @@
1
+ {
2
+ "tauri": {
3
+ "bundle": {
4
+ "icon": [
5
+ "icons/weread.icns"
6
+ ],
7
+ "identifier": "com.tw93.weread",
8
+ "active": true,
9
+ "category": "DeveloperTool",
10
+ "copyright": "",
11
+ "externalBin": [],
12
+ "longDescription": "",
13
+ "macOS": {
14
+ "entitlements": null,
15
+ "exceptionDomain": "",
16
+ "frameworks": [],
17
+ "providerShortName": null,
18
+ "signingIdentity": null
19
+ },
20
+ "resources": [],
21
+ "shortDescription": "",
22
+ "targets": ["dmg"]
23
+ }
24
+ }
25
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "tauri": {
3
+ "bundle": {
4
+ "icon": [
5
+ "png/weread_256.ico",
6
+ "png/weread_32.ico"
7
+ ],
8
+ "identifier": "com.tw93.weread",
9
+ "active": true,
10
+ "category": "DeveloperTool",
11
+ "copyright": "",
12
+ "externalBin": [],
13
+ "longDescription": "",
14
+ "resources": ["png/weread_32.ico"],
15
+ "shortDescription": "",
16
+ "targets": ["msi"],
17
+ "windows": {
18
+ "certificateThumbprint": null,
19
+ "digestAlgorithm": "sha256",
20
+ "timestampUrl": "",
21
+ "wix": {
22
+ "language": ["en-US"]
23
+ }
24
+ }
25
+ }
26
+ }
27
+ }
Binary file
Binary file
Binary file
Binary file