add static files

we have a favicon now :')

Signed-off-by: Gunwant Jain <mail@wantguns.dev>
This commit is contained in:
Gunwant Jain 2021-07-13 03:40:58 +05:30
parent 1175a57539
commit c6262e9e87
10 changed files with 12 additions and 2 deletions

View File

@ -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,

View File

@ -3,4 +3,5 @@ pub mod pretty_retrieve;
pub mod pretty_retrieve_ext;
pub mod submit;
pub mod upload;
pub mod retrieve;
pub mod retrieve;
pub mod static_files;

View File

@ -0,0 +1,7 @@
use std::path::{Path, PathBuf};
use rocket::fs::NamedFile;
#[get("/<file..>", rank = 3)]
pub async fn static_files(file: PathBuf) -> Option<NamedFile> {
NamedFile::open(Path::new("static/").join(file)).await.ok()
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 593 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
static/apple-touch-icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 563 B

BIN
static/favicon-16x16.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 83 B

BIN
static/favicon-32x32.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 B

BIN
static/favicon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 15 KiB

1
static/site.webmanifest Normal file
View File

@ -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"}