flabk/src/main.rs

51 lines
1.1 KiB
Rust

mod database;
mod model;
mod sec;
mod servek;
mod svc;
use database::db::DB;
use serde::{Deserialize, Serialize};
use servek::servek::Server;
use svc::{auth::Auth, profiles::Profiler};
#[derive(Clone, Copy, Serialize, Deserialize)]
pub enum ActivityKind {
Create,
Like,
Note,
}
#[derive(Clone, Serialize, Deserialize)]
pub struct ActivityLD {
pub context_uri: String,
pub kind: ActivityKind,
pub actor_uri: String,
pub to_uris: Vec<String>,
pub object: Option<ObjectLD>,
}
#[derive(Clone, Serialize, Deserialize)]
pub struct ObjectLD {
pub context_uri: String,
pub id: Option<String>,
pub kind: Option<ActivityKind>,
pub attributed_to: Option<String>,
pub published: Option<String>,
pub content: Option<String>,
}
#[tokio::main]
async fn main() -> Result<(), anyhow::Error> {
let db = DB::new(
"localhost".to_owned(),
"flabk".to_owned(),
"flabk".to_owned(),
)
.await?;
let profiler = Profiler::new(db.users());
let auth = Auth::new(db.keys(), db.users()).await;
Server::new(profiler, auth).listen_and_serve(8008).await;
Ok(())
}