pake-cli 2.0.5 โ†’ 2.0.6

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
@@ -248,25 +248,25 @@ Pake's development can not be without these Hackers. They contributed a lot of c
248
248
  </a>
249
249
  </td>
250
250
  <td align="center">
251
- <a href="https://github.com/m1911star">
252
- <img src="https://avatars.githubusercontent.com/u/4948120?v=4" width="90;" alt="m1911star"/>
251
+ <a href="https://github.com/AielloChan">
252
+ <img src="https://avatars.githubusercontent.com/u/7900765?v=4" width="90;" alt="AielloChan"/>
253
253
  <br />
254
- <sub><b>Horus</b></sub>
254
+ <sub><b>Aiello</b></sub>
255
255
  </a>
256
256
  </td></tr>
257
257
  <tr>
258
258
  <td align="center">
259
- <a href="https://github.com/Pake-Actions">
260
- <img src="https://avatars.githubusercontent.com/u/126550811?v=4" width="90;" alt="Pake-Actions"/>
259
+ <a href="https://github.com/m1911star">
260
+ <img src="https://avatars.githubusercontent.com/u/4948120?v=4" width="90;" alt="m1911star"/>
261
261
  <br />
262
- <sub><b>Pake Actions</b></sub>
262
+ <sub><b>Horus</b></sub>
263
263
  </a>
264
264
  </td>
265
265
  <td align="center">
266
- <a href="https://github.com/AielloChan">
267
- <img src="https://avatars.githubusercontent.com/u/7900765?v=4" width="90;" alt="AielloChan"/>
266
+ <a href="https://github.com/Pake-Actions">
267
+ <img src="https://avatars.githubusercontent.com/u/126550811?v=4" width="90;" alt="Pake-Actions"/>
268
268
  <br />
269
- <sub><b>Aiello</b></sub>
269
+ <sub><b>Pake Actions</b></sub>
270
270
  </a>
271
271
  </td>
272
272
  <td align="center">
@@ -333,6 +333,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
333
333
  <sub><b>Hyzhao</b></sub>
334
334
  </a>
335
335
  </td>
336
+ <td align="center">
337
+ <a href="https://github.com/lakca">
338
+ <img src="https://avatars.githubusercontent.com/u/16255922?v=4" width="90;" alt="lakca"/>
339
+ <br />
340
+ <sub><b>Null</b></sub>
341
+ </a>
342
+ </td>
336
343
  <td align="center">
337
344
  <a href="https://github.com/liusishan">
338
345
  <img src="https://avatars.githubusercontent.com/u/33129823?v=4" width="90;" alt="liusishan"/>
package/dist/cli.js CHANGED
@@ -34,8 +34,6 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
34
34
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
35
35
  PERFORMANCE OF THIS SOFTWARE.
36
36
  ***************************************************************************** */
37
- /* global Reflect, Promise */
38
-
39
37
 
