2022-09-24 10:23:54 +00:00
|
|
|
mod routes;
|
|
|
|
mod sbot;
|
2022-09-24 16:31:21 +00:00
|
|
|
mod utils;
|
2022-09-27 17:19:24 +00:00
|
|
|
mod db;
|
|
|
|
|
|
|
|
use xdg::BaseDirectories;
|
|
|
|
|
2022-09-24 10:13:08 +00:00
|
|
|
|
2022-09-24 10:23:54 +00:00
|
|
|
use rocket::{launch, routes};
|
2022-09-24 14:53:52 +00:00
|
|
|
use rocket_dyn_templates::Template;
|
2022-09-24 10:13:08 +00:00
|
|
|
|
2022-09-27 17:19:24 +00:00
|
|
|
use crate::{db::Database, routes::*};
|
2022-09-24 09:53:36 +00:00
|
|
|
|
|
|
|
#[launch]
|
|
|
|
async fn rocket() -> _ {
|
2022-09-27 17:19:24 +00:00
|
|
|
|
|
|
|
let xdg_dirs = BaseDirectories::with_prefix("lykin").unwrap();
|
|
|
|
|
|
|
|
let db_path = xdg_dirs
|
|
|
|
.place_config_file("database")
|
|
|
|
.expect("Cannot create database directory");
|
|
|
|
|
|
|
|
let db = Database::init(&db_path);
|
|
|
|
|
2022-09-24 14:53:52 +00:00
|
|
|
rocket::build()
|
2022-09-27 17:19:24 +00:00
|
|
|
.manage(db)
|
2022-09-24 14:53:52 +00:00
|
|
|
.attach(Template::fairing())
|
2022-09-28 16:52:49 +00:00
|
|
|
.mount("/", routes![home, subscribe_form, unsubscribe_form, about_start, about_form])
|
2022-09-24 09:42:02 +00:00
|
|
|
}
|