Commit Graph

20 Commits (eff2698664dec6a3c93820edbd6186f74f5d8450)

Author SHA1 Message Date
Baptiste Gelez 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
5 years ago
fdb-hiroshima 716c58cb71 Lowercase extension before detemining media type (#437) 5 years ago
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)
5 years ago
Baptiste Gelez 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
5 years ago
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
5 years ago
Trinity Pointard ed71d24fe9 Verify remote user name and media url 5 years ago
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
5 years ago
fdb-hiroshima 8a4702df92 Add unit tests for main model parts (#310)
Add tests for following models:
- Blog
- Instance
- Media
- User
5 years ago
Baptiste Gelez 25b7399e7f Only list images for possible covers 6 years ago
Baptiste Gelez 95326c09e0 Federate article covers 6 years ago
Trinity Pointard 0bb719830a Fix incorrect media link
Fix #292
6 years ago
Trinity Pointard 4e6f3209d5 Normalize panic message
Change all unwrap to expect
Normalize expect's messages
Don't panic where it could be avoided easily
6 years ago
Bat 743620eb6a
Fix the SQlite build 6 years ago
Bat 38d737ed0c
Introduce features to choose between SQlite or Postgres 6 years ago
Bat aa5fa11218 Add support for avatars, and fetch remote ones 6 years ago
Bat a357dae45d Add Markdown code to copy/paste for medias 6 years ago
Bat 15f4a2079f Add support for SVG medias 6 years ago
Bat 99fdb8e680 Media deletion 6 years ago
Bat f44b6fffa3 Media upload 6 years ago
Bat 0b5eb2c946 Add a Media model 6 years ago