pake-cli 3.4.3 โ†’ 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.
package/dist/cli.js CHANGED
@@ -23,7 +23,7 @@ import sharp from 'sharp';
23
23
  import * as psl from 'psl';
24
24
 
25
25
  var name = "pake-cli";
26
- var version = "3.4.3";
26
+ var version = "3.5.0";
27
27
  var description = "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with one command. ๐Ÿคฑ๐Ÿป ไธ€้”ฎๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆ่ฝป้‡ๆกŒ้ขๅบ”็”จใ€‚";
28
28
  var engines = {
29
29
  node: ">=18.0.0"
@@ -470,7 +470,7 @@ async function mergeConfig(url, options, tauriConf) {
470
470
  await fsExtra.copy(sourcePath, destPath);
471
471
  }
472
472
  }));
473
- const { width, height, fullscreen, maximize, hideTitleBar, alwaysOnTop, appVersion, darkMode, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, proxyUrl, installerLanguage, hideOnClose, incognito, title, wasm, enableDragDrop, multiInstance, startToTray, } = options;
473
+ const { width, height, fullscreen, maximize, hideTitleBar, alwaysOnTop, appVersion, darkMode, disabledWebShortcuts, activationShortcut, userAgent, showSystemTray, systemTrayIcon, useLocalFile, identifier, name, resizable = true, inject, proxyUrl, installerLanguage, hideOnClose, incognito, title, wasm, enableDragDrop, multiInstance, startToTray, forceInternalNavigation, } = options;
474
474
  const { platform } = process;
475
475
  const platformHideOnClose = hideOnClose ?? platform === 'darwin';
476
476
  const tauriConfWindowOptions = {
@@ -490,6 +490,7 @@ async function mergeConfig(url, options, tauriConf) {
490
490
  enable_wasm: wasm,
491
491
  enable_drag_drop: enableDragDrop,
492
492
  start_to_tray: startToTray && showSystemTray,
493
+ force_internal_navigation: forceInternalNavigation,
493
494
  };
494
495
  Object.assign(tauriConf.pake.windows[0], { url, ...tauriConfWindowOptions });
495
496
  tauriConf.productName = name;
@@ -1331,6 +1332,7 @@ const DEFAULT_PAKE_OPTIONS = {
1331
1332
  keepBinary: false,
1332
1333
  multiInstance: false,
1333
1334
  startToTray: false,
1335
+ forceInternalNavigation: false,
1334
1336
  };
1335
1337
 
1336
1338
  async function checkUpdateTips() {
@@ -1862,6 +1864,9 @@ program
1862
1864
  .addOption(new Option('--start-to-tray', 'Start app minimized to tray')
1863
1865
  .default(DEFAULT_PAKE_OPTIONS.startToTray)
1864
1866
  .hideHelp())
1867
+ .addOption(new Option('--force-internal-navigation', 'Keep every link inside the Pake window instead of opening external handlers')
1868
+ .default(DEFAULT_PAKE_OPTIONS.forceInternalNavigation)
1869
+ .hideHelp())
1865
1870
  .addOption(new Option('--installer-language <string>', 'Installer language')
1866
1871
  .default(DEFAULT_PAKE_OPTIONS.installerLanguage)
1867
1872
  .hideHelp())
@@ -1888,6 +1893,7 @@ program
1888
1893
  return;
1889
1894
  }
1890
1895
  log.setDefaultLevel('info');
1896
+ log.setLevel('info');
1891
1897
  if (options.debug) {
1892
1898
  log.setLevel('debug');
1893
1899
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pake-cli",
3
- "version": "3.4.3",
3
+ "version": "3.5.0",
4
4
  "description": "๐Ÿคฑ๐Ÿป Turn any webpage into a desktop app with one command. ๐Ÿคฑ๐Ÿป ไธ€้”ฎๆ‰“ๅŒ…็ฝ‘้กต็”Ÿๆˆ่ฝป้‡ๆกŒ้ขๅบ”็”จใ€‚",
5
5
  "engines": {
6
6
  "node": ">=18.0.0"
@@ -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
  }