pake-cli 2.5.0 → 2.5.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 CHANGED
@@ -1,4 +1,4 @@
1
- <h4 align="right"><strong>English</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_CN.md">简体中文</a></h4>
1
+ <h4 align="right"><strong>English</strong> | <a href="https://github.com/tw93/Pake/blob/master/README_CN.md">简体中文</a> | <a href="https://github.com/tw93/Pake/blob/master/README_JP.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>
@@ -257,6 +257,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
257
257
  </a>
258
258
  </td></tr>
259
259
  <tr>
260
+ <td align="center">
261
+ <a href="https://github.com/YangguangZhou">
262
+ <img src="https://avatars.githubusercontent.com/u/61733195?v=4" width="90;" alt="YangguangZhou"/>
263
+ <br />
264
+ <sub><b>Jerry Zhou</b></sub>
265
+ </a>
266
+ </td>
260
267
  <td align="center">
261
268
  <a href="https://github.com/AielloChan">
262
269
  <img src="https://avatars.githubusercontent.com/u/7900765?v=4" width="90;" alt="AielloChan"/>
@@ -278,6 +285,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
278
285
  <sub><b>Pake Actions</b></sub>
279
286
  </a>
280
287
  </td>
288
+ <td align="center">
289
+ <a href="https://github.com/eltociear">
290
+ <img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="90;" alt="eltociear"/>
291
+ <br />
292
+ <sub><b>Ikko Eltociear Ashimine</b></sub>
293
+ </a>
294
+ </td>
281
295
  <td align="center">
282
296
  <a href="https://github.com/QingZ11">
283
297
  <img src="https://avatars.githubusercontent.com/u/38887077?v=4" width="90;" alt="QingZ11"/>
@@ -291,7 +305,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
291
305
  <br />
292
306
  <sub><b>孟世博</b></sub>
293
307
  </a>
294
- </td>
308
+ </td></tr>
309
+ <tr>
295
310
  <td align="center">
296
311
  <a href="https://github.com/2nthony">
297
312
  <img src="https://avatars.githubusercontent.com/u/19513289?v=4" width="90;" alt="2nthony"/>
@@ -305,8 +320,7 @@ Pake's development can not be without these Hackers. They contributed a lot of c
305
320
  <br />
306
321
  <sub><b>Null</b></sub>
307
322
  </a>
308
- </td></tr>
309
- <tr>
323
+ </td>
310
324
  <td align="center">
311
325
  <a href="https://github.com/imabutahersiddik">
312
326
  <img src="https://avatars.githubusercontent.com/u/138387257?v=4" width="90;" alt="imabutahersiddik"/>
@@ -341,12 +355,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
341
355
  <br />
342
356
  <sub><b>Fechin</b></sub>
343
357
  </a>
344
- </td>
358
+ </td></tr>
359
+ <tr>
345
360
  <td align="center">
346
- <a href="https://github.com/eltociear">
347
- <img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="90;" alt="eltociear"/>
361
+ <a href="https://github.com/ImgBotApp">
362
+ <img src="https://avatars.githubusercontent.com/u/31427850?v=4" width="90;" alt="ImgBotApp"/>
348
363
  <br />
349
- <sub><b>Ikko Eltociear Ashimine</b></sub>
364
+ <sub><b>Imgbot</b></sub>
350
365
  </a>
351
366
  </td>
352
367
  <td align="center">
@@ -355,8 +370,7 @@ Pake's development can not be without these Hackers. They contributed a lot of c
355
370
  <br />
356
371
  <sub><b>Jiaqi Gu</b></sub>
357
372
  </a>
358
- </td></tr>
359
- <tr>
373
+ </td>
360
374
  <td align="center">
361
375
  <a href="https://github.com/Milo123459">
362
376
  <img src="https://avatars.githubusercontent.com/u/50248166?v=4" width="90;" alt="Milo123459"/>
@@ -391,7 +405,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
391
405
  <br />
392
406
  <sub><b>Null</b></sub>
393
407
  </a>
394
- </td>
408
+ </td></tr>
409
+ <tr>
395
410
  <td align="center">
396
411
  <a href="https://github.com/liudonghua123">
397
412
  <img src="https://avatars.githubusercontent.com/u/2276718?v=4" width="90;" alt="liudonghua123"/>
@@ -405,8 +420,7 @@ Pake's development can not be without these Hackers. They contributed a lot of c
405
420
  <br />