40
38
  function __awaiter(thisArg, _arguments, P, generator) {
41
39
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
@@ -1697,9 +1695,9 @@ function mergeTauriConfig(url, options, tauriConf) {
1697
1695
  const cli_path = path.join(new_dir, "cli.js");
1698
1696
  const cli_path_target = path.join(old_dir, "cli.js");
1699
1697
  const about_pake_path = path.join(new_dir, "about_pake.html");
1700
- const about_patk_path_target = path.join(old_dir, "about_pake.html");
1698
+ const about_pake_path_target = path.join(old_dir, "about_pake.html");
1701
1699
  fs$1.copyFile(cli_path, cli_path_target);
1702
- fs$1.copyFile(about_pake_path, about_patk_path_target);
1700
+ fs$1.copyFile(about_pake_path, about_pake_path_target);
1703
1701
  }
1704
1702
  tauriConf.pake.windows[0].url = file_name;
1705
1703
  tauriConf.pake.windows[0].url_type = "local";
@@ -2525,7 +2523,7 @@ class BuilderFactory {
2525
2523
  }
2526
2524
 
2527
2525
  var name = "pake-cli";
2528
- var version = "2.0.5";
2526
+ var version = "2.0.6";
2529
2527
  var description = "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with Rust. ๐Ÿคฑ๐Ÿป ๅพˆ็ฎ€ๅ•็š„็”จ Rust ๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆๅพˆๅฐ็š„ๆกŒ้ข Appใ€‚";
2530
2528
  var engines = {
2531
2529
  node: ">=16.0.0"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "2.0.5",
3
+ "version": "2.0.6",
4
4
  "description": "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with Rust. ๐Ÿคฑ๐Ÿป ๅพˆ็ฎ€ๅ•็š„็”จ Rust ๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆๅพˆๅฐ็š„ๆกŒ้ข Appใ€‚",
5
5
  "engines": {
6
6
  "node": ">=16.0.0"
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -26,6 +26,7 @@ pub fn get_window(app: &mut App, config: PakeConfig, _data_dir: PathBuf) -> Wind
26
26
  .resizable(window_config.resizable)
27
27
  .fullscreen(window_config.fullscreen)
28
28
  .inner_size(window_config.width, window_config.height)
29
+ .disable_file_drop_handler() //Very annoying, otherwise dragging files to the window will not work.
29
30
  .initialization_script(include_str!("../inject/style.js"))
30
31
  .initialization_script(include_str!("../inject/event.js"))
31
32
  .initialization_script(include_str!("../inject/component.js"));
@@ -1,204 +1,224 @@
1
1
  const shortcuts = {
2
- ArrowUp: () => scrollTo(0, 0),
3
- ArrowDown: () => scrollTo(0, document.body.scrollHeight),
4
- ArrowLeft: () => window.history.back(),
5
- ArrowRight: () => window.history.forward(),
6
- '[': () => window.history.back(),
7
- ']': () => window.history.forward(),
8
- r: () => window.location.reload(),
9
- '-': () => zoomOut(),
10
- '=': () => zoomIn(),
11
- '+': () => zoomIn(),
12
- 0: () => setZoom('100%'),
2
+ ArrowUp: () => scrollTo(0, 0),
3
+ ArrowDown: () => scrollTo(0, document.body.scrollHeight),
4
+ // Don't use command + ArrowLeft or command + ArrowRight
5
+ // When editing text in page, it causes unintended page navigation.
6
+ // ArrowLeft: () => window.history.back(),
7
+ // ArrowRight: () => window.history.forward(),
8
+ '[': () => window.history.back(),
9
+ ']': () => window.history.forward(),
10
+ r: () => window.location.reload(),
11
+ '-': () => zoomOut(),
12
+ '=': () => zoomIn(),
13
+ '+': () => zoomIn(),
14
+ 0: () => setZoom('100%'),
13
15
  };
14
16
 
15
17
  function setZoom(zoom) {
16
- const html = document.getElementsByTagName('html')[0];
17
- html.style.zoom = zoom;
18
- window.localStorage.setItem('htmlZoom', zoom);
18
+ const html = document.getElementsByTagName('html')[0];
19
+ html.style.zoom = zoom;
20
+ window.localStorage.setItem('htmlZoom', zoom);
19
21
  }
20
22
 
21
23
  function zoomCommon(zoomChange) {
22
- const currentZoom = window.localStorage.getItem('htmlZoom') || '100%';
23
- setZoom(zoomChange(currentZoom));
24
+ const currentZoom = window.localStorage.getItem('htmlZoom') || '100%';
25
+ setZoom(zoomChange(currentZoom));
24
26
  }
25
27
 
26
28
  function zoomIn() {
27
- zoomCommon((currentZoom) => `${Math.min(parseInt(currentZoom) + 10, 200)}%`);
29
+ zoomCommon((currentZoom) => `${Math.min(parseInt(currentZoom) + 10, 200)}%`);
28
30
  }
29
31
 
30
32
  function zoomOut() {
31
- zoomCommon((currentZoom) => `${Math.max(parseInt(currentZoom) - 10, 30)}%`);
33
+ zoomCommon((currentZoom) => `${Math.max(parseInt(currentZoom) - 10, 30)}%`);
32
34
  }
33
35
 
34
36
  function handleShortcut(event) {
35
- if (shortcuts[event.key]) {
36
- event.preventDefault();
37
- shortcuts[event.key]();
38
- }
37
+ if (shortcuts[event.key]) {
38
+ event.preventDefault();
39
+ shortcuts[event.key]();
40
+ }
39
41
  }
40
42
 
41
43
  //่ฟ™้‡Œๅ‚่€ƒ ChatGPT ็š„ไปฃ็ 
42
44
  const uid = () => window.crypto.getRandomValues(new Uint32Array(1))[0];
43
- function transformCallback(callback = () => {}, once = false) {
44
- const identifier = uid();
45
- const prop = `_${identifier}`;
46
- Object.defineProperty(window, prop, {
47
- value: (result) => {
48
- if (once) {
49
- Reflect.deleteProperty(window, prop);
50
- }
51
- return callback(result);
52
- },
53
- writable: false,
54
- configurable: true,
55
- });
56
- return identifier;
45
+
46
+ function transformCallback(callback = () => {
47
+ }, once = false) {
48
+ const identifier = uid();
49
+ const prop = `_${identifier}`;
50
+ Object.defineProperty(window, prop, {
51
+ value: (result) => {
52
+ if (once) {
53
+ Reflect.deleteProperty(window, prop);
54
+ }
55
+ return callback(result);
56
+ },
57
+ writable: false,
58
+ configurable: true,
59
+ });
60
+ return identifier;
57
61
  }
62
+
58
63
  async function invoke(cmd, args) {
59
- return new Promise((resolve, reject) => {
60
- if (!window.__TAURI_POST_MESSAGE__)
61
- reject('__TAURI_POST_MESSAGE__ does not exist~');
62
- const callback = transformCallback((e) => {
63
- resolve(e);
64
- Reflect.deleteProperty(window, `_${error}`);
65
- }, true);
66
- const error = transformCallback((e) => {
67
- reject(e);
68
- Reflect.deleteProperty(window, `_${callback}`);
69
- }, true);
70
- window.__TAURI_POST_MESSAGE__({
71
- cmd,
72
- callback,
73
- error,
74
- ...args,
64
+ return new Promise((resolve, reject) => {
65
+ if (!window.__TAURI_POST_MESSAGE__)
66
+ reject('__TAURI_POST_MESSAGE__ does not exist~');
67
+ const callback = transformCallback((e) => {
68
+ resolve(e);
69
+ Reflect.deleteProperty(window, `_${error}`);
70
+ }, true);
71
+ const error = transformCallback((e) => {
72
+ reject(e);
73
+ Reflect.deleteProperty(window, `_${callback}`);
74
+ }, true);
75
+ window.__TAURI_POST_MESSAGE__({
76
+ cmd,
77
+ callback,
78
+ error,
79
+ ...args,
80
+ });
75
81
  });
76
- });
77
82
  }
78
83
 
79
- document.addEventListener('DOMContentLoaded', () => {
80
- const topDom = document.createElement('div');
81
- topDom.id = 'pack-top-dom';
82
- document.body.appendChild(topDom);
83
- const domEl = document.getElementById('pack-top-dom');
84
-
85
- domEl.addEventListener('mousedown', (e) => {
86
- e.preventDefault();
87
- if (e.buttons === 1 && e.detail !== 2) {
88
- invoke('drag_window');
89
- }
90
- });
84
+ // Judgment of file download.
85
+ function isDownloadLink(url) {
86
+ const fileExtensions = [
87
+ '3gp', '7z', 'ai', 'apk', 'avi', 'bmp', 'csv', 'dmg', 'doc', 'docx', 'fla', 'flv', 'gif', 'gz', 'gzip',
88
+ 'ico', 'iso', 'indd', 'jar', 'jpeg', 'jpg', 'm3u8', 'mov', 'mp3', 'mp4', 'mpa', 'mpg',
89
+ 'mpeg', 'msi', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'raw', 'rss', 'svg',
90
+ 'swf', 'tar', 'tif', 'tiff', 'ts', 'txt', 'wav', 'webm', 'webp', 'wma', 'wmv', 'xls', 'xlsx', 'xml', 'zip'
91
+ ];
92
+ const downloadLinkPattern = new RegExp(`\\.(${fileExtensions.join('|')})$`, 'i');
93
+ return downloadLinkPattern.test(url);
94
+ }
91
95
 
92
- domEl.addEventListener('touchstart', () => {
93
- invoke('drag_window');
94
- });
96
+ // No need to go to the download link.
97
+ function externalDownLoadLink() {
98
+ return ['quickref.me'].indexOf(location.hostname) > -1;
99
+ }
95
100
 
96
- domEl.addEventListener('dblclick', () => {
97
- invoke('fullscreen');
98
- });
101
+ document.addEventListener('DOMContentLoaded', () => {
102
+ const topDom = document.createElement('div');
103
+ topDom.id = 'pack-top-dom';
104
+ document.body.appendChild(topDom);
105
+ const domEl = document.getElementById('pack-top-dom');
99
106
 
100
- document.addEventListener('keyup', (event) => {
101
- if (/windows|linux/i.test(navigator.userAgent) && event.ctrlKey) {
102
- handleShortcut(event);
103
- }
104
- if (/macintosh|mac os x/i.test(navigator.userAgent) && event.metaKey) {
105
- handleShortcut(event);
106
- }
107
- });
108
-
109
- document.addEventListener('click', (e) => {
110
- const anchorElement = e.target.closest('a');
111
-
112
- if (anchorElement && anchorElement.href) {
113
- const target = anchorElement.target;
114
- anchorElement.target = '_self';
115
- const hrefUrl = new URL(anchorElement.href);
116
- const absoluteUrl = hrefUrl.href;
117
-
118
- // Handling external link redirection.
119
- if (
120
- window.location.host !== hrefUrl.host &&
121
- (target === '_blank' || target === '_new')
122
- ) {
107
+ domEl.addEventListener('mousedown', (e) => {
123
108
  e.preventDefault();
124
- invoke('open_browser', { url: absoluteUrl });
125
- return;
126
- }
127
-
128
- // Process download links for Rust to handle.
129
- if (
130
- /\.[a-zA-Z0-9]+$/i.test(removeUrlParameters(absoluteUrl)) &&
131
- !externalDownLoadLink()
132
- ) {
133
- e.preventDefault();
134
- invoke('download_file', {
135
- params: {
136
- url: absoluteUrl,
137
- filename: getFilenameFromUrl(absoluteUrl),
138
- },
139
- });
140
- }
141
- }
142
- });
143
-
144
- // Rewrite the window.open function.
145
- const originalWindowOpen = window.open;
146
- window.open = function (url, name, specs) {
147
- // Apple login and google login
148
- if (name === 'AppleAuthentication') {
149
- //do nothing
150
- } else if (specs.includes('height=') || specs.includes('width=')) {
151
- location.href = url;
152
- } else {
153
- const baseUrl = window.location.origin + window.location.pathname;
154
- const hrefUrl = new URL(url, baseUrl);
155
- invoke('open_browser', { url: hrefUrl.href });
109
+ if (e.buttons === 1 && e.detail !== 2) {
110
+ invoke('drag_window');
111
+ }
112
+ });
113
+
114
+ domEl.addEventListener('touchstart', () => {
115
+ invoke('drag_window');
116
+ });
117
+
118
+ domEl.addEventListener('dblclick', () => {
119
+ invoke('fullscreen');
120
+ });
121
+
122
+ document.addEventListener('keyup', (event) => {
123
+ if (/windows|linux/i.test(navigator.userAgent) && event.ctrlKey) {
124
+ handleShortcut(event);
125
+ }
126
+ if (/macintosh|mac os x/i.test(navigator.userAgent) && event.metaKey) {
127
+ handleShortcut(event);
128
+ }
129
+ });
130
+
131
+ // Prevent some special websites from executing in advance, before the click event is triggered.
132
+ document.addEventListener('mousedown', (e) => {
133
+ const anchorElement = e.target.closest('a');
134
+
135
+ if (anchorElement && anchorElement.href) {
136
+ const target = anchorElement.target;
137
+ anchorElement.target = '_self';
138
+ const hrefUrl = new URL(anchorElement.href);
139
+ const absoluteUrl = hrefUrl.href;
140
+
141
+ // Handling external link redirection.
142
+ if (
143
+ window.location.host !== hrefUrl.host &&
144
+ (target === '_blank' || target === '_new')
145
+ ) {
146
+ e.preventDefault();
147
+ invoke('open_browser', {url: absoluteUrl});
148
+ return;
149
+ }
150
+
151
+ let filename = anchorElement.download ? anchorElement.download : getFilenameFromUrl(absoluteUrl)
152
+ // Process download links for Rust to handle.
153
+ // If the download attribute is set, the download attribute is used as the file name.
154
+ if ((anchorElement.download || e.metaKey || e.ctrlKey || isDownloadLink(absoluteUrl))
155
+ && !externalDownLoadLink()
156
+ ) {
157
+ e.preventDefault();
158
+ invoke('download_file', {
159
+ params: {
160
+ url: absoluteUrl,
161
+ filename,
162
+ },
163
+ });
164
+ }
165
+ }
166
+ });
167
+
168
+ // Rewrite the window.open function.
169
+ const originalWindowOpen = window.open;
170
+ window.open = function (url, name, specs) {
171
+ // Apple login and google login
172
+ if (name === 'AppleAuthentication') {
173
+ //do nothing
174
+ } else if (specs.includes('height=') || specs.includes('width=')) {
175
+ location.href = url;
176
+ } else {
177
+ const baseUrl = window.location.origin + window.location.pathname;
178
+ const hrefUrl = new URL(url, baseUrl);
179
+ invoke('open_browser', {url: hrefUrl.href});
180
+ }
181
+ // Call the original window.open function to maintain its normal functionality.
182
+ return originalWindowOpen.call(window, url, name, specs);
183
+ };
184
+
185
+ // Set the default zoom, There are problems with Loop without using try-catch.
186
+ try {
187
+ setDefaultZoom();
188
+ } catch (e) {
189
+ console.log(e);
156
190
  }
157
- // Call the original window.open function to maintain its normal functionality.
158
- return originalWindowOpen.call(window, url, name, specs);
159
- };
160
-
161
- // Set the default zoom, There are problems with Loop without using try-catch.
162
- try {
163
- setDefaultZoom();
164
- } catch (e) {
165
- console.log(e);
166
- }
167
191
  });
168
192
 
169
193
  function setDefaultZoom() {
170
- const htmlZoom = window.localStorage.getItem('htmlZoom');
171
- if (htmlZoom) {
172
- setZoom(htmlZoom);
173
- }
194
+ const htmlZoom = window.localStorage.getItem('htmlZoom');
195
+ if (htmlZoom) {
196
+ setZoom(htmlZoom);
197
+ }
174
198
  }
175
199
 
176
200
  function getFilenameFromUrl(url) {
177
- const urlPath = new URL(url).pathname;
178
- const filename = urlPath.substring(urlPath.lastIndexOf('/') + 1);
179
- return filename;
201
+ const urlPath = new URL(url).pathname;
202
+ const filename = urlPath.substring(urlPath.lastIndexOf('/') + 1);
203
+ return filename;
180
204
  }
181
205
 
182
206
  function removeUrlParameters(url) {
183
- const parsedUrl = new URL(url);
184
- parsedUrl.search = '';
185
- return parsedUrl.toString();
207
+ const parsedUrl = new URL(url);
208
+ parsedUrl.search = '';
209
+ return parsedUrl.toString();
186
210
  }
187
211
 
188
- // No need to go to the download link.
189
- function externalDownLoadLink() {
190
- return ['quickref.me'].indexOf(location.hostname) > -1;
191
- }
192
212
 
193
213
  // Toggle video playback when the window is hidden.
194
214
  function toggleVideoPlayback(pause) {
195
- const videos = document.getElementsByTagName('video');
196
- for (const video of videos) {
197
- if (pause) {
198
- video.pause();
199
- } else {
200
- video.play();
215
+ const videos = document.getElementsByTagName('video');
216
+ for (const video of videos) {
217
+ if (pause) {
218
+ video.pause();
219
+ } else {
220
+ video.play();
221
+ }
201
222
  }
202
- }
203
223
  }
204
224
 
@@ -57,6 +57,11 @@ window.addEventListener('DOMContentLoaded', (_event) => {
57
57
  min-width: 260px;
58
58
  }
59
59
 
60
+ #__next > div.overflow-hidden.w-full.h-full.relative.flex.z-0 > div.relative.flex.h-full.max-w-full.flex-1.overflow-hidden > div > main > div.absolute.left-2.top-2.z-10.hidden.md\\:inline-block{
61
+ margin-top:20px;
62
+ margin-left: 10px;
63
+ }
64
+
60
65
  .chakra-ui-light #app .chakra-heading,
61
66
  .chakra-ui-dark #app .chakra-heading,
62
67
  .chakra-ui-light #app .chakra-stack,
@@ -84,6 +89,19 @@ window.addEventListener('DOMContentLoaded', (_event) => {
84
89
  width: 100%;
85
90
  }
86
91
 
92
+ #tabs-sidebar--tabpanel-0 > div.tw-flex.tw-items-center.tw-mb-\\[12px\\].tw-mt-\\[14px\\].tw-px-4 {
93
+ padding-top: 15px;
94
+ }
95
+
96
+ #tabs-sidebar--tabpanel-1 > div > div.tw-p-\\[16px\\].tw-flex.tw-flex-col.tw-gap-1\\.5{
97
+ padding-top: 30px;
98
+ }
99
+
100
+ #tabs-sidebar--tabpanel-2 > div > h2 {
101
+ padding-top: 20px;
102
+ height: 70px;
103
+ }
104
+
87
105
  .lark > .dashboard-sidebar, .lark > .dashboard-sidebar > .sidebar-user-info , .lark > .dashboard-sidebar .index-module_wrapper_F-Wbq{
88
106
  padding-top:15px;
89
107
  }
@@ -135,10 +153,12 @@ window.addEventListener('DOMContentLoaded', (_event) => {
135
153
  margin-top:24px;
136
154
  }
137
155
 
156
+
138
157
  #react-root [data-testid="placementTracking"] article,
139
158
  #react-root a[href*="quick_promote_web"],
140
159
  #react-root [data-testid="AppTabBar_Explore_Link"],
141
160
  #react-root a[href*="/lists"][role="link"][aria-label],
161
+ #react-root a[href*="/i/communitynotes"][role="link"][aria-label],
142
162
  #react-root a[href*="/i/verified-orgs-signup"][role="link"][aria-label] {
143
163
  display: none !important;
144
164
  }