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!ia0y~yU^oE69Bd2>3_*8t*clj@Bs^UlLn`LHy{yQ{pdfJI zK)+*gRS-jxLfNA~XP&(&U6@tJe!!ni;Vi=v$p#bV326+McpPRidKfcgjtUOr0J+87 Y_E1dyx^cfX0|Nttr>mdKI;Vst01^bNz5oCK 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}6Aa4mJh`hA$OYelaj`#Cy6phE&XXdrgs%L4o0b zLDGde^F$iN6zmM^e{Q^P!{BiGhb#lbo^%EVg%b=64igv|8Wflr7#!Ic7@Bw(7+543 z7&wd=7z9#A6^w?%XnGjU7o+9FXgN7r9gJ3skmf;b-pRR*n=XC7&%nUI;OXk;vd$@? F2>{ds9VP$( 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!ia0y~yVAuk}9Bd2>47O+4j2IXge|fq%hE&XXdubylg95_= zgYzGX|9@eubrSGudn0T0Z5F%MvG)uWCoe3Km?h#oIVmHE$G2;tr=f{vo7&M)!66(V bQ@Brj@GX7ham;~%fq}u()z4*}Q$iB}_nb*^O61kBxz$fqQ}cBi@A%7#J8BJYD@<);T3K0RY{86rBJ7 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!ia0y~yU{C;I4mJh`hT^KKFANL}`kpS1ArY-_&nYr8FmNy% vBwd&@PozP@T=?_qx%-v~37`NEcDZfN4b$UxoG4^qU|{fc^>bP0l+XkKo6;G4 literal 0 HcmV?d00001 diff --git a/static/favicon.ico b/static/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..0caa54b3c11e25c7d74993765bfeacfd1e708f72 GIT binary patch literal 15406 zcmZQzU}Rus5D);-3Je)63=C!r3=9ei5Wa>W1H(KP1_lEI2tPxOf#H}a1A_(w1A_oa z9Roz10SAzn{^|cH9u0%hG%zyL0FGjTXkkz}qrkwx;4oUwjFzLLb;)QN7)=ACX<#%B zjHZFnG%%V5M$^D(8W>FjqiJ9?4UG6SK=gpZFjWW|Coy1PU`QApCmHd1VRWo@WRA6t z#`|czkEVgqG%%V5M$^D(8W>FjqiJ9?4UDFN(KIlc21e7sXc`zz1EXnRG!2ZVfzdQD tng&MGz-Ss6O#`E8U^ESkrh(BkFq#HN)4*sN7#V3`m@a=B^%k8%0016t$Rz*( 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