feat: allow header injection for liveview
This commit is contained in:
1 parent
1f6c0593b4
commit
a1c644d80b
2 files changed
+3
-4
No files matched your search
@@ -13,7 +13,7 @@ async fn main() {
|
|||||||
|
|
||||||
// todo: compactify this routing under one liveview::app method
|
// todo: compactify this routing under one liveview::app method
|
||||||
let view = liveview::new(addr);
|
let view = liveview::new(addr);
|
||||||
let body = view.body();
|
let body = view.body("<title>Dioxus LiveView</title>");
|
||||||
|
|
||||||
let routes = warp::path::end()
|
let routes = warp::path::end()
|
||||||
.map(move || warp::reply::html(body.clone()))
|
.map(move || warp::reply::html(body.clone()))
|
||||||
|
|||||||
@@ -31,14 +31,13 @@ pub struct Liveview {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Liveview {
|
impl Liveview {
|
||||||
pub fn body(&self) -> String {
|
pub fn body(&self, header: &str) -> String {
|
||||||
format!(
|
format!(
|
||||||
r#"
|
r#"
|
||||||
<!DOCTYPE html>
|
<!DOCTYPE html>
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Dioxus app</title>
|
{header}
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="main"></div>
|
<div id="main"></div>
|
||||||
|
|||||||
Reference in new issue
Block a user