- obscura-net/cookies.rs: #[allow(dead_code)] on CookieEntry.same_site (parsed today, kept for future SameSite enforcement). - obscura-js/runtime.rs: drop vestigial BOOTSTRAP_JS const; bootstrap.js is already embedded into the V8 snapshot via build.rs. - obscura-js/ops.rs: prefix the four unused fields in InterceptResolution::Continue with _. - obscura-cdp/dispatch.rs: drop unused InterceptResolution import. - obscura-cdp/domains/fetch.rs: drop unused Arc / Mutex / CdpEvent imports. - obscura-cdp/domains/input.rs: prefix _button / _click_count; CDP parses them but the JS click stub is hardcoded for now. - obscura-cdp/server.rs: prefix _processor_handle and _ctx; drop dead initial Ok(())/None for navigate_result/page_back - they are unconditionally overwritten in the only loop break arm. cargo build --workspace: 0 warnings. cargo test --workspace: 113 passed.
This commit is contained in:
1 parent
61a3b9f44e
commit
a8b1ec0968
7 files changed
+9
-13
No files matched your search
@@ -2,7 +2,7 @@ use std::collections::HashMap;
|
|||||||
use std::sync::Arc;
|
use std::sync::Arc;
|
||||||
|
|
||||||
use obscura_browser::{BrowserContext, Page};
|
use obscura_browser::{BrowserContext, Page};
|
||||||
use obscura_js::ops::{InterceptResolution, InterceptedRequest};
|
use obscura_js::ops::InterceptedRequest;
|
||||||
use serde_json::json;
|
use serde_json::json;
|
||||||
|
|
||||||
use crate::domains;
|
use crate::domains;
|
||||||
|
|||||||
@@ -1,11 +1,8 @@
|
|||||||
use std::collections::HashMap;
|
use std::collections::HashMap;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use serde_json::{json, Value};
|
use serde_json::{json, Value};
|
||||||
use tokio::sync::Mutex;
|
|
||||||
|
|
||||||
use crate::dispatch::CdpContext;
|
use crate::dispatch::CdpContext;
|
||||||
use crate::types::CdpEvent;
|
|
||||||
|
|
||||||
pub struct PausedRequest {
|
pub struct PausedRequest {
|
||||||
pub request_id: String,
|
pub request_id: String,
|
||||||
|
|||||||
@@ -13,8 +13,8 @@ pub async fn handle(
|
|||||||
let event_type = params.get("type").and_then(|v| v.as_str()).unwrap_or("");
|
let event_type = params.get("type").and_then(|v| v.as_str()).unwrap_or("");
|
||||||
let x = params.get("x").and_then(|v| v.as_f64()).unwrap_or(0.0);
|
let x = params.get("x").and_then(|v| v.as_f64()).unwrap_or(0.0);
|
||||||
let y = params.get("y").and_then(|v| v.as_f64()).unwrap_or(0.0);
|
let y = params.get("y").and_then(|v| v.as_f64()).unwrap_or(0.0);
|
||||||
let button = params.get("button").and_then(|v| v.as_str()).unwrap_or("left");
|
let _button = params.get("button").and_then(|v| v.as_str()).unwrap_or("left");
|
||||||
let click_count = params.get("clickCount").and_then(|v| v.as_u64()).unwrap_or(1);
|
let _click_count = params.get("clickCount").and_then(|v| v.as_u64()).unwrap_or(1);
|
||||||
|
|
||||||
if event_type == "mousePressed" {
|
if event_type == "mousePressed" {
|
||||||
if let Some(page) = ctx.get_session_page_mut(session_id) {
|
if let Some(page) = ctx.get_session_page_mut(session_id) {
|
||||||
|
|||||||
@@ -55,7 +55,7 @@ pub async fn start_with_full_options(
|
|||||||
.run_until(async {
|
.run_until(async {
|
||||||
let (msg_tx, msg_rx) = mpsc::unbounded_channel::<ServerMessage>();
|
let (msg_tx, msg_rx) = mpsc::unbounded_channel::<ServerMessage>();
|
||||||
|
|
||||||
let processor_handle = tokio::task::spawn_local(cdp_processor(msg_rx, proxy, stealth, user_agent));
|
let _processor_handle = tokio::task::spawn_local(cdp_processor(msg_rx, proxy, stealth, user_agent));
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
match listener.accept().await {
|
match listener.accept().await {
|
||||||
@@ -120,7 +120,7 @@ async fn cdp_processor(
|
|||||||
|
|
||||||
fn handle_fetch_resolution(
|
fn handle_fetch_resolution(
|
||||||
text: &str,
|
text: &str,
|
||||||
ctx: &mut CdpContext,
|
_ctx: &mut CdpContext,
|
||||||
reply_tx: &mpsc::UnboundedSender<String>,
|
reply_tx: &mpsc::UnboundedSender<String>,
|
||||||
intercepted_paused: &mut HashMap<String, tokio::sync::oneshot::Sender<obscura_js::ops::InterceptResolution>>,
|
intercepted_paused: &mut HashMap<String, tokio::sync::oneshot::Sender<obscura_js::ops::InterceptResolution>>,
|
||||||
) {
|
) {
|
||||||
@@ -247,8 +247,8 @@ async fn process_with_interception(
|
|||||||
let _ = nav_done_tx.send((page, result)).await;
|
let _ = nav_done_tx.send((page, result)).await;
|
||||||
});
|
});
|
||||||
|
|
||||||
let mut navigate_result: Result<(), String> = Ok(());
|
let navigate_result: Result<(), String>;
|
||||||
let mut page_back: Option<obscura_browser::Page> = None;
|
let page_back: Option<obscura_browser::Page>;
|
||||||
|
|
||||||
loop {
|
loop {
|
||||||
let has_irx = intercept_rx.is_some();
|
let has_irx = intercept_rx.is_some();
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ async fn op_fetch_url(
|
|||||||
"error": reason,
|
"error": reason,
|
||||||
}).to_string());
|
}).to_string());
|
||||||
}
|
}
|
||||||
Ok(InterceptResolution::Continue { url: new_url, method: new_method, headers: new_headers, body: new_body }) => {
|
Ok(InterceptResolution::Continue { url: _new_url, method: _new_method, headers: _new_headers, body: _new_body }) => {
|
||||||
tracing::debug!("Interception: continue request {}", url);
|
tracing::debug!("Interception: continue request {}", url);
|
||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
|
|||||||
@@ -10,8 +10,6 @@ use crate::ops::{build_extension, ObscuraState};
|
|||||||
|
|
||||||
static SNAPSHOT: &[u8] = include_bytes!(env!("OBSCURA_SNAPSHOT_PATH"));
|
static SNAPSHOT: &[u8] = include_bytes!(env!("OBSCURA_SNAPSHOT_PATH"));
|
||||||
|
|
||||||
const BOOTSTRAP_JS: &str = include_str!("../js/bootstrap.js");
|
|
||||||
|
|
||||||
#[derive(Debug, Clone)]
|
#[derive(Debug, Clone)]
|
||||||
pub struct RemoteObjectInfo {
|
pub struct RemoteObjectInfo {
|
||||||
pub js_type: String,
|
pub js_type: String,
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ struct CookieEntry {
|
|||||||
secure: bool,
|
secure: bool,
|
||||||
http_only: bool,
|
http_only: bool,
|
||||||
expires: Option<u64>,
|
expires: Option<u64>,
|
||||||
|
#[allow(dead_code)]
|
||||||
same_site: String,
|
same_site: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user