feat: partially add wayfern

This commit is contained in:
zhom
2026-01-09 09:50:07 +04:00
parent fdd921c6bb
commit e9c084d6a4
22 changed files with 2313 additions and 127 deletions
+75
View File
@@ -74,6 +74,22 @@ impl BrowserVersionManager {
// Camoufox supports all platforms and architectures according to the JS code
Ok(true)
}
"wayfern" => {
// Wayfern support depends on version.json downloads availability
// Currently supports macos-arm64 and linux-x64
let platform_key = format!("{os}-{arch}");
// Check dynamically, but allow the browser to appear even if platform not available yet
// The actual download will fail gracefully if not supported
Ok(matches!(
platform_key.as_str(),
"macos-arm64"
| "linux-x64"
| "macos-x64"
| "linux-arm64"
| "windows-x64"
| "windows-arm64"
))
}
_ => Err(format!("Unknown browser: {browser}").into()),
}
}
@@ -87,6 +103,7 @@ impl BrowserVersionManager {
"brave",
"chromium",
"camoufox",
"wayfern",
];
all_browsers
@@ -224,6 +241,7 @@ impl BrowserVersionManager {
"brave" => self.fetch_brave_versions(true).await?,
"chromium" => self.fetch_chromium_versions(true).await?,
"camoufox" => self.fetch_camoufox_versions(true).await?,
"wayfern" => self.fetch_wayfern_versions(true).await?,
_ => return Err(format!("Unsupported browser: {browser}").into()),
};
@@ -424,6 +442,17 @@ impl BrowserVersionManager {
})
.collect()
}
"wayfern" => {
// Wayfern only has one version from version.json
merged_versions
.into_iter()
.map(|version| BrowserVersionInfo {
version: version.clone(),
is_prerelease: false, // Wayfern releases are always stable
date: "".to_string(),
})
.collect()
}
_ => {
return Err(format!("Unsupported browser: {browser}").into());
}
@@ -647,6 +676,31 @@ impl BrowserVersionManager {
is_archive: true,
})
}
"wayfern" => {
// Wayfern downloads from https://download.wayfern.com/
// File naming: wayfern-{chromium_version}-{platform}-{arch}.{ext}
// Platform/arch format: linux-x64, macos-arm64, etc.
let platform_key = format!("{os}-{arch}");
let (filename, is_archive) = match platform_key.as_str() {
"macos-arm64" | "macos-x64" => (format!("wayfern-{version}-{platform_key}.dmg"), true),
"linux-x64" | "linux-arm64" => (format!("wayfern-{version}-{platform_key}.tar.xz"), true),
"windows-x64" | "windows-arm64" => {
(format!("wayfern-{version}-{platform_key}.exe"), false)
}
_ => {
return Err(
format!("Unsupported platform/architecture for Wayfern: {os}/{arch}").into(),
)
}
};
// Note: The actual URL will be resolved dynamically from version.json in downloader.rs
Ok(DownloadInfo {
url: format!("https://download.wayfern.com/{filename}"),
filename,
is_archive,
})
}
_ => Err(format!("Unsupported browser: {browser}").into()),
}
}
@@ -820,6 +874,27 @@ impl BrowserVersionManager {
.fetch_camoufox_releases_with_caching(no_caching)
.await
}
async fn fetch_wayfern_versions(
&self,
no_caching: bool,
) -> Result<Vec<String>, Box<dyn std::error::Error + Send + Sync>> {
let version_info = self
.api_client
.fetch_wayfern_version_with_caching(no_caching)
.await?;
// Check if current platform has a download available
if self
.api_client
.has_wayfern_compatible_download(&version_info)
{
Ok(vec![version_info.version])
} else {
// No compatible download for current platform
Ok(vec![])
}
}
}
#[tauri::command]