mirror of
https://github.com/Nutomic/ibis.git
synced 2025-02-04 02:51:35 +00:00
Move files into subfolders
This commit is contained in:
parent
a427c418a4
commit
95ee090275
35 changed files with 167 additions and 135 deletions
|
@ -7,9 +7,8 @@ use crate::{
|
|||
edit::DbEditForm,
|
||||
IbisData,
|
||||
},
|
||||
error::MyResult,
|
||||
federation::activities::{create_article::CreateArticle, submit_article_update},
|
||||
utils::generate_article_version,
|
||||
utils::{error::MyResult, generate_article_version},
|
||||
},
|
||||
common::{
|
||||
utils::{extract_domain, http_protocol_str},
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
backend::{database::IbisData, error::MyResult, federation::activities::follow::Follow},
|
||||
backend::{database::IbisData, federation::activities::follow::Follow, utils::error::MyResult},
|
||||
common::{
|
||||
DbInstance,
|
||||
FollowInstance,
|
||||
|
|
|
@ -16,7 +16,7 @@ use crate::{
|
|||
user::{get_user, login_user, logout_user, register_user},
|
||||
},
|
||||
database::IbisData,
|
||||
error::MyResult,
|
||||
utils::error::MyResult,
|
||||
},
|
||||
common::{DbEdit, EditView, GetEditList, LocalUserView, SiteView},
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ use super::{check_is_admin, empty_to_none};
|
|||
use crate::{
|
||||
backend::{
|
||||
database::{conflict::DbConflict, read_jwt_secret, IbisData},
|
||||
error::MyResult,
|
||||
utils::error::MyResult,
|
||||
},
|
||||
common::{
|
||||
DbArticle,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::{backend::error::MyResult, common::Options};
|
||||
use crate::{backend::utils::error::MyResult, common::Options};
|
||||
use config::Config;
|
||||
use doku::Document;
|
||||
use serde::Deserialize;
|
||||
|
|
|
@ -4,8 +4,8 @@ use crate::{
|
|||
schema::{article, edit, instance},
|
||||
IbisData,
|
||||
},
|
||||
error::MyResult,
|
||||
federation::objects::edits_collection::DbEditCollection,
|
||||
utils::error::MyResult,
|
||||
},
|
||||
common::{
|
||||
newtypes::{ArticleId, InstanceId},
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::{schema::conflict, IbisData},
|
||||
error::MyResult,
|
||||
federation::activities::submit_article_update,
|
||||
utils::generate_article_version,
|
||||
utils::{error::MyResult, generate_article_version},
|
||||
},
|
||||
common::{
|
||||
newtypes::{ArticleId, ConflictId, PersonId},
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::schema::{article, edit, person},
|
||||
error::MyResult,
|
||||
utils::error::MyResult,
|
||||
IbisData,
|
||||
},
|
||||
common::{
|
||||
|
|
|
@ -4,11 +4,11 @@ use crate::{
|
|||
schema::{instance, instance_follow},
|
||||
IbisData,
|
||||
},
|
||||
error::MyResult,
|
||||
federation::objects::{
|
||||
articles_collection::DbArticleCollection,
|
||||
instance_collection::DbInstanceCollection,
|
||||
},
|
||||
utils::error::MyResult,
|
||||
},
|
||||
common::{newtypes::InstanceId, DbInstance, DbPerson, InstanceView},
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use crate::backend::{config::IbisConfig, database::schema::jwt_secret, error::MyResult};
|
||||
use crate::backend::{config::IbisConfig, database::schema::jwt_secret, utils::error::MyResult};
|
||||
use diesel::{
|
||||
r2d2::{ConnectionManager, Pool},
|
||||
PgConnection,
|
||||
|
|
|
@ -4,8 +4,7 @@ use crate::{
|
|||
schema::{instance, instance_follow, local_user, person},
|
||||
IbisData,
|
||||
},
|
||||
error::MyResult,
|
||||
utils::generate_keypair,
|
||||
utils::{error::MyResult, generate_keypair},
|
||||
},
|
||||
common::{
|
||||
newtypes::PersonId,
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::IbisData,
|
||||
error::MyResult,
|
||||
federation::{activities::follow::Follow, send_activity},
|
||||
utils::generate_activity_id,
|
||||
utils::{
|
||||
error::{Error, MyResult},
|
||||
generate_activity_id,
|
||||
},
|
||||
},
|
||||
common::DbInstance,
|
||||
};
|
||||
|
@ -54,7 +56,7 @@ impl Accept {
|
|||
#[async_trait::async_trait]
|
||||
impl ActivityHandler for Accept {
|
||||
type DataType = IbisData;
|
||||
type Error = crate::backend::error::Error;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
&self.id
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::IbisData,
|
||||
error::MyResult,
|
||||
federation::objects::article::ApubArticle,
|
||||
utils::generate_activity_id,
|
||||
utils::{
|
||||
error::{Error, MyResult},
|
||||
generate_activity_id,
|
||||
},
|
||||
},
|
||||
common::{DbArticle, DbInstance},
|
||||
};
|
||||
|
@ -51,7 +53,7 @@ impl CreateArticle {
|
|||
#[async_trait::async_trait]
|
||||
impl ActivityHandler for CreateArticle {
|
||||
type DataType = IbisData;
|
||||
type Error = crate::backend::error::Error;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
&self.id
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::IbisData,
|
||||
error::MyResult,
|
||||
federation::{activities::accept::Accept, send_activity},
|
||||
generate_activity_id,
|
||||
utils::error::{Error, MyResult},
|
||||
},
|
||||
common::{DbInstance, DbPerson},
|
||||
};
|
||||
|
@ -44,7 +44,7 @@ impl Follow {
|
|||
#[async_trait::async_trait]
|
||||
impl ActivityHandler for Follow {
|
||||
type DataType = IbisData;
|
||||
type Error = crate::backend::error::Error;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
&self.id
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::{edit::DbEditForm, IbisData},
|
||||
error::Error,
|
||||
federation::activities::{
|
||||
update_local_article::UpdateLocalArticle,
|
||||
update_remote_article::UpdateRemoteArticle,
|
||||
},
|
||||
utils::error::Error,
|
||||
},
|
||||
common::{
|
||||
newtypes::{EditId, PersonId},
|
||||
|
|
|
@ -4,9 +4,11 @@ use crate::{
|
|||
conflict::{DbConflict, DbConflictForm},
|
||||
IbisData,
|
||||
},
|
||||
error::MyResult,
|
||||
federation::{objects::edit::ApubEdit, send_activity},
|
||||
utils::generate_activity_id,
|
||||
utils::{
|
||||
error::{Error, MyResult},
|
||||
generate_activity_id,
|
||||
},
|
||||
},
|
||||
common::{DbInstance, EditVersion},
|
||||
};
|
||||
|
@ -61,7 +63,7 @@ impl RejectEdit {
|
|||
#[async_trait::async_trait]
|
||||
impl ActivityHandler for RejectEdit {
|
||||
type DataType = IbisData;
|
||||
type Error = crate::backend::error::Error;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
&self.id
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::IbisData,
|
||||
error::MyResult,
|
||||
federation::objects::article::ApubArticle,
|
||||
utils::generate_activity_id,
|
||||
utils::{
|
||||
error::{Error, MyResult},
|
||||
generate_activity_id,
|
||||
},
|
||||
},
|
||||
common::{DbArticle, DbInstance},
|
||||
};
|
||||
|
@ -58,7 +60,7 @@ impl UpdateLocalArticle {
|
|||
#[async_trait::async_trait]
|
||||
impl ActivityHandler for UpdateLocalArticle {
|
||||
type DataType = IbisData;
|
||||
type Error = crate::backend::error::Error;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
&self.id
|
||||
|
|
|
@ -1,13 +1,15 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::IbisData,
|
||||
error::MyResult,
|
||||
federation::{
|
||||
activities::{reject::RejectEdit, update_local_article::UpdateLocalArticle},
|
||||
objects::edit::ApubEdit,
|
||||
send_activity,
|
||||
},
|
||||
utils::generate_activity_id,
|
||||
utils::{
|
||||
error::{Error, MyResult},
|
||||
generate_activity_id,
|
||||
},
|
||||
},
|
||||
common::{validation::can_edit_article, DbArticle, DbEdit, DbInstance},
|
||||
};
|
||||
|
@ -64,7 +66,7 @@ impl UpdateRemoteArticle {
|
|||
#[async_trait::async_trait]
|
||||
impl ActivityHandler for UpdateRemoteArticle {
|
||||
type DataType = IbisData;
|
||||
type Error = crate::backend::error::Error;
|
||||
type Error = Error;
|
||||
|
||||
fn id(&self) -> &Url {
|
||||
&self.id
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::{article::DbArticleForm, IbisData},
|
||||
error::Error,
|
||||
federation::objects::edits_collection::DbEditCollection,
|
||||
utils::error::Error,
|
||||
},
|
||||
common::{DbArticle, DbInstance, EditVersion},
|
||||
};
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::IbisData,
|
||||
error::{Error, MyResult},
|
||||
federation::objects::article::ApubArticle,
|
||||
utils::error::{Error, MyResult},
|
||||
},
|
||||
common::{utils::http_protocol_str, DbArticle},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::{edit::DbEditForm, IbisData},
|
||||
error::Error,
|
||||
utils::error::Error,
|
||||
},
|
||||
common::{DbArticle, DbEdit, DbPerson, EditVersion},
|
||||
};
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
backend::{database::IbisData, error::Error, federation::objects::edit::ApubEdit},
|
||||
backend::{database::IbisData, federation::objects::edit::ApubEdit, utils::error::Error},
|
||||
common::{DbArticle, DbEdit},
|
||||
};
|
||||
use activitypub_federation::{
|
||||
|
|
|
@ -2,8 +2,8 @@ use super::instance_collection::DbInstanceCollection;
|
|||
use crate::{
|
||||
backend::{
|
||||
database::{instance::DbInstanceForm, IbisData},
|
||||
error::{Error, MyResult},
|
||||
federation::{objects::articles_collection::DbArticleCollection, send_activity},
|
||||
utils::error::{Error, MyResult},
|
||||
},
|
||||
common::{utils::extract_domain, DbInstance},
|
||||
};
|
||||
|
|
|
@ -2,7 +2,7 @@ use super::instance::ApubInstance;
|
|||
use crate::{
|
||||
backend::{
|
||||
database::IbisData,
|
||||
error::{Error, MyResult},
|
||||
utils::error::{Error, MyResult},
|
||||
},
|
||||
common::{utils::http_protocol_str, DbInstance},
|
||||
};
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
use crate::{
|
||||
backend::{
|
||||
database::{user::DbPersonForm, IbisData},
|
||||
error::Error,
|
||||
utils::error::Error,
|
||||
},
|
||||
common::DbPerson,
|
||||
};
|
||||
|
|
|
@ -2,7 +2,6 @@ use super::objects::instance_collection::{DbInstanceCollection, InstanceCollecti
|
|||
use crate::{
|
||||
backend::{
|
||||
database::IbisData,
|
||||
error::{Error, MyResult},
|
||||
federation::{
|
||||
activities::{
|
||||
accept::Accept,
|
||||
|
@ -20,6 +19,7 @@ use crate::{
|
|||
user::ApubUser,
|
||||
},
|
||||
},
|
||||
utils::error::{Error, MyResult},
|
||||
},
|
||||
common::{DbArticle, DbInstance, DbPerson},
|
||||
};
|
||||
|
|
|
@ -2,38 +2,25 @@ use crate::{
|
|||
backend::{
|
||||
config::IbisConfig,
|
||||
database::{article::DbArticleForm, instance::DbInstanceForm, IbisData},
|
||||
federation::{activities::submit_article_update, VerifyUrlData},
|
||||
utils::{
|
||||
error::{Error, MyResult},
|
||||
federation::{activities::submit_article_update, routes::federation_routes, VerifyUrlData},
|
||||
utils::generate_activity_id,
|
||||
generate_activity_id,
|
||||
},
|
||||
},
|
||||
common::{
|
||||
utils::http_protocol_str,
|
||||
Auth,
|
||||
DbArticle,
|
||||
DbInstance,
|
||||
DbPerson,
|
||||
EditVersion,
|
||||
MAIN_PAGE_NAME,
|
||||
},
|
||||
frontend::app::{shell, App},
|
||||
};
|
||||
use activitypub_federation::{
|
||||
config::{Data, FederationConfig, FederationMiddleware},
|
||||
config::{Data, FederationConfig},
|
||||
fetch::object_id::ObjectId,
|
||||
};
|
||||
use api::api_routes;
|
||||
use assets::file_and_error_handler;
|
||||
use axum::{
|
||||
body::Body,
|
||||
extract::State,
|
||||
http::Request,
|
||||
middleware::from_fn_with_state,
|
||||
response::{IntoResponse, Response},
|
||||
routing::get,
|
||||
Extension,
|
||||
Router,
|
||||
ServiceExt,
|
||||
};
|
||||
use chrono::Utc;
|
||||
use diesel::{
|
||||
r2d2::{ConnectionManager, Pool},
|
||||
|
@ -44,26 +31,18 @@ use federation::objects::{
|
|||
articles_collection::local_articles_url,
|
||||
instance_collection::linked_instances_url,
|
||||
};
|
||||
use leptos::prelude::*;
|
||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||
use log::info;
|
||||
use middleware::{auth_middleware, federation_routes_middleware, FEDERATION_ROUTES_PREFIX};
|
||||
use std::{net::SocketAddr, sync::Arc, thread};
|
||||
use tokio::{net::TcpListener, sync::oneshot};
|
||||
use tower_http::{compression::CompressionLayer, cors::CorsLayer};
|
||||
use tower_layer::Layer;
|
||||
use utils::generate_keypair;
|
||||
use server::start_server;
|
||||
use std::{net::SocketAddr, thread};
|
||||
use tokio::sync::oneshot;
|
||||
use utils::{generate_keypair, scheduled_tasks};
|
||||
|
||||
pub mod api;
|
||||
mod assets;
|
||||
pub mod config;
|
||||
pub mod database;
|
||||
pub mod error;
|
||||
pub mod federation;
|
||||
mod middleware;
|
||||
mod nodeinfo;
|
||||
mod scheduled_tasks;
|
||||
mod utils;
|
||||
mod server;
|
||||
pub mod utils;
|
||||
|
||||
const MIGRATIONS: EmbeddedMigrations = embed_migrations!("migrations");
|
||||
|
||||
|
@ -85,14 +64,14 @@ pub async fn start(
|
|||
let data = FederationConfig::builder()
|
||||
.domain(ibis_data.config.federation.domain.clone())
|
||||
.url_verifier(Box::new(VerifyUrlData(ibis_data.config.clone())))
|
||||
.app_data(ibis_data.clone())
|
||||
.app_data(ibis_data)
|
||||
.http_fetch_limit(1000)
|
||||
.debug(cfg!(debug_assertions))
|
||||
.build()
|
||||
.await?;
|
||||
|
||||
// Create local instance if it doesnt exist yet
|
||||
if DbInstance::read_local_instance(&data).is_err() {
|
||||
info!("Running setup for new instance");
|
||||
setup(&data.to_request_data()).await?;
|
||||
}
|
||||
|
||||
|
@ -101,60 +80,11 @@ pub async fn start(
|
|||
scheduled_tasks::start(db_pool);
|
||||
});
|
||||
|
||||
let leptos_options = get_config_from_str(include_str!("../../Cargo.toml"))?;
|
||||
let mut addr = leptos_options.site_addr;
|
||||
if let Some(override_hostname) = override_hostname {
|
||||
addr = override_hostname;
|
||||
}
|
||||
let routes = generate_route_list(App);
|
||||
|
||||
let config = data.clone();
|
||||
let arc_data = Arc::new(ibis_data);
|
||||
let app = Router::new()
|
||||
.leptos_routes_with_handler(routes, get(leptos_routes_handler))
|
||||
.fallback(file_and_error_handler)
|
||||
.with_state(leptos_options)
|
||||
.nest(FEDERATION_ROUTES_PREFIX, federation_routes())
|
||||
.nest("/api/v1", api_routes())
|
||||
.nest("", nodeinfo::config())
|
||||
.layer(FederationMiddleware::new(config))
|
||||
.layer(CorsLayer::permissive())
|
||||
.layer(CompressionLayer::new())
|
||||
.route_layer(from_fn_with_state(arc_data.clone(), auth_middleware));
|
||||
|
||||
// Rewrite federation routes
|
||||
// https://docs.rs/axum/0.7.4/axum/middleware/index.html#rewriting-request-uri-in-middleware
|
||||
let middleware = axum::middleware::from_fn(federation_routes_middleware);
|
||||
let app_with_middleware = middleware.layer(app);
|
||||
|
||||
info!("Listening on {}", &addr);
|
||||
let listener = TcpListener::bind(&addr).await?;
|
||||
if let Some(notify_start) = notify_start {
|
||||
notify_start.send(()).expect("send oneshot");
|
||||
}
|
||||
axum::serve(listener, app_with_middleware.into_make_service()).await?;
|
||||
start_server(data, override_hostname, notify_start).await?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Make auth token available in hydrate mode
|
||||
async fn leptos_routes_handler(
|
||||
auth: Option<Extension<Auth>>,
|
||||
State(leptos_options): State<LeptosOptions>,
|
||||
request: Request<Body>,
|
||||
) -> Response {
|
||||
let handler = leptos_axum::render_app_async_with_context(
|
||||
move || {
|
||||
if let Some(auth) = &auth {
|
||||
provide_context(auth.0.clone());
|
||||
}
|
||||
},
|
||||
move || shell(leptos_options.clone()),
|
||||
);
|
||||
|
||||
handler(request).await.into_response()
|
||||
}
|
||||
|
||||
const MAIN_PAGE_DEFAULT_TEXT: &str = "Welcome to Ibis, the federated Wikipedia alternative!
|
||||
|
||||
This main page can only be edited by the admin. Use it as an introduction for new users, \
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
use super::error::MyResult;
|
||||
use crate::backend::utils::error::MyResult;
|
||||
use anyhow::anyhow;
|
||||
use axum::{
|
||||
body::Body,
|
|
@ -1,6 +1,5 @@
|
|||
use super::api::user::validate;
|
||||
use crate::{
|
||||
backend::database::IbisData,
|
||||
backend::{api::user::validate, database::IbisData},
|
||||
common::{Auth, AUTH_COOKIE},
|
||||
};
|
||||
use axum::{body::Body, extract::State, http::Request, middleware::Next, response::Response};
|
88
src/backend/server/mod.rs
Normal file
88
src/backend/server/mod.rs
Normal file
|
@ -0,0 +1,88 @@
|
|||
use super::{database::IbisData, utils::error::MyResult};
|
||||
use crate::{
|
||||
backend::{api::api_routes, federation::routes::federation_routes},
|
||||
common::Auth,
|
||||
frontend::app::{shell, App},
|
||||
};
|
||||
use activitypub_federation::config::{FederationConfig, FederationMiddleware};
|
||||
use assets::file_and_error_handler;
|
||||
use axum::{
|
||||
body::Body,
|
||||
extract::State,
|
||||
http::Request,
|
||||
middleware::from_fn_with_state,
|
||||
response::{IntoResponse, Response},
|
||||
routing::get,
|
||||
Extension,
|
||||
Router,
|
||||
ServiceExt,
|
||||
};
|
||||
use leptos::prelude::*;
|
||||
use leptos_axum::{generate_route_list, LeptosRoutes};
|
||||
use log::info;
|
||||
use middleware::{auth_middleware, federation_routes_middleware, FEDERATION_ROUTES_PREFIX};
|
||||
use std::{net::SocketAddr, ops::Deref, sync::Arc};
|
||||
use tokio::{net::TcpListener, sync::oneshot};
|
||||
use tower_http::{compression::CompressionLayer, cors::CorsLayer};
|
||||
use tower_layer::Layer;
|
||||
|
||||
mod assets;
|
||||
mod middleware;
|
||||
mod nodeinfo;
|
||||
|
||||
pub(super) async fn start_server(
|
||||
data: FederationConfig<IbisData>,
|
||||
override_hostname: Option<SocketAddr>,
|
||||
notify_start: Option<oneshot::Sender<()>>,
|
||||
) -> MyResult<()> {
|
||||
let leptos_options = get_config_from_str(include_str!("../../../Cargo.toml"))?;
|
||||
let mut addr = leptos_options.site_addr;
|
||||
if let Some(override_hostname) = override_hostname {
|
||||
addr = override_hostname;
|
||||
}
|
||||
let routes = generate_route_list(App);
|
||||
|
||||
let arc_data = Arc::new(data.deref().clone());
|
||||
let app = Router::new()
|
||||
.leptos_routes_with_handler(routes, get(leptos_routes_handler))
|
||||
.fallback(file_and_error_handler)
|
||||
.with_state(leptos_options)
|
||||
.nest(FEDERATION_ROUTES_PREFIX, federation_routes())
|
||||
.nest("/api/v1", api_routes())
|
||||
.nest("", nodeinfo::config())
|
||||
.layer(FederationMiddleware::new(data))
|
||||
.layer(CorsLayer::permissive())
|
||||
.layer(CompressionLayer::new())
|
||||
.route_layer(from_fn_with_state(arc_data, auth_middleware));
|
||||
|
||||
// Rewrite federation routes
|
||||
// https://docs.rs/axum/0.7.4/axum/middleware/index.html#rewriting-request-uri-in-middleware
|
||||
let middleware = axum::middleware::from_fn(federation_routes_middleware);
|
||||
let app_with_middleware = middleware.layer(app);
|
||||
|
||||
info!("Listening on {}", &addr);
|
||||
let listener = TcpListener::bind(&addr).await?;
|
||||
if let Some(notify_start) = notify_start {
|
||||
notify_start.send(()).expect("send oneshot");
|
||||
}
|
||||
axum::serve(listener, app_with_middleware.into_make_service()).await?;
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// Make auth token available in hydrate mode
|
||||
async fn leptos_routes_handler(
|
||||
auth: Option<Extension<Auth>>,
|
||||
State(leptos_options): State<LeptosOptions>,
|
||||
request: Request<Body>,
|
||||
) -> Response {
|
||||
let handler = leptos_axum::render_app_async_with_context(
|
||||
move || {
|
||||
if let Some(auth) = &auth {
|
||||
provide_context(auth.0.clone());
|
||||
}
|
||||
},
|
||||
move || shell(leptos_options.clone()),
|
||||
);
|
||||
|
||||
handler(request).await.into_response()
|
||||
}
|
|
@ -1,6 +1,8 @@
|
|||
use super::database::instance_stats::InstanceStats;
|
||||
use crate::{
|
||||
backend::{database::IbisData, error::MyResult},
|
||||
backend::{
|
||||
database::{instance_stats::InstanceStats, IbisData},
|
||||
utils::error::MyResult,
|
||||
},
|
||||
common::utils::http_protocol_str,
|
||||
};
|
||||
use activitypub_federation::config::Data;
|
|
@ -1,5 +1,5 @@
|
|||
use crate::{
|
||||
backend::{database::IbisData, error::MyResult},
|
||||
backend::{database::IbisData, utils::error::MyResult},
|
||||
common::{utils, DbEdit, EditVersion},
|
||||
};
|
||||
use activitypub_federation::{
|
||||
|
@ -12,7 +12,10 @@ use rand::{distributions::Alphanumeric, thread_rng, Rng};
|
|||
use std::sync::LazyLock;
|
||||
use url::{ParseError, Url};
|
||||
|
||||
pub fn generate_activity_id(data: &Data<IbisData>) -> Result<Url, ParseError> {
|
||||
pub mod error;
|
||||
pub(super) mod scheduled_tasks;
|
||||
|
||||
pub(super) fn generate_activity_id(data: &Data<IbisData>) -> Result<Url, ParseError> {
|
||||
let domain = &data.config.federation.domain;
|
||||
let id: String = thread_rng()
|
||||
.sample_iter(&Alphanumeric)
|
||||
|
@ -32,7 +35,10 @@ pub fn generate_activity_id(data: &Data<IbisData>) -> Result<Url, ParseError> {
|
|||
///
|
||||
/// TODO: testing
|
||||
/// TODO: should cache all these generated versions
|
||||
pub fn generate_article_version(edits: &Vec<DbEdit>, version: &EditVersion) -> MyResult<String> {
|
||||
pub(super) fn generate_article_version(
|
||||
edits: &Vec<DbEdit>,
|
||||
version: &EditVersion,
|
||||
) -> MyResult<String> {
|
||||
let mut generated = String::new();
|
||||
if version == &EditVersion::default() {
|
||||
return Ok(generated);
|
|
@ -1,4 +1,4 @@
|
|||
use super::{database::DbPool, error::MyResult};
|
||||
use crate::backend::{database::DbPool, utils::error::MyResult};
|
||||
use clokwerk::{Scheduler, TimeUnits};
|
||||
use diesel::{sql_query, RunQueryDsl};
|
||||
use log::{error, info};
|
|
@ -1,6 +1,6 @@
|
|||
#[cfg(feature = "ssr")]
|
||||
#[tokio::main]
|
||||
pub async fn main() -> ibis::backend::error::MyResult<()> {
|
||||
pub async fn main() -> ibis::backend::utils::error::MyResult<()> {
|
||||
use ibis::backend::config::IbisConfig;
|
||||
use log::LevelFilter;
|
||||
|
||||
|
|
Loading…
Reference in a new issue