Skip to content

Commit 0535b11

Browse files
committed
show content blocking rule as JSON
1 parent 3a84aba commit 0535b11

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ wasm-bindgen = "^ 0.2"
1313
web-sys = { version = "^ 0.3", features = [ "HtmlAnchorElement" ] }
1414
console_error_panic_hook = "^ 0.1"
1515
base64 = "0.13"
16+
serde_json = "^ 1.0"
1617

1718
adblock = { version = "^ 0.7.7", features = ["css-validation", "content-blocking"] }

src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,9 +244,10 @@ impl Model {
244244
}
245245
}
246246
fn view_cb_rule(filter: &adblock::content_blocking::CbRule) -> Html {
247+
let cb = serde_json::to_string(filter);
247248
html! {
248249
<>
249-
<p>{ format!("{:?}", filter) }</p>
250+
<p>{ format!("{}", cb.unwrap_or_else(|_| "failed to deserialize content blocking rule".to_string())) }</p>
250251
</>
251252
}
252253
}

0 commit comments

Comments
 (0)