1
0
Fork 0
mirror of https://github.com/Nutomic/ibis.git synced 2024-11-25 18:51:09 +00:00

Rename to Ibis

This commit is contained in:
Felix Ableitner 2023-12-20 17:08:19 +01:00
parent c42556ed05
commit f2c9a76d75
8 changed files with 78 additions and 74 deletions

66
Cargo.lock generated
View file

@ -669,39 +669,6 @@ version = "2.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5"
[[package]]
name = "fediwiki"
version = "0.1.0"
dependencies = [
"activitypub_federation",
"anyhow",
"async-trait",
"axum",
"axum-macros",
"bcrypt",
"chrono",
"diesel",
"diesel-derive-newtype",
"diesel_migrations",
"diffy",
"enum_delegate",
"env_logger",
"futures",
"hex",
"jsonwebtoken",
"once_cell",
"pretty_assertions",
"rand",
"reqwest",
"serde",
"serde_json",
"sha2",
"tokio",
"tracing",
"url",
"uuid",
]
[[package]]
name = "fnv"
version = "1.0.7"
@ -1083,6 +1050,39 @@ dependencies = [
"cc",
]
[[package]]
name = "ibis"
version = "0.1.0"
dependencies = [
"activitypub_federation",
"anyhow",
"async-trait",
"axum",
"axum-macros",
"bcrypt",
"chrono",
"diesel",
"diesel-derive-newtype",
"diesel_migrations",
"diffy",
"enum_delegate",
"env_logger",
"futures",
"hex",
"jsonwebtoken",
"once_cell",
"pretty_assertions",
"rand",
"reqwest",
"serde",
"serde_json",
"sha2",
"tokio",
"tracing",
"url",
"uuid",
]
[[package]]
name = "ident_case"
version = "1.0.1"

View file

@ -1,5 +1,5 @@
[package]
name = "fediwiki"
name = "ibis"
version = "0.1.0"
edition = "2021"

View file

