:Merge branch 'main' into dev
This commit is contained in:
38
README.md
38
README.md
@@ -300,21 +300,14 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<sub><b>GoodbyeNJN</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/eltociear">
|
||||
<img src="https://avatars.githubusercontent.com/u/22633385?v=4" width="90;" alt="eltociear"/>
|
||||
<br />
|
||||
<sub><b>Ikko Eltociear Ashimine</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/mattbajorek">
|
||||
<img src="https://avatars.githubusercontent.com/u/17235301?v=4" width="90;" alt="mattbajorek"/>
|
||||
<br />
|
||||
<sub><b>Matt Bajorek</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/QingZ11">
|
||||
<img src="https://avatars.githubusercontent.com/u/38887077?v=4" width="90;" alt="QingZ11"/>
|
||||
@@ -336,6 +329,13 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<sub><b>Yi Xin</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/lkieryan">
|
||||
<img src="https://avatars.githubusercontent.com/u/187804088?v=4" width="90;" alt="lkieryan"/>
|
||||
<br />
|
||||
<sub><b>Kieran</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/exposir">
|
||||
<img src="https://avatars.githubusercontent.com/u/33340988?v=4" width="90;" alt="exposir"/>
|
||||
@@ -422,6 +422,20 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<sub><b>Po Chen</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/beautifulrem">
|
||||
<img src="https://avatars.githubusercontent.com/u/98527099?v=4" width="90;" alt="beautifulrem"/>
|
||||
<br />
|
||||
<sub><b>Xie Ruiqi</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/bocanhcam">
|
||||
<img src="https://avatars.githubusercontent.com/u/35592955?v=4" width="90;" alt="bocanhcam"/>
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/geekvest">
|
||||
<img src="https://avatars.githubusercontent.com/u/126322776?v=4" width="90;" alt="geekvest"/>
|
||||
@@ -442,7 +456,8 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<br />
|
||||
<sub><b>Null</b></sub>
|
||||
</a>
|
||||
</td>
|
||||
</td></tr>
|
||||
<tr>
|
||||
<td align="center">
|
||||
<a href="https://github.com/liudonghua123">
|
||||
<img src="https://avatars.githubusercontent.com/u/2276718?v=4" width="90;" alt="liudonghua123"/>
|
||||
@@ -456,8 +471,7 @@ Pake's development can not be without these Hackers. They contributed a lot of c
|
||||
<br />
|
||||
<sub><b>Liusishan</b></sub>
|
||||
</a>
|
||||
</td></tr>
|
||||
<tr>
|
||||
</td>
|
||||
<td align="center">
|
||||
<a href="https://github.com/piaoyidage">
|
||||
<img src="https://avatars.githubusercontent.com/u/5135405?v=4" width="90;" alt="piaoyidage"/>
|
||||
|
||||
60
src-tauri/Cargo.lock
generated
60
src-tauri/Cargo.lock
generated
@@ -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"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"windows": [
|
||||
{
|
||||
"url": "https://weread.qq.com",
|
||||
"url": "https://github.com",
|
||||
"url_type": "web",
|
||||
"hide_title_bar": true,
|
||||
"fullscreen": false,
|
||||
|
||||
57
src-tauri/src/inject/event.js
vendored
57
src-tauri/src/inject/event.js
vendored
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user