set up rocket server

This commit is contained in:
cel 🌸 2023-01-15 21:43:21 +00:00
parent 4a860896c2
commit 1280b8d6a2
Signed by: cel
GPG Key ID: 48E29AF13B5F1349
107 changed files with 3231 additions and 0 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/target

1
.rustfmt.toml Normal file
View File

@ -0,0 +1 @@
edition = "2021"

2611
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

12
Cargo.toml Normal file
View File

@ -0,0 +1,12 @@
[package]
name = "site"
version = "0.1.0"
edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
rocket = { version = "0.5.0-rc.2", features = ["json"] }
reqwest = { version = "0.11", features = ["json"] }
tokio = { version = "1", features = ["full"] }
rocket_dyn_templates = { version = "0.1.0-rc.2", features = ["tera"] }

46
src/main.rs Normal file
View File

@ -0,0 +1,46 @@
use rocket::fs::{relative, FileServer};
use rocket::{response::Responder, serde::json::Json};
use rocket_dyn_templates::{context, Template};
#[macro_use]
extern crate rocket;
#[get("/")]
async fn home() -> Template {
Template::render("home", context! { is_live: true, is_scrobbling: true })
}
#[get("/contact")]
async fn contact() -> Template {
Template::render("contact", context! {})
}
// #[get("/test")]
// async fn test() -> Result<Template, BlossomError> {
// let posts = reqwest::get("https://skinnyver.se/api/v1/accounts/cel/statuses").await;
// posts
// }
#[tokio::main]
async fn main() -> Result<(), rocket::Error> {
let _rocket = rocket::build()
.attach(Template::fairing())
.mount("/", routes![home, contact])
.mount("/", FileServer::from(relative!("static")))
.launch()
.await?;
Ok(())
}
#[derive(Responder)]
enum BlossomError {
#[response(status = 500)]
Reqwest(&'static str, #[response(ignore)] reqwest::Error),
}
impl From<reqwest::Error> for BlossomError {
fn from(e: reqwest::Error) -> Self {
BlossomError::Reqwest("reqwest error", e)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

12
static/fonts.css Normal file
View File

@ -0,0 +1,12 @@
@font-face {
font-family: kaerukaeru;
src: url('/fonts/kaerukaeru-Regular.woff2') format('woff2'),
url('/fonts/kaerukaeru-Regular.woff') format('woff');
}
@font-face {
font-family: Louise;
src: url('/fonts/Louise-Regular.woff2') format('woff2'),
url('/fonts/Louise-Regular.woff') format('woff');
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
static/fonts/FT88-Bold.woff Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
static/fonts/Go-Mono.ttf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
static/fonts/Steps-Mono.otf Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
static/fonts/ukikusa.ttf Normal file

Binary file not shown.

BIN
static/quinntyping.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 938 KiB

Some files were not shown because too many files have changed in this diff Show More