forked from jmug/stoatchat
feat: update to rAuth v1
This commit is contained in:
@@ -25,8 +25,9 @@ pub fn mount(mut rocket: Rocket<Build>) -> Rocket<Build> {
|
||||
"/channels" => channels::routes(),
|
||||
"/servers" => servers::routes(),
|
||||
"/invites" => invites::routes(),
|
||||
"/auth/account" => rauth::web::account::routes(),
|
||||
"/auth/session" => rauth::web::session::routes(),
|
||||
"/auth/account" => rocket_rauth::routes::account::routes(),
|
||||
"/auth/session" => rocket_rauth::routes::session::routes(),
|
||||
"/auth/mfa" => rocket_rauth::routes::mfa::routes(),
|
||||
"/onboard" => onboard::routes(),
|
||||
"/push" => push::routes(),
|
||||
"/sync" => sync::routes(),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
use crate::util::regex::RE_USERNAME;
|
||||
use revolt_quark::{models::User, Database, EmptyResponse, Error, Result};
|
||||
use revolt_quark::{models::User, rauth::models::Session, Database, EmptyResponse, Error, Result};
|
||||
|
||||
use rauth::entities::Session;
|
||||
use rocket::{serde::json::Json, State};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use validator::Validate;
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
use rauth::entities::Session;
|
||||
use revolt_quark::models::User;
|
||||
use revolt_quark::{models::User, rauth::models::Session};
|
||||
use rocket::serde::json::Json;
|
||||
use serde::Serialize;
|
||||
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
use revolt_quark::{EmptyResponse, Error, Result};
|
||||
|
||||
use rauth::{
|
||||
entities::{Model, Session, WebPushSubscription},
|
||||
logic::Auth,
|
||||
use revolt_quark::{
|
||||
rauth::{
|
||||
models::{Session, WebPushSubscription},
|
||||
RAuth,
|
||||
},
|
||||
EmptyResponse, Error, Result,
|
||||
};
|
||||
|
||||
use rocket::{serde::json::Json, State};
|
||||
|
||||
/// # Push Subscribe
|
||||
@@ -14,13 +16,13 @@ use rocket::{serde::json::Json, State};
|
||||
#[openapi(tag = "Web Push")]
|
||||
#[post("/subscribe", data = "<data>")]
|
||||
pub async fn req(
|
||||
auth: &State<Auth>,
|
||||
rauth: &State<RAuth>,
|
||||
mut session: Session,
|
||||
data: Json<WebPushSubscription>,
|
||||
) -> Result<EmptyResponse> {
|
||||
session.subscription = Some(data.into_inner());
|
||||
session
|
||||
.save(&auth.db, None)
|
||||
.save(&rauth)
|
||||
.await
|
||||
.map(|_| EmptyResponse)
|
||||
.map_err(|_| Error::DatabaseError {
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use revolt_quark::{EmptyResponse, Error, Result};
|
||||
|
||||
use rauth::{
|
||||
entities::{Model, Session},
|
||||
logic::Auth,
|
||||
use revolt_quark::{
|
||||
rauth::{models::Session, RAuth},
|
||||
EmptyResponse, Error, Result,
|
||||
};
|
||||
|
||||
use rocket::State;
|
||||
|
||||
/// # Unsubscribe
|
||||
@@ -11,10 +10,10 @@ use rocket::State;
|
||||
/// Remove the Web Push subscription associated with the current session.
|
||||
#[openapi(tag = "Web Push")]
|
||||
#[post("/unsubscribe")]
|
||||
pub async fn req(auth: &State<Auth>, mut session: Session) -> Result<EmptyResponse> {
|
||||
pub async fn req(rauth: &State<RAuth>, mut session: Session) -> Result<EmptyResponse> {
|
||||
session.subscription = None;
|
||||
session
|
||||
.save(&auth.db, None)
|
||||
.save(&rauth)
|
||||
.await
|
||||
.map(|_| EmptyResponse)
|
||||
.map_err(|_| Error::DatabaseError {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
use revolt_quark::models::User;
|
||||
use revolt_quark::r#impl::generic::users::user_settings::UserSettingsImpl;
|
||||
use revolt_quark::r#impl::UserSettingsImpl;
|
||||
use revolt_quark::{Db, EmptyResponse, Result};
|
||||
|
||||
use chrono::prelude::*;
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
use crate::util::regex::RE_USERNAME;
|
||||
use rauth::entities::Account;
|
||||
use revolt_quark::{models::User, Database, Error, Result};
|
||||
use revolt_quark::{models::User, rauth::models::Account, Database, Error, Result};
|
||||
use rocket::{serde::json::Json, State};
|
||||
use serde::{Deserialize, Serialize};
|
||||
use validator::Validate;
|
||||
|
||||
Reference in New Issue
Block a user