406
421
  <sub><b>Liusishan</b></sub>
407
422
  </a>
408
- </td></tr>
409
- <tr>
423
+ </td>
410
424
  <td align="center">
411
425
  <a href="https://github.com/piaoyidage">
412
426
  <img src="https://avatars.githubusercontent.com/u/5135405?v=4" width="90;" alt="piaoyidage"/>
package/dist/cli.js CHANGED
@@ -20,7 +20,7 @@ import psl from 'psl';
20
20
  import isUrl from 'is-url';
21
21
 
22
22
  var name = "pake-cli";
23
- var version = "2.5.0";
23
+ var version = "2.5.2";
24
24
  var description = "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。";
25
25
  var engines = {
26
26
  node: ">=16.0.0"
@@ -465,9 +465,11 @@ async function combineFiles(files, output) {
465
465
  const contents = files.map(file => {
466
466
  const fileContent = fs.readFileSync(file);
467
467
  if (file.endsWith('.css')) {
468
- return "window.addEventListener('DOMContentLoaded', (_event) => { const css = `" + fileContent + "`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });";
468
+ return ("window.addEventListener('DOMContentLoaded', (_event) => { const css = `" +
469
+ fileContent +
470
+ "`; const style = document.createElement('style'); style.innerHTML = css; document.head.appendChild(style); });");
469
471
  }
470
- return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + " });";
472
+ return "window.addEventListener('DOMContentLoaded', (_event) => { " + fileContent + ' });';
471
473
  });
472
474
  fs.writeFileSync(output, contents.join('\n'));
473
475
  return files;
@@ -633,7 +635,7 @@ async function mergeConfig(url, options, tauriConf) {
633
635
  logger.error('The injected file must be in either CSS or JS format.');
634
636
  return;
635
637
  }
636
- const files = inject.map(filepath => path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath));
638
+ const files = inject.map(filepath => (path.isAbsolute(filepath) ? filepath : path.join(process.cwd(), filepath)));
637
639
  tauriConf.pake.inject = files;
638
640
  await combineFiles(files, injectFilePath);
639
641
  }
@@ -1014,10 +1016,7 @@ ${green('| |_) / _` | |/ / _ \\')}
1014
1016
  ${green('| __/ (_| | < __/')} ${yellow('https://github.com/tw93/pake')}
1015
1017
  ${green('|_| \\__,_|_|\\_\\___| can turn any webpage into a desktop app with Rust.')}
