Skip to content

Commit 5c7fedb

Browse files
committed
Fixed: Fix the issue of obtaining site cookies
1 parent 5a8768a commit 5c7fedb

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

src-tauri/src/utils.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -63,17 +63,17 @@ pub async fn get_window_cookies(
6363
let cookies: Vec<_> = all_cookies
6464
.into_iter()
6565
.filter(|cookie| {
66-
if target_is_ip {
67-
return true;
68-
}
69-
7066
let domain_opt = cookie.domain();
71-
let domain = domain_opt.unwrap_or("");
72-
let cd = domain.trim_start_matches('.');
67+
let domain = domain_opt.unwrap_or("").trim_start_matches('.').to_string();
7368
let td = target_domain.as_str();
7469

70+
if target_is_ip {
71+
// IP 站点只接受 host-only cookie 或者域名与 IP 完全一致的 cookie,避免捞到其他站点的凭据
72+
return domain_opt.is_none() || (!domain.is_empty() && domain == td);
73+
}
74+
7575
let exact_or_subdomain =
76-
!cd.is_empty() && (cd == td || cd.ends_with(&format!(".{}", td)) || td.ends_with(&format!(".{}", cd)));
76+
!domain.is_empty() && (domain == td || domain.ends_with(&format!(".{}", td)) || td.ends_with(&format!(".{}", domain)));
7777
let host_only_cookie = domain_opt.is_none() && !td.is_empty();
7878

7979
exact_or_subdomain || host_only_cookie

ui/components/SideBar/profile.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -500,7 +500,7 @@ onMounted(async () => {
500500
org: currentOrgData,
501501
system_roles: profileData.system_roles,
502502
availableOrgs,
503-
xpackLicenseValid: xpack_license_valid ?? true,
503+
xpackLicenseValid: xpack_license_valid ?? false,
504504
language,
505505
connectionInfo: {
506506
protocol: "",

0 commit comments

Comments
 (0)