mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-04-22 03:46:43 +02:00
refactor: cleanup
This commit is contained in:
@@ -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");
|
||||
|
||||
@@ -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!(
|
||||
|
||||
@@ -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(),
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user