diff --git a/README.md b/README.md
index 336d21f..64d7c5e 100644
--- a/README.md
+++ b/README.md
@@ -300,21 +300,14 @@ Pake's development can not be without these Hackers. They contributed a lot of c
GoodbyeNJN
-
-
-
-
- Ikko Eltociear Ashimine
-
- |
-
Matt Bajorek
- |
+
+
@@ -336,6 +329,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
Yi Xin
|
+
+
+
+
+ Kieran
+
+ |
@@ -422,6 +422,20 @@ Pake's development can not be without these Hackers. They contributed a lot of c
Po Chen
|
+
+
+
+
+ Xie Ruiqi
+
+ |
+
+
+
+
+ Null
+
+ |
@@ -442,7 +456,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
Null
- |
+
+
@@ -456,8 +471,7 @@ Pake's development can not be without these Hackers. They contributed a lot of c
Liusishan
- |
-
+
diff --git a/bin/README.md b/bin/README.md
index 5072baf..7246dee 100644
--- a/bin/README.md
+++ b/bin/README.md
@@ -24,7 +24,7 @@ npm install pake-cli -g
```bash
sudo apt install libdbus-1-dev \
- libsoup3.0-dev \
+ libsoup-3.0-dev \
libjavascriptcoregtk-4.1-dev \
libwebkit2gtk-4.1-dev \
build-essential \
diff --git a/dist/cli.js b/dist/cli.js
index 2f58f68..4aa0bf3 100644
--- a/dist/cli.js
+++ b/dist/cli.js
@@ -976,7 +976,7 @@ program
.option('--fullscreen', 'Start in full screen', DEFAULT_PAKE_OPTIONS.fullscreen)
.option('--hide-title-bar', 'For Mac, hide title bar', DEFAULT_PAKE_OPTIONS.hideTitleBar)
.option('--multi-arch', 'For Mac, both Intel and M1', DEFAULT_PAKE_OPTIONS.multiArch)
- .option('--inject <./style.css,./script.js,...>', 'Injection of .js or .css files', (val, previous) => (val ? val.split(',').map(item => item.trim()) : DEFAULT_PAKE_OPTIONS.inject), DEFAULT_PAKE_OPTIONS.inject)
+ .option('--inject ', 'Injection of .js or .css files', DEFAULT_PAKE_OPTIONS.inject)
.option('--debug', 'Debug build and more output', DEFAULT_PAKE_OPTIONS.debug)
.addOption(new Option('--proxy-url ', 'Proxy URL for all network requests').default(DEFAULT_PAKE_OPTIONS.proxyUrl).hideHelp())
.addOption(new Option('--user-agent ', 'Custom user agent').default(DEFAULT_PAKE_OPTIONS.userAgent).hideHelp())
diff --git a/src-tauri/Cargo.lock b/src-tauri/Cargo.lock
index 4d237bb..ce52446 100644
--- a/src-tauri/Cargo.lock
+++ b/src-tauri/Cargo.lock
@@ -1339,6 +1339,16 @@ dependencies = [
"version_check",
]
+[[package]]
+name = "gethostname"
+version = "0.4.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "0176e0459c2e4a1fe232f984bca6890e681076abb9934f6cea7c326f3fc47818"
+dependencies = [
+ "libc",
+ "windows-targets 0.48.5",
+]
+
[[package]]
name = "getrandom"
version = "0.1.16"
@@ -1468,9 +1478,9 @@ checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2"
[[package]]
name = "global-hotkey"
-version = "0.6.4"
+version = "0.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "41fbb3a4e56c901ee66c190fdb3fa08344e6d09593cc6c61f8eb9add7144b271"
+checksum = "b9247516746aa8e53411a0db9b62b0e24efbcf6a76e0ba73e5a91b512ddabed7"
dependencies = [
"crossbeam-channel",
"keyboard-types",
@@ -1480,7 +1490,8 @@ dependencies = [
"serde",
"thiserror 2.0.11",
"windows-sys 0.59.0",
- "x11-dl",
+ "x11rb",
+ "xkeysym",
]
[[package]]
@@ -4193,9 +4204,9 @@ dependencies = [
[[package]]
name = "tauri-plugin-global-shortcut"
-version = "2.2.0"
+version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "00f646a09511e8d283267dcdaa08c2ef27c4116bf271d9114849d9ca215606c3"
+checksum = "31919f3c07bcb585afef217c0c33cde80da9ebccf5b8e2c90e0e0a535b14ab47"
dependencies = [
"global-hotkey",
"log",
@@ -4230,9 +4241,9 @@ dependencies = [
[[package]]
name = "tauri-plugin-notification"
-version = "2.2.1"
+version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "0f8d3ee5207d3359ca2b714545664f24f70374d795bf91f7c1935a494003a57d"
+checksum = "c474c7cc524385e682ccc1e149e13913a66fd8586ac4c2319cf01b78f070d309"
dependencies = [
"log",
"notify-rust",
@@ -4264,9 +4275,9 @@ dependencies = [
[[package]]
name = "tauri-plugin-shell"
-version = "2.2.0"
+version = "2.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bb2c50a63e60fb8925956cc5b7569f4b750ac197a4d39f13b8dd46ea8e2bad79"
+checksum = "69d5eb3368b959937ad2aeaf6ef9a8f5d11e01ffe03629d3530707bbcb27ff5d"
dependencies = [
"encoding_rs",
"log",
@@ -4285,9 +4296,9 @@ dependencies = [
[[package]]
name = "tauri-plugin-single-instance"
-version = "2.2.1"
+version = "2.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "47c387d4d96690131dc46d1d2827df5c222b896a2bfeb15a16267229a55c50b5"
+checksum = "97d0e07b40fb2eb13778e30778f5979347a2bf30e1b9d47f78ff7fe92d2e4b3d"
dependencies = [
"serde",
"serde_json",
@@ -4300,9 +4311,9 @@ dependencies = [
[[package]]
name = "tauri-plugin-window-state"
-version = "2.2.1"
+version = "2.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "35e344b512b0d99d9d06225f235d87d6c66d89496a3bf323d9b578d940596e6c"
+checksum = "a27a3fe49de72adbe0d84aee33c89a0b059722cd0b42aaeab29eaaee7f7535cd"
dependencies = [
"bitflags 2.8.0",
"log",
@@ -5674,6 +5685,23 @@ dependencies = [
"pkg-config",
]
+[[package]]
+name = "x11rb"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5d91ffca73ee7f68ce055750bf9f6eca0780b8c85eff9bc046a3b0da41755e12"
+dependencies = [
+ "gethostname",
+ "rustix",
+ "x11rb-protocol",
+]
+
+[[package]]
+name = "x11rb-protocol"
+version = "0.13.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "ec107c4503ea0b4a98ef47356329af139c0a4f7750e621cf2973cd3385ebcb3d"
+
[[package]]
name = "xdg-home"
version = "1.3.0"
@@ -5684,6 +5712,12 @@ dependencies = [
"windows-sys 0.59.0",
]
+[[package]]
+name = "xkeysym"
+version = "0.2.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "b9cc00251562a284751c9973bace760d86c0276c471b4be569fe6b068ee97a56"
+
[[package]]
name = "yoke"
version = "0.7.5"
diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml
index cbc9b8f..ef1f5e7 100644
--- a/src-tauri/Cargo.toml
+++ b/src-tauri/Cargo.toml
@@ -19,16 +19,16 @@ tauri-build = { version = "2.0.4", features = [] }
[dependencies]
serde_json = "1.0.134"
-serde = { version = "1.0.217", features = ["derive"] }
-tokio = { version = "1.42.0", features = ["full"] }
-tauri = { version = "2.2.0", features = ["tray-icon", "image-ico", "image-png", "macos-proxy"] }
-tauri-plugin-window-state = "2.2.0"
+serde = { version = "1.0.218", features = ["derive"] }
+tokio = { version = "1.43.0", features = ["full"] }
+tauri = { version = "2.2.5", features = ["tray-icon", "image-ico", "image-png", "macos-proxy"] }
+tauri-plugin-window-state = "2.2.2"
tauri-plugin-oauth = "2.0.0"
-tauri-plugin-http = "2.2.0"
-tauri-plugin-global-shortcut = { version = "2.2.0" }
-tauri-plugin-shell = "2.2.0"
-tauri-plugin-single-instance = "2.2.0"
-tauri-plugin-notification = "2.2.0"
+tauri-plugin-http = "2.3.0"
+tauri-plugin-global-shortcut = { version = "2.2.1" }
+tauri-plugin-shell = "2.2.1"
+tauri-plugin-single-instance = "2.2.4"
+tauri-plugin-notification = "2.2.2"
[features]
# this feature is used for development builds from development cli
diff --git a/src-tauri/pake.json b/src-tauri/pake.json
index 304b8e9..512c1e5 100644
--- a/src-tauri/pake.json
+++ b/src-tauri/pake.json
@@ -1,7 +1,7 @@
{
"windows": [
{
- "url": "https://weread.qq.com",
+ "url": "https://github.com",
"url_type": "web",
"hide_title_bar": true,
"fullscreen": false,
diff --git a/src-tauri/src/inject/event.js b/src-tauri/src/inject/event.js
index 8477741..1691d26 100644
--- a/src-tauri/src/inject/event.js
+++ b/src-tauri/src/inject/event.js
@@ -186,6 +186,26 @@ document.addEventListener('DOMContentLoaded', () => {
});
};
+ // Check if URL belongs to the same domain (including subdomains)
+ const isSameDomain = (url) => {
+ try {
+ const linkUrl = new URL(url);
+ const currentUrl = new URL(window.location.href);
+
+ if (linkUrl.hostname === currentUrl.hostname) return true;
+
+ // Extract root domain (e.g., bilibili.com from www.bilibili.com)
+ const getRootDomain = (hostname) => {
+ const parts = hostname.split('.');
+ return parts.length >= 2 ? parts.slice(-2).join('.') : hostname;
+ };
+
+ return getRootDomain(currentUrl.hostname) === getRootDomain(linkUrl.hostname);
+ } catch (e) {
+ return false;
+ }
+ };
+
const detectAnchorElementClick = e => {
const anchorElement = e.target.closest('a');
@@ -195,9 +215,17 @@ document.addEventListener('DOMContentLoaded', () => {
const absoluteUrl = hrefUrl.href;
let filename = anchorElement.download || getFilenameFromUrl(absoluteUrl);
- // Handling external link redirection, _blank will automatically open.
+ // Handle _blank links: same domain navigates in-app, cross-domain opens new window
if (target === '_blank') {
e.preventDefault();
+ e.stopImmediatePropagation();
+
+ if (isSameDomain(absoluteUrl)) {
+ window.location.href = absoluteUrl;
+ } else {
+ const newWindow = originalWindowOpen.call(window, absoluteUrl, '_blank', 'width=1200,height=800,scrollbars=yes,resizable=yes');
+ if (!newWindow) handleExternalLink(absoluteUrl);
+ }
return;
}
@@ -210,7 +238,19 @@ document.addEventListener('DOMContentLoaded', () => {
// Process download links for Rust to handle.
if (isDownloadRequired(absoluteUrl, anchorElement, e) && !isSpecialDownload(absoluteUrl)) {
e.preventDefault();
+ e.stopImmediatePropagation();
invoke('download_file', { params: { url: absoluteUrl, filename } });
+ return;
+ }
+
+ // Handle regular links: same domain allows normal navigation, cross-domain opens new window
+ if (!target || target === '_self') {
+ if (!isSameDomain(absoluteUrl)) {
+ e.preventDefault();
+ e.stopImmediatePropagation();
+ const newWindow = originalWindowOpen.call(window, absoluteUrl, '_blank', 'width=1200,height=800,scrollbars=yes,resizable=yes');
+ if (!newWindow) handleExternalLink(absoluteUrl);
+ }
}
}
};
@@ -232,7 +272,20 @@ document.addEventListener('DOMContentLoaded', () => {
} else {
const baseUrl = window.location.origin + window.location.pathname;
const hrefUrl = new URL(url, baseUrl);
- handleExternalLink(hrefUrl.href);
+ const absoluteUrl = hrefUrl.href;
+
+ // Apply same domain logic as anchor links
+ if (isSameDomain(absoluteUrl)) {
+ // Same domain: navigate in app or open new window based on specs
+ if (name === '_blank' || !name) {
+ return originalWindowOpen.call(window, absoluteUrl, '_blank', 'width=1200,height=800,scrollbars=yes,resizable=yes');
+ } else {
+ location.href = absoluteUrl;
+ }
+ } else {
+ // Cross domain: open in external browser
+ handleExternalLink(absoluteUrl);
+ }
}
// Call the original window.open function to maintain its normal functionality.
return originalWindowOpen.call(window, url, name, specs);
|