Browse Source

draft meta parser

master
yggverse 2 months ago
parent
commit
4cdfaa2d6b
  1. 29
      src/browser/main/tab/page/mod.rs

29
src/browser/main/tab/page/mod.rs

@ -10,11 +10,12 @@ use gtk::{ @@ -10,11 +10,12 @@ use gtk::{
prelude::{BoxExt, IOStreamExt, InputStreamExtManual, OutputStreamExtManual, SocketClientExt},
Box, Orientation,
};
use std::sync::Arc;
pub struct Page {
widget: Box,
navigation: Navigation,
content: Content,
content: Arc<Content>,
}
impl Page {
@ -76,15 +77,26 @@ impl Page { @@ -76,15 +77,26 @@ impl Page {
vec![0; 0xfffff], // 1Mb @TODO
Priority::DEFAULT,
Some(&Cancellable::new()),
{
move |result| match result {
Ok(response) => {
println!(
"Result: {:?}",
GString::from_utf8_until_nul(
response.0
)
); // @TODO
match GString::from_utf8_until_nul(
response.0,
) {
Ok(data) => {
// Detect page meta
let meta = Regex::split_simple(
r"^(\d+)?\s([\w]+\/[\w]+)?",
data,
RegexCompileFlags::DEFAULT,
RegexMatchFlags::DEFAULT,
);
//println!("{:?}", meta);
//println!("Result: {}", data);
}
Err(_) => todo!(),
}
// @TODO connection.close(cancellable);
}
Err(e) => {
@ -93,7 +105,6 @@ impl Page { @@ -93,7 +105,6 @@ impl Page {
e
);
}
}
},
);
}

Loading…
Cancel
Save