-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(core) Fix HTML encoding in webview rendered via data url
- Loading branch information
1 parent
b0f2781
commit 7066f97
Showing
15 changed files
with
228 additions
and
37 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Data Url Example | ||
|
||
To execute run the following on the root directory of the repository: `cargo run --example data-url --features window-data-url`. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Welcome to Tauri!</title> | ||
</head> | ||
<body> | ||
<h1>Welcome to Tauri!</h1> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Copyright 2019-2023 Tauri Programme within The Commons Conservancy | ||
// SPDX-License-Identifier: Apache-2.0 | ||
// SPDX-License-Identifier: MIT | ||
|
||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] | ||
use tauri::WindowBuilder; | ||
|
||
#[cfg(not(feature = "window-data-url"))] | ||
fn main() { | ||
compile_error!("Feature `window-data-url` is required to run this example"); | ||
} | ||
|
||
#[cfg(feature = "window-data-url")] | ||
fn main() { | ||
|
||
tauri::Builder::default() | ||
.setup(|app| { | ||
let html = r#" | ||
<html> | ||
<body> | ||
/+&'=#%?\^`{}|[]~ <br/> | ||
Hello World <br/> | ||
สวัสดีชาวโลก! <br/> | ||
你好世界!<br/> | ||
</body> | ||
</html>"#; | ||
let data = format!("data:text/html,{}", html); | ||
#[allow(unused_mut)] | ||
let mut builder = | ||
WindowBuilder::new( | ||
app, | ||
"Rust".to_string(), | ||
tauri::WindowUrl::DataUrl(data.parse().unwrap())); | ||
#[cfg(target_os = "macos")] | ||
{ | ||
builder = builder.tabbing_identifier("Rust"); | ||
} | ||
let _window = builder.title("Tauri - Rust").build()?; | ||
|
||
Ok(()) | ||
}) | ||
.run(tauri::generate_context!( | ||
"../../examples/data-url/tauri.conf.json" | ||
)) | ||
.expect("error while running tauri application"); | ||
} |
Oops, something went wrong.