From 8e1d34595abeaf650faf871344f5586fcdc8d643 Mon Sep 17 00:00:00 2001 From: SadlyNotSappho Date: Tue, 6 Feb 2024 14:41:29 -0800 Subject: [PATCH] fix crash on first startup due to making admin account, and allow creation of new users through a ui --- src/main.rs | 91 +++++++++++++--------------------- src/tables.rs | 14 +++--- web/createuser.html | 50 +++++++++++++++++++ web/{index.html => login.html} | 5 +- 4 files changed, 94 insertions(+), 66 deletions(-) create mode 100644 web/createuser.html rename web/{index.html => login.html} (91%) diff --git a/src/main.rs b/src/main.rs index 83e7829..c4ba40e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,4 +1,5 @@ use rocket::fairing::AdHoc; +use rocket::fs::FileServer; use rocket::http::Status; use rocket::response::content::{self, RawHtml}; use rocket::{Build, Request, Rocket}; @@ -15,29 +16,18 @@ use rocket_db_pools::{ }; use rocket::serde::{json::Json, Deserialize}; -use rocket::{ - fs::FileServer, - http::CookieJar, - tokio::time::{sleep, Duration}, -}; +use rocket::http::CookieJar; use fossil::tables::{Db, Post, User}; -#[get("/")] -fn hello() -> RawHtml { - content::RawHtml(fs::read_to_string("/srv/web/index.html").unwrap()) - // format!("hi!!!") +#[get("/login")] +fn login_page() -> RawHtml { + content::RawHtml(fs::read_to_string("/srv/web/login.html").unwrap()) } -#[get("/book//")] -fn get_book(card: String, isbn: String) -> String { - format!("You're checking out the book {isbn}, with the account {card}.") -} - -#[get("/delay/