Commit Graph

157 Commits

Author SHA1 Message Date
Baptiste Gelez
fe6e69d7c4
Add a fqn field to blogs and users (#457)
Fixes #319
2019-03-06 18:28:10 +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
e28371bbe4
Add a page listing people someone follows (#444)
Nothing exceptional, the layout is the same as the followers page.

Fixes #325
2019-02-26 13:13:00 +01:00
Baptiste Gelez
7eef4643c8
Update rocket_i18n and add gettext_macros (#431)
Internationalization now uses proc-macros that generate the .pot file
automatically.
2019-02-02 15:23:50 +01:00
fdb-hiroshima
c4a4ea5b6c Support blind key rotation (#399)
* Allow receiving objects with new unknown key

* Rotate key after sending Delete activity

* Do the right check
2019-01-05 22:30:28 +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
ccba485215
Trim email and username (#386)
Also forbid whitespaces in username
Fix #385
2018-12-25 18:00:21 +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
ab2998e214
Make Plume compile on release (#365)
* Remove use of String for body parameters

Create SignedJson and implement FromData for it

* Make Travis test on release

* Remove warning when installing and fix coverage
2018-12-22 18:27:21 +01:00
Baptiste Gelez
38302203f4
Count items in database as much as possible (#344)
* Count items in database as much as possible

* Fix the tests

* Remove two useless queries

* Run pragma directive before each sqlite connection

* Pragma for tests too

* Remove debug messages
2018-12-14 23:16:18 +01:00
Baptiste Gelez
b0089e59b7
Remove useless pagination routes (#351)
Rocket 0.4 let us have routes with optional query parameter
2018-12-13 22:20:19 +01:00
Baptiste Gelez
b73fbd3768
License federation (#343)
* Federate license

* Make it possible to use no license
2018-12-09 18:43:34 +01:00
fdb-hiroshima
e1ecc7289f
Upgrade plume dependencies (#332)
* Bump base64 from 0.9.3 to 0.10.0
* Bump bcrypt from 0.2.0 to 0.2.1
* Bump canapi from 0.1.0 to 0.2.0
* Bump failure from 0.1.2 to 0.1.3
* Bump hyper from 0.11.27 to 0.12.11
* Bump hyper from 0.11.27 to 0.12.16
* Bump lazy_static from 1.1.0 to 1.2.0
* Bump multipart from 0.15.3 to 0.15.4
* Bump openssl from 0.10.12 to 0.10.15
* Bump pulldown-cmark from 0.1.2 to 0.2.0
* Bump reqwest from 0.9.2 to 0.9.5
* Bump rocket from 0.4.0-rc.1 to 0.4.0
* Bump rpassword from 2.0.0 to 2.1.0
* Bump ructe from 0.5.2 to 0.5.4
* Bump serde_derive from 1.0.79 to 1.0.80
* Bump serde from 1.0.79 to 1.0.80
* Bump serde_json from 1.0.32 to 1.0.33
* Bump tera from 0.11.17 to 0.11.20
* Bump url from 1.7.1 to 1.7.2
* Bump validator to from 0.7.2 to 0.8.0
* Bump validator_derive from 0.7.2 to 0.8.0
* Bump whatlang from 0.5.0 to 0.6.0
* Remove hyper from plume-common dependencies
* Remove rpassword from Plume dependancies
* Upgrade compiler to nightly-2018-12-06
2018-12-07 21:00:12 +01:00
Baptiste Gelez
70af57c6e1
Use Ructe (#327)
All the template are now compiled at compile-time with the `ructe` crate.

I preferred to use it instead of askama because it allows more complex Rust expressions, where askama only supports a small subset of expressions and doesn't allow them everywhere (for instance, `{{ macro!() | filter }}` would result in a parsing error).

The diff is quite huge, but there is normally no changes in functionality.

Fixes #161 and unblocks #110 and #273
2018-12-06 18:54:16 +01:00
fdb-hiroshima
449641d158
Add a search engine into Plume (#324)
* Add search engine to the model

Add a Tantivy based search engine to the model
Implement most required functions for it

* Implement indexing and plm subcommands

Implement indexation on insert, update and delete
Modify func args to get the indexer where required
Add subcommand to initialize, refill and unlock search db

* Move to a new threadpool engine allowing scheduling

* Autocommit search index every half an hour

* Implement front part of search

Add default fields for search
Add new routes and templates for search and result
Implement FromFormValue for Page to reuse it on search result pagination
Add optional query parameters to paginate template's macro
Update to newer rocket_csrf, don't get csrf token on GET forms

* Handle process termination to release lock

Handle process termination
Add tests to search

* Add proper support for advanced search

Add an advanced search form to /search, in template and route
Modify Tantivy schema, add new tokenizer for some properties
Create new String query parser
Create Tantivy query AST from our own

* Split search.rs, add comment and tests

Split search.rs into multiple submodules
Add comments and tests for Query
Make user@domain be treated as one could assume
2018-12-02 17:37:51 +01:00
Trinity Pointard
9714bafded Verify username for special characters on signup 2018-12-02 12:43:03 +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
Trinity Pointard
fd92383f87 Normalize panic message and return 400 or 404 when suitable 2018-10-20 11:04:20 +02:00
Trinity Pointard
ba4695f490 Add support for signature verification on pseudo header
Add support for pseudo-header '(request-target)'
Add some logging for denied request
2018-10-10 21:10:43 +02:00
Trinity Pointard
3466e55548 Implement JSON-ld signature verification
Implement JSON-ld signature verification
Move signature verification functions to the proper file
2018-10-06 10:06:06 +02:00
Trinity Pointard
62c94ed463 Refactor and verify http signature on personnal inbox
Verify signature on personnal inbox
Reduce code duplication
Put Headers in plume-models
2018-10-03 20:48:25 +02:00
Bat
d8ca1d70b7 Fix CSRF issues
GET routes are not protected against CSRF. This commit changes the needed URLs to
POST and replace simple links with forms.

Thanks @fdb-hiroshima for noticing it!
2018-09-19 18:13:07 +01:00
Bat
10da8f31b6 Hide articles on public pages
Only show them in the dashboard
2018-09-10 20:06:00 +01:00
Bat
de3707983a Account deletion
Fixes #182
2018-09-09 20:49:24 +01:00
Bat
f66ddf6ef2 Actually implement blocks 2018-09-08 22:05:48 +01:00
Baptiste Gelez
fe7f87c47f
Merge pull request #205 from lthms/recent_rocket
Update to a more recent rocket and rust toolchain
2018-09-08 19:06:52 +01:00
Thomas Letan
0ef4717a7f deps: Update to a more recent rocket and rust toolchain
With this patch, Plume will be use a more up-to-date revision of
Rocket, that works with nightly-2018-07-17. It may have been able to
make it work with a more recent revision, but it turns out rocket has
introduced several breaking changes so I’d rather fix those.

Besides updating rocket_i18n and rocket_csrf to use the same revision
than Plume, this patch deals with the new implementation of the
Uri<'_> type. It silents a class of warnings, to deal with a change in
rustc which affects diesel. This latter change should be reverted as
soon as diesel releases a new version of its crate.
2018-09-08 15:51:55 +02:00
Bat
2822f8efe9 Don't show the "Registrations closed" message if there is an error when creating a new user 2018-09-07 20:13:14 +01:00
Bat
7653551d57 Fix some compilation errors 2018-09-04 11:45:41 +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
32a4949f25 Update user information if needed
When a remote is displayed, if it has not been updated since at least 24 hours, newer informations are fetched.

Fixes #135
2018-09-03 19:53:20 +01:00
Bat
ac631627ab Make it possible to disable registrations
Fix #41
2018-09-03 17:05:45 +01:00
Bat
3013eec579 Redesign menu items 2018-09-03 14:59:02 +01:00
Bat
97c0b533ab Add Atom feeds for blogs and users 2018-09-01 21:08:26 +01:00
Bat
38d99ad5af Try to fetch followers 2018-07-27 12:53:21 +02:00
Bat
0314629d99 Improve the background article fetching code 2018-07-26 22:59:41 +02:00
Bat
bd259891f3 Try to fetch remote articles 2018-07-26 22:23:53 +02:00
Bat
a9f95c91e2 Sent activities in other threads 2018-07-26 17:51:41 +02:00
Bat
4e07fdbd05 Paginate followers too 2018-07-25 15:50:29 +02:00
Bat
3764e295b8 Fix the link of the follow/unfollow button so that it is always working, even without a trailing slash 2018-07-20 17:59:16 +02:00
Bat
b95e384ed7 Use the ApRequest guard for routes that need it + Fix a few issues with its impl
Also fixes some Rocket warnings!
2018-07-11 17:30:01 +02:00
Bat
3775d3a9c9 HTML validation + Actually associate messages to errors + Fix inverted behavior on new blog and post form 2018-07-07 22:51:48 +02:00
Bat
5f3afe900f Display errors on invalid forms
It will probably need a bit of styling…
2018-07-06 19:29:36 +02:00
Bat
153400959c Actually validate forms 2018-07-06 11:51:19 +02:00
Bat
c81bb9ec25 Make forms validatable 2018-06-29 14:56:00 +02:00
Trinity Pointard
30e9620d0a Add csrf protection 2018-06-24 18:58:57 +02:00
Bat
68c7aad179 Big repository reorganization
The code is divided in three crates:
- plume-common, for the ActivityPub module, and some common utils
- plume-models, for the models and database-related code
- plume, the app itself

This new organization will allow to test it more easily, but also to create other tools that only reuse a little part of
the code (for instance a Wordpress import tool, that would just use the plume-models crate)
2018-06-23 17:36:11 +01:00
Bat
e7fd12ae6f Set to and cc for new Follow activities 2018-06-23 13:47:53 +01:00
Didier Link
b153a9ce2b add an argument in the macro may_fail to have the account linked in the error template 2018-06-22 00:50:06 +02:00
Bat
e34d12922c Serialize publicKey in Person representation 2018-06-21 22:12:24 +01:00
Bat
f5f2aa7c59 Get rid of the activity_pub::actor::Actor trait 2018-06-21 18:53:57 +01:00
Bat
b2e8d54161 Drop activity_pub::activitypub and activity_pub::ActivityPub and only use the ActivityStream responder 2018-06-21 18:09:18 +01:00
Bat
3fe2625e86 Simplify the Inbox trait
If we want to add, for instance, streams in the future, we could introduce
a new trait for that, similar to FromActivity or Notify

We also display inbox errors to the "client" if something fails,
which could be useful for debugging.
2018-06-21 17:00:37 +01:00
Bat
2217ec0d56 Remove PgConnection when we don't need it
Massive simplification in the ActivityPub module!
2018-06-21 16:31:42 +01:00
Bat
5457a80eec Avoid calling compute_id when we shouldn't
It should only be used at initialization, after we should prefer ap_url,
as not everybody is using the same URLs as Plume.
2018-06-21 15:53:58 +01:00
Bat
3551bef895 Simplify the activity_pub::inbox::Notify trait + Fix notifications
Also fix a bug with the list of mentions that was returned
2018-06-20 22:51:47 +01:00
Bat
635ac6cf42 Merge branch 'master' into setup-script 2018-06-19 22:26:31 +01:00
Bat
8ab25b1ca2 Use uri! as much as possible instead of directly writing URLs 2018-06-19 22:20:27 +01:00
Bat
dd152f2607 Remove old configuration code 2018-06-19 18:29:34 +01:00
Bat
51571d6320 may_fail! macro
Returns an error template if an Option is None, else runs the given block
2018-06-18 18:28:28 +01:00
Bat
7e3cdec0b6 Add some to_json functions to models for serialization in templates 2018-06-18 17:34:29 +01:00
Bat
36bf2e114c Fix local notifications 2018-06-18 12:32:03 +01:00
Bat
0b9515645c De-duplicate some parts of the users templates 2018-06-17 18:48:22 +01:00
Bat
b18aa33c70 Update to the latest version of Rocket, to use rocket_contrib::Template::custom 2018-06-16 18:39:22 +01:00
Bat
c9b4c40fa1 Add the gettext-rs crate 2018-06-15 14:08:38 +01:00
Bat
a4a8446d45 Make the follow button a bit smarter 2018-06-13 19:06:14 +01:00
Bat
1c287c6dfe View remote profiles locally
Add a link to the profile on the real instance
2018-06-13 18:48:37 +01:00
Bat
edbeeef640 Add a dashboard 2018-06-10 18:55:08 +01:00
Bat
7a3215edaa Show 6 articles on the home and on profiles 2018-06-10 17:37:02 +01:00
Bat
78362feffb Use the activitypub crate 2018-06-10 12:13:07 +01:00
Trinity Pointard
3dcd78f205 fix redirection to login in src/routes/user.rs 2018-06-07 10:39:22 +02:00
Bat
e9cd48ecca Display reshares on profile page 2018-05-24 10:45:36 +01:00
Trinity Pointard
a8aeb40b95 add trailing slashes to links where they were missing
Signed-off-by: Trinity Pointard <trinity.pointard@insa-rennes.fr>
2018-05-22 17:35:16 +02:00
Bat
14bf3f00aa Make post metadata look nicer 2018-05-19 08:53:51 +01:00
Bat
b55622f2b1 Reorganize use statements 2018-05-19 08:39:59 +01:00
Baptiste Gelez
d7552ba369
Merge pull request #27 from Plume-org/activitystreams
Use the Activitystreams crate
2018-05-18 23:14:55 +01:00
Bat
4a86af6fc1 Resolve activitystream TODOs 2018-05-18 23:04:30 +01:00
Bat
e83226ae85 Validate data before creating a new account
Fix #28
2018-05-18 21:48:07 +01:00
Bat
c779b1c58a WIP: use the activitystreams crate 2018-05-16 19:20:44 +01:00
Bat
91b19bccb5 Add a link to author's profile on article card
Use a macro to render those cards too
2018-05-13 18:19:23 +01:00
Bat
fdc481e384 Use shared inbox when available
But it is not yet stored in the database, so it means never
2018-05-13 15:39:55 +01:00
Bat
c6b2560eb0 Followers listing
And clean up models functions a bit
2018-05-13 12:53:58 +01:00
Bat
b8aade1e12 Delete likes 2018-05-12 21:56:57 +01:00
Bat
b68e481b3f Make the website more mobile-friendly 2018-05-12 18:59:38 +01:00
Bat
aefa31b84e Add a few (ugly) badges to the user page 2018-05-12 17:55:25 +01:00
Bat
ea08718c23 User profile edition 2018-05-12 16:30:14 +01:00
Bat
6de9d5b82a Articles listings on blogs and users pages 2018-05-12 14:31:09 +01:00
Bat
a74215ef07 Start an actual design 2018-05-10 21:31:52 +01:00
Bat
292f4d6b27 Add actual templates for everything 2018-05-09 20:09:52 +01:00
Bat
92af83565e Add an AP followers endpoint for users 2018-05-04 14:13:55 +01:00
Bat
22cb286f86 Signing activities
I hope it works correctly…

Fixes #6
2018-05-03 20:11:04 +01:00
Bat
afe98ab1c3 Start refactoring activities 2018-05-02 21:44:03 +01:00
Bat
9fdfb2b25e Follow endpoint 2018-05-01 20:57:30 +01:00
Bat
03df88e186 WIP: inboxes 2018-05-01 15:00:29 +01:00
Bat
8047df6848 Display remote profiles! 2018-05-01 12:48:19 +01:00
Bat
80472506ca User outbox 2018-04-29 19:01:42 +01:00
Bat
721456de30 Actually start playing with ActivityPub
And Rust
2018-04-24 15:52:47 +01:00
Bat
0b00849a62 Refactor ActivityPub 2018-04-24 13:31:02 +01:00
Bat
0c9a1bfc3a Reorganize uses 2018-04-24 10:21:39 +01:00