diff --git a/Cargo.lock b/Cargo.lock index 316e658..345e825 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "activitypub_federation" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eee115a53849bbcac6c953495b5f9322b56680c0a1bdef6813183f0453f9ee3c" +checksum = "a028034c642d3ed16b535f98f48b3df30397833c183d68852d79de16650d5ed5" dependencies = [ "activitystreams-kinds", "async-trait", diff --git a/Cargo.toml b/Cargo.toml index 9a7a4d9..8410bdd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ dbg_macro = "deny" unwrap_used = "deny" [dependencies] -activitypub_federation = { version = "0.5.1", features = [ +activitypub_federation = { version = "0.5.2", features = [ "axum", "diesel", ], default-features = false, optional = true } diff --git a/assets/ibis.css b/assets/ibis.css index 7515b01..e14deca 100644 --- a/assets/ibis.css +++ b/assets/ibis.css @@ -25,6 +25,7 @@ main { .item-view { padding: 0 20px 20px 20px; + max-width: 700px; } pre { diff --git a/migrations/2023-11-28-150402_ibis_setup/up.sql b/migrations/2023-11-28-150402_ibis_setup/up.sql index 86d297d..2f5fcb8 100644 --- a/migrations/2023-11-28-150402_ibis_setup/up.sql +++ b/migrations/2023-11-28-150402_ibis_setup/up.sql @@ -3,8 +3,8 @@ create table instance ( domain text not null unique, ap_id varchar(255) not null unique, description text, - inbox_url text not null, articles_url varchar(255) not null unique, + inbox_url varchar(255) not null, public_key text not null, private_key text, last_refreshed_at timestamptz not null default now(), @@ -15,7 +15,7 @@ create table person ( id serial primary key, username text not null, ap_id varchar(255) not null unique, - inbox_url text not null, + inbox_url varchar(255) not null, public_key text not null, private_key text, last_refreshed_at timestamptz not null default now(), diff --git a/src/backend/database/schema.rs b/src/backend/database/schema.rs index c6179d7..7a8e12d 100644 --- a/src/backend/database/schema.rs +++ b/src/backend/database/schema.rs @@ -47,9 +47,10 @@ diesel::table! { #[max_length = 255] ap_id -> Varchar, description -> Nullable, - inbox_url -> Text, #[max_length = 255] articles_url -> Varchar, + #[max_length = 255] + inbox_url -> Varchar, public_key -> Text, private_key -> Nullable, last_refreshed_at -> Timestamptz, @@ -88,7 +89,8 @@ diesel::table! { username -> Text, #[max_length = 255] ap_id -> Varchar, - inbox_url -> Text, + #[max_length = 255] + inbox_url -> Varchar, public_key -> Text, private_key -> Nullable, last_refreshed_at -> Timestamptz, diff --git a/src/backend/federation/objects/edits_collection.rs b/src/backend/federation/objects/edits_collection.rs index 93fa91e..89173dd 100644 --- a/src/backend/federation/objects/edits_collection.rs +++ b/src/backend/federation/objects/edits_collection.rs @@ -1,6 +1,6 @@ use crate::{ backend::{database::IbisData, error::Error, federation::objects::edit::ApubEdit}, - common::{DbArticle, DbEdit, DbInstance}, + common::{DbArticle, DbEdit}, }; use activitypub_federation::{ config::Data, @@ -45,10 +45,9 @@ impl Collection for DbEditCollection { .collect::>(), ) .await?; - let local_instance = DbInstance::read_local_instance(data)?; let collection = ApubEditCollection { r#type: Default::default(), - id: Url::from(local_instance.articles_url), + id: Url::from(article.article.edits_id()?), total_items: edits.len() as i32, items: edits, }; diff --git a/src/database/schema.rs b/src/database/schema.rs deleted file mode 100644 index c6179d7..0000000 --- a/src/database/schema.rs +++ /dev/null @@ -1,117 +0,0 @@ -// @generated automatically by Diesel CLI. - -diesel::table! { - article (id) { - id -> Int4, - title -> Text, - text -> Text, - #[max_length = 255] - ap_id -> Varchar, - instance_id -> Int4, - local -> Bool, - protected -> Bool, - } -} - -diesel::table! { - conflict (id) { - id -> Int4, - hash -> Uuid, - diff -> Text, - summary -> Text, - creator_id -> Int4, - article_id -> Int4, - previous_version_id -> Uuid, - } -} - -diesel::table! { - edit (id) { - id -> Int4, - creator_id -> Int4, - hash -> Uuid, - #[max_length = 255] - ap_id -> Varchar, - diff -> Text, - summary -> Text, - article_id -> Int4, - previous_version_id -> Uuid, - created -> Timestamptz, - } -} - -diesel::table! { - instance (id) { - id -> Int4, - domain -> Text, - #[max_length = 255] - ap_id -> Varchar, - description -> Nullable, - inbox_url -> Text, - #[max_length = 255] - articles_url -> Varchar, - public_key -> Text, - private_key -> Nullable, - last_refreshed_at -> Timestamptz, - local -> Bool, - } -} - -diesel::table! { - instance_follow (id) { - id -> Int4, - instance_id -> Int4, - follower_id -> Int4, - pending -> Bool, - } -} - -diesel::table! { - jwt_secret (id) { - id -> Int4, - secret -> Varchar, - } -} - -diesel::table! { - local_user (id) { - id -> Int4, - password_encrypted -> Text, - person_id -> Int4, - admin -> Bool, - } -} - -diesel::table! { - person (id) { - id -> Int4, - username -> Text, - #[max_length = 255] - ap_id -> Varchar, - inbox_url -> Text, - public_key -> Text, - private_key -> Nullable, - last_refreshed_at -> Timestamptz, - local -> Bool, - } -} - -diesel::joinable!(article -> instance (instance_id)); -diesel::joinable!(conflict -> article (article_id)); -diesel::joinable!(conflict -> local_user (creator_id)); -diesel::joinable!(edit -> article (article_id)); -diesel::joinable!(edit -> person (creator_id)); -diesel::joinable!(instance_follow -> instance (instance_id)); -diesel::joinable!(instance_follow -> person (follower_id)); -diesel::joinable!(local_user -> person (person_id)); - -diesel::allow_tables_to_appear_in_same_query!( - article, - conflict, - edit, - instance, - instance_follow, - jwt_secret, - local_user, - person, -);