@ -1,8 +1,12 @@
fediwiki
Ibis - A federated Wikipedia Alternative
===
A federated Wikipedia alternative. Main objects in terms of federation are the `Instance` and `Article`. Each article belongs to a single origin instance, the one where it was originally created. Articles have a collection of `Edit`s a custom ActivityPub type containing a diff. The text of any article can be built by starting from empty string and applying all associated edits in order. Instances can synchronize their articles with each other, and follow each other to receive updates about articles. Edits are done with diffs which are generated on the backend, and allow for conflict resolution similar to git. Editing also works over federation. In this case an activity `Update/Edit` is sent to the origin instance. If the diff applies cleanly, the origin instance sends the new text in an `Update/Article` activity to its followers. In case there is a conflict, a `Reject` activity is sent back, the editor needs to resolve and resubmit the edit.
## Name
The Ibis is a [bird which is related to the Egyptian god of knowledge and science](https://en.wikipedia.org/wiki/African_sacred_ibis#In_myth_and_legend).
## License
[AGPL](LICENSE)

View file

@ -1,5 +1,5 @@
use fediwiki::error::MyResult;
use fediwiki::start;
use ibis::error::MyResult;
use ibis::start;
use tracing::log::LevelFilter;
#[tokio::main]
@ -7,9 +7,9 @@ pub async fn main() -> MyResult<()> {
env_logger::builder()
.filter_level(LevelFilter::Warn)
.filter_module("activitypub_federation", LevelFilter::Info)
.filter_module("fediwiki", LevelFilter::Info)
.filter_module("ibis", LevelFilter::Info)
.init();
let database_url = "postgres://fediwiki:password@localhost:5432/fediwiki";
let database_url = "postgres://ibis:password@localhost:5432/ibis";
start("localhost:8131", database_url).await?;
Ok(())
}

View file

@ -1,14 +1,14 @@
use anyhow::anyhow;
use fediwiki::api::article::{CreateArticleData, EditArticleData, ForkArticleData, GetArticleData};
use fediwiki::api::instance::FollowInstance;
use fediwiki::api::user::RegisterUserData;
use fediwiki::api::user::{LoginResponse, LoginUserData};
use fediwiki::api::ResolveObject;
use fediwiki::database::article::ArticleView;
use fediwiki::database::conflict::ApiConflict;
use fediwiki::database::instance::DbInstance;
use fediwiki::error::MyResult;
use fediwiki::start;
use ibis::api::article::{CreateArticleData, EditArticleData, ForkArticleData, GetArticleData};
use ibis::api::instance::FollowInstance;
use ibis::api::user::RegisterUserData;
use ibis::api::user::{LoginResponse, LoginUserData};
use ibis::api::ResolveObject;
use ibis::database::article::ArticleView;
use ibis::database::conflict::ApiConflict;
use ibis::database::instance::DbInstance;
use ibis::error::MyResult;
use ibis::start;
use once_cell::sync::Lazy;
use reqwest::{Client, RequestBuilder, StatusCode};
use serde::de::Deserialize;
@ -27,9 +27,9 @@ use url::Url;
pub static CLIENT: Lazy<Client> = Lazy::new(Client::new);
pub struct TestData {
pub alpha: FediwikiInstance,
pub beta: FediwikiInstance,
pub gamma: FediwikiInstance,
pub alpha: IbisInstance,
pub beta: IbisInstance,
pub gamma: IbisInstance,
}
impl TestData {
@ -39,7 +39,7 @@ impl TestData {
env_logger::builder()
.filter_level(LevelFilter::Warn)
.filter_module("activitypub_federation", LevelFilter::Info)
.filter_module("fediwiki", LevelFilter::Info)
.filter_module("ibis", LevelFilter::Info)
.init();
});
@ -61,17 +61,17 @@ impl TestData {
// initialize postgres databases in parallel because its slow
for j in [
FediwikiInstance::prepare_db(alpha_db_path.clone()),
FediwikiInstance::prepare_db(beta_db_path.clone()),
FediwikiInstance::prepare_db(gamma_db_path.clone()),
IbisInstance::prepare_db(alpha_db_path.clone()),
IbisInstance::prepare_db(beta_db_path.clone()),
IbisInstance::prepare_db(gamma_db_path.clone()),
] {
j.join().unwrap();
}
Self {
alpha: FediwikiInstance::start(alpha_db_path, port_alpha, "alpha").await,
beta: FediwikiInstance::start(beta_db_path, port_beta, "beta").await,
gamma: FediwikiInstance::start(gamma_db_path, port_gamma, "gamma").await,
alpha: IbisInstance::start(alpha_db_path, port_alpha, "alpha").await,
beta: IbisInstance::start(beta_db_path, port_beta, "beta").await,
gamma: IbisInstance::start(gamma_db_path, port_gamma, "gamma").await,
}
}
@ -93,14 +93,14 @@ fn generate_db_path(name: &'static str, port: i32) -> String {
path
}
pub struct FediwikiInstance {
pub struct IbisInstance {
pub hostname: String,
pub jwt: String,
db_path: String,
db_handle: JoinHandle<()>,
}
impl FediwikiInstance {
impl IbisInstance {
fn prepare_db(db_path: String) -> std::thread::JoinHandle<()> {
spawn(move || {
Command::new("./tests/scripts/start_dev_db.sh")
@ -146,7 +146,7 @@ impl FediwikiInstance {
pub const TEST_ARTICLE_DEFAULT_TEXT: &str = "some\nexample\ntext\n";
pub async fn create_article(instance: &FediwikiInstance, title: String) -> MyResult<ArticleView> {
pub async fn create_article(instance: &IbisInstance, title: String) -> MyResult<ArticleView> {
let create_form = CreateArticleData {
title: title.clone(),
};
@ -172,7 +172,7 @@ pub async fn get_article(hostname: &str, article_id: i32) -> MyResult<ArticleVie
}
pub async fn edit_article_with_conflict(
instance: &FediwikiInstance,
instance: &IbisInstance,
edit_form: &EditArticleData,
) -> MyResult<Option<ApiConflict>> {
let req = CLIENT
@ -182,7 +182,7 @@ pub async fn edit_article_with_conflict(
handle_json_res(req).await
}
pub async fn get_conflicts(instance: &FediwikiInstance) -> MyResult<Vec<ApiConflict>> {
pub async fn get_conflicts(instance: &IbisInstance) -> MyResult<Vec<ApiConflict>> {
let req = CLIENT
.get(format!(
"http://{}/api/v1/edit_conflicts",
@ -193,7 +193,7 @@ pub async fn get_conflicts(instance: &FediwikiInstance) -> MyResult<Vec<ApiConfl
}
pub async fn edit_article(
instance: &FediwikiInstance,
instance: &IbisInstance,
edit_form: &EditArticleData,
) -> MyResult<ArticleView> {
let edit_res = edit_article_with_conflict(instance, edit_form).await?;
@ -221,7 +221,7 @@ where
}
pub async fn fork_article(
instance: &FediwikiInstance,
instance: &IbisInstance,
form: &ForkArticleData,
) -> MyResult<ArticleView> {
let req = CLIENT
@ -245,7 +245,7 @@ where
}
}
pub async fn follow_instance(instance: &FediwikiInstance, follow_instance: &str) -> MyResult<()> {
pub async fn follow_instance(instance: &IbisInstance, follow_instance: &str) -> MyResult<()> {
// fetch beta instance on alpha
let resolve_form = ResolveObject {
id: Url::parse(&format!("http://{}", follow_instance))?,
@ -286,7 +286,7 @@ pub async fn register(hostname: &str, username: &str, password: &str) -> MyResul
}
pub async fn login(
instance: &FediwikiInstance,
instance: &IbisInstance,
username: &str,
password: &str,
) -> MyResult<LoginResponse> {

View file

@ -1,4 +1,4 @@
extern crate fediwiki;
extern crate ibis;
mod common;
@ -9,11 +9,11 @@ use crate::common::{
use crate::common::{fork_article, handle_json_res, login};
use crate::common::{get_conflicts, register};
use common::get;
use fediwiki::api::article::{CreateArticleData, EditArticleData, ForkArticleData};
use fediwiki::api::{ResolveObject, SearchArticleData};
use fediwiki::database::article::{ArticleView, DbArticle};
use fediwiki::database::instance::{DbInstance, InstanceView};
use fediwiki::error::MyResult;
use ibis::api::article::{CreateArticleData, EditArticleData, ForkArticleData};
use ibis::api::{ResolveObject, SearchArticleData};
use ibis::database::article::{ArticleView, DbArticle};
use ibis::database::instance::{DbInstance, InstanceView};
use ibis::error::MyResult;
use pretty_assertions::{assert_eq, assert_ne};
use url::Url;