Commit Graph
100 Commits
Author SHA1 Message Date
Baptiste GelezandGitHub 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
Baptiste Gelezandfdb-hiroshima d7de09ab81 Fix Atom feed link on user page (#518) 2019-04-07 05:53:38 +02:00
Baptiste GelezandGitHub 7645fdbf35 Fix tabs on user page (#516)
The "Articles" tab was always selected.
2019-04-06 19:03:00 +01:00
Baptiste GelezandGitHub 1bc2684af1 Run cargo fmt on plume-front (#515)
When `editor-improvements` was merged it was not run, because Travis was still used, but now it makes Circle CI fail on master.
2019-04-06 18:57:25 +01:00
Baptiste GelezandGitHub 1f7ff62c19 Editor improvements (#486)
- Make it possible to insert new paragraphs in the article body
- Make it impossible to copy formatted HTML (to make media insertion from markdown code work correctly)

TODO:

- [x] make it possible to escape draft mode
- [x] display errors from the server
- [x] button to go back to the "normal" editor
- [x] Avoid publishing placeholders
2019-04-06 14:20:12 +01:00
Baptiste Gelezandfdb-hiroshima 21cb0ef437 Always use GMT as a timezone for federation (#502)
To prevent a bug with Mastodon
2019-03-25 14:13:54 +01:00
Baptiste GelezandGitHub 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
Baptiste Gelez 90baf9beb1 Update Crowdin configuration file 2019-03-15 16:45:17 +01:00
Baptiste GelezandGitHub 9076dbaadc New editor (#458)
With this PR, when JS is activated and WASM supported, the article editor will be dynamically replaced with `contenteditable`s elements. This makes the editing interface simpler and less like a regular form. It will also allow us to easily add visual formatting with native browser APIs (and to insert images or videos directly). Here is a little demo:

![peek 05-03-2019 16-12](https://user-images.githubusercontent.com/16254623/53815536-1dc05680-3f62-11e9-94d3-b363ed84eb97.gif)

There is still a lot to do, but it is a good first step.

Fixes #255
2019-03-15 16:06:10 +01:00
Baptiste Gelez ffcbc0fde3 Update Crowdin configuration file 2019-03-15 14:41:51 +01:00
Baptiste GelezandGitHub 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 GelezandIgor Galić 6405bd7261 Update issue templates (#471)
Use two different templates instead of one: one for bugs, one for feature requests.
2019-03-12 17:20:53 +01:00
Baptiste GelezandIgor Galić b52b8fc880 Fix wrong condition, resulting in 404 for valid NodeInfo endpoints (#464)
* Fix wrong condition, resulting in 404 for valid NodeInfo endpoints

* Forgot to remove that dbg!
2019-03-12 17:00:23 +01:00
Baptiste GelezandGitHub fe6e69d7c4 Add a fqn field to blogs and users (#457)
Fixes #319
2019-03-06 18:28:10 +01:00
Baptiste GelezandGitHub eff2698664 Slightly improve the media experience (#452)
* Slightly improve the media experience

- Use a grid to display the list of media
- Add icons for non-image media preview
- Paginate the gallery
- Add links to the gallery in the editor and in the profile settings to make it more discoverable when you need it

Fixes #432

* Allow video and audio tags in SafeString

Otherwise we can't display their preview, nor show them in articles

Also show controls by default for these two elements

* Show fallback images for audio and unknown files, to make them more visible

* Add a new constructor to SafeString when the input is trusted and doesn't need to be escaped.

And use it to generate media previews.

* Make it possible to insert video/audio in articles
2019-03-06 14:11:36 +01:00
Baptiste GelezandGitHub a5e0486da0 Make media extension parsing safer (#459)
Only keep it if contains letters and numbers only, otherwise remove it.

To be merged before #452
2019-03-06 14:09:43 +01:00
Baptiste GelezandGitHub 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 GelezandGitHub 9b48b8a846 Update dependencies (#456)
(whatlang especially, since it received an update that removes many build dependencies, making our total dependency count go from 512 to 478)
2019-03-04 20:46:26 +01:00
Baptiste GelezandGitHub a2b9d7ec44 Password reset (#448)
* Password reset

* Various improvements and fixes for password reset

- Reorganize src/mail.rs to make it  cleaner
- add a build_mail function
- only make the requests invalid after 2 hours
- avoid infintely-growing list of requests by deleting them once completed, or after 24 hours
- avoid sending many requests for the same user
- validate the password reset form

* Avoid locking so many times

Fix durations

* Remove old requests even if the current one is not valid

* Remove unused feature

* Also remove the custom_derive and plugin features while we are at it

* Forgot a 0 è_é

* Avoid panicking while owning a request lock

* Use master branch of lettre so that we can build with the latest OpenSSL

* Fix the debug mailer
2019-02-27 13:29:26 +01:00
Baptiste GelezandGitHub 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 GelezandGitHub 576a4ed499 Pull i18n from Funkwhale's weblate (#439)
* Added translation using Weblate (Arabic)

* Translated using Weblate (Arabic)

Currently translated at 66.7% (124 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ar/

* Translated using Weblate (English)

Currently translated at 100.0% (186 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/en/

* Translated using Weblate (Japanese)

Currently translated at 100.0% (186 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ja/

* Translated using Weblate (Arabic)

Currently translated at 68.8% (128 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ar/

* Translated using Weblate (Norwegian Bokmål)

Currently translated at 96.8% (180 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/nb/

* Translated using Weblate (Arabic)

Currently translated at 95.7% (178 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ar/

* Added translation using Weblate (Spanish)

* Translated using Weblate (Spanish)

Currently translated at 3.8% (7 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/es/

* Added translation using Weblate (Portuguese (Portugal))

* Translated using Weblate (Arabic)

Currently translated at 99.5% (185 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ar/

* Translated using Weblate (Portuguese (Portugal))

Currently translated at 95.7% (178 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/pt_PT/

* Translated using Weblate (Spanish)

Currently translated at 26.9% (50 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/es/

* Translated using Weblate (Spanish)

Currently translated at 34.9% (65 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/es/

* Translated using Weblate (Spanish)

Currently translated at 34.9% (65 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/es/
2019-02-13 13:39:42 +01:00
Baptiste GelezandGitHub 77bfe635d7 Update dependencies (#440) 2019-02-13 13:39:30 +01:00
Baptiste GelezandGitHub 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
Baptiste GelezandGitHub 5880dc1957 Improve search UI (#375) 2019-01-28 13:12:56 +01:00
Baptiste GelezandGitHub 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
Baptiste GelezandGitHub 3fce5d6a14 Use Rust for the front-end too (#374)
Rust can compile to WASM, so let's use it for front-end code as well.

To compile the front-end:

```
cargo install cargo-web
cargo web deploy -p plume-front
```
2018-12-25 11:51:40 +01:00
Baptiste GelezandGitHub 4ec2480f50 Post creation API (#307) 2018-12-24 16:42:40 +01:00
Baptiste GelezandGitHub 8ff6332784 I'm not the only one who made Plume è_é (#373) 2018-12-23 17:29:08 +01:00
Baptiste GelezandGitHub 04625b3fea Use Route159 for comment deletion button (#372)
For some reason it was not what was used.
2018-12-23 15:58:25 +01:00
Baptiste GelezandGitHub 5a682419cb Remove the docs folder (#371)
Since documentation now has its own repo.

I also modified a bit the dockerfile to make the image lighter.
2018-12-23 15:24:55 +01:00
Baptiste GelezandGitHub 718e23ac85 Update README.md
Links to joinplu.me

Say that we have a CoC

Remove link to baptiste.gelez.xyz
2018-12-21 19:53:09 +01:00
Baptiste GelezandGitHub 9e799f2cf2 Use SCSS (#355)
- Use variables
- Split everything in various files

The SCSS is compiled with `cargo build`/`run`

I also fixed a few visual issues.
2018-12-15 22:06:27 +01:00
Baptiste GelezandGitHub 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 GelezandGitHub 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 e139008d35 Fix reshare button style 2018-12-13 21:56:26 +01:00
Baptiste GelezandGitHub 61b6ceed92 Add some constraint at database level (#342)
* Add some constraint at database level

Fixes #79 and should fix #201 and #113 as well

* Fix tests

Delete duplicated data before adding constraints (only with Postgres, there is no way to do it with Sqlite with complex constraints like the one we are using)

Remove the constraint on media path

* We don't need to drop the media unique constraint anymore

Because we deleted it
2018-12-09 18:44:26 +01:00
Baptiste GelezandGitHub b73fbd3768 License federation (#343)
* Federate license

* Make it possible to use no license
2018-12-09 18:43:34 +01:00
Baptiste GelezandGitHub 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
Baptiste GelezandGitHub a64c4912cf Add support for CW in comments (#308)
All the backend/federation code was already, I just added the UI 🤷‍♀️ 

Fixes #253
2018-11-07 15:57:31 +01:00
Baptiste GelezandGitHub b28411da99 Test with PostgreSQL too (#309)
* Test with PostgreSQL too

* Add 'test' to Travis build stages

* Add test coverage for postgresql
2018-11-07 15:50:24 +01:00
Baptiste Gelez 3690e4cfb9 Fix the path of the media directory for Docker setups 2018-11-06 10:56:42 +01:00
Baptiste Gelez 94904fa3d5 Escape titles in RSS feeds 2018-11-06 10:49:46 +01:00
Baptiste Gelez f0b911a328 Fix RSS feed link on blog pages 2018-11-06 10:41:17 +01:00
Baptiste GelezandGitHub 8d5eaaec6a Add Codecov badge 2018-11-02 10:02:31 +01:00
Baptiste GelezandGitHub 6b2d9d4221 Tests infrastructure for plume-models (#302)
First step for testing `plume-models`. I only added one test for the moment, but we should add more in future PRs.
2018-11-01 22:23:38 +01:00
Baptiste Gelez 57cf55fecc Fix RSS feed icon
Closes #289
2018-10-31 18:17:13 +01:00
Baptiste Gelez 67077267cf Add OpenGraph metadata 2018-10-31 16:14:26 +01:00
Baptiste Gelez 68a30cc80e Fix spacing for the delete article button 2018-10-31 15:22:49 +01:00
Baptiste Gelez 185cb5142a Better style for subtitles 2018-10-31 15:19:42 +01:00
Baptiste Gelez 25b7399e7f Only list images for possible covers 2018-10-31 15:07:40 +01:00
Baptiste Gelez f593ce40af Remove some debug messages 2018-10-31 15:07:40 +01:00
Baptiste Gelez 464832bb31 Avoid template errors when form.cover is not defined 2018-10-31 15:07:40 +01:00
Baptiste Gelez 1a49569bf2 Better style for <select> 2018-10-31 15:07:40 +01:00
Baptiste Gelez 4a2f5aeeeb Display article covers 2018-10-31 15:07:40 +01:00
Baptiste Gelez 95326c09e0 Federate article covers 2018-10-31 15:07:40 +01:00
Baptiste Gelez 485aac2e20 Add an interface to select an article illustration 2018-10-31 15:07:40 +01:00
Baptiste Gelez ab5edbc6a5 Add a cover field to posts
Referencing the media to use to illustrate the article
2018-10-31 15:07:40 +01:00
Baptiste Gelez 9f1b37648e Fix error in de.po 2018-10-31 15:06:00 +01:00
Baptiste Gelez f6227e7a42 Nicer default avatar 2018-10-31 15:03:21 +01:00
Baptiste Gelez 8e8aae17b1 Nginx docs: add 'unsafe-inline' to CSP header (to allow avatars to be loaded) 2018-10-31 14:56:17 +01:00
Baptiste GelezandGitHub 2e072affb5 Fix editor auto-expansion (#293) 2018-10-30 18:16:24 +01:00
Baptiste Gelez e26a150164 Make Authorization optional for read routes
Only require it when reading draft articles.
2018-10-30 18:13:49 +01:00
Baptiste Gelez c341179150 ApiToken: rename what to scope 2018-10-30 18:13:49 +01:00
Baptiste Gelez 28fbf35779 Use PhantomData intead of two Options useless for Authorization
And remove some warnings about unused parameters
2018-10-30 18:13:49 +01:00
Baptiste Gelez 647a5af070 Make it impossible to know if an username is used or not with the API 2018-10-30 18:13:49 +01:00
Baptiste Gelez 0dbf9f519e AppEndpoint.name is required for both the client and server 2018-10-30 18:13:49 +01:00
Baptiste Gelez 31641b1ea1 New request guard: Authorization<Action, Scope>
Filter requests that don't have an API token authorized to read or write
a specific scope;
2018-10-30 18:13:49 +01:00
Baptiste Gelez cd4ae5b7f5 Document API authentication and apps API 2018-10-30 18:13:49 +01:00
Baptiste Gelez 9a13d804c5 impl FromRequest for ApiToken
and use it for the posts API
2018-10-30 18:13:49 +01:00
Baptiste Gelez 663ec52fea Disable CSRF for the whole API 2018-10-30 18:13:49 +01:00
Baptiste Gelez 2394ff424b Add an ApiToken model, and an endpoint to get one 2018-10-30 18:13:49 +01:00
Baptiste Gelez f2190adfc2 Add an API endpoint to register apps 2018-10-30 18:13:49 +01:00
Baptiste Gelez 4c8a727e9e Add a model for external apps
Stores their name, website, and credentials
2018-10-30 18:13:49 +01:00
Baptiste Gelez 1a2de6c88f Fix the NodeInfo example
Forgot to change that when I copy/pasted it from the source
code.
2018-10-29 20:31:25 +01:00
Baptiste Gelez 175a9edb77 Add documentation for our ActivityPub implementation
Fixes #262
2018-10-29 20:31:25 +01:00
Baptiste GelezandGitHub 6efcba46ad Merge pull request #297 from maximesrd/patch-8
Added startup script for openrc
2018-10-29 19:35:57 +01:00
Baptiste GelezandGitHub 8c2e0e680a Merge pull request #294 from silkevicious/master
Added Italian translation
2018-10-29 19:28:38 +01:00
Baptiste GelezandGitHub b28c1a7568 Merge pull request #288 from maximesrd/patch-7
Adding MIGRATION_DIRECTORY
2018-10-22 19:24:20 +01:00
Baptiste GelezandGitHub 9000f2ba62 Merge pull request #287 from maximesrd/patch-6
Variable name error
2018-10-22 19:23:53 +01:00
Baptiste Gelez fcf911fac9 ActivityPub: don't delete anything if the actor is not authorized 2018-10-22 16:29:25 +01:00
Baptiste GelezandGitHub fc5acac861 Merge pull request #283 from Plume-org/hashtags
Support hashtags
2018-10-21 13:53:15 +01:00
Baptiste GelezandGitHub 9187aefda0 Merge pull request #282 from Plume-org/blog-deletion
Add support for blog deletion
2018-10-21 13:39:41 +01:00
Baptiste GelezandGitHub 879fde81ba Merge pull request #281 from Plume-org/panic-refactor
Panic less and with better messages
2018-10-20 10:56:29 +01:00
Baptiste GelezandGitHub 630ad0920d Merge pull request #279 from PhieF/patch-1
Apache config wasn't working
2018-10-18 19:21:09 +01:00
Baptiste GelezandGitHub 370dafc2dc Merge pull request #280 from anoadragon453/anoa/welcome
Fix Welcome banner grammar
2018-10-18 19:20:45 +01:00
Bat 9d70eeae61 Don't register the media serving route (they are now served with other static files)
And remove some unused imports
2018-10-12 20:48:11 +01:00
Bat dde4583fd3 Database setup in Docker install instructions 2018-10-12 20:41:05 +01:00
Bat ab20fec147 Fix MIGRATION_DIR for Docker 2018-10-12 20:38:54 +01:00
Bat 14969d489c Save medias in static/media
Fixes #272
2018-10-12 20:32:34 +01:00
Baptiste GelezandGitHub f7c37ca6ca Merge pull request #277 from oliof/patch-1
Add caddyserver example configuration
2018-10-12 19:57:14 +01:00
Baptiste GelezandGitHub 8fdb55a501 Merge pull request #256 from Plume-org/verify-signature
Verify activity's signature
2018-10-10 21:31:11 +01:00
Baptiste Gelez 09e7226c23 Don't lowercase URL for requests signatures 2018-10-10 20:23:39 +00:00
Baptiste GelezandGitHub ce09ca14c4 Merge pull request #276 from midzer/patch-1
Update de.po
2018-10-10 17:55:44 +01:00
Bat d77d064a85 Add links to API.md and CLI.md on the docs homepage 2018-10-09 21:39:30 +01:00
Baptiste GelezandGitHub 3901ae835f Merge pull request #274 from Plume-org/logo
New logo!
2018-10-09 20:03:29 +01:00
Bat 1b9c3f69bf Add icons to Web Manifest 2018-10-09 19:38:01 +01:00
Bat 25f47a7951 Add a favicon 2018-10-09 19:23:36 +01:00
Bat 45c31b1c8a Add the new logo the header 2018-10-09 15:37:40 +01:00
Bat d5ba8864c3 Import @trwnh's logos
I would have liked to merge their commits in Plume's repository, but I have no idea how it could be done.

For reference, here is the repository they come from: https://github.com/trwnh/plumeLogos
2018-10-09 15:22:07 +01:00
Bat 3f18cdd38b Add .swp to .gitignore 2018-10-08 20:42:40 +01:00