pake-cli 3.16.0 โ†’ 3.16.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.
package/dist/cli.js CHANGED
@@ -19,7 +19,7 @@ import * as psl from 'psl';
19
19
  import { InvalidArgumentError, program as program$1, Option } from 'commander';
20
20
 
21
21
  var name = "pake-cli";
22
- var version = "3.16.0";
22
+ var version = "3.16.1";
23
23
  var description = "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with one command. ๐Ÿคฑ๐Ÿป ไธ€้”ฎๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆ่ฝป้‡ๆกŒ้ขๅบ”็”จใ€‚";
24
24
  var homepage = "https://faberon.io/projects/pake";
25
25
  var engines = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "3.16.0",
3
+ "version": "3.16.1",
4
4
  "description": "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with one command. ๐Ÿคฑ๐Ÿป ไธ€้”ฎๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆ่ฝป้‡ๆกŒ้ขๅบ”็”จใ€‚",
5
5
  "homepage": "https://faberon.io/projects/pake",
6
6
  "engines": {
@@ -2564,7 +2564,7 @@ dependencies = [
2564
2564
 
2565
2565
  [[package]]
2566
2566
  name = "pake"
2567
- version = "3.16.0"
2567
+ version = "3.16.1"
2568
2568
  dependencies = [
2569
2569
  "block2",
2570
2570
  "dispatch",
@@ -1,6 +1,6 @@
1
1
  [package]
2
2
  name = "pake"
3
- version = "3.16.0"
3
+ version = "3.16.1"
4
4
  description = "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with Rust."
5
5
  authors = ["Tw93"]
6
6
  license = "GPL-3.0-or-later"
@@ -736,6 +736,7 @@ document.addEventListener("DOMContentLoaded", () => {
736
736
 
737
737
  const target = anchorElement.target;
738
738
  const hrefUrl = new URL(anchorElement.href);
739
+ if (["mailto:", "tel:"].includes(hrefUrl.protocol)) return;
739
740
  const absoluteUrl = hrefUrl.href;
740
741
  let filename = anchorElement.download || getFilenameFromUrl(absoluteUrl);
741
742
 
@@ -848,7 +849,11 @@ document.addEventListener("DOMContentLoaded", () => {
848
849
  }
849
850
  };
850
851
 
851
- // Prevent some special websites from executing in advance, before the click event is triggered.
852
+ window.addEventListener("click", (event) =>
853
+ handleProtocolLinkClick(event, handleExternalLink),
854
+ );
855
+
856
+ // Capture web links before site popup handlers route them into the app.
852
857
  document.addEventListener("click", detectAnchorElementClick, true);
853
858
 
854
859
  // Rewrite the window.open function.
@@ -43,6 +43,10 @@
43
43
  return null;
44
44
  };
45
45
 
46
+ window.addEventListener("click", (event) =>
47
+ handleProtocolLinkClick(event, forward),
48
+ );
49
+
46
50
  document.addEventListener(
47
51
  "click",
48
52
  (event) => {
@@ -52,7 +56,7 @@
52
56
  if (anchor.target && !["_blank", "_new", "_self"].includes(anchor.target))
53
57
  return;
54
58
  const external = externalDestination(anchor.getAttribute("href"), "");
55
- if (!external) return;
59
+ if (!external || /^(mailto|tel):/.test(external)) return;
56
60
  event.preventDefault();
57
61
  event.stopImmediatePropagation();
58
62
  forward(external);
@@ -58,3 +58,26 @@ function createInternalUrlMatcher(pattern) {
58
58
  }
59
59
  };
60
60
  }
61
+
62
+ // Protocol links may represent a web app's compose/contact menu. Let target
63
+ // and document handlers cancel them before falling back to the system app.
64
+ function handleProtocolLinkClick(event, openExternal) {
65
+ if (event.defaultPrevented) return;
66
+ const anchor = event.target?.closest?.("a[href]");
67
+ if (!anchor || anchor.hasAttribute("download")) return;
68
+ if (anchor.target && !["_blank", "_new", "_self"].includes(anchor.target))
69
+ return;
70
+ if (typeof anchor.href !== "string" || !/^(mailto|tel):/i.test(anchor.href))
71
+ return;
72
+ const url = new URL(anchor.href);
73
+ if (window.pakeConfig?.force_internal_navigation) return;
74
+ if (
75
+ createInternalUrlMatcher(window.pakeConfig?.internal_url_regex)(
76
+ url.href,
77
+ window.pakeConfig?.url || window.location.href,
78
+ )
79
+ )
80
+ return;
81
+ event.preventDefault();
82
+ openExternal(url.href);
83
+ }
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "productName": "Weekly",
3
3
  "identifier": "com.pake.weekly",
4
- "version": "3.16.0",
4
+ "version": "3.16.1",
5
5
  "app": {
6
6
  "withGlobalTauri": true,
7
7
  "trayIcon": {