1016
1018
  `;
1017
- program
1018
- .addHelpText('beforeAll', logo)
1019
- .usage(`[url] [options]`)
1020
- .showHelpAfterError();
1019
+ program.addHelpText('beforeAll', logo).usage(`[url] [options]`).showHelpAfterError();
1021
1020
  program
1022
1021
  .argument('[url]', 'The web URL you want to package', validateUrlInput)
1023
1022
  .option('--name <string>', 'Application name')
@@ -1034,8 +1033,12 @@ program
1034
1033
  .addOption(new Option('--user-agent <string>', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp())
1035
1034
  .addOption(new Option('--targets <string>', 'Only for Linux, option "deb" or "appimage"').default(DEFAULT_PAKE_OPTIONS.targets).hideHelp())
1036
1035
  .addOption(new Option('--always-on-top', 'Always on the top level').default(DEFAULT_PAKE_OPTIONS.alwaysOnTop).hideHelp())
1037
- .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts').default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts).hideHelp())
1038
- .addOption(new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration').default(DEFAULT_PAKE_OPTIONS.safeDomain).hideHelp())
1036
+ .addOption(new Option('--disabled-web-shortcuts', 'Disabled webPage shortcuts')
1037
+ .default(DEFAULT_PAKE_OPTIONS.disabledWebShortcuts)
1038
+ .hideHelp())
1039
+ .addOption(new Option('--safe-domain [domains...]', 'Domains that Require Security Configuration')
1040
+ .default(DEFAULT_PAKE_OPTIONS.safeDomain)
1041
+ .hideHelp())
1039
1042
  .addOption(new Option('--show-system-tray', 'Show system tray in app').default(DEFAULT_PAKE_OPTIONS.showSystemTray).hideHelp())
1040
1043
  .addOption(new Option('--system-tray-icon <string>', 'Custom system tray icon').default(DEFAULT_PAKE_OPTIONS.systemTrayIcon).hideHelp())
1041
1044
  .version(packageJson.version, '-v, --version', 'Output the current version')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "2.5.0",
3
+ "version": "2.5.2",
4
4
  "description": "🤱🏻 Turn any webpage into a desktop app with Rust. 🤱🏻 利用 Rust 轻松构建轻量级多端桌面应用。",
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
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -6,16 +6,15 @@ document.addEventListener('DOMContentLoaded', () => {
6
6
  m.style.cssText =
7
7
  'max-width:60%;min-width: 80px;padding:0 12px;height: 32px;color: rgb(255, 255, 255);line-height: 32px;text-align: center;border-radius: 8px;position: fixed; bottom:24px;right: 28px;z-index: 999999;background: rgba(0, 0, 0,.8);font-size: 13px;';
8
8
  document.body.appendChild(m);
9
- setTimeout(function() {
9
+ setTimeout(function () {
10
10
  const d = 0.5;
11
11
  m.style.transition = 'transform ' + d + 's ease-in, opacity ' + d + 's ease-in';
12
12
  m.style.opacity = '0';
13
- setTimeout(function() {
13
+ setTimeout(function () {
14
14
  document.body.removeChild(m);
15
15
  }, d * 1000);
16
16
  }, 3000);
17
17
  }
18
18
 
19
19
  window.pakeToast = pakeToast;
20
-
21
20
  });
@@ -1,13 +1,13 @@
1
1
  const shortcuts = {
2
- 'ArrowUp': () => scrollTo(0, 0),
3
- 'ArrowDown': () => scrollTo(0, document.body.scrollHeight),
4
2
  '[': () => window.history.back(),
5
3
  ']': () => window.history.forward(),
6
- 'r': () => window.location.reload(),
7
4
  '-': () => zoomOut(),
8
5
  '=': () => zoomIn(),
9
6
  '+': () => zoomIn(),
10
- '0': () => setZoom('100%'),
7
+ 0: () => setZoom('100%'),
8
+ r: () => window.location.reload(),
9
+ ArrowUp: () => scrollTo(0, 0),
10
+ ArrowDown: () => scrollTo(0, document.body.scrollHeight),
11
11
  };
12
12
 
13
13
  function setZoom(zoom) {
@@ -22,11 +22,11 @@ function zoomCommon(zoomChange) {
22
22
  }
23
23
 
24
24
  function zoomIn() {
25
- zoomCommon((currentZoom) => `${Math.min(parseInt(currentZoom) + 10, 200)}%`);
25
+ zoomCommon(currentZoom => `${Math.min(parseInt(currentZoom) + 10, 200)}%`);
26
26
  }
27
27
 
28
28
  function zoomOut() {
29
- zoomCommon((currentZoom) => `${Math.max(parseInt(currentZoom) - 10, 30)}%`);
29
+ zoomCommon(currentZoom => `${Math.max(parseInt(currentZoom) - 10, 30)}%`);
30
30
  }
31
31
 
32
32
  function handleShortcut(event) {
@@ -38,11 +38,14 @@ function handleShortcut(event) {
38
38
 
39
39
  // Judgment of file download.
40
40
  function isDownloadLink(url) {
41
+ // prettier-ignore
41
42
  const fileExtensions = [
42
- '3gp', '7z', 'ai', 'apk', 'avi', 'bmp', 'csv', 'dmg', 'doc', 'docx', 'fla', 'flv', 'gif', 'gz', 'gzip',
43
- 'ico', 'iso', 'indd', 'jar', 'jpeg', 'jpg', 'm3u8', 'mov', 'mp3', 'mp4', 'mpa', 'mpg',
44
- 'mpeg', 'msi', 'odt', 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'raw', 'rss', 'svg',
45
- 'swf', 'tar', 'tif', 'tiff', 'ts', 'txt', 'wav', 'webm', 'webp', 'wma', 'wmv', 'xls', 'xlsx', 'xml', 'zip',
43
+ '3gp', '7z', 'ai', 'apk', 'avi', 'bmp', 'csv', 'dmg', 'doc', 'docx',
44
+ 'fla', 'flv', 'gif', 'gz', 'gzip', 'ico', 'iso', 'indd', 'jar', 'jpeg',
45
+ 'jpg', 'm3u8', 'mov', 'mp3', 'mp4', 'mpa', 'mpg', 'mpeg', 'msi', 'odt',
46
+ 'ogg', 'ogv', 'pdf', 'png', 'ppt', 'pptx', 'psd', 'rar', 'raw', 'rss',
47
+ 'svg', 'swf', 'tar', 'tif', 'tiff', 'ts', 'txt', 'wav', 'webm', 'webp',
48
+ 'wma', 'wmv', 'xls', 'xlsx', 'xml', 'zip', 'json', 'yaml', '7zip', 'mkv'
46
49
  ];
47
50
  const downloadLinkPattern = new RegExp(`\\.(${fileExtensions.join('|')})$`, 'i');
48
51
  return downloadLinkPattern.test(url);
@@ -75,7 +78,7 @@ document.addEventListener('DOMContentLoaded', () => {
75
78
  appWindow.startDragging().then();
76
79
  });
77
80
 
78
- domEl.addEventListener('mousedown', (e) => {
81
+ domEl.addEventListener('mousedown', e => {
79
82
  e.preventDefault();
80
83
  if (e.buttons === 1 && e.detail !== 2) {
81
84
  appWindow.startDragging().then();
@@ -83,13 +86,13 @@ document.addEventListener('DOMContentLoaded', () => {
83
86
  });
84
87
 
85
88
  domEl.addEventListener('dblclick', () => {
86
- appWindow.isFullscreen().then((fullscreen) => {
89
+ appWindow.isFullscreen().then(fullscreen => {
87
90
  appWindow.setFullscreen(!fullscreen).then();
88
91
  });
89
92
  });
90
93
 
91
94
  if (window['pakeConfig']?.disabled_web_shortcuts !== true) {
92
- document.addEventListener('keyup', (event) => {
95
+ document.addEventListener('keyup', event => {
93
96
  if (/windows|linux/i.test(navigator.userAgent) && event.ctrlKey) {
94
97
  handleShortcut(event);
95
98
  }
@@ -103,7 +106,7 @@ document.addEventListener('DOMContentLoaded', () => {
103
106
  function collectUrlToBlobs() {
104
107
  const backupCreateObjectURL = window.URL.createObjectURL;
105
108
  window.blobToUrlCaches = new Map();
106
- window.URL.createObjectURL = (blob) => {
109
+ window.URL.createObjectURL = blob => {
107
110
  const url = backupCreateObjectURL.call(window.URL, blob);
108
111
  window.blobToUrlCaches.set(url, blob);
109
112
  return url;
@@ -111,7 +114,7 @@ document.addEventListener('DOMContentLoaded', () => {
111
114
  }
112
115
 
113
116
  function convertBlobUrlToBinary(blobUrl) {
114
- return new Promise((resolve) => {
117
+ return new Promise(resolve => {
115
118
  const blob = window.blobToUrlCaches.get(blobUrl);
116
119
  const reader = new FileReader();
117
120
 
@@ -145,7 +148,7 @@ document.addEventListener('DOMContentLoaded', () => {
145
148
  }
146
149
 
147
150
  function downloadFromBlobUrl(blobUrl, filename) {
148
- convertBlobUrlToBinary(blobUrl).then((binary) => {
151
+ convertBlobUrlToBinary(blobUrl).then(binary => {
149
152
  invoke('download_file_by_binary', {
150
153
  params: {
151
154
  filename,
@@ -155,37 +158,40 @@ document.addEventListener('DOMContentLoaded', () => {
155
158
  });
156
159
  }
157
160
 
158
- // detect blob download by createElement("a")
161
+ // detect blob download by createElement("a")
159
162
  function detectDownloadByCreateAnchor() {
160
163
  const createEle = document.createElement;
161
- document.createElement = (el) => {
164
+ document.createElement = el => {
162
165
  if (el !== 'a') return createEle.call(document, el);
163
166
  const anchorEle = createEle.call(document, el);
164
167
 
165
168
  // use addEventListener to avoid overriding the original click event.
166
- anchorEle.addEventListener('click', (e) => {
167
- const url = anchorEle.href;
168
- const filename = anchorEle.download || getFilenameFromUrl(url);
169
- if (window.blobToUrlCaches.has(url)) {
170
- downloadFromBlobUrl(url, filename);
171
- // case: download from dataURL -> convert dataURL ->
172
- } else if (url.startsWith('data:')) {
173
- downloadFromDataUri(url, filename);
174
- } else if (isDownloadLink(url) || anchorEle.hostname !== window.location.host) {
175
- handleExternalLink(e, url);
176
- }
177
- }, true);
169
+ anchorEle.addEventListener(
170
+ 'click',
171
+ e => {
172
+ const url = anchorEle.href;
173
+ const filename = anchorEle.download || getFilenameFromUrl(url);
174
+ if (window.blobToUrlCaches.has(url)) {
175
+ downloadFromBlobUrl(url, filename);
176
+ // case: download from dataURL -> convert dataURL ->
177
+ } else if (url.startsWith('data:')) {
178
+ downloadFromDataUri(url, filename);
179
+ } else if (isDownloadLink(url) || anchorEle.host !== window.location.host) {
180
+ handleExternalLink(e, url);
181
+ }
182
+ },
183
+ true,
184
+ );
178
185
 
179
186
  return anchorEle;
180
187
  };
181
188
  }
182
189
 
183
- const isExternalLink = (link) => window.location.host !== link.host;
190
+ const isExternalLink = link => window.location.host !== link.host;
184
191
  // process special download protocol['data:','blob:']
185
- const isSpecialDownload = (url) => ['blob', 'data'].some(protocol => url.startsWith(protocol));
192
+ const isSpecialDownload = url => ['blob', 'data'].some(protocol => url.startsWith(protocol));
186
193
 
187
- const isDownloadRequired = (url, anchorElement, e) =>
188
- anchorElement.download || e.metaKey || e.ctrlKey || isDownloadLink(url);
194
+ const isDownloadRequired = (url, anchorElement, e) => anchorElement.download || e.metaKey || e.ctrlKey || isDownloadLink(url);
189
195
 
190
196
  const handleExternalLink = (e, url) => {
191
197
  e.preventDefault();
@@ -197,16 +203,19 @@ document.addEventListener('DOMContentLoaded', () => {
197
203
  invoke('download_file', { params: { url, filename } });
198
204
  };
199
205
 
200
- const detectAnchorElementClick = (e) => {
206
+ const detectAnchorElementClick = e => {
201
207
  const anchorElement = e.target.closest('a');
202
208
  if (anchorElement && anchorElement.href) {
203
- anchorElement.target = '_self';
209
+ if (!anchorElement.target) {
210
+ anchorElement.target = '_self';
211
+ }
212
+
204
213
  const hrefUrl = new URL(anchorElement.href);
205
214
  const absoluteUrl = hrefUrl.href;
206
215
  let filename = anchorElement.download || getFilenameFromUrl(absoluteUrl);
207
216
 
208
217
  // Handling external link redirection.
209
- if (isExternalLink(absoluteUrl) && (['_blank', '_new'].includes(anchorElement.target) || externalTargetLink())) {
218
+ if ((isExternalLink(absoluteUrl) && ['_blank', '_new'].includes(anchorElement.target)) || externalTargetLink()) {
210
219
  handleExternalLink(e, absoluteUrl);
211
220
  return;
212
221
  }
@@ -226,7 +235,7 @@ document.addEventListener('DOMContentLoaded', () => {
226
235
 
227
236
  // Rewrite the window.open function.
228
237
  const originalWindowOpen = window.open;
229
- window.open = function(url, name, specs) {
238
+ window.open = function (url, name, specs) {
230
239
  // Apple login and google login
231
240
  if (name === 'AppleAuthentication') {
232
241
  //do nothing
@@ -249,10 +258,13 @@ document.addEventListener('DOMContentLoaded', () => {
249
258
  }
250
259
 
251
260
  // Fix Chinese input method "Enter" on Safari
252
- document.addEventListener('keydown', (e) => {
253
- if (e.keyCode === 229) e.stopPropagation();
254
- }, true);
255
-
261
+ document.addEventListener(
262
+ 'keydown',
263
+ e => {
264
+ if (e.keyCode === 229) e.stopPropagation();
265
+ },
266
+ true,
267
+ );
256
268
  });
257
269
 
258
270
  function setDefaultZoom() {
@@ -8,7 +8,7 @@
8
8
  "copyright": "",
9
9
  "deb": {
10
10
  "depends": ["curl", "wget"],
11
- "files": {"/usr/share/applications/com-pake-weread.desktop": "assets/com-pake-weread.desktop"}
11
+ "files": { "/usr/share/applications/com-pake-weread.desktop": "assets/com-pake-weread.desktop" }
12
12
  },
13
13
  "externalBin": [],
14
14
  "longDescription": "",