pake-cli 3.0.0-beta → 3.0.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.
@@ -26,22 +26,22 @@ pub fn get_window(app: &mut App, config: &PakeConfig, _data_dir: PathBuf) -> Web
26
26
 
27
27
  let mut window_builder = WebviewWindowBuilder::new(app, "pake", url)
28
28
  .title("")
29
+ .visible(false)
29
30
  .user_agent(user_agent)
30
- .visible(false) // Prevent initial shaking
31
31
  .resizable(window_config.resizable)
32
32
  .fullscreen(window_config.fullscreen)
33
33
  .inner_size(window_config.width, window_config.height)
34
34
  .always_on_top(window_config.always_on_top)
35
+ .disable_drag_drop_handler()
35
36
  .initialization_script(&config_script)
36
37
  .initialization_script(include_str!("../inject/component.js"))
37
38
  .initialization_script(include_str!("../inject/event.js"))
38
39
  .initialization_script(include_str!("../inject/style.js"))
39
- //This is necessary to allow for file injection by external developers for customization purposes.
40
40
  .initialization_script(include_str!("../inject/custom.js"));
41
41
 
42
- if config.proxy_url != "" {
42
+ if !config.proxy_url.is_empty() {
43
43
  window_builder =
44
- window_builder.proxy_url(Url::from_str(&config.proxy_url.as_str()).unwrap());
44
+ window_builder.proxy_url(Url::from_str(config.proxy_url.as_str()).unwrap());
45
45
  }
46
46
 
47
47
  #[cfg(target_os = "macos")]
@@ -175,19 +175,19 @@ document.addEventListener('DOMContentLoaded', () => {
175
175
  };
176
176
  }
177
177
 
178
- const isExternalLink = link => window.location.host !== link.host;
179
178
  // process special download protocol['data:','blob:']
180
179
  const isSpecialDownload = url => ['blob', 'data'].some(protocol => url.startsWith(protocol));
181
180
 
182
181
  const isDownloadRequired = (url, anchorElement, e) => anchorElement.download || e.metaKey || e.ctrlKey || isDownloadLink(url);
183
182
 
184
- const handleExternalLink = (url) => {
183
+ const handleExternalLink = url => {
185
184
  invoke('plugin:shell|open', {
186
185
  path: url,
187
186
  });
188
187
  };
189
188
 
190
189
  const detectAnchorElementClick = e => {
190
+
191
191
  const anchorElement = e.target.closest('a');
192
192
 
193
193
  if (anchorElement && anchorElement.href) {
@@ -224,7 +224,7 @@ document.addEventListener('DOMContentLoaded', () => {
224
224
 
225
225
  // Rewrite the window.open function.
226
226
  const originalWindowOpen = window.open;
227
- window.open = function(url, name, specs) {
227
+ window.open = function (url, name, specs) {
228
228
  // Apple login and google login
229
229
  if (name === 'AppleAuthentication') {
230
230
  //do nothing
@@ -23,7 +23,7 @@ pub fn run_app() {
23
23
 
24
24
  // Save the value of toggle_app_shortcut before pake_config is moved
25
25
  let activation_shortcut = pake_config.windows[0].activation_shortcut.clone();
26
- let init_fullscreen = pake_config.windows[0].fullscreen.clone();
26
+ let init_fullscreen = pake_config.windows[0].fullscreen;
27
27
 
28
28
  let window_state_plugin = if init_fullscreen {
29
29
  windowStatePlugin::default()
@@ -38,12 +38,13 @@ pub fn run_app() {
38
38
  .plugin(tauri_plugin_oauth::init())
39
39
  .plugin(tauri_plugin_http::init())
40
40
  .plugin(tauri_plugin_shell::init())
41
+ .plugin(tauri_plugin_single_instance::init(|_, _, _| ()))
41
42
  .invoke_handler(tauri::generate_handler![
42
43
  download_file,
43
44
  download_file_by_binary
44
45
  ])
45
46
  .setup(move |app| {
46
- let data_dir = get_data_dir(&app.app_handle(), tauri_config.clone());
47
+ let data_dir = get_data_dir(app.app_handle(), tauri_config.clone());
47
48
 
48
49
  let _window = get_window(app, &pake_config, data_dir);
49
50
 
@@ -51,14 +52,14 @@ pub fn run_app() {
51
52
  _window.show().unwrap();
52
53
 
53
54
  if show_system_tray {
54
- let _ = set_system_tray(&app.app_handle());
55
+ let _ = set_system_tray(app.app_handle());
55
56
  } else {
56
57
  app.app_handle().remove_tray_by_id("pake-tray");
57
58
  }
58
59
 
59
60
  if !activation_shortcut.is_empty() {
60
61
  let app_handle = app.app_handle().clone();
61
- let shortcut_hotkey = Shortcut::from_str(&activation_shortcut.as_str()).unwrap();
62
+ let shortcut_hotkey = Shortcut::from_str(activation_shortcut.as_str()).unwrap();
62
63
  let last_triggered = Arc::new(Mutex::new(Instant::now()));
63
64
 
64
65
  app_handle
@@ -101,26 +102,20 @@ pub fn run_app() {
101
102
  Ok(())
102
103
  })
103
104
  .on_window_event(|window, event| {
105
+ #[cfg(target_os = "macos")]
104
106
  if let tauri::WindowEvent::CloseRequested { api, .. } = event {
105
107
  let window = window.clone();
106
-
107
- #[cfg(target_os = "macos")]
108
108
  {
109
- let window_handle = window.clone();
110
109
  tauri::async_runtime::spawn(async move {
111
- if window_handle.is_fullscreen().unwrap_or(false) {
112
- window_handle.set_fullscreen(false).unwrap();
110
+ if window.is_fullscreen().unwrap_or(false) {
111
+ window.set_fullscreen(false).unwrap();
113
112
  // Give a small delay to ensure the full-screen exit operation is completed.
114
113
  tokio::time::sleep(Duration::from_millis(900)).await;
115
114
  }
116
- window_handle.minimize().unwrap();
117
- window_handle.hide().unwrap();
115
+ window.minimize().unwrap();
116
+ window.hide().unwrap();
118
117
  });
119
118
  }
120
-
121
- #[cfg(not(target_os = "macos"))]
122
- window.close().unwrap();
123
-
124
119
  api.prevent_close();
125
120
  }
126
121
  })
@@ -1,22 +1,16 @@
1
1
  {
2
2
  "productName": "WeRead",
3
3
  "identifier": "com.pake.weread",
4
- "version": "2.0.0",
5
- "plugins": {},
4
+ "version": "1.0.0",
6
5
  "app": {
7
- "security": {
8
- "csp": null
9
- },
6
+ "withGlobalTauri": true,
10
7
  "trayIcon": {
11
8
  "iconPath": "png/weread_512.png",
12
9
  "iconAsTemplate": false,
13
10
  "id": "pake-tray"
14
- },
15
- "withGlobalTauri": true
11
+ }
16
12
  },
17
13
  "build": {
18
- "beforeBuildCommand": "",
19
- "frontendDist": "../dist",
20
- "beforeDevCommand": ""
14
+ "frontendDist": "../dist"
21
15
  }
22
16
  }
@@ -1,20 +1,14 @@
1
1
  {
2
- "productName": "weread",
2
+ "productName": "we-read",
3
3
  "bundle": {
4
4
  "icon": ["png/weread_512.png"],
5
5
  "active": true,
6
- "category": "DeveloperTool",
7
- "copyright": "",
8
6
  "linux": {
9
7
  "deb": {
10
8
  "depends": ["curl", "wget"],
11
9
  "files": { "/usr/share/applications/com-pake-weread.desktop": "assets/com-pake-weread.desktop" }
12
10
  }
13
11
  },
14
- "externalBin": [],
15
- "longDescription": "",
16
- "resources": [],
17
- "shortDescription": "",
18
12
  "targets": ["deb", "appimage"]
19
13
  }
20
14
  }
@@ -2,19 +2,7 @@
2
2
  "bundle": {
3
3
  "icon": ["icons/weread.icns"],
4
4
  "active": true,
5
- "category": "DeveloperTool",
6
- "copyright": "",
7
- "externalBin": [],
8
- "longDescription": "",
9
- "macOS": {
10
- "entitlements": null,
11
- "exceptionDomain": null,
12
- "frameworks": [],
13
- "providerShortName": null,
14
- "signingIdentity": null
15
- },
16
- "resources": [],
17
- "shortDescription": "",
5
+ "macOS": {},
18
6
  "targets": ["dmg"]
19
7
  }
20
8
  }
@@ -2,17 +2,10 @@
2
2
  "bundle": {
3
3
  "icon": ["png/weread_256.ico", "png/weread_32.ico"],
4
4
  "active": true,
5
- "category": "DeveloperTool",
6
- "copyright": "",
7
- "externalBin": [],
8
- "longDescription": "",
9
5
  "resources": ["png/weread_32.ico"],
10
- "shortDescription": "",
11
6
  "targets": ["msi"],
12
7
  "windows": {
13
- "certificateThumbprint": null,
14
8
  "digestAlgorithm": "sha256",
15
- "timestampUrl": "",
16
9
  "wix": {
17
10
  "language": ["en-US"],
18
11
  "template": "assets/main.wxs"