refactor: cleanup

This commit is contained in:
zhom
2026-04-16 01:55:32 +04:00
parent ba796f1cea
commit e293c36b97
4 changed files with 79 additions and 11 deletions
+27 -8
View File
@@ -198,11 +198,20 @@ impl CookieManager {
match profile.browser.as_str() {
"wayfern" => {
let path = profile_data_path.join("Default").join("Cookies");
if path.exists() {
Ok(path)
let network_path = profile_data_path
.join("Default")
.join("Network")
.join("Cookies");
let legacy_path = profile_data_path.join("Default").join("Cookies");
if network_path.exists() {
Ok(network_path)
} else if legacy_path.exists() {
Ok(legacy_path)
} else {
Err(format!("Cookie database not found at: {}", path.display()))
Err(format!(
"Cookie database not found at: {}",
network_path.display()
))
}
}
"camoufox" => {
@@ -232,11 +241,21 @@ impl CookieManager {
match profile.browser.as_str() {
"wayfern" => {
let path = profile_data_path.join("Default").join("Cookies");
if !path.exists() {
Self::create_empty_chrome_cookies_db(&path)?;
let network_path = profile_data_path
.join("Default")
.join("Network")
.join("Cookies");
let legacy_path = profile_data_path.join("Default").join("Cookies");
if network_path.exists() {
Ok(network_path)
} else if legacy_path.exists() {
Ok(legacy_path)
} else {
let dir = network_path.parent().unwrap();
std::fs::create_dir_all(dir).map_err(|e| format!("Failed to create Network dir: {e}"))?;
Self::create_empty_chrome_cookies_db(&network_path)?;
Ok(network_path)
}
Ok(path)
}
"camoufox" => {
let path = profile_data_path.join("cookies.sqlite");
+12 -1
View File
@@ -2344,7 +2344,18 @@ impl SyncEngine {
// Verify critical files after download
let os_crypt_key_path = profile_dir.join("profile").join("os_crypt_key");
let cookies_path = profile_dir.join("profile").join("Default").join("Cookies");
let cookies_path = {
let network = profile_dir
.join("profile")
.join("Default")
.join("Network")
.join("Cookies");
if network.exists() {
network
} else {
profile_dir.join("profile").join("Default").join("Cookies")
}
};
if os_crypt_key_path.exists() {
let key_data = fs::read(&os_crypt_key_path).unwrap_or_default();
log::info!(
+34 -1
View File
@@ -519,7 +519,17 @@ impl WayfernManager {
{
let profile_path_buf = std::path::PathBuf::from(profile_path);
let key_path = profile_path_buf.join("os_crypt_key");
let cookies_path = profile_path_buf.join("Default").join("Cookies");
let cookies_path = {
let network = profile_path_buf
.join("Default")
.join("Network")
.join("Cookies");
if network.exists() {
network
} else {
profile_path_buf.join("Default").join("Cookies")
}
};
if key_path.exists() {
let key_text = std::fs::read_to_string(&key_path).unwrap_or_default();
@@ -819,6 +829,29 @@ impl WayfernManager {
}
}
// Clear Playwright's emulation overrides that cause tampering detection
for target in &page_targets {
if let Some(ws_url) = &target.websocket_debugger_url {
let _ = self
.send_cdp_command(ws_url, "Emulation.clearDeviceMetricsOverride", json!({}))
.await;
let _ = self
.send_cdp_command(
ws_url,
"Emulation.setFocusEmulationEnabled",
json!({ "enabled": false }),
)
.await;
let _ = self
.send_cdp_command(
ws_url,
"Emulation.setEmulatedMedia",
json!({ "media": "", "features": [] }),
)
.await;
}
}
let id = uuid::Uuid::new_v4().to_string();
let instance = WayfernInstance {
id: id.clone(),
+6 -1
View File
@@ -67,7 +67,12 @@ const ChartContainer = React.forwardRef<
{...props}
>
<ChartStyle id={chartId} config={config} />
<RechartsPrimitive.ResponsiveContainer minWidth={1} minHeight={1}>
<RechartsPrimitive.ResponsiveContainer
width="100%"
height="100%"
minWidth={1}
minHeight={1}
>
{children}
</RechartsPrimitive.ResponsiveContainer>
</div>