mirror of
https://github.com/Nutomic/ibis.git
synced 2024-12-04 19:01:13 +00:00
Use nightly cargo fmt for better imports formatting
This commit is contained in:
parent
b2b20dcd2a
commit
d5ce966ea1
53 changed files with 613 additions and 442 deletions
4
.rustfmt.toml
Normal file
4
.rustfmt.toml
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
edition = "2021"
|
||||||
|
imports_layout = "HorizontalVertical"
|
||||||
|
imports_granularity = "Crate"
|
||||||
|
group_imports = "One"
|
|
@ -3,13 +3,14 @@ variables:
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
cargo_fmt:
|
cargo_fmt:
|
||||||
image: *rust_image
|
image: rustlang/rust:nightly
|
||||||
environment:
|
environment:
|
||||||
# store cargo data in repo folder so that it gets cached between steps
|
# store cargo data in repo folder so that it gets cached between steps
|
||||||
CARGO_HOME: .cargo_home
|
CARGO_HOME: .cargo_home
|
||||||
commands:
|
commands:
|
||||||
- rustup component add rustfmt
|
- rustup component add rustfmt
|
||||||
- cargo fmt -- --check
|
- cargo +nightly fmt -- --check
|
||||||
|
|
||||||
|
|
||||||
check_config_defaults_updated:
|
check_config_defaults_updated:
|
||||||
image: *rust_image
|
image: *rust_image
|
||||||
|
|
|
@ -1,27 +1,38 @@
|
||||||
use crate::backend::database::article::DbArticleForm;
|
use crate::{
|
||||||
use crate::backend::database::conflict::{DbConflict, DbConflictForm};
|
backend::{
|
||||||
use crate::backend::database::edit::DbEditForm;
|
database::{
|
||||||
use crate::backend::database::IbisData;
|
article::DbArticleForm,
|
||||||
use crate::backend::error::MyResult;
|
conflict::{DbConflict, DbConflictForm},
|
||||||
use crate::backend::federation::activities::create_article::CreateArticle;
|
edit::DbEditForm,
|
||||||
use crate::backend::federation::activities::submit_article_update;
|
IbisData,
|
||||||
use crate::backend::utils::generate_article_version;
|
},
|
||||||
use crate::common::utils::extract_domain;
|
error::MyResult,
|
||||||
use crate::common::utils::http_protocol_str;
|
federation::activities::{create_article::CreateArticle, submit_article_update},
|
||||||
use crate::common::validation::can_edit_article;
|
utils::generate_article_version,
|
||||||
use crate::common::{ApiConflict, ResolveObject};
|
},
|
||||||
use crate::common::{ArticleView, DbArticle, DbEdit};
|
common::{
|
||||||
use crate::common::{CreateArticleForm, EditArticleForm, EditVersion, ForkArticleForm};
|
utils::{extract_domain, http_protocol_str},
|
||||||
use crate::common::{DbInstance, SearchArticleForm};
|
validation::can_edit_article,
|
||||||
use crate::common::{GetArticleForm, ListArticlesForm};
|
ApiConflict,
|
||||||
use crate::common::{LocalUserView, ProtectArticleForm};
|
ArticleView,
|
||||||
use activitypub_federation::config::Data;
|
CreateArticleForm,
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
DbArticle,
|
||||||
|
DbEdit,
|
||||||
|
DbInstance,
|
||||||
|
EditArticleForm,
|
||||||
|
EditVersion,
|
||||||
|
ForkArticleForm,
|
||||||
|
GetArticleForm,
|
||||||
|
ListArticlesForm,
|
||||||
|
LocalUserView,
|
||||||
|
ProtectArticleForm,
|
||||||
|
ResolveObject,
|
||||||
|
SearchArticleForm,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
use activitypub_federation::{config::Data, fetch::object_id::ObjectId};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use axum::extract::Query;
|
use axum::{extract::Query, Extension, Form, Json};
|
||||||
use axum::Extension;
|
|
||||||
use axum::Form;
|
|
||||||
use axum::Json;
|
|
||||||
use axum_macros::debug_handler;
|
use axum_macros::debug_handler;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use diffy::create_patch;
|
use diffy::create_patch;
|
||||||
|
|
|
@ -1,13 +1,9 @@
|
||||||
use crate::backend::database::IbisData;
|
use crate::{
|
||||||
use crate::backend::error::MyResult;
|
backend::{database::IbisData, error::MyResult, federation::activities::follow::Follow},
|
||||||
use crate::backend::federation::activities::follow::Follow;
|
common::{DbInstance, FollowInstance, InstanceView, LocalUserView, ResolveObject},
|
||||||
use crate::common::{DbInstance, InstanceView, ResolveObject};
|
};
|
||||||
use crate::common::{FollowInstance, LocalUserView};
|
use activitypub_federation::{config::Data, fetch::object_id::ObjectId};
|
||||||
use activitypub_federation::config::Data;
|
use axum::{extract::Query, Extension, Form, Json};
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
|
||||||
use axum::extract::Query;
|
|
||||||
use axum::Extension;
|
|
||||||
use axum::{Form, Json};
|
|
||||||
use axum_macros::debug_handler;
|
use axum_macros::debug_handler;
|
||||||
|
|
||||||
/// Retrieve the local instance info.
|
/// Retrieve the local instance info.
|
||||||
|
|
|
@ -1,29 +1,42 @@
|
||||||
use crate::backend::api::article::protect_article;
|
use crate::{
|
||||||
use crate::backend::api::article::{
|
backend::{
|
||||||
create_article, list_articles, resolve_article, search_article,
|
api::{
|
||||||
|
article::{
|
||||||
|
create_article,
|
||||||
|
edit_article,
|
||||||
|
fork_article,
|
||||||
|
get_article,
|
||||||
|
list_articles,
|
||||||
|
protect_article,
|
||||||
|
resolve_article,
|
||||||
|
search_article,
|
||||||
|
},
|
||||||
|
instance::{follow_instance, get_local_instance, resolve_instance},
|
||||||
|
user::{
|
||||||
|
get_user,
|
||||||
|
login_user,
|
||||||
|
logout_user,
|
||||||
|
my_profile,
|
||||||
|
register_user,
|
||||||
|
validate,
|
||||||
|
AUTH_COOKIE,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
database::{conflict::DbConflict, IbisData},
|
||||||
|
error::MyResult,
|
||||||
|
},
|
||||||
|
common::{ApiConflict, LocalUserView},
|
||||||
};
|
};
|
||||||
use crate::backend::api::article::{edit_article, fork_article, get_article};
|
|
||||||
use crate::backend::api::instance::get_local_instance;
|
|
||||||
use crate::backend::api::instance::{follow_instance, resolve_instance};
|
|
||||||
use crate::backend::api::user::validate;
|
|
||||||
use crate::backend::api::user::{get_user, register_user};
|
|
||||||
use crate::backend::api::user::{login_user, logout_user};
|
|
||||||
use crate::backend::api::user::{my_profile, AUTH_COOKIE};
|
|
||||||
use crate::backend::database::conflict::DbConflict;
|
|
||||||
use crate::backend::database::IbisData;
|
|
||||||
use crate::backend::error::MyResult;
|
|
||||||
use crate::common::ApiConflict;
|
|
||||||
use crate::common::LocalUserView;
|
|
||||||
use activitypub_federation::config::Data;
|
use activitypub_federation::config::Data;
|
||||||
use axum::routing::{get, post};
|
|
||||||
use axum::{
|
use axum::{
|
||||||
http::Request,
|
http::{Request, StatusCode},
|
||||||
http::StatusCode,
|
|
||||||
middleware::{self, Next},
|
middleware::{self, Next},
|
||||||
response::Response,
|
response::Response,
|
||||||
|
routing::{get, post},
|
||||||
Extension,
|
Extension,
|
||||||
|
Json,
|
||||||
|
Router,
|
||||||
};
|
};
|
||||||
use axum::{Json, Router};
|
|
||||||
use axum_extra::extract::CookieJar;
|
use axum_extra::extract::CookieJar;
|
||||||
use axum_macros::debug_handler;
|
use axum_macros::debug_handler;
|
||||||
use futures::future::try_join_all;
|
use futures::future::try_join_all;
|
||||||
|
|
|
@ -1,18 +1,26 @@
|
||||||
use crate::backend::database::{read_jwt_secret, IbisData};
|
use crate::{
|
||||||
use crate::backend::error::MyResult;
|
backend::{
|
||||||
use crate::common::{DbPerson, GetUserForm, LocalUserView, LoginUserForm, RegisterUserForm};
|
database::{read_jwt_secret, IbisData},
|
||||||
|
error::MyResult,
|
||||||
|
},
|
||||||
|
common::{DbPerson, GetUserForm, LocalUserView, LoginUserForm, RegisterUserForm},
|
||||||
|
};
|
||||||
use activitypub_federation::config::Data;
|
use activitypub_federation::config::Data;
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use axum::extract::Query;
|
use axum::{extract::Query, Form, Json};
|
||||||
use axum::{Form, Json};
|
|
||||||
use axum_extra::extract::cookie::{Cookie, CookieJar, Expiration, SameSite};
|
use axum_extra::extract::cookie::{Cookie, CookieJar, Expiration, SameSite};
|
||||||
use axum_macros::debug_handler;
|
use axum_macros::debug_handler;
|
||||||
use bcrypt::verify;
|
use bcrypt::verify;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
use jsonwebtoken::DecodingKey;
|
use jsonwebtoken::{
|
||||||
use jsonwebtoken::Validation;
|
decode,
|
||||||
use jsonwebtoken::{decode, get_current_timestamp};
|
encode,
|
||||||
use jsonwebtoken::{encode, EncodingKey, Header};
|
get_current_timestamp,
|
||||||
|
DecodingKey,
|
||||||
|
EncodingKey,
|
||||||
|
Header,
|
||||||
|
Validation,
|
||||||
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use time::{Duration, OffsetDateTime};
|
use time::{Duration, OffsetDateTime};
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,24 @@
|
||||||
use crate::backend::database::schema::{article, edit, instance};
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::MyResult;
|
database::{
|
||||||
use crate::backend::federation::objects::edits_collection::DbEditCollection;
|
schema::{article, edit, instance},
|
||||||
use crate::common::DbEdit;
|
IbisData,
|
||||||
use crate::common::EditVersion;
|
},
|
||||||
use crate::common::{ArticleView, DbArticle};
|
error::MyResult,
|
||||||
use activitypub_federation::fetch::collection_id::CollectionId;
|
federation::objects::edits_collection::DbEditCollection,
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
},
|
||||||
use diesel::dsl::max;
|
common::{ArticleView, DbArticle, DbEdit, EditVersion},
|
||||||
|
};
|
||||||
use diesel::ExpressionMethods;
|
use activitypub_federation::fetch::{collection_id::CollectionId, object_id::ObjectId};
|
||||||
use diesel::{
|
use diesel::{
|
||||||
insert_into, AsChangeset, BoolExpressionMethods, Insertable, PgTextExpressionMethods, QueryDsl,
|
dsl::max,
|
||||||
|
insert_into,
|
||||||
|
AsChangeset,
|
||||||
|
BoolExpressionMethods,
|
||||||
|
ExpressionMethods,
|
||||||
|
Insertable,
|
||||||
|
PgTextExpressionMethods,
|
||||||
|
QueryDsl,
|
||||||
RunQueryDsl,
|
RunQueryDsl,
|
||||||
};
|
};
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
|
|
@ -1,16 +1,23 @@
|
||||||
use crate::backend::database::schema::conflict;
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::MyResult;
|
database::{schema::conflict, IbisData},
|
||||||
use crate::backend::federation::activities::submit_article_update;
|
error::MyResult,
|
||||||
use crate::backend::utils::generate_article_version;
|
federation::activities::submit_article_update,
|
||||||
use crate::common::DbEdit;
|
utils::generate_article_version,
|
||||||
use crate::common::DbLocalUser;
|
},
|
||||||
use crate::common::EditVersion;
|
common::{ApiConflict, DbArticle, DbEdit, DbLocalUser, EditVersion},
|
||||||
use crate::common::{ApiConflict, DbArticle};
|
};
|
||||||
use activitypub_federation::config::Data;
|
use activitypub_federation::config::Data;
|
||||||
use diesel::ExpressionMethods;
|
|
||||||
use diesel::{
|
use diesel::{
|
||||||
delete, insert_into, Identifiable, Insertable, QueryDsl, Queryable, RunQueryDsl, Selectable,
|
delete,
|
||||||
|
insert_into,
|
||||||
|
ExpressionMethods,
|
||||||
|
Identifiable,
|
||||||
|
Insertable,
|
||||||
|
QueryDsl,
|
||||||
|
Queryable,
|
||||||
|
RunQueryDsl,
|
||||||
|
Selectable,
|
||||||
};
|
};
|
||||||
use diffy::{apply, merge, Patch};
|
use diffy::{apply, merge, Patch};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
use crate::backend::database::schema::{edit, person};
|
use crate::{
|
||||||
use crate::backend::error::MyResult;
|
backend::{
|
||||||
use crate::backend::IbisData;
|
database::schema::{edit, person},
|
||||||
use crate::common::{DbArticle, DbEdit};
|
error::MyResult,
|
||||||
use crate::common::{EditVersion, EditView};
|
IbisData,
|
||||||
|
},
|
||||||
|
common::{DbArticle, DbEdit, EditVersion, EditView},
|
||||||
|
};
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
use activitypub_federation::fetch::object_id::ObjectId;
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use diesel::ExpressionMethods;
|
use diesel::{insert_into, AsChangeset, ExpressionMethods, Insertable, QueryDsl, RunQueryDsl};
|
||||||
use diesel::{insert_into, AsChangeset, Insertable, QueryDsl, RunQueryDsl};
|
|
||||||
use diffy::create_patch;
|
use diffy::create_patch;
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,29 @@
|
||||||
use crate::backend::database::schema::{instance, instance_follow};
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::MyResult;
|
database::{
|
||||||
use crate::backend::federation::objects::articles_collection::DbArticleCollection;
|
schema::{instance, instance_follow},
|
||||||
use crate::common::{DbInstance, DbPerson, InstanceView};
|
IbisData,
|
||||||
use activitypub_federation::config::Data;
|
},
|
||||||
use activitypub_federation::fetch::collection_id::CollectionId;
|
error::MyResult,
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
federation::objects::articles_collection::DbArticleCollection,
|
||||||
|
},
|
||||||
|
common::{DbInstance, DbPerson, InstanceView},
|
||||||
|
};
|
||||||
|
use activitypub_federation::{
|
||||||
|
config::Data,
|
||||||
|
fetch::{collection_id::CollectionId, object_id::ObjectId},
|
||||||
|
};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use diesel::ExpressionMethods;
|
use diesel::{
|
||||||
use diesel::{insert_into, AsChangeset, Insertable, JoinOnDsl, QueryDsl, RunQueryDsl};
|
insert_into,
|
||||||
use std::fmt::Debug;
|
AsChangeset,
|
||||||
use std::ops::DerefMut;
|
ExpressionMethods,
|
||||||
|
Insertable,
|
||||||
|
JoinOnDsl,
|
||||||
|
QueryDsl,
|
||||||
|
RunQueryDsl,
|
||||||
|
};
|
||||||
|
use std::{fmt::Debug, ops::DerefMut};
|
||||||
|
|
||||||
#[derive(Debug, Clone, Insertable, AsChangeset)]
|
#[derive(Debug, Clone, Insertable, AsChangeset)]
|
||||||
#[diesel(table_name = instance, check_for_backend(diesel::pg::Pg))]
|
#[diesel(table_name = instance, check_for_backend(diesel::pg::Pg))]
|
||||||
|
|
|
@ -1,11 +1,10 @@
|
||||||
use crate::backend::config::IbisConfig;
|
use crate::backend::{config::IbisConfig, database::schema::jwt_secret, error::MyResult};
|
||||||
use crate::backend::database::schema::jwt_secret;
|
use diesel::{
|
||||||
use crate::backend::error::MyResult;
|
r2d2::{ConnectionManager, Pool},
|
||||||
use diesel::r2d2::ConnectionManager;
|
PgConnection,
|
||||||
use diesel::r2d2::Pool;
|
QueryDsl,
|
||||||
use diesel::PgConnection;
|
RunQueryDsl,
|
||||||
use diesel::{QueryDsl, RunQueryDsl};
|
};
|
||||||
|
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
|
||||||
pub mod article;
|
pub mod article;
|
||||||
|
|
|
@ -1,18 +1,30 @@
|
||||||
use crate::backend::database::schema::{instance, instance_follow};
|
use crate::{
|
||||||
use crate::backend::database::schema::{local_user, person};
|
backend::{
|
||||||
use crate::backend::database::IbisData;
|
database::{
|
||||||
use crate::backend::error::MyResult;
|
schema::{instance, instance_follow, local_user, person},
|
||||||
use crate::common::utils::http_protocol_str;
|
IbisData,
|
||||||
use crate::common::{DbInstance, DbLocalUser, DbPerson, LocalUserView};
|
},
|
||||||
use activitypub_federation::config::Data;
|
error::MyResult,
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
},
|
||||||
use activitypub_federation::http_signatures::generate_actor_keypair;
|
common::{utils::http_protocol_str, DbInstance, DbLocalUser, DbPerson, LocalUserView},
|
||||||
use bcrypt::hash;
|
};
|
||||||
use bcrypt::DEFAULT_COST;
|
use activitypub_federation::{
|
||||||
|
config::Data,
|
||||||
|
fetch::object_id::ObjectId,
|
||||||
|
http_signatures::generate_actor_keypair,
|
||||||
|
};
|
||||||
|
use bcrypt::{hash, DEFAULT_COST};
|
||||||
use chrono::{DateTime, Local, Utc};
|
use chrono::{DateTime, Local, Utc};
|
||||||
use diesel::{insert_into, AsChangeset, Insertable, RunQueryDsl};
|
use diesel::{
|
||||||
use diesel::{ExpressionMethods, JoinOnDsl};
|
insert_into,
|
||||||
use diesel::{PgTextExpressionMethods, QueryDsl};
|
AsChangeset,
|
||||||
|
ExpressionMethods,
|
||||||
|
Insertable,
|
||||||
|
JoinOnDsl,
|
||||||
|
PgTextExpressionMethods,
|
||||||
|
QueryDsl,
|
||||||
|
RunQueryDsl,
|
||||||
|
};
|
||||||
use std::ops::DerefMut;
|
use std::ops::DerefMut;
|
||||||
|
|
||||||
#[derive(Debug, Clone, Insertable, AsChangeset)]
|
#[derive(Debug, Clone, Insertable, AsChangeset)]
|
||||||
|
|
|
@ -1,11 +1,17 @@
|
||||||
use crate::backend::error::MyResult;
|
use crate::{
|
||||||
use crate::backend::federation::send_activity;
|
backend::{
|
||||||
use crate::backend::utils::generate_activity_id;
|
database::IbisData,
|
||||||
use crate::backend::{database::IbisData, federation::activities::follow::Follow};
|
error::MyResult,
|
||||||
use crate::common::DbInstance;
|
federation::{activities::follow::Follow, send_activity},
|
||||||
use activitypub_federation::traits::Actor;
|
utils::generate_activity_id,
|
||||||
|
},
|
||||||
|
common::DbInstance,
|
||||||
|
};
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data, fetch::object_id::ObjectId, kinds::activity::AcceptType, traits::ActivityHandler,
|
config::Data,
|
||||||
|
fetch::object_id::ObjectId,
|
||||||
|
kinds::activity::AcceptType,
|
||||||
|
traits::{ActivityHandler, Actor},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
use crate::backend::database::IbisData;
|
use crate::{
|
||||||
use crate::backend::error::MyResult;
|
backend::{
|
||||||
use crate::backend::federation::objects::article::ApubArticle;
|
database::IbisData,
|
||||||
use crate::backend::utils::generate_activity_id;
|
error::MyResult,
|
||||||
use crate::common::DbArticle;
|
federation::objects::article::ApubArticle,
|
||||||
use crate::common::DbInstance;
|
utils::generate_activity_id,
|
||||||
use activitypub_federation::kinds::activity::CreateType;
|
},
|
||||||
|
common::{DbArticle, DbInstance},
|
||||||
|
};
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
fetch::object_id::ObjectId,
|
fetch::object_id::ObjectId,
|
||||||
|
kinds::activity::CreateType,
|
||||||
protocol::helpers::deserialize_one_or_many,
|
protocol::helpers::deserialize_one_or_many,
|
||||||
traits::{ActivityHandler, Object},
|
traits::{ActivityHandler, Object},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
use crate::backend::error::MyResult;
|
use crate::{
|
||||||
use crate::backend::federation::send_activity;
|
backend::{
|
||||||
use crate::backend::{
|
database::IbisData,
|
||||||
database::IbisData, federation::activities::accept::Accept, generate_activity_id,
|
error::MyResult,
|
||||||
|
federation::{activities::accept::Accept, send_activity},
|
||||||
|
generate_activity_id,
|
||||||
|
},
|
||||||
|
common::{DbInstance, DbPerson},
|
||||||
};
|
};
|
||||||
use crate::common::DbInstance;
|
|
||||||
use crate::common::DbPerson;
|
|
||||||
use activitypub_federation::protocol::verification::verify_urls_match;
|
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
fetch::object_id::ObjectId,
|
fetch::object_id::ObjectId,
|
||||||
kinds::activity::FollowType,
|
kinds::activity::FollowType,
|
||||||
|
protocol::verification::verify_urls_match,
|
||||||
traits::{ActivityHandler, Actor},
|
traits::{ActivityHandler, Actor},
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
use crate::backend::database::edit::DbEditForm;
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::Error;
|
database::{edit::DbEditForm, IbisData},
|
||||||
use crate::backend::federation::activities::update_local_article::UpdateLocalArticle;
|
error::Error,
|
||||||
use crate::backend::federation::activities::update_remote_article::UpdateRemoteArticle;
|
federation::activities::{
|
||||||
use crate::common::DbInstance;
|
update_local_article::UpdateLocalArticle,
|
||||||
use crate::common::EditVersion;
|
update_remote_article::UpdateRemoteArticle,
|
||||||
use crate::common::{DbArticle, DbEdit};
|
},
|
||||||
|
},
|
||||||
|
common::{DbArticle, DbEdit, DbInstance, EditVersion},
|
||||||
|
};
|
||||||
use activitypub_federation::config::Data;
|
use activitypub_federation::config::Data;
|
||||||
use chrono::Utc;
|
use chrono::Utc;
|
||||||
|
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
use crate::backend::database::conflict::{DbConflict, DbConflictForm};
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::MyResult;
|
database::{
|
||||||
use crate::backend::federation::objects::edit::ApubEdit;
|
conflict::{DbConflict, DbConflictForm},
|
||||||
use crate::backend::utils::generate_activity_id;
|
IbisData,
|
||||||
use crate::common::DbInstance;
|
},
|
||||||
use crate::common::EditVersion;
|
error::MyResult,
|
||||||
use activitypub_federation::kinds::activity::RejectType;
|
federation::{objects::edit::ApubEdit, send_activity},
|
||||||
|
utils::generate_activity_id,
|
||||||
|
},
|
||||||
|
common::{DbInstance, EditVersion},
|
||||||
|
};
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data, fetch::object_id::ObjectId, protocol::helpers::deserialize_one_or_many,
|
config::Data,
|
||||||
|
fetch::object_id::ObjectId,
|
||||||
|
kinds::activity::RejectType,
|
||||||
|
protocol::helpers::deserialize_one_or_many,
|
||||||
traits::ActivityHandler,
|
traits::ActivityHandler,
|
||||||
};
|
};
|
||||||
|
|
||||||
use crate::backend::federation::send_activity;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
use crate::backend::database::IbisData;
|
use crate::{
|
||||||
use crate::backend::error::MyResult;
|
backend::{
|
||||||
use crate::backend::federation::objects::article::ApubArticle;
|
database::IbisData,
|
||||||
|
error::MyResult,
|
||||||
use crate::backend::utils::generate_activity_id;
|
federation::objects::article::ApubArticle,
|
||||||
use crate::common::DbArticle;
|
utils::generate_activity_id,
|
||||||
use crate::common::DbInstance;
|
},
|
||||||
use activitypub_federation::kinds::activity::UpdateType;
|
common::{DbArticle, DbInstance},
|
||||||
|
};
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
fetch::object_id::ObjectId,
|
fetch::object_id::ObjectId,
|
||||||
|
kinds::activity::UpdateType,
|
||||||
protocol::helpers::deserialize_one_or_many,
|
protocol::helpers::deserialize_one_or_many,
|
||||||
traits::{ActivityHandler, Object},
|
traits::{ActivityHandler, Object},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,19 +1,20 @@
|
||||||
use crate::backend::database::IbisData;
|
use crate::{
|
||||||
use crate::backend::error::MyResult;
|
backend::{
|
||||||
|
database::IbisData,
|
||||||
use crate::backend::federation::activities::reject::RejectEdit;
|
error::MyResult,
|
||||||
use crate::backend::federation::activities::update_local_article::UpdateLocalArticle;
|
federation::{
|
||||||
use crate::backend::federation::objects::edit::ApubEdit;
|
activities::{reject::RejectEdit, update_local_article::UpdateLocalArticle},
|
||||||
use crate::backend::federation::send_activity;
|
objects::edit::ApubEdit,
|
||||||
use crate::backend::utils::generate_activity_id;
|
send_activity,
|
||||||
use crate::common::validation::can_edit_article;
|
},
|
||||||
use crate::common::DbArticle;
|
utils::generate_activity_id,
|
||||||
use crate::common::DbEdit;
|
},
|
||||||
use crate::common::DbInstance;
|
common::{validation::can_edit_article, DbArticle, DbEdit, DbInstance},
|
||||||
use activitypub_federation::kinds::activity::UpdateType;
|
};
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
fetch::object_id::ObjectId,
|
fetch::object_id::ObjectId,
|
||||||
|
kinds::activity::UpdateType,
|
||||||
protocol::helpers::deserialize_one_or_many,
|
protocol::helpers::deserialize_one_or_many,
|
||||||
traits::{ActivityHandler, Object},
|
traits::{ActivityHandler, Object},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
use crate::backend::config::IbisConfig;
|
use crate::backend::{config::IbisConfig, database::IbisData};
|
||||||
use crate::backend::database::IbisData;
|
use activitypub_federation::{
|
||||||
use activitypub_federation::activity_queue::queue_activity;
|
activity_queue::queue_activity,
|
||||||
use activitypub_federation::config::{Data, UrlVerifier};
|
config::{Data, UrlVerifier},
|
||||||
use activitypub_federation::error::Error as ActivityPubError;
|
error::Error as ActivityPubError,
|
||||||
use activitypub_federation::protocol::context::WithContext;
|
protocol::context::WithContext,
|
||||||
use activitypub_federation::traits::{ActivityHandler, Actor};
|
traits::{ActivityHandler, Actor},
|
||||||
|
};
|
||||||
use async_trait::async_trait;
|
use async_trait::async_trait;
|
||||||
use serde::Serialize;
|
use serde::Serialize;
|
||||||
use std::fmt::Debug;
|
use std::fmt::Debug;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
use crate::backend::database::article::DbArticleForm;
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::Error;
|
database::{article::DbArticleForm, IbisData},
|
||||||
use crate::backend::federation::objects::edits_collection::DbEditCollection;
|
error::Error,
|
||||||
use crate::common::DbArticle;
|
federation::objects::edits_collection::DbEditCollection,
|
||||||
use crate::common::DbInstance;
|
},
|
||||||
use crate::common::EditVersion;
|
common::{DbArticle, DbInstance, EditVersion},
|
||||||
use activitypub_federation::config::Data;
|
};
|
||||||
use activitypub_federation::fetch::collection_id::CollectionId;
|
|
||||||
use activitypub_federation::kinds::object::ArticleType;
|
|
||||||
use activitypub_federation::kinds::public;
|
|
||||||
use activitypub_federation::protocol::verification::verify_domains_match;
|
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
fetch::object_id::ObjectId, protocol::helpers::deserialize_one_or_many, traits::Object,
|
config::Data,
|
||||||
|
fetch::{collection_id::CollectionId, object_id::ObjectId},
|
||||||
|
kinds::{object::ArticleType, public},
|
||||||
|
protocol::{helpers::deserialize_one_or_many, verification::verify_domains_match},
|
||||||
|
traits::Object,
|
||||||
};
|
};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,17 +1,14 @@
|
||||||
use crate::backend::database::IbisData;
|
use crate::{
|
||||||
use crate::backend::error::Error;
|
backend::{database::IbisData, error::Error, federation::objects::article::ApubArticle},
|
||||||
use crate::backend::federation::objects::article::ApubArticle;
|
common::{DbArticle, DbInstance},
|
||||||
use crate::common::DbInstance;
|
};
|
||||||
|
|
||||||
use crate::common::DbArticle;
|
|
||||||
use activitypub_federation::kinds::collection::CollectionType;
|
|
||||||
use activitypub_federation::protocol::verification::verify_domains_match;
|
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
|
kinds::collection::CollectionType,
|
||||||
|
protocol::verification::verify_domains_match,
|
||||||
traits::{Collection, Object},
|
traits::{Collection, Object},
|
||||||
};
|
};
|
||||||
use futures::future;
|
use futures::{future, future::try_join_all};
|
||||||
use futures::future::try_join_all;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
use crate::backend::database::edit::DbEditForm;
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::Error;
|
database::{edit::DbEditForm, IbisData},
|
||||||
use crate::common::DbPerson;
|
error::Error,
|
||||||
use crate::common::EditVersion;
|
},
|
||||||
use crate::common::{DbArticle, DbEdit};
|
common::{DbArticle, DbEdit, DbPerson, EditVersion},
|
||||||
use activitypub_federation::config::Data;
|
};
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
use activitypub_federation::{
|
||||||
use activitypub_federation::protocol::verification::verify_domains_match;
|
config::Data,
|
||||||
use activitypub_federation::traits::Object;
|
fetch::object_id::ObjectId,
|
||||||
|
protocol::verification::verify_domains_match,
|
||||||
|
traits::Object,
|
||||||
|
};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
use crate::backend::database::IbisData;
|
use crate::{
|
||||||
use crate::backend::error::Error;
|
backend::{database::IbisData, error::Error, federation::objects::edit::ApubEdit},
|
||||||
use crate::backend::federation::objects::edit::ApubEdit;
|
common::{DbArticle, DbEdit, DbInstance},
|
||||||
use crate::common::DbArticle;
|
};
|
||||||
|
|
||||||
use crate::common::DbEdit;
|
|
||||||
use crate::common::DbInstance;
|
|
||||||
use activitypub_federation::kinds::collection::OrderedCollectionType;
|
|
||||||
use activitypub_federation::protocol::verification::verify_domains_match;
|
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
|
kinds::collection::OrderedCollectionType,
|
||||||
|
protocol::verification::verify_domains_match,
|
||||||
traits::{Collection, Object},
|
traits::{Collection, Object},
|
||||||
};
|
};
|
||||||
use futures::future;
|
use futures::{future, future::try_join_all};
|
||||||
use futures::future::try_join_all;
|
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
|
|
@ -1,19 +1,17 @@
|
||||||
use crate::backend::database::instance::DbInstanceForm;
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::Error;
|
database::{instance::DbInstanceForm, IbisData},
|
||||||
use crate::backend::error::MyResult;
|
error::{Error, MyResult},
|
||||||
use crate::backend::federation::objects::articles_collection::DbArticleCollection;
|
federation::{objects::articles_collection::DbArticleCollection, send_activity},
|
||||||
use crate::backend::federation::send_activity;
|
},
|
||||||
use crate::common::utils::extract_domain;
|
common::{utils::extract_domain, DbInstance},
|
||||||
use crate::common::DbInstance;
|
};
|
||||||
use activitypub_federation::fetch::collection_id::CollectionId;
|
|
||||||
use activitypub_federation::kinds::actor::ServiceType;
|
|
||||||
use activitypub_federation::traits::ActivityHandler;
|
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
fetch::object_id::ObjectId,
|
fetch::{collection_id::CollectionId, object_id::ObjectId},
|
||||||
|
kinds::actor::ServiceType,
|
||||||
protocol::{public_key::PublicKey, verification::verify_domains_match},
|
protocol::{public_key::PublicKey, verification::verify_domains_match},
|
||||||
traits::{Actor, Object},
|
traits::{ActivityHandler, Actor, Object},
|
||||||
};
|
};
|
||||||
use chrono::{DateTime, Local, Utc};
|
use chrono::{DateTime, Local, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -1,11 +1,14 @@
|
||||||
use crate::backend::database::user::DbPersonForm;
|
use crate::{
|
||||||
use crate::backend::database::IbisData;
|
backend::{
|
||||||
use crate::backend::error::Error;
|
database::{user::DbPersonForm, IbisData},
|
||||||
use crate::common::DbPerson;
|
error::Error,
|
||||||
use activitypub_federation::kinds::actor::PersonType;
|
},
|
||||||
|
common::DbPerson,
|
||||||
|
};
|
||||||
use activitypub_federation::{
|
use activitypub_federation::{
|
||||||
config::Data,
|
config::Data,
|
||||||
fetch::object_id::ObjectId,
|
fetch::object_id::ObjectId,
|
||||||
|
kinds::actor::PersonType,
|
||||||
protocol::{public_key::PublicKey, verification::verify_domains_match},
|
protocol::{public_key::PublicKey, verification::verify_domains_match},
|
||||||
traits::{Actor, Object},
|
traits::{Actor, Object},
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,33 +1,42 @@
|
||||||
use crate::backend::database::IbisData;
|
use crate::{
|
||||||
use crate::backend::error::Error;
|
backend::{
|
||||||
use crate::backend::error::MyResult;
|
database::IbisData,
|
||||||
use crate::backend::federation::activities::accept::Accept;
|
error::{Error, MyResult},
|
||||||
use crate::backend::federation::activities::create_article::CreateArticle;
|
federation::{
|
||||||
use crate::backend::federation::activities::follow::Follow;
|
activities::{
|
||||||
use crate::backend::federation::activities::reject::RejectEdit;
|
accept::Accept,
|
||||||
use crate::backend::federation::activities::update_local_article::UpdateLocalArticle;
|
create_article::CreateArticle,
|
||||||
use crate::backend::federation::activities::update_remote_article::UpdateRemoteArticle;
|
follow::Follow,
|
||||||
use crate::backend::federation::objects::article::ApubArticle;
|
reject::RejectEdit,
|
||||||
use crate::backend::federation::objects::articles_collection::{
|
update_local_article::UpdateLocalArticle,
|
||||||
ArticleCollection, DbArticleCollection,
|
update_remote_article::UpdateRemoteArticle,
|
||||||
|
},
|
||||||
|
objects::{
|
||||||
|
article::ApubArticle,
|
||||||
|
articles_collection::{ArticleCollection, DbArticleCollection},
|
||||||
|
edits_collection::{ApubEditCollection, DbEditCollection},
|
||||||
|
instance::ApubInstance,
|
||||||
|
user::ApubUser,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
common::{DbArticle, DbInstance, DbPerson},
|
||||||
|
};
|
||||||
|
use activitypub_federation::{
|
||||||
|
axum::{
|
||||||
|
inbox::{receive_activity, ActivityData},
|
||||||
|
json::FederationJson,
|
||||||
|
},
|
||||||
|
config::Data,
|
||||||
|
protocol::context::WithContext,
|
||||||
|
traits::{ActivityHandler, Actor, Collection, Object},
|
||||||
|
};
|
||||||
|
use axum::{
|
||||||
|
extract::Path,
|
||||||
|
response::IntoResponse,
|
||||||
|
routing::{get, post},
|
||||||
|
Router,
|
||||||
};
|
};
|
||||||
use crate::backend::federation::objects::edits_collection::{ApubEditCollection, DbEditCollection};
|
|
||||||
use crate::backend::federation::objects::instance::ApubInstance;
|
|
||||||
use crate::backend::federation::objects::user::ApubUser;
|
|
||||||
use crate::common::DbArticle;
|
|
||||||
use crate::common::DbInstance;
|
|
||||||
use crate::common::DbPerson;
|
|
||||||
use activitypub_federation::axum::inbox::{receive_activity, ActivityData};
|
|
||||||
use activitypub_federation::axum::json::FederationJson;
|
|
||||||
use activitypub_federation::config::Data;
|
|
||||||
use activitypub_federation::protocol::context::WithContext;
|
|
||||||
use activitypub_federation::traits::Actor;
|
|
||||||
use activitypub_federation::traits::Object;
|
|
||||||
use activitypub_federation::traits::{ActivityHandler, Collection};
|
|
||||||
use axum::extract::Path;
|
|
||||||
use axum::response::IntoResponse;
|
|
||||||
use axum::routing::{get, post};
|
|
||||||
use axum::Router;
|
|
||||||
use axum_macros::debug_handler;
|
use axum_macros::debug_handler;
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -1,38 +1,45 @@
|
||||||
use crate::backend::config::IbisConfig;
|
use crate::{
|
||||||
use crate::backend::database::article::DbArticleForm;
|
backend::{
|
||||||
use crate::backend::database::instance::DbInstanceForm;
|
config::IbisConfig,
|
||||||
use crate::backend::database::IbisData;
|
database::{article::DbArticleForm, instance::DbInstanceForm, IbisData},
|
||||||
use crate::backend::error::Error;
|
error::{Error, MyResult},
|
||||||
use crate::backend::error::MyResult;
|
federation::{activities::submit_article_update, routes::federation_routes, VerifyUrlData},
|
||||||
use crate::backend::federation::activities::submit_article_update;
|
utils::generate_activity_id,
|
||||||
use crate::backend::federation::routes::federation_routes;
|
},
|
||||||
use crate::backend::federation::VerifyUrlData;
|
common::{
|
||||||
use crate::backend::utils::generate_activity_id;
|
utils::http_protocol_str,
|
||||||
use crate::common::utils::http_protocol_str;
|
DbArticle,
|
||||||
use crate::common::{DbArticle, DbInstance, DbPerson, EditVersion, MAIN_PAGE_NAME};
|
DbInstance,
|
||||||
use crate::frontend::app::App;
|
DbPerson,
|
||||||
use activitypub_federation::config::{Data, FederationConfig, FederationMiddleware};
|
EditVersion,
|
||||||
use activitypub_federation::fetch::collection_id::CollectionId;
|
MAIN_PAGE_NAME,
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
},
|
||||||
use activitypub_federation::http_signatures::generate_actor_keypair;
|
frontend::app::App,
|
||||||
|
};
|
||||||
|
use activitypub_federation::{
|
||||||
|
config::{Data, FederationConfig, FederationMiddleware},
|
||||||
|
fetch::{collection_id::CollectionId, object_id::ObjectId},
|
||||||
|
http_signatures::generate_actor_keypair,
|
||||||
|
};
|
||||||
use api::api_routes;
|
use api::api_routes;
|
||||||
use axum::debug_handler;
|
use axum::{
|
||||||
use axum::headers::HeaderMap;
|
debug_handler,
|
||||||
use axum::http::{HeaderValue, Request};
|
headers::HeaderMap,
|
||||||
use axum::response::IntoResponse;
|
http::{HeaderValue, Request},
|
||||||
use axum::routing::get;
|
middleware::Next,
|
||||||
use axum::Server;
|
response::{IntoResponse, Response},
|
||||||
use axum::ServiceExt;
|
routing::get,
|
||||||
use axum::{middleware::Next, response::Response, Router};
|
Router,
|
||||||
|
Server,
|
||||||
|
ServiceExt,
|
||||||
|
};
|
||||||
use chrono::Local;
|
use chrono::Local;
|
||||||
use diesel::r2d2::ConnectionManager;
|
use diesel::{
|
||||||
use diesel::r2d2::Pool;
|
r2d2::{ConnectionManager, Pool},
|
||||||
use diesel::PgConnection;
|
PgConnection,
|
||||||
use diesel_migrations::embed_migrations;
|
};
|
||||||
use diesel_migrations::EmbeddedMigrations;
|
use diesel_migrations::{embed_migrations, EmbeddedMigrations, MigrationHarness};
|
||||||
use diesel_migrations::MigrationHarness;
|
use leptos::{leptos_config::get_config_from_str, *};
|
||||||
use leptos::leptos_config::get_config_from_str;
|
|
||||||
use leptos::*;
|
|
||||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||||
use log::info;
|
use log::info;
|
||||||
use tower::Layer;
|
use tower::Layer;
|
||||||
|
|
|
@ -1,14 +1,12 @@
|
||||||
use crate::backend::error::MyResult;
|
use crate::{
|
||||||
use crate::common::EditView;
|
backend::error::MyResult,
|
||||||
use crate::common::{utils, EditVersion};
|
common::{utils, utils::extract_domain, EditVersion, EditView},
|
||||||
use activitypub_federation::fetch::object_id::ObjectId;
|
};
|
||||||
use activitypub_federation::traits::Object;
|
use activitypub_federation::{fetch::object_id::ObjectId, traits::Object};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use diffy::{apply, Patch};
|
use diffy::{apply, Patch};
|
||||||
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
||||||
use serde::Deserialize;
|
use serde::Deserialize;
|
||||||
|
|
||||||
use crate::common::utils::extract_domain;
|
|
||||||
use url::{ParseError, Url};
|
use url::{ParseError, Url};
|
||||||
|
|
||||||
pub fn generate_activity_id<T>(for_url: &ObjectId<T>) -> Result<Url, ParseError>
|
pub fn generate_activity_id<T>(for_url: &ObjectId<T>) -> Result<Url, ParseError>
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use crate::common::DbArticle;
|
use crate::common::DbArticle;
|
||||||
use anyhow::anyhow;
|
use anyhow::{anyhow, Result};
|
||||||
use anyhow::Result;
|
|
||||||
|
|
||||||
pub fn can_edit_article(article: &DbArticle, is_admin: bool) -> Result<()> {
|
pub fn can_edit_article(article: &DbArticle, is_admin: bool) -> Result<()> {
|
||||||
let err = anyhow!("Article is protected, only admins on origin instance can edit");
|
let err = anyhow!("Article is protected, only admins on origin instance can edit");
|
||||||
|
|
|
@ -1,11 +1,28 @@
|
||||||
use crate::common::utils::http_protocol_str;
|
use crate::{
|
||||||
use crate::common::{ApiConflict, ListArticlesForm, ProtectArticleForm};
|
common::{
|
||||||
use crate::common::{ArticleView, LoginUserForm, RegisterUserForm};
|
utils::http_protocol_str,
|
||||||
use crate::common::{CreateArticleForm, EditArticleForm, ForkArticleForm, LocalUserView};
|
ApiConflict,
|
||||||
use crate::common::{DbArticle, GetArticleForm};
|
ArticleView,
|
||||||
use crate::common::{DbInstance, FollowInstance, InstanceView, SearchArticleForm};
|
CreateArticleForm,
|
||||||
use crate::common::{DbPerson, GetUserForm, ResolveObject};
|
DbArticle,
|
||||||
use crate::frontend::error::MyResult;
|
DbInstance,
|
||||||
|
DbPerson,
|
||||||
|
EditArticleForm,
|
||||||
|
FollowInstance,
|
||||||
|
ForkArticleForm,
|
||||||
|
GetArticleForm,
|
||||||
|
GetUserForm,
|
||||||
|
InstanceView,
|
||||||
|
ListArticlesForm,
|
||||||
|
LocalUserView,
|
||||||
|
LoginUserForm,
|
||||||
|
ProtectArticleForm,
|
||||||
|
RegisterUserForm,
|
||||||
|
ResolveObject,
|
||||||
|
SearchArticleForm,
|
||||||
|
},
|
||||||
|
frontend::error::MyResult,
|
||||||
|
};
|
||||||
use anyhow::anyhow;
|
use anyhow::anyhow;
|
||||||
use reqwest::{Client, RequestBuilder, StatusCode};
|
use reqwest::{Client, RequestBuilder, StatusCode};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -1,29 +1,44 @@
|
||||||
use crate::common::LocalUserView;
|
use crate::{
|
||||||
use crate::frontend::api::ApiClient;
|
common::LocalUserView,
|
||||||
use crate::frontend::backend_hostname;
|
frontend::{
|
||||||
use crate::frontend::components::nav::Nav;
|
api::ApiClient,
|
||||||
use crate::frontend::pages::article::actions::ArticleActions;
|
backend_hostname,
|
||||||
use crate::frontend::pages::article::create::CreateArticle;
|
components::nav::Nav,
|
||||||
use crate::frontend::pages::article::edit::EditArticle;
|
pages::{
|
||||||
use crate::frontend::pages::article::history::ArticleHistory;
|
article::{
|
||||||
use crate::frontend::pages::article::list::ListArticles;
|
actions::ArticleActions,
|
||||||
use crate::frontend::pages::article::read::ReadArticle;
|
create::CreateArticle,
|
||||||
use crate::frontend::pages::conflicts::Conflicts;
|
edit::EditArticle,
|
||||||
use crate::frontend::pages::diff::EditDiff;
|
history::ArticleHistory,
|
||||||
use crate::frontend::pages::instance_details::InstanceDetails;
|
list::ListArticles,
|
||||||
use crate::frontend::pages::login::Login;
|
read::ReadArticle,
|
||||||
use crate::frontend::pages::register::Register;
|
},
|
||||||
use crate::frontend::pages::search::Search;
|
conflicts::Conflicts,
|
||||||
use crate::frontend::pages::user_profile::UserProfile;
|
diff::EditDiff,
|
||||||
use leptos::{
|
instance_details::InstanceDetails,
|
||||||
component, create_local_resource, create_rw_signal, expect_context, provide_context,
|
login::Login,
|
||||||
use_context, view, IntoView, RwSignal, SignalGet, SignalGetUntracked, SignalUpdate,
|
register::Register,
|
||||||
|
search::Search,
|
||||||
|
user_profile::UserProfile,
|
||||||
|
},
|
||||||
|
},
|
||||||
};
|
};
|
||||||
use leptos_meta::provide_meta_context;
|
use leptos::{
|
||||||
use leptos_meta::*;
|
component,
|
||||||
use leptos_router::Route;
|
create_local_resource,
|
||||||
use leptos_router::Router;
|
create_rw_signal,
|
||||||
use leptos_router::Routes;
|
expect_context,
|
||||||
|
provide_context,
|
||||||
|
use_context,
|
||||||
|
view,
|
||||||
|
IntoView,
|
||||||
|
RwSignal,
|
||||||
|
SignalGet,
|
||||||
|
SignalGetUntracked,
|
||||||
|
SignalUpdate,
|
||||||
|
};
|
||||||
|
use leptos_meta::{provide_meta_context, *};
|
||||||
|
use leptos_router::{Route, Router, Routes};
|
||||||
use reqwest::Client;
|
use reqwest::Client;
|
||||||
|
|
||||||
// https://book.leptos.dev/15_global_state.html
|
// https://book.leptos.dev/15_global_state.html
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::common::validation::can_edit_article;
|
use crate::{
|
||||||
use crate::common::ArticleView;
|
common::{validation::can_edit_article, ArticleView},
|
||||||
use crate::frontend::app::GlobalState;
|
frontend::{app::GlobalState, article_link},
|
||||||
use crate::frontend::article_link;
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::*;
|
use leptos_router::*;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
use crate::frontend::app::GlobalState;
|
use crate::frontend::app::GlobalState;
|
||||||
use leptos::*;
|
use leptos::{component, use_context, view, IntoView, RwSignal, SignalWith, *};
|
||||||
use leptos::{component, use_context, view, IntoView, RwSignal, SignalWith};
|
|
||||||
use leptos_router::*;
|
use leptos_router::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,6 +1,11 @@
|
||||||
use crate::frontend::backend_hostname;
|
use crate::frontend::backend_hostname;
|
||||||
use markdown_it::parser::inline::{InlineRule, InlineState};
|
use markdown_it::{
|
||||||
use markdown_it::{MarkdownIt, Node, NodeValue, Renderer};
|
parser::inline::{InlineRule, InlineState},
|
||||||
|
MarkdownIt,
|
||||||
|
Node,
|
||||||
|
NodeValue,
|
||||||
|
Renderer,
|
||||||
|
};
|
||||||
|
|
||||||
pub fn markdown_parser() -> MarkdownIt {
|
pub fn markdown_parser() -> MarkdownIt {
|
||||||
let mut parser = MarkdownIt::new();
|
let mut parser = MarkdownIt::new();
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use crate::common::utils::extract_domain;
|
use crate::common::{utils::extract_domain, DbArticle, DbPerson};
|
||||||
use crate::common::{DbArticle, DbPerson};
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
|
||||||
pub mod api;
|
pub mod api;
|
||||||
|
|
|
@ -1,10 +1,14 @@
|
||||||
use crate::common::ForkArticleForm;
|
use crate::{
|
||||||
use crate::frontend::app::GlobalState;
|
common::ForkArticleForm,
|
||||||
use crate::frontend::article_link;
|
frontend::{
|
||||||
use crate::frontend::article_title;
|
app::GlobalState,
|
||||||
use crate::frontend::components::article_nav::ArticleNav;
|
article_link,
|
||||||
use crate::frontend::pages::article_resource;
|
article_title,
|
||||||
use crate::frontend::DbArticle;
|
components::article_nav::ArticleNav,
|
||||||
|
pages::article_resource,
|
||||||
|
DbArticle,
|
||||||
|
},
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::Redirect;
|
use leptos_router::Redirect;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
use crate::common::CreateArticleForm;
|
use crate::{common::CreateArticleForm, frontend::app::GlobalState};
|
||||||
use crate::frontend::app::GlobalState;
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::Redirect;
|
use leptos_router::Redirect;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
use crate::common::{ApiConflict, ArticleView, EditArticleForm};
|
use crate::{
|
||||||
use crate::frontend::app::GlobalState;
|
common::{ApiConflict, ArticleView, EditArticleForm},
|
||||||
use crate::frontend::article_title;
|
frontend::{
|
||||||
use crate::frontend::components::article_nav::ArticleNav;
|
app::GlobalState,
|
||||||
use crate::frontend::pages::article_resource;
|
article_title,
|
||||||
|
components::article_nav::ArticleNav,
|
||||||
|
pages::article_resource,
|
||||||
|
},
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::use_params_map;
|
use leptos_router::use_params_map;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,9 @@
|
||||||
use crate::frontend::components::article_nav::ArticleNav;
|
use crate::frontend::{
|
||||||
use crate::frontend::pages::article_resource;
|
article_title,
|
||||||
use crate::frontend::{article_title, user_link};
|
components::article_nav::ArticleNav,
|
||||||
|
pages::article_resource,
|
||||||
|
user_link,
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::common::ListArticlesForm;
|
use crate::{
|
||||||
use crate::frontend::app::GlobalState;
|
common::ListArticlesForm,
|
||||||
use crate::frontend::{article_link, article_title};
|
frontend::{app::GlobalState, article_link, article_title},
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use web_sys::wasm_bindgen::JsCast;
|
use web_sys::wasm_bindgen::JsCast;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
use crate::frontend::article_title;
|
use crate::frontend::{
|
||||||
use crate::frontend::components::article_nav::ArticleNav;
|
article_title,
|
||||||
use crate::frontend::markdown::markdown_parser;
|
components::article_nav::ArticleNav,
|
||||||
use crate::frontend::pages::article_resource;
|
markdown::markdown_parser,
|
||||||
|
pages::article_resource,
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use crate::frontend::app::GlobalState;
|
use crate::frontend::{app::GlobalState, article_link, article_title};
|
||||||
use crate::frontend::article_link;
|
|
||||||
use crate::frontend::article_title;
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,6 +1,4 @@
|
||||||
use crate::frontend::components::article_nav::ArticleNav;
|
use crate::frontend::{components::article_nav::ArticleNav, pages::article_resource, user_link};
|
||||||
use crate::frontend::pages::article_resource;
|
|
||||||
use crate::frontend::user_link;
|
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::*;
|
use leptos_router::*;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::common::utils::http_protocol_str;
|
use crate::{
|
||||||
use crate::common::{DbInstance, FollowInstance};
|
common::{utils::http_protocol_str, DbInstance, FollowInstance},
|
||||||
use crate::frontend::app::GlobalState;
|
frontend::app::GlobalState,
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::use_params_map;
|
use leptos_router::use_params_map;
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::common::LoginUserForm;
|
use crate::{
|
||||||
use crate::frontend::app::GlobalState;
|
common::LoginUserForm,
|
||||||
use crate::frontend::components::credentials::*;
|
frontend::{app::GlobalState, components::credentials::*},
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::Redirect;
|
use leptos_router::Redirect;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
use crate::common::{ArticleView, GetArticleForm, MAIN_PAGE_NAME};
|
use crate::{
|
||||||
use crate::frontend::app::GlobalState;
|
common::{ArticleView, GetArticleForm, MAIN_PAGE_NAME},
|
||||||
|
frontend::app::GlobalState,
|
||||||
|
};
|
||||||
use leptos::{create_resource, Resource, SignalGet};
|
use leptos::{create_resource, Resource, SignalGet};
|
||||||
use leptos_router::use_params_map;
|
use leptos_router::use_params_map;
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use crate::common::{LocalUserView, RegisterUserForm};
|
use crate::{
|
||||||
use crate::frontend::app::GlobalState;
|
common::{LocalUserView, RegisterUserForm},
|
||||||
use crate::frontend::components::credentials::*;
|
frontend::{app::GlobalState, components::credentials::*, error::MyResult},
|
||||||
use crate::frontend::error::MyResult;
|
};
|
||||||
use leptos::{logging::log, *};
|
use leptos::{logging::log, *};
|
||||||
|
|
||||||
#[component]
|
#[component]
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::common::{DbArticle, DbInstance, SearchArticleForm};
|
use crate::{
|
||||||
use crate::frontend::app::GlobalState;
|
common::{DbArticle, DbInstance, SearchArticleForm},
|
||||||
use crate::frontend::{article_link, article_title};
|
frontend::{app::GlobalState, article_link, article_title},
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::use_query_map;
|
use leptos_router::use_query_map;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
use crate::common::{DbPerson, GetUserForm};
|
use crate::{
|
||||||
use crate::frontend::app::GlobalState;
|
common::{DbPerson, GetUserForm},
|
||||||
use crate::frontend::user_title;
|
frontend::{app::GlobalState, user_title},
|
||||||
|
};
|
||||||
use leptos::*;
|
use leptos::*;
|
||||||
use leptos_router::use_params_map;
|
use leptos_router::use_params_map;
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,7 @@ pub async fn main() -> ibis_lib::backend::error::MyResult<()> {
|
||||||
#[cfg(not(feature = "ssr"))]
|
#[cfg(not(feature = "ssr"))]
|
||||||
fn main() {
|
fn main() {
|
||||||
use ibis_lib::frontend::app::App;
|
use ibis_lib::frontend::app::App;
|
||||||
use leptos::mount_to_body;
|
use leptos::{mount_to_body, view};
|
||||||
use leptos::view;
|
|
||||||
|
|
||||||
_ = console_log::init_with_level(log::Level::Debug);
|
_ = console_log::init_with_level(log::Level::Debug);
|
||||||
console_error_panic_hook::set_once();
|
console_error_panic_hook::set_once();
|
||||||
|
|
|
@ -1,19 +1,26 @@
|
||||||
#![allow(clippy::unwrap_used)]
|
#![allow(clippy::unwrap_used)]
|
||||||
|
|
||||||
use ibis_lib::backend::config::{IbisConfig, IbisConfigDatabase, IbisConfigFederation};
|
use ibis_lib::{
|
||||||
use ibis_lib::backend::start;
|
backend::{
|
||||||
use ibis_lib::common::RegisterUserForm;
|
config::{IbisConfig, IbisConfigDatabase, IbisConfigFederation},
|
||||||
use ibis_lib::frontend::api::ApiClient;
|
start,
|
||||||
use ibis_lib::frontend::error::MyResult;
|
},
|
||||||
|
common::RegisterUserForm,
|
||||||
|
frontend::{api::ApiClient, error::MyResult},
|
||||||
|
};
|
||||||
use reqwest::ClientBuilder;
|
use reqwest::ClientBuilder;
|
||||||
use std::env::current_dir;
|
use std::{
|
||||||
use std::fs::{create_dir_all, remove_dir_all};
|
env::current_dir,
|
||||||
use std::ops::Deref;
|
fs::{create_dir_all, remove_dir_all},
|
||||||
use std::process::{Command, Stdio};
|
ops::Deref,
|
||||||
use std::sync::atomic::{AtomicI32, Ordering};
|
process::{Command, Stdio},
|
||||||
use std::sync::Once;
|
sync::{
|
||||||
use std::thread::{sleep, spawn};
|
atomic::{AtomicI32, Ordering},
|
||||||
use std::time::Duration;
|
Once,
|
||||||
|
},
|
||||||
|
thread::{sleep, spawn},
|
||||||
|
time::Duration,
|
||||||
|
};
|
||||||
use tokio::task::JoinHandle;
|
use tokio::task::JoinHandle;
|
||||||
use tracing::log::LevelFilter;
|
use tracing::log::LevelFilter;
|
||||||
|
|
||||||
|
|
|
@ -5,14 +5,23 @@ extern crate ibis_lib;
|
||||||
mod common;
|
mod common;
|
||||||
|
|
||||||
use crate::common::{TestData, TEST_ARTICLE_DEFAULT_TEXT};
|
use crate::common::{TestData, TEST_ARTICLE_DEFAULT_TEXT};
|
||||||
use ibis_lib::common::utils::extract_domain;
|
use ibis_lib::{
|
||||||
use ibis_lib::common::{
|
common::{
|
||||||
ArticleView, EditArticleForm, ForkArticleForm, GetArticleForm, GetUserForm, ListArticlesForm,
|
utils::extract_domain,
|
||||||
ProtectArticleForm,
|
ArticleView,
|
||||||
|
CreateArticleForm,
|
||||||
|
EditArticleForm,
|
||||||
|
ForkArticleForm,
|
||||||
|
GetArticleForm,
|
||||||
|
GetUserForm,
|
||||||
|
ListArticlesForm,
|
||||||
|
LoginUserForm,
|
||||||
|
ProtectArticleForm,
|
||||||
|
RegisterUserForm,
|
||||||
|
SearchArticleForm,
|
||||||
|
},
|
||||||
|
frontend::error::MyResult,
|
||||||
};
|
};
|
||||||
use ibis_lib::common::{CreateArticleForm, SearchArticleForm};
|
|
||||||
use ibis_lib::common::{LoginUserForm, RegisterUserForm};
|
|
||||||
use ibis_lib::frontend::error::MyResult;
|
|
||||||
use pretty_assertions::{assert_eq, assert_ne};
|
use pretty_assertions::{assert_eq, assert_ne};
|
||||||
use url::Url;
|
use url::Url;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue