Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

fix: LocalAPI server trusted host should accept asterisk (#6551)

Louis7f09c36a92ee
diff --git a/src-tauri/utils/src/http.rs b/src-tauri/utils/src/http.rs
index 3fd4007ec..bdae2d262 100644
--- a/src-tauri/utils/src/http.rs
+++ b/src-tauri/utils/src/http.rs
@@ -6,6 +6,10 @@ pub fn is_cors_header(header_name: &str) -> bool {
/// Validates if host is in trusted hosts list
pub fn is_valid_host(host: &str, trusted_hosts: &[Vec<String>]) -> bool {
+ if trusted_hosts.iter().any(|hosts| hosts.contains(&"*".to_string())) {
+ return true;
+ }
+
if host.is_empty() {
return false;
}