mirror of
				https://github.com/RGBCube/rgbcube.github.io
				synced 2025-10-31 06:52:45 +00:00 
			
		
		
		
	Switch to embed-rs
This commit is contained in:
		
							parent
							
								
									397e666ced
								
							
						
					
					
						commit
						f8e9d77792
					
				
					 6 changed files with 42 additions and 31 deletions
				
			
		
							
								
								
									
										48
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							
							
						
						
									
										48
									
								
								Cargo.lock
									
										
									
										generated
									
									
									
								
							|  | @ -49,15 +49,15 @@ dependencies = [ | |||
| 
 | ||||
| [[package]] | ||||
| name = "anyhow" | ||||
| version = "1.0.75" | ||||
| version = "1.0.76" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" | ||||
| checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "async-trait" | ||||
| version = "0.1.74" | ||||
| version = "0.1.75" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" | ||||
| checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" | ||||
| dependencies = [ | ||||
|  "proc-macro2", | ||||
|  "quote", | ||||
|  | @ -191,10 +191,12 @@ dependencies = [ | |||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "embed-file" | ||||
| name = "embed" | ||||
| version = "0.1.0" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "11c84540ea27680af34e655a36b1b3d362f2a1d2088db07760358a01fa9546ad" | ||||
| source = "git+https://github.com/RGBCube/embed-rs#2dd76f64949dd983a2e6e7752633c9dcb2330ef6" | ||||
| dependencies = [ | ||||
|  "include_dir", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "env_logger" | ||||
|  | @ -427,6 +429,25 @@ dependencies = [ | |||
|  "tracing", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "include_dir" | ||||
| version = "0.7.3" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "18762faeff7122e89e0857b02f7ce6fcc0d101d5e9ad2ad7846cc01d61b7f19e" | ||||
| dependencies = [ | ||||
|  "include_dir_macros", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "include_dir_macros" | ||||
| version = "0.7.3" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "b139284b5cf57ecfa712bcc66950bb635b31aff41c188e8a4cfc758eca374a3f" | ||||
| dependencies = [ | ||||
|  "proc-macro2", | ||||
|  "quote", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "indexmap" | ||||
| version = "2.1.0" | ||||
|  | @ -842,12 +863,11 @@ dependencies = [ | |||
|  "anyhow", | ||||
|  "axum", | ||||
|  "dashmap", | ||||
|  "embed-file", | ||||
|  "embed", | ||||
|  "env_logger", | ||||
|  "log", | ||||
|  "maud", | ||||
|  "minify-js", | ||||
|  "stringreader", | ||||
|  "tar", | ||||
|  "tokio", | ||||
| ] | ||||
|  | @ -877,17 +897,11 @@ dependencies = [ | |||
|  "windows-sys 0.48.0", | ||||
| ] | ||||
| 
 | ||||
| [[package]] | ||||
| name = "stringreader" | ||||
| version = "0.1.1" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "913e7b03d63752f6cdd2df77da36749d82669904798fe8944b9ec3d23f159905" | ||||
| 
 | ||||
| [[package]] | ||||
| name = "syn" | ||||
| version = "2.0.41" | ||||
| version = "2.0.42" | ||||
| source = "registry+https://github.com/rust-lang/crates.io-index" | ||||
| checksum = "44c8b28c477cc3bf0e7966561e3460130e1255f7a1cf71931075f1c5e7a7e269" | ||||
| checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" | ||||
| dependencies = [ | ||||
|  "proc-macro2", | ||||
|  "quote", | ||||
|  |  | |||
|  | @ -12,12 +12,11 @@ edition     = "2021" | |||
| anyhow       = "1.0.75" | ||||
| axum         = "0.7.2" | ||||
| dashmap      = "5.5.3" | ||||
| embed-file   = "0.1.0" | ||||
| embed        = { git = "https://github.com/RGBCube/embed-rs" } | ||||
| env_logger   = "0.10.1" | ||||
| log          = "0.4.20" | ||||
| maud         = { git = "https://github.com/vidhanio/maud", branch = "patch-1", features = [ "axum" ] } | ||||
| minify-js    = "0.5.6" | ||||
| stringreader = "0.1.1" | ||||
| tar          = "0.4.40" | ||||
| tokio        = { version = "1.35.1", features = [ "full" ] } | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,4 +1,3 @@ | |||
| use embed_file::embed_string as embed; | ||||
| use maud::{ | ||||
|     html, | ||||
|     Markup, | ||||
|  | @ -16,7 +15,7 @@ pub fn create<S: AsRef<str>>(styling: S, faces: [Markup; 6]) -> Markup { | |||
|     page::create( | ||||
|         html! { | ||||
|             style { | ||||
|                 (PreEscaped(minify::css(embed!("cube.css")))) | ||||
|                 (PreEscaped(minify::css(embed::string!("cube.css")))) | ||||
|             } | ||||
|         }, | ||||
|         html! { | ||||
|  | @ -35,7 +34,7 @@ pub fn create<S: AsRef<str>>(styling: S, faces: [Markup; 6]) -> Markup { | |||
|             } | ||||
| 
 | ||||
|             script { | ||||
|                 (PreEscaped(minify::js(embed!("cube.js")))) | ||||
|                 (PreEscaped(minify::js(embed::string!("cube.js")))) | ||||
|             } | ||||
|         }, | ||||
|     ) | ||||
|  |  | |||
|  | @ -1,6 +1,5 @@ | |||
| use std::array; | ||||
| 
 | ||||
| use embed_file::embed_string as embed; | ||||
| use maud::{ | ||||
|     html, | ||||
|     Markup, | ||||
|  | @ -13,7 +12,7 @@ use crate::{ | |||
| 
 | ||||
| pub async fn generate() -> Markup { | ||||
|     cube::create( | ||||
|         minify::css(embed!("404.css")), | ||||
|         minify::css(embed::string!("404.css")), | ||||
|         array::from_fn(|_| { | ||||
|             (html! { | ||||
|                div class="frame" { "404" } | ||||
|  |  | |||
|  | @ -1,16 +1,17 @@ | |||
| use std::io::Read; | ||||
| use std::io::{ | ||||
|     Cursor, | ||||
|     Read, | ||||
| }; | ||||
| 
 | ||||
| use axum::Router; | ||||
| use dashmap::DashMap; | ||||
| use embed_file::embed_string as embed; | ||||
| use stringreader::StringReader; | ||||
| use tar::Archive; | ||||
| 
 | ||||
| pub fn router() -> Router { | ||||
|     let app = Router::new(); | ||||
| 
 | ||||
|     let tar_contents = embed!("assets.tar"); | ||||
|     let mut archive = Archive::new(StringReader::new(&tar_contents)); | ||||
|     let tar_contents = embed::bytes!("../../assets.tar"); | ||||
|     let mut archive = Archive::new(Cursor::new(tar_contents.as_ref())); | ||||
|     let archive_map: DashMap<String, Vec<u8>> = DashMap::new(); | ||||
| 
 | ||||
|     for entry in archive.entries().unwrap() { | ||||
|  |  | |||
|  | @ -1,4 +1,3 @@ | |||
| use embed_file::embed_string as embed; | ||||
| use maud::{ | ||||
|     html, | ||||
|     Markup, | ||||
|  | @ -11,7 +10,7 @@ use crate::{ | |||
| 
 | ||||
| pub async fn generate() -> Markup { | ||||
|     cube::create( | ||||
|         minify::css(embed!("index.css")), | ||||
|         minify::css(embed::string!("index.css")), | ||||
|         [ | ||||
|             html! { | ||||
|               a href="contact" { | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 RGBCube
						RGBCube