Upgrade dependencies
This commit is contained in:
parent
4c598da07a
commit
bda259cf14
6 changed files with 1005 additions and 96 deletions
660
Cargo.lock
generated
660
Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -7,10 +7,10 @@ edition = "2021"
|
|||
anyhow = "1.0"
|
||||
log = "0.4"
|
||||
simplelog = "0.12"
|
||||
wry = "0.27"
|
||||
wry = "0.33"
|
||||
native-dialog = "0.6"
|
||||
rust-embed = "6"
|
||||
base64 = "0.21"
|
||||
rust-embed = "8"
|
||||
bs64 = "0.1"
|
||||
directories = "5"
|
||||
clap = "4"
|
||||
warp = "0.3"
|
||||
|
|
File diff suppressed because one or more lines are too long
414
flamegraph.svg
Normal file
414
flamegraph.svg
Normal file
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 431 KiB |
5
js/three.min.js
vendored
5
js/three.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -1,7 +1,6 @@
|
|||
#![windows_subsystem = "windows"]
|
||||
|
||||
use anyhow::{anyhow, Result};
|
||||
use base64::Engine;
|
||||
use clap::{Arg, Command};
|
||||
use image::{io::Reader as ImageReader, DynamicImage};
|
||||
use log::info;
|
||||
|
@ -69,8 +68,11 @@ fn main() -> Result<()> {
|
|||
let (width, height) = image::image_dimensions(&img_path)?;
|
||||
const MAX_IMG_SIZE: u32 = 20_000_000;
|
||||
let img_data_path = if height * width > MAX_IMG_SIZE {
|
||||
// @todo utilisation de rfd au lieu de message_dialog
|
||||
// @todo Option pas de resize / taille en ligne de commande
|
||||
// @todo Option pas de resize / taille dans une config (confy)
|
||||
// @todo Demande ensergistre l’action la première fois
|
||||
// @todo Option always en ligne de commnade
|
||||
// @todo Icon
|
||||
let ratio = (height * width) as f64 / MAX_IMG_SIZE as f64;
|
||||
let new_height = (height as f64 / ratio.sqrt()) as u32;
|
||||
|
@ -106,7 +108,7 @@ fn main() -> Result<()> {
|
|||
};
|
||||
let img_data = std::fs::read(&img_data_path)?;
|
||||
tmp_dir.close()?;
|
||||
let img_base_64 = base64::engine::general_purpose::STANDARD.encode(img_data);
|
||||
let img_base_64 = bs64::encode(&img_data);
|
||||
|
||||
info!("Generate HTML");
|
||||
let html = std::str::from_utf8(Embed::get("index.html").unwrap().data.as_ref())?
|
||||
|
@ -143,11 +145,14 @@ fn main() -> Result<()> {
|
|||
|
||||
fn run_server(html: String) -> JoinHandle<()> {
|
||||
std::thread::spawn(|| {
|
||||
info!("Create runtime");
|
||||
let async_runtime = tokio::runtime::Builder::new_current_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
.unwrap();
|
||||
info!("Create response");
|
||||
let hello = warp::any().map(move || warp::reply::html(html.clone()));
|
||||
info!("Launch webserver");
|
||||
async_runtime.block_on(warp::serve(hello).run(([127, 0, 0, 1], 62371)));
|
||||
})
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue