Commit Graph

52 Commits

Author SHA1 Message Date
Kitaiti Makoto
f8a0dff526 Remove unused Follow::build_accept() 2022-05-03 00:45:22 +09:00
Kitaiti Makoto
06d216c7ed Remove unused Follow::accept_follow() 2022-05-03 00:43:47 +09:00
Kitaiti Makoto
f44bca30f4 Use Follow::build_undo07() instead of build_undo() 2022-05-03 00:41:05 +09:00
Kitaiti Makoto
28440271bb Rename: FromId::from_id07 -> from_id 2022-05-02 19:24:36 +09:00
Kitaiti Makoto
0ab7774e29 Rename: AsObject07 -> AsObject 2022-05-02 17:43:03 +09:00
Kitaiti Makoto
33afe9111e Remove AsObject 2022-05-02 17:38:08 +09:00
Kitaiti Makoto
d8a2e1925f Rename FromId07 -> FromId 2022-05-02 16:07:08 +09:00
Kitaiti Makoto
2804f44a06 Rmove FromId 2022-05-02 12:58:01 +09:00
Kitaiti Makoto
05df3b89a1 Fix Follow::activity07() 2022-05-01 07:45:05 +09:00
Kitaiti Makoto
73009818f2 Implement AsObject07<User, Undo07, &DbConn> for Follow 2022-04-24 06:11:54 +09:00
Kitaiti Makoto
fb5027becd Implement FromId07 for Follow 2022-04-24 06:09:00 +09:00
Kitaiti Makoto
86609b51fa Implement AsObject07<User, FollowAct07, &DbConn> for User 2022-04-24 05:51:24 +09:00
Kitaiti Makoto
44799e94fd Implement Follow::accept_follow07() 2022-04-24 05:50:45 +09:00
Kitaiti Makoto
174624f5c1 Implement Follow::build_undo07() 2022-04-24 03:45:22 +09:00
Kitaiti Makoto
5f91345d69 Add test for Follow::build_undo07() 2022-04-24 03:45:11 +09:00
Kitaiti Makoto
9ca975113c Implement Follow::build_accept07() 2022-04-24 03:39:08 +09:00
Kitaiti Makoto
38a55857c6 Add test for Follow::build_accept07() 2022-04-24 03:38:54 +09:00
Kitaiti Makoto
9343d3a120 Implement Follow::to_activity07() 2022-04-24 03:38:36 +09:00
Kitaiti Makoto
c5656971c9 Add test for Follow::to_activity07() 2022-04-24 03:38:24 +09:00
Kitaiti Makoto
93a2c6d99f Add tests for Follow::build_accept() and build_undo() 2022-02-05 17:58:00 +09:00
Kitaiti Makoto
b97c3fdb87 Extract Follow::build_accept 2022-02-05 17:58:00 +09:00
Kitaiti Makoto
64838ad864 Add test for Follow::to_activity() 2022-02-05 17:58:00 +09:00
Kitaiti Makoto
f4d7dfb261 Sign GET request to other instances 2021-12-05 19:32:27 +09:00
Kitaiti Makoto
ae3344f318 Follow Rust and crates update 2021-11-28 08:06:29 +09:00
Kitaiti Makoto
25e52788c5 Replace PlumeRocket with DbConn where possible 2021-01-31 21:58:09 +09:00
Aiden McClelland
24aac22b89
proxy support 2021-01-11 13:27:52 -07:00
Ana Gelez
5f8d6b8e0e Rust 2018! (#726) 2020-01-21 07:02:03 +01:00
fdb-hiroshima
3663bffe5c Update compiler (#725)
* update compiler to recent nightly

* cargo fmt

* fix clippy

but ructe code is still complaining

* update circleci and rocket_csrf

* fix last clippy problems

* cargo fmt

* fix build issue

was caused be improper handling of recursive template (comment) by old ructe, which is fixed on newer version
2020-01-19 12:52:32 +01:00
fdb-hiroshima
006b44f580 Add support for generic timeline (#525)
* Begin adding support for timeline

* fix some bugs with parser

* fmt

* add error reporting for parser

* add tests for timeline query parser

* add rejection tests for parse

* begin adding support for lists

also run migration before compiling, so schema.rs is up to date

* add sqlite migration

* end adding lists

still miss tests and query integration

* cargo fmt

* try to add some tests

* Add some constraint to db, and fix list test

and refactor other tests to use begin_transaction

* add more tests for lists

* add support for lists in query executor

* add keywords for including/excluding boosts and likes

* cargo fmt

* add function to list lists used by query

will make it easier to warn users when creating timeline with unknown lists

* add lang support

* add timeline creation error message when using unexisting lists

* Update .po files

* WIP: interface for timelines

* don't use diesel for migrations

not sure how it passed the ci on the other branch

* add some tests for timeline

add an int representing the order of timelines (first one will be on
top, second just under...)
use first() instead of limit(1).get().into_iter().nth(0)
remove migrations from build artifacts as they are now compiled in

* cargo fmt

* remove timeline order

* fix tests

* add tests for timeline creation failure

* cargo fmt

* add tests for timelines

* add test for matching direct lists and keywords

* add test for language filtering

* Add a more complex test for Timeline::matches, and fix TQ::matches for TQ::Or

* Make the main crate compile + FMT

* Use the new timeline system

- Replace the old "feed" system with timelines
- Display all timelines someone can access on their home page (either their personal ones, or instance timelines)
- Remove functions that were used to get user/local/federated feed
- Add new posts to timelines
- Create a default timeline called "My feed" for everyone, and "Local feed"/"Federated feed" with timelines

@fdb-hiroshima I don't know if that's how you pictured it? If you imagined it differently I can of course make changes.

I hope I didn't forgot anything…

* Cargo fmt

* Try to fix the migration

* Fix tests

* Fix the test (for real this time ?)

* Fix the tests ? + fmt

* Use Kind::Like and Kind::Reshare when needed

* Forgot to run cargo fmt once again

* revert translations

* fix reviewed stuff

* reduce code duplication by macros

* cargo fmt
2019-10-07 19:08:20 +02:00
Igor Galić
8c59c822b6 refactor code to use Shrinkwraprs and diesel-derive-newtype (#598)
* add shrinkwraprs and implement Id thru it

This also means we can automatically convert Id to String without using
.into()!

* cleanup with the help of clippy!

* cleanup with the help of cargo fmt!

* remove extra block

* Shrinkwrap Page, ContentLen and RemoteForm

* translations
2019-05-25 19:23:45 +01:00
fdb-hiroshima
c9070930d2
Improve notification management (#561)
* Don't notify for comment when mentioned

fix #505

* Don't save notification for remote users

fix #472
2019-05-04 17:15:41 +02:00
Baptiste Gelez
12efe721cc
Big refactoring of the Inbox (#443)
* Big refactoring of the Inbox

We now have a type that routes an activity through the registered handlers
until one of them matches.

Each Actor/Activity/Object combination is represented by an implementation of AsObject

These combinations are then registered on the Inbox type, which will try to deserialize
the incoming activity in the requested types.

Advantages:
- nicer syntax: the final API is clearer and more idiomatic
- more generic: only two traits (`AsActor` and `AsObject`) instead of one for each kind of activity
- it is easier to see which activities we handle and which one we don't

* Small fixes

- Avoid panics
- Don't search for AP ID infinitely
- Code style issues

* Fix tests

* Introduce a new trait: FromId

It should be implemented for any AP object.

It allows to look for an object in database using its AP ID, or to dereference it if it was not present in database

Also moves the inbox code to plume-models to test it (and write a basic test for each activity type we handle)

* Use if let instead of match

* Don't require PlumeRocket::intl for tests

* Return early and remove a forgotten dbg!

* Add more tests to try to understand where the issues come from

* Also add a test for comment federation

* Don't check creation_date is the same for blogs

* Make user and blog federation more tolerant to errors/missing fields

* Make clippy happy

* Use the correct Accept header when dereferencing

* Fix follow approval with Mastodon

* Add spaces to characters that should not be in usernames

And validate blog names too

* Smarter dereferencing: only do it once for each actor/object

* Forgot some files

* Cargo fmt

* Delete plume_test

* Delete plume_tests

* Update get_id docs + Remove useless : Sized

* Appease cargo fmt

* Remove dbg! + Use as_ref instead of clone when possible + Use and_then instead of map when possible

* Remove .po~

* send unfollow to local instance

* read cover from update activity

* Make sure "cc" and "to" are never empty

and fix a typo in a constant name

* Cargo fmt
2019-04-17 18:31:47 +01:00
fdb-hiroshima
26fc2cde5d
use circleci instead of travis (#511)
Upgrade rust-toolchain
Upgrade Tantivy
Warning: tantivy now use a different file format, search index may need to be deleted and recreated to work as intended
try to run compile twice in a row because sometime oomk is evil
2019-04-01 20:28:23 +02:00
Baptiste Gelez
bdfad844d7
Edit blogs, and add blog icons and banners (#460)
Also adds a parameter to `md_to_html` to only render inline elements (so that we don't have titles or images in blog descriptions). And moves the delete button for the blog on the edition page.

I still have to update the SQLite migration once others PRs with migrations will be merged.

Also, there will be a problem when you edit a blog while not owning its banner or icon: when validating they will be reset to their default values… I don't see a good solution to this until we have a better way to handle uploads with Rocket (the same is probably happening for articles btw).

And the icon/banner are not federated yet, I don't know if I should add it to this PR or if it can come after?

![image](https://user-images.githubusercontent.com/16254623/53894510-7d853300-4030-11e9-8a2c-f5c0b0c7f512.png)
![image](https://user-images.githubusercontent.com/16254623/53894539-8b3ab880-4030-11e9-8113-685a27be8d7c.png)

Fixes #453
Fixes #454
2019-03-22 19:51:36 +01:00
fdb-hiroshima
65bb50e88f Centralize configuration and add some new config (#494)
Ideally, if someone could review the idea in [this comment](https://github.com/Plume-org/Plume/issues/273#issuecomment-474982184), I'd like to add the implementation to this pr too
2019-03-21 10:30:33 +01:00
Atul Bhosale
b945d1f602 Run 'cargo fmt' to format code (#489) 2019-03-20 17:56:17 +01:00
Baptiste Gelez
42dca3daae
Remove some unused #[derive] (#473)
We used to need them, probably when we were using Tera.
2019-03-12 19:40:54 +01:00
Baptiste Gelez
2a188abfa1
Fix follow IDs (#455)
* Generate valid IDs for Follow

Fixes #449

* Use the new post-insert hook for all the models

* Fix plume-cli build
2019-03-04 21:35:03 +01:00
Baptiste Gelez
80a4dae8bd
Avoid panics (#392)
- Use `Result` as much as possible
- Display errors instead of panicking

TODO (maybe in another PR? this one is already quite big):
- Find a way to merge Ructe/ErrorPage types, so that we can have routes returning `Result<X, ErrorPage>` instead of panicking when we have an `Error`
- Display more details about the error, to make it easier to debug

(sorry, this isn't going to be fun to review, the diff is huge, but it is always the same changes)
2018-12-29 09:36:07 +01:00
fdb-hiroshima
0ea1d57e48
Fix some federation issues (#357)
* Fix some follow issues

Fix not receiving notifications when followed by remote users
Fix imposibility to be unfollowed by Mastodon/Pleroma users (tested only against Pleroma)

* Fix notification on every post

* Fix issues with federation

Send Link instead of Object when emiting Follow request
Receive both Link and Object for Follow request
Don't panic when fetching user with no followers or posts from Pleroma
Reorder follower routes so Activity Pub one is reachable

* Generate absolute urls for mentions and tags

* Verify author when undoing activity by Link
2018-12-23 11:12:15 +01:00
fdb-hiroshima
74c398d60c
Run cargo clippy on whole project (#322)
* Run cargo clippy on plume-common

Run clippy on plume-common and adjuste code accordingly

* Run cargo clippy on plume-model

Run clippy on plume-model and adjuste code accordingly

* Reduce need for allocation in plume-common

* Reduce need for allocation in plume-model

add a quick compilation failure if no database backend is enabled

* Run cargo clippy on plume-cli

* Run cargo clippy on plume
2018-11-26 10:21:52 +01:00
fdb-hiroshima
8a4702df92 Add unit tests for main model parts (#310)
Add tests for following models:
- Blog
- Instance
- Media
- User
2018-11-24 12:44:17 +01:00
KokaKiwi
0b9727ed28 Generate valid follow Accept activity URI (#317)
For now it only generate a "fake" URI for accept follow activities, but it should be possible to get the URI dereferencable later.

Also I don't know if this URI looks ok, I tried to get something kind of future-proof, but I don't really know about the actual URIs conventions.

Closes #313
2018-11-23 13:23:46 +01:00
Baptiste Gelez
fcf911fac9 ActivityPub: don't delete anything if the actor is not authorized 2018-10-22 16:29:25 +01:00
Trinity Pointard
4e6f3209d5 Normalize panic message
Change all unwrap to expect
Normalize expect's messages
Don't panic where it could be avoided easily
2018-10-20 08:44:33 +02:00
Bat
743620eb6a
Fix the SQlite build 2018-09-30 14:13:56 +02:00
Bat
38d737ed0c
Introduce features to choose between SQlite or Postgres 2018-09-30 14:13:54 +02:00
Bat
008f2b1d71 Delete notifications when deleting likes/boosts/follows
Fixes #190
2018-09-07 23:29:50 +01:00
Bat
dcebc4653a Make it possible to unfollow someone
I was sure it was already implemented, but it looks like it wasn't
2018-09-04 11:37:58 +01:00
Bat
c87d490664 Refactor notifications 2018-07-26 15:46:10 +02:00