Big repository reorganization
The code is divided in three crates: - plume-common, for the ActivityPub module, and some common utils - plume-models, for the models and database-related code - plume, the app itself This new organization will allow to test it more easily, but also to create other tools that only reuse a little part of the code (for instance a Wordpress import tool, that would just use the plume-models crate)
This commit is contained in:
+4
-4
@@ -6,16 +6,16 @@ use rocket::{
|
||||
use rocket_contrib::Template;
|
||||
use serde_json;
|
||||
|
||||
use activity_pub::ActivityStream;
|
||||
use db_conn::DbConn;
|
||||
use models::{
|
||||
use plume_common::activity_pub::ActivityStream;
|
||||
use plume_common::utils;
|
||||
use plume_models::{
|
||||
blog_authors::*,
|
||||
blogs::*,
|
||||
db_conn::DbConn,
|
||||
instance::Instance,
|
||||
posts::Post,
|
||||
users::User
|
||||
};
|
||||
use utils;
|
||||
|
||||
#[get("/~/<name>", rank = 2)]
|
||||
fn details(name: String, conn: DbConn, user: Option<User>) -> Template {
|
||||
|
||||
@@ -4,15 +4,16 @@ use rocket::{
|
||||
};
|
||||
use serde_json;
|
||||
|
||||
use activity_pub::{broadcast, inbox::Inbox};
|
||||
use db_conn::DbConn;
|
||||
use models::{
|
||||
use plume_common::activity_pub::broadcast;
|
||||
use plume_models::{
|
||||
blogs::Blog,
|
||||
comments::*,
|
||||
db_conn::DbConn,
|
||||
instance::Instance,
|
||||
posts::Post,
|
||||
users::User
|
||||
};
|
||||
use inbox::Inbox;
|
||||
|
||||
#[derive(FromForm)]
|
||||
pub struct CommentQuery {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
use rocket_contrib::Template;
|
||||
use rocket::Request;
|
||||
use rocket::request::FromRequest;
|
||||
use models::users::User;
|
||||
use plume_models::users::User;
|
||||
|
||||
#[catch(404)]
|
||||
fn not_found(req: &Request) -> Template {
|
||||
|
||||
@@ -2,14 +2,14 @@ use gettextrs::gettext;
|
||||
use rocket_contrib::{Json, Template};
|
||||
use serde_json;
|
||||
|
||||
use activity_pub::inbox::Inbox;
|
||||
use db_conn::DbConn;
|
||||
use models::{
|
||||
use plume_models::{
|
||||
comments::Comment,
|
||||
db_conn::DbConn,
|
||||
posts::Post,
|
||||
users::User,
|
||||
instance::*
|
||||
};
|
||||
use inbox::Inbox;
|
||||
|
||||
#[get("/")]
|
||||
fn index(conn: DbConn, user: Option<User>) -> Template {
|
||||
|
||||
+4
-5
@@ -1,16 +1,15 @@
|
||||
use rocket::response::{Redirect, Flash};
|
||||
|
||||
use activity_pub::{broadcast, inbox::Notify};
|
||||
use db_conn::DbConn;
|
||||
use models::{
|
||||
use plume_common::activity_pub::{broadcast, inbox::Notify};
|
||||
use plume_common::utils;
|
||||
use plume_models::{
|
||||
blogs::Blog,
|
||||
db_conn::DbConn,
|
||||
likes,
|
||||
posts::Post,
|
||||
users::User
|
||||
};
|
||||
|
||||
use utils;
|
||||
|
||||
#[get("/~/<blog>/<slug>/like")]
|
||||
fn create(blog: String, slug: String, user: User, conn: DbConn) -> Redirect {
|
||||
let b = Blog::find_by_fqn(&*conn, blog.clone()).unwrap();
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
use rocket::response::{Redirect, Flash};
|
||||
use rocket_contrib::Template;
|
||||
|
||||
use db_conn::DbConn;
|
||||
use models::{notifications::Notification, users::User};
|
||||
|
||||
use utils;
|
||||
use plume_common::utils;
|
||||
use plume_models::{db_conn::DbConn, notifications::Notification, users::User};
|
||||
|
||||
#[get("/notifications")]
|
||||
fn notifications(conn: DbConn, user: User) -> Template {
|
||||
|
||||
+5
-5
@@ -5,19 +5,19 @@ use rocket::response::{Redirect, Flash};
|
||||
use rocket_contrib::Template;
|
||||
use serde_json;
|
||||
|
||||
use activity_pub::{broadcast, ActivityStream};
|
||||
use db_conn::DbConn;
|
||||
use models::{
|
||||
use plume_common::activity_pub::{broadcast, ActivityStream};
|
||||
use plume_common::utils;
|
||||
use plume_models::{
|
||||
blogs::*,
|
||||
db_conn::DbConn,
|
||||
comments::Comment,
|
||||
mentions::Mention,
|
||||
post_authors::*,
|
||||
posts::*,
|
||||
safe_string::SafeString,
|
||||
users::User
|
||||
};
|
||||
use routes::comments::CommentQuery;
|
||||
use safe_string::SafeString;
|
||||
use utils;
|
||||
|
||||
// See: https://github.com/SergioBenitez/Rocket/pull/454
|
||||
#[get("/~/<blog>/<slug>", rank = 4)]
|
||||
|
||||
@@ -1,16 +1,15 @@
|
||||
use rocket::response::{Redirect, Flash};
|
||||
|
||||
use activity_pub::{broadcast, inbox::Notify};
|
||||
use db_conn::DbConn;
|
||||
use models::{
|
||||
use plume_common::activity_pub::{broadcast, inbox::Notify};
|
||||
use plume_common::utils;
|
||||
use plume_models::{
|
||||
blogs::Blog,
|
||||
db_conn::DbConn,
|
||||
posts::Post,
|
||||
reshares::*,
|
||||
users::User
|
||||
};
|
||||
|
||||
use utils;
|
||||
|
||||
#[get("/~/<blog>/<slug>/reshare")]
|
||||
fn create(blog: String, slug: String, user: User, conn: DbConn) -> Redirect {
|
||||
let b = Blog::find_by_fqn(&*conn, blog.clone()).unwrap();
|
||||
|
||||
@@ -6,8 +6,10 @@ use rocket::{
|
||||
};
|
||||
use rocket_contrib::Template;
|
||||
|
||||
use db_conn::DbConn;
|
||||
use models::users::{User, AUTH_COOKIE};
|
||||
use plume_models::{
|
||||
db_conn::DbConn,
|
||||
users::{User, AUTH_COOKIE}
|
||||
};
|
||||
|
||||
#[get("/login")]
|
||||
fn new(user: Option<User>) -> Template {
|
||||
|
||||
+6
-5
@@ -8,20 +8,21 @@ use rocket::{request::Form,
|
||||
use rocket_contrib::Template;
|
||||
use serde_json;
|
||||
|
||||
use activity_pub::{
|
||||
use plume_common::activity_pub::{
|
||||
ActivityStream, broadcast, Id, IntoId,
|
||||
inbox::{Inbox, Notify}
|
||||
inbox::{Notify}
|
||||
};
|
||||
use db_conn::DbConn;
|
||||
use models::{
|
||||
use plume_common::utils;
|
||||
use plume_models::{
|
||||
blogs::Blog,
|
||||
db_conn::DbConn,
|
||||
follows,
|
||||
instance::Instance,
|
||||
posts::Post,
|
||||
reshares::Reshare,
|
||||
users::*
|
||||
};
|
||||
use utils;
|
||||
use inbox::Inbox;
|
||||
|
||||
#[get("/me")]
|
||||
fn me(user: Option<User>) -> Result<Redirect, Flash<Redirect>> {
|
||||
|
||||
@@ -3,10 +3,8 @@ use rocket::response::Content;
|
||||
use serde_json;
|
||||
use webfinger::*;
|
||||
|
||||
use BASE_URL;
|
||||
use activity_pub::ap_url;
|
||||
use db_conn::DbConn;
|
||||
use models::{blogs::Blog, users::User};
|
||||
use plume_common::activity_pub::ap_url;
|
||||
use plume_models::{BASE_URL, db_conn::DbConn, blogs::Blog, users::User};
|
||||
|
||||
#[get("/.well-known/nodeinfo")]
|
||||
fn nodeinfo() -> Content<String> {
|
||||
|
||||
Reference in New Issue
Block a user