pake-cli 3.4.2 → 3.5.0

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.
@@ -519,10 +519,10 @@
519
519
  "markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`"
520
520
  },
521
521
  {
522
- "description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`",
522
+ "description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
523
523
  "type": "string",
524
524
  "const": "core:app:default",
525
- "markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`"
525
+ "markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
526
526
  },
527
527
  {
528
528
  "description": "Enables the app_hide command without any pre-configured scope.",
@@ -566,12 +566,24 @@
566
566
  "const": "core:app:allow-name",
567
567
  "markdownDescription": "Enables the name command without any pre-configured scope."
568
568
  },
569
+ {
570
+ "description": "Enables the register_listener command without any pre-configured scope.",
571
+ "type": "string",
572
+ "const": "core:app:allow-register-listener",
573
+ "markdownDescription": "Enables the register_listener command without any pre-configured scope."
574
+ },
569
575
  {
570
576
  "description": "Enables the remove_data_store command without any pre-configured scope.",
571
577
  "type": "string",
572
578
  "const": "core:app:allow-remove-data-store",
573
579
  "markdownDescription": "Enables the remove_data_store command without any pre-configured scope."
574
580
  },
581
+ {
582
+ "description": "Enables the remove_listener command without any pre-configured scope.",
583
+ "type": "string",
584
+ "const": "core:app:allow-remove-listener",
585
+ "markdownDescription": "Enables the remove_listener command without any pre-configured scope."
586
+ },
575
587
  {
576
588
  "description": "Enables the set_app_theme command without any pre-configured scope.",
577
589
  "type": "string",
@@ -638,12 +650,24 @@
638
650
  "const": "core:app:deny-name",
639
651
  "markdownDescription": "Denies the name command without any pre-configured scope."
640
652
  },
653
+ {
654
+ "description": "Denies the register_listener command without any pre-configured scope.",
655
+ "type": "string",
656
+ "const": "core:app:deny-register-listener",
657
+ "markdownDescription": "Denies the register_listener command without any pre-configured scope."
658
+ },
641
659
  {
642
660
  "description": "Denies the remove_data_store command without any pre-configured scope.",
643
661
  "type": "string",
644
662
  "const": "core:app:deny-remove-data-store",
645
663
  "markdownDescription": "Denies the remove_data_store command without any pre-configured scope."
646
664
  },
665
+ {
666
+ "description": "Denies the remove_listener command without any pre-configured scope.",
667
+ "type": "string",
668
+ "const": "core:app:deny-remove-listener",
669
+ "markdownDescription": "Denies the remove_listener command without any pre-configured scope."
670
+ },
647
671
  {
648
672
  "description": "Denies the set_app_theme command without any pre-configured scope.",
649
673
  "type": "string",
@@ -519,10 +519,10 @@
519
519
  "markdownDescription": "Default core plugins set.\n#### This default permission set includes:\n\n- `core:path:default`\n- `core:event:default`\n- `core:window:default`\n- `core:webview:default`\n- `core:app:default`\n- `core:image:default`\n- `core:resources:default`\n- `core:menu:default`\n- `core:tray:default`"
520
520
  },
521
521
  {
522
- "description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`",
522
+ "description": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`",
523
523
  "type": "string",
524
524
  "const": "core:app:default",
525
- "markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`"
525
+ "markdownDescription": "Default permissions for the plugin.\n#### This default permission set includes:\n\n- `allow-version`\n- `allow-name`\n- `allow-tauri-version`\n- `allow-identifier`\n- `allow-bundle-type`\n- `allow-register-listener`\n- `allow-remove-listener`"
526
526
  },
527
527
  {
528
528
  "description": "Enables the app_hide command without any pre-configured scope.",
@@ -566,12 +566,24 @@
566
566
  "const": "core:app:allow-name",
567
567
  "markdownDescription": "Enables the name command without any pre-configured scope."
568
568
  },
569
+ {
570
+ "description": "Enables the register_listener command without any pre-configured scope.",
571
+ "type": "string",
572
+ "const": "core:app:allow-register-listener",
573
+ "markdownDescription": "Enables the register_listener command without any pre-configured scope."
574
+ },
569
575
  {
570
576
  "description": "Enables the remove_data_store command without any pre-configured scope.",
571
577
  "type": "string",
572
578
  "const": "core:app:allow-remove-data-store",
573
579
  "markdownDescription": "Enables the remove_data_store command without any pre-configured scope."
574
580
  },
581
+ {
582
+ "description": "Enables the remove_listener command without any pre-configured scope.",
583
+ "type": "string",
584
+ "const": "core:app:allow-remove-listener",
585
+ "markdownDescription": "Enables the remove_listener command without any pre-configured scope."
586
+ },
575
587
  {
576
588
  "description": "Enables the set_app_theme command without any pre-configured scope.",
577
589
  "type": "string",
@@ -638,12 +650,24 @@
638
650
  "const": "core:app:deny-name",
639
651
  "markdownDescription": "Denies the name command without any pre-configured scope."
640
652
  },
