forked from jmug/stoatchat
feat(routes/users): implement fetch_self
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -3017,6 +3017,7 @@ version = "0.1.0"
|
||||
dependencies = [
|
||||
"async-std",
|
||||
"async-trait",
|
||||
"bitfield",
|
||||
"impl_ops",
|
||||
"lazy_static",
|
||||
"log",
|
||||
@@ -3024,6 +3025,7 @@ dependencies = [
|
||||
"num_enum",
|
||||
"ops",
|
||||
"optional_struct",
|
||||
"rauth",
|
||||
"rocket",
|
||||
"serde",
|
||||
"validator 0.14.0",
|
||||
|
||||
16
src/main.rs
16
src/main.rs
@@ -29,6 +29,7 @@ use rauth::{
|
||||
config::{Captcha, Config, EmailVerification, SMTPSettings, Template, Templates},
|
||||
logic::Auth,
|
||||
};
|
||||
use revolt_quark::DatabaseInfo;
|
||||
use std::str::FromStr;
|
||||
use rocket_cors::AllowedOrigins;
|
||||
/*use util::variables::{
|
||||
@@ -128,13 +129,20 @@ async fn launch_web() {
|
||||
};
|
||||
}*/
|
||||
|
||||
//let auth = Auth::new(database::get_db(), config);
|
||||
let db = DatabaseInfo::Dummy.connect().await.unwrap();
|
||||
|
||||
let mongo_db = mongodb::Client::with_uri_str("mongodb://localhost")
|
||||
.await
|
||||
.expect("Failed to init db connection.");
|
||||
|
||||
let auth = Auth::new(mongo_db.database("revolt"), config);
|
||||
let rocket = rocket::build();
|
||||
routes::mount(rocket)
|
||||
.mount("/", rocket_cors::catch_all_options_routes())
|
||||
//.mount("/auth/account", rauth::web::account::routes())
|
||||
//.mount("/auth/session", rauth::web::session::routes())
|
||||
//.manage(auth)
|
||||
.mount("/auth/account", rauth::web::account::routes())
|
||||
.mount("/auth/session", rauth::web::session::routes())
|
||||
.manage(auth)
|
||||
.manage(db)
|
||||
.manage(cors.clone())
|
||||
//.manage(RatelimitState::new())
|
||||
.attach(cors)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use revolt_quark::Result;
|
||||
use revolt_quark::models::User;
|
||||
|
||||
use rocket::serde::json::{Json, Value};
|
||||
use rocket::serde::json::Json;
|
||||
|
||||
#[get("/@me")]
|
||||
pub async fn req(user: User) -> Result<Json<User>> {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
use revolt_quark::{Error, Result};
|
||||
use revolt_quark::{Ref, Result, models::User};
|
||||
|
||||
use rocket::serde::json::Value;
|
||||
|
||||
#[get("/<target>")]
|
||||
pub async fn req(user: User, target: User, target: String) -> Result<Value> {
|
||||
pub async fn req(user: User, target: Ref) -> Result<Value> {
|
||||
todo!()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user