Skip to content

Commit

Permalink
Upgrade dependencies and fix issues from deprecated and new functions
Browse files Browse the repository at this point in the history
  • Loading branch information
448-OG committed Apr 1, 2024
1 parent a6d8c42 commit 8defd5f
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 11 deletions.
8 changes: 4 additions & 4 deletions Lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "puppeteer"
authors = ["448 Engineering Developers <superuser@448.africa>"]
version = "2.7.3"
version = "2.7.4"
edition = "2021"
description = "A Minimal Dependency Easy to Use GUI Builder in Rust using Async Channels"
categories = ["graphics", "gui"]
Expand All @@ -20,7 +20,7 @@ base64ct = { version = "1.6.0", features = ["std"] }
blake3 = "1.5.0"
bytes = { version = "1.5.0", default-features = false }
camino = "1.1.6"
file-format = { version = "0.23.0", features = [
file-format = { version = "0.24.0", features = [
"reader",
"reader-asf",
"reader-cfb",
Expand All @@ -35,10 +35,10 @@ file-format = { version = "0.23.0", features = [
] }
once_cell = "1.18.0"
smol = "2.0.0"
tao = "0.24.0"
tao = "0.27.0"
thiserror = "1.0.50"
tracing = "0.1.40"
wry = "0.35.1"
wry = "0.39.0"

[dev-dependencies]
html-to-string-macro = "0.2.5"
Expand Down
2 changes: 1 addition & 1 deletion Lib/examples/load_resource.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ fn main() {
.unwrap();

assert_eq!(FileFormat::PlainText, resource.format());
assert_eq!(file_format::Kind::Text, resource.format().kind());
assert_eq!(file_format::Kind::Other, resource.format().kind());
assert_eq!("text/plain", resource.format().media_type());
assert_eq!(Some("TXT"), resource.format().short_name());
assert_eq!("frow.min.css", resource.name());
Expand Down
17 changes: 12 additions & 5 deletions Lib/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ use tao::{
window::{Window, WindowBuilder},
};
use tracing::Level;
use wry::{WebView, WebViewBuilder};
use wry::{http::Request, WebView, WebViewBuilder};

/// Environment variables set when the app is initialized
#[derive(Debug, Clone)]
Expand Down Expand Up @@ -284,8 +284,15 @@ where
WebViewBuilder::new_gtk(vbox)
};

let current_html = shell.to_html();

#[cfg(target_os = "windows")]
if current_html.as_ref().len() * 2 > 2 * 1024 * 1024 {
return Err(PuppeteerError::StringTooLarge);
}

let webview = webview_builder
.with_html(shell.to_html())?
.with_html(current_html)
.with_devtools(devtools_enabled)
.with_ipc_handler(handler)
.build()?;
Expand All @@ -296,8 +303,8 @@ where
fn handler(
proxy: EventLoopProxy<UiEvent<T>>,
app_env: ActiveAppEnv,
) -> Box<dyn Fn(String) + 'static> {
let outcome = move |req: String| match req.as_str() {
) -> Box<dyn Fn(Request<String>) + 'static> {
let outcome = move |req: Request<String>| match req.body().as_str() {
"minimize" => PuppeteerApp::<T>::proxy_error_handler(
proxy.send_event(UiEvent::Minimize),
app_env.app_name,
Expand All @@ -316,7 +323,7 @@ where
app_env.app_name,
),
_ => {
let req_parse = T::parse(&req);
let req_parse = T::parse(&req.body());

PuppeteerApp::<T>::proxy_error_handler(
proxy.send_event(UiEvent::Custom(req_parse)),
Expand Down
2 changes: 1 addition & 1 deletion Lib/src/assets.rs
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ mod asset_checks {
.unwrap();

assert_eq!(&FileFormat::PlainText, &resource.format());
assert_eq!(&file_format::Kind::Text, &resource.format().kind());
assert_eq!(&file_format::Kind::Other, &resource.format().kind());
assert_eq!(&"text/plain", &resource.format().media_type());
assert_eq!(&Some("TXT",), &resource.format().short_name());
assert_eq!("frow.min.css", &resource.name());
Expand Down
3 changes: 3 additions & 0 deletions Lib/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@ pub enum PuppeteerError {
/// Encountered a GTK error on Linux
#[error("Encountered a GTK error on Linux")]
GtkError,
/// String must be less than 2MiB on Windows OS
#[error("String must be less than 2MiB on Windows OS")]
StringTooLarge,
}

impl From<std::io::Error> for PuppeteerError {
Expand Down

0 comments on commit 8defd5f

Please sign in to comment.