refactor: handle missing mmdb

This commit is contained in:
zhom
2025-08-09 12:42:46 +04:00
parent ad2d9b73f2
commit 90d8e782de
4 changed files with 156 additions and 17 deletions
+23 -1
View File
@@ -164,6 +164,20 @@ export function CreateProfileDialog({
}
}, []);
const checkAndDownloadGeoIPDatabase = useCallback(async () => {
try {
const isAvailable = await invoke<boolean>("is_geoip_database_available");
if (!isAvailable) {
console.log("GeoIP database not available, downloading...");
await invoke("download_geoip_database");
console.log("GeoIP database downloaded successfully");
}
} catch (error) {
console.error("Failed to check/download GeoIP database:", error);
// Don't show error to user as this is not critical for profile creation
}
}, []);
const loadReleaseTypes = useCallback(
async (browser: string) => {
// Set loading state
@@ -205,8 +219,16 @@ export function CreateProfileDialog({
void loadStoredProxies();
// Load camoufox release types when dialog opens
void loadReleaseTypes("camoufox");
// Check and download GeoIP database if needed for Camoufox
void checkAndDownloadGeoIPDatabase();
}
}, [isOpen, loadSupportedBrowsers, loadStoredProxies, loadReleaseTypes]);
}, [
isOpen,
loadSupportedBrowsers,
loadStoredProxies,
loadReleaseTypes,
checkAndDownloadGeoIPDatabase,
]);
// Load release types when browser selection changes
useEffect(() => {