From c6262e9e8774968ff9be5f88fe31af1b789bdb5a Mon Sep 17 00:00:00 2001 From: Gunwant Jain Date: Tue, 13 Jul 2021 03:40:58 +0530 Subject: [PATCH] add static files we have a favicon now :') Signed-off-by: Gunwant Jain --- src/main.rs | 3 ++- src/routes/mod.rs | 3 ++- src/routes/static_files.rs | 7 +++++++ static/android-chrome-192x192.png | Bin 0 -> 593 bytes static/android-chrome-512x512.png | Bin 0 -> 2200 bytes static/apple-touch-icon.png | Bin 0 -> 563 bytes static/favicon-16x16.png | Bin 0 -> 83 bytes static/favicon-32x32.png | Bin 0 -> 104 bytes static/favicon.ico | Bin 0 -> 15406 bytes static/site.webmanifest | 1 + 10 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/routes/static_files.rs create mode 100644 static/android-chrome-192x192.png create mode 100644 static/android-chrome-512x512.png create mode 100644 static/apple-touch-icon.png create mode 100644 static/favicon-16x16.png create mode 100644 static/favicon-32x32.png create mode 100644 static/favicon.ico create mode 100644 static/site.webmanifest diff --git a/src/main.rs b/src/main.rs index a56916d..7d644eb 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ #[macro_use] extern crate rocket; -use rocket::shield::{Shield, NoSniff}; +use rocket::shield::{NoSniff, Shield}; use rocket_dyn_templates::Template; mod models; @@ -15,6 +15,7 @@ fn rocket() -> _ { "/", routes![ routes::index::index, + routes::static_files::static_files, routes::upload::upload, routes::submit::submit, routes::retrieve::retrieve, diff --git a/src/routes/mod.rs b/src/routes/mod.rs index db45145..cb2551e 100644 --- a/src/routes/mod.rs +++ b/src/routes/mod.rs @@ -3,4 +3,5 @@ pub mod pretty_retrieve; pub mod pretty_retrieve_ext; pub mod submit; pub mod upload; -pub mod retrieve; \ No newline at end of file +pub mod retrieve; +pub mod static_files; diff --git a/src/routes/static_files.rs b/src/routes/static_files.rs new file mode 100644 index 0000000..7aceded --- /dev/null +++ b/src/routes/static_files.rs @@ -0,0 +1,7 @@ +use std::path::{Path, PathBuf}; +use rocket::fs::NamedFile; + +#[get("/", rank = 3)] +pub async fn static_files(file: PathBuf) -> Option { + NamedFile::open(Path::new("static/").join(file)).await.ok() +} diff --git a/static/android-chrome-192x192.png b/static/android-chrome-192x192.png new file mode 100644 index 0000000000000000000000000000000000000000..cd3a451f78545a18923554b886622eee749a1a91 GIT binary patch literal 593 zcmeAS@N?(olHy`uVBq!ia0vp^2SAvE4M+yv$zf+;V3P23aSW-L^Y*eLBZGp#fdl=H z#Z^HJNeX3;{+xOCrgULe9s2=)HifecOC%dim?xw$T;g$<#pq$okU1(ij05BrbK65P V_3Os{*1)8~;OXk;vd$@?2>=oVtG)mL literal 0 HcmV?d00001 diff --git a/static/android-chrome-512x512.png b/static/android-chrome-512x512.png new file mode 100644 index 0000000000000000000000000000000000000000..01547f2892ce101bddd84368298190eaed96c060 GIT binary patch literal 2200 zcmeAS@N?(olHy`uVBq!ia0y~yU;;9k7&zE~)R&4YzZe)e;yqm)Ln`LHy{5>>puljz zAnC%Kc_IyB3U-F|KQ~^tVQ@J8LzaPIPdWpG!U+ZjhY5@f4GPQ*430n}ns^u(SR{dF z7%?yiq>L&U4TsV6Fq$t$%ZJf&abP0l+XkK D)B_zR literal 0 HcmV?d00001 diff --git a/static/apple-touch-icon.png b/static/apple-touch-icon.png new file mode 100644 index 0000000000000000000000000000000000000000..01df7888940d2af551ff8472dba7c2fd6f9010a9 GIT binary patch literal 563 zcmeAS@N?(olHy`uVBq!ia0vp^TR@nD4M^IaWiw)6VEpCj;uumf=k2A9oD2#K2Mo@C zDE|M2vDQhztL=@f)wfyfTF2fqRGhr9L}HeR^W>zAARgbYg`S2cnr&)FM+Jv)fK1^& Y@xizBk;gFyU}9kKboFyt=akR{0Qh{-zyJUM literal 0 HcmV?d00001 diff --git a/static/favicon-16x16.png b/static/favicon-16x16.png new file mode 100644 index 0000000000000000000000000000000000000000..8ae5da49a6d816c4fc9b612ec780853280b474ba GIT binary patch literal 83 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Ql2i3Ar`&KKTKjD*{jY-ywVWJ e?8Ymh2UOC)y+HmE@4^Q_RScf4elF{r5}E+reiWSm literal 0 HcmV?d00001 diff --git a/static/favicon-32x32.png b/static/favicon-32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..0ad90432c1528e2b786947365864e24c3738b20a GIT binary patch literal 104 zcmeAS@N?(olHy`uVBq!ia0vp^3LwnE1|*BCs=fdzeNPw1kcif|=M)(k7&w>>k}k}d qC(n+rPfi?{+HiaLOQ=jQ8 zE)`RMT3dXz>C3&lcLo?>fB^;=V1NMz7+|0+18Z}ER`S!Fq(-#4R+y8tWnZsz-wZIo y00Rs#zyJdbFu(u<3^2d|0}L?000Rs#zyJdbFu(u<3^2ezI|l0aAWH@QuD}N#ZpbA7 literal 0 HcmV?d00001 diff --git a/static/site.webmanifest b/static/site.webmanifest new file mode 100644 index 0000000..45dc8a2 --- /dev/null +++ b/static/site.webmanifest @@ -0,0 +1 @@ +{"name":"","short_name":"","icons":[{"src":"/android-chrome-192x192.png","sizes":"192x192","type":"image/png"},{"src":"/android-chrome-512x512.png","sizes":"512x512","type":"image/png"}],"theme_color":"#ffffff","background_color":"#ffffff","display":"standalone"} \ No newline at end of file