support browser icons
This commit is contained in:
@@ -35,6 +35,7 @@ pub fn resolve_browser_configs(app: &AppHandle) -> Result<Vec<BrowserConfigEntry
|
||||
id: config.id,
|
||||
source: BrowserConfigSource::Custom,
|
||||
browser_family_id: None,
|
||||
icon_key: config.icon_key,
|
||||
name: config.name,
|
||||
executable_path: config.executable_path,
|
||||
user_data_path: config.user_data_path,
|
||||
@@ -50,6 +51,14 @@ pub fn create_custom_browser_config(
|
||||
input: CreateCustomBrowserConfigInput,
|
||||
) -> Result<BrowserConfigListResponse, String> {
|
||||
let name = input.name.trim();
|
||||
let icon_key = input.icon_key.and_then(|value| {
|
||||
let trimmed = value.trim().to_string();
|
||||
if trimmed.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(trimmed)
|
||||
}
|
||||
});
|
||||
let executable_path = input.executable_path.trim();
|
||||
let user_data_path = input.user_data_path.trim();
|
||||
|
||||
@@ -67,6 +76,7 @@ pub fn create_custom_browser_config(
|
||||
stored.custom_configs.push(CustomBrowserConfigRecord {
|
||||
id: generate_custom_config_id(),
|
||||
name: name.to_string(),
|
||||
icon_key,
|
||||
executable_path: executable_path.to_string(),
|
||||
user_data_path: user_data_path.to_string(),
|
||||
});
|
||||
@@ -117,6 +127,7 @@ fn default_browser_configs() -> Result<Vec<BrowserConfigEntry>, String> {
|
||||
id: definition.id.to_string(),
|
||||
source: BrowserConfigSource::Default,
|
||||
browser_family_id: Some(definition.id.to_string()),
|
||||
icon_key: Some(definition.id.to_string()),
|
||||
name: definition.name.to_string(),
|
||||
executable_path: resolve_browser_executable(definition.id)
|
||||
.map(|path| path.display().to_string())
|
||||
|
||||
Reference in New Issue
Block a user