653
+ {
654
+ "description": "Denies the register_listener command without any pre-configured scope.",
655
+ "type": "string",
656
+ "const": "core:app:deny-register-listener",
657
+ "markdownDescription": "Denies the register_listener command without any pre-configured scope."
658
+ },
641
659
  {
642
660
  "description": "Denies the remove_data_store command without any pre-configured scope.",
643
661
  "type": "string",
644
662
  "const": "core:app:deny-remove-data-store",
645
663
  "markdownDescription": "Denies the remove_data_store command without any pre-configured scope."
646
664
  },
665
+ {
666
+ "description": "Denies the remove_listener command without any pre-configured scope.",
667
+ "type": "string",
668
+ "const": "core:app:deny-remove-listener",
669
+ "markdownDescription": "Denies the remove_listener command without any pre-configured scope."
670
+ },
647
671
  {
648
672
  "description": "Denies the set_app_theme command without any pre-configured scope.",
649
673
  "type": "string",
@@ -17,7 +17,8 @@
17
17
  "enable_wasm": false,
18
18
  "enable_drag_drop": false,
19
19
  "maximize": false,
20
- "start_to_tray": false
20
+ "start_to_tray": false,
21
+ "force_internal_navigation": false
21
22
  }
22
23
  ],
23
24
  "user_agent": {
@@ -20,6 +20,8 @@ pub struct WindowConfig {
20
20
  pub enable_wasm: bool,
21
21
  pub enable_drag_drop: bool,
22
22
  pub start_to_tray: bool,
23
+ #[serde(default)]
24
+ pub force_internal_navigation: bool,
23
25
  }
24
26
 
25
27
  #[derive(Debug, Serialize, Deserialize)]
@@ -192,6 +192,8 @@ document.addEventListener("DOMContentLoaded", () => {
192
192
  const tauri = window.__TAURI__;
193
193
  const appWindow = tauri.window.getCurrentWindow();
194
194
  const invoke = tauri.core.invoke;
195
+ const pakeConfig = window["pakeConfig"] || {};
196
+ const forceInternalNavigation = pakeConfig.force_internal_navigation === true;
195
197
 
196
198
  if (!document.getElementById("pake-top-dom")) {
197
199
  const topDom = document.createElement("div");
@@ -319,9 +321,13 @@ document.addEventListener("DOMContentLoaded", () => {
319
321
  const url = anchorEle.href;
320
322
  const filename = anchorEle.download || getFilenameFromUrl(url);
321
323
  if (window.blobToUrlCaches.has(url)) {
324
+ e.preventDefault();
325
+ e.stopImmediatePropagation();
322
326
  downloadFromBlobUrl(url, filename);
323
327
  // case: download from dataURL -> convert dataURL ->
324
328
  } else if (url.startsWith("data:")) {
329
+ e.preventDefault();
330
+ e.stopImmediatePropagation();
325
331
  downloadFromDataUri(url, filename);
326
332
  }
327
333
  },
@@ -390,9 +396,15 @@ document.addEventListener("DOMContentLoaded", () => {
390
396
 
391
397
  // Handle _blank links: same domain navigates in-app, cross-domain opens new window
392
398
  if (target === "_blank") {
399
+ if (forceInternalNavigation) {
400
+ e.preventDefault();
401
+ e.stopImmediatePropagation();
402
+ window.location.href = absoluteUrl;
403
+ return;
404
+ }
405
+
393
406
  if (isSameDomain(absoluteUrl)) {
394
- // For same-domain links, let the browser/SPA handle it naturally
395
- // This prevents full page reload in SPA apps like Discord
407
+ // For same-domain links, let the browser handle it naturally
396
408
  return;
397
409
  }
398
410
 
@@ -409,6 +421,10 @@ document.addEventListener("DOMContentLoaded", () => {
409
421
  }
410
422
 
411
423
  if (target === "_new") {
424
+ if (forceInternalNavigation) {
425
+ return;
426
+ }
427
+
412
428
  e.preventDefault();
413
429
  handleExternalLink(absoluteUrl);
414
430
  return;
@@ -431,6 +447,10 @@ document.addEventListener("DOMContentLoaded", () => {
431
447
  // Handle regular links: same domain allows normal navigation, cross-domain opens new window
432
448
  if (!target || target === "_self") {
433
449
  if (!isSameDomain(absoluteUrl)) {
450
+ if (forceInternalNavigation) {
451
+ return;
452
+ }
453
+
434
454
  e.preventDefault();
435
455
  e.stopImmediatePropagation();
436
456
  const newWindow = originalWindowOpen.call(
@@ -464,6 +484,10 @@ document.addEventListener("DOMContentLoaded", () => {
464
484
  const absoluteUrl = hrefUrl.href;
465
485
 
466
486
  if (!isSameDomain(absoluteUrl)) {
487
+ if (forceInternalNavigation) {
488
+ return originalWindowOpen.call(window, absoluteUrl, name, specs);
489
+ }
490
+
467
491
  handleExternalLink(absoluteUrl);
468
492
  return null;
469
493
  }