fix: warn about insecure custom API server connections (#16616)

* fix: warn about insecure custom API server connections

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: limit API server warning to HTTP addresses

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: resolve API warnings against effective server configuration

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: reuse common sync for API server previews

Signed-off-by: fufesou <linlong1266@gmail.com>

* fix: keep server settings usable on API preview errors

Signed-off-by: fufesou <linlong1266@gmail.com>

---------

Signed-off-by: fufesou <linlong1266@gmail.com>
This commit is contained in:
fufesou authored and GitHub committed 2026-10-20 22:52:48 +08:00
1 parent 7f5a401947
commit c7f212df2c
59 files changed
+291 -2

No files matched your search

+10
View File
@@ -2763,6 +2763,16 @@ pub fn main_get_common(key: String) -> String {
}
pub fn main_get_common_sync(key: String) -> SyncReturn<String> {
if let Some(args) = key.strip_prefix("resolve-api-server:") {
let response = match serde_json::from_str::<(String, String)>(args) {
Ok((api, custom)) => serde_json::json!({"url": crate::get_api_server(api, custom)}),
Err(err) => {
log::trace!("Invalid API server preview arguments: {err}");
serde_json::json!({"error": err.to_string()})
}
};
return SyncReturn(response.to_string());
}
// Metadata verification performs blocking network requests. Keep this key on
// the asynchronous FFI path to avoid blocking the calling Flutter isolate.
if key.starts_with("verified-download-url-") {
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", "“{}” 不能用作快捷键。"),
("On", "开"),
("Off", "关"),
("api_server_connection_tip", "自定义服务器正在使用未加密的 HTTP。请联系管理员启用 HTTPS。"),
("api_server_empty_tip", "API 服务器留空时,自定义服务器默认使用 HTTP。请联系管理员启用 HTTPS。"),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -288,5 +288,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-already-bound-to", "Already bound to"),
("shortcut-mobile-physical-keyboard-tip", "Recording requires a physical keyboard. Soft keyboards are not supported."),
("shortcut-key-not-supported", "\"{}\" can't be used as a shortcut."),
("api_server_connection_tip", "Your custom server uses unencrypted HTTP. Contact your administrator to enable HTTPS."),
("api_server_empty_tip", "With API Server empty, your custom server defaults to HTTP. Contact your administrator to enable HTTPS."),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", "'{}' non può essere usato come scorciatoia."),
("On", "ON"),
("Off", "OFF"),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", "Sneltoets wordt niet ondersteund"),
("On", "Aan"),
("Off", "Uit"),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", "Não é possível usar \"{}\" como atalho."),
("On", "Ativado"),
("Off", "Desativado"),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", "\"{}\" невозможно использовать как сочетание клавиш."),
("On", "вкл"),
("Off", "откл"),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", "自訂伺服器正在使用未加密的 HTTP。請聯絡管理員啟用 HTTPS。"),
("api_server_empty_tip", "API 伺服器留空時,自訂伺服器預設使用 HTTP。請聯絡管理員啟用 HTTPS。"),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,6 +813,8 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}
+2
View File
@@ -813,5 +813,7 @@ pub static ref T: std::collections::HashMap<&'static str, &'static str> =
("shortcut-key-not-supported", ""),
("On", ""),
("Off", ""),
("api_server_connection_tip", ""),
("api_server_empty_tip", ""),
].iter().cloned().collect();
}