Commit Graph

67 Commits (42dca3daaee3e647337ceb7e18ab97b8a133a95e)

Author SHA1 Message Date
Baptiste Gelez 42dca3daae
Remove some unused #[derive] (#473)
We used to need them, probably when we were using Tera.
5 years ago
Baptiste Gelez fe6e69d7c4
Add a fqn field to blogs and users (#457)
Fixes #319
5 years ago
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
5 years ago
Baptiste Gelez 7eef4643c8
Update rocket_i18n and add gettext_macros (#431)
Internationalization now uses proc-macros that generate the .pot file
automatically.
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)
6 years ago
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
6 years ago
Baptiste Gelez b0089e59b7
Remove useless pagination routes (#351)
Rocket 0.4 let us have routes with optional query parameter
6 years ago
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
6 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
6 years ago
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
6 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
6 years ago
Trinity Pointard eca458b0e5 Add support for blog deletion
fix #181
6 years ago
Trinity Pointard fd92383f87 Normalize panic message and return 400 or 404 when suitable 6 years ago
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.
6 years ago
Bat 3013eec579 Redesign menu items 6 years ago
Bat 97c0b533ab Add Atom feeds for blogs and users 6 years ago
Bat 5583029b07 Update the WebFinger crate
Fixes an issue with some Mastodon accounts
6 years ago
Bat ab4af10ce5 Fix a simlar bug on blog pages 6 years ago
Bat 04dac6f87f Add pagination links 6 years ago
Bat 5549e4d0e5 Merge branch 'master' of github.com:Plume-org/Plume 6 years ago
Kevin "Ilphrin" Pellet cd24b0f057 Show the total number of article on a blog
fixes #150
6 years ago
Bat 67eb41add1 Add pagination to the blog page
No UI to control it yet
6 years ago
Bat ce256d6e39 List authors of a blog
Update french translation accordingly

Fixes #129
6 years ago
Bat b95e384ed7 Use the ApRequest guard for routes that need it + Fix a few issues with its impl
Also fixes some Rocket warnings!
6 years ago
Bat 3775d3a9c9 HTML validation + Actually associate messages to errors + Fix inverted behavior on new blog and post form 6 years ago
Bat 5f3afe900f Display errors on invalid forms
It will probably need a bit of styling…
6 years ago
Bat 153400959c Actually validate forms 6 years ago
Bat c81bb9ec25 Make forms validatable 6 years ago
Trinity Pointard 30e9620d0a Add csrf protection 6 years ago
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)
6 years ago
Didier Link b153a9ce2b add an argument in the macro may_fail to have the account linked in the error template 6 years ago
Bat dccab062e3 Implement Blog::into_activity 6 years ago
Bat b2e8d54161 Drop activity_pub::activitypub and activity_pub::ActivityPub and only use the ActivityStream responder 6 years ago
Bat 8ab25b1ca2 Use uri! as much as possible instead of directly writing URLs 6 years ago
Trinity Pointard db248701b9 Disallow blog name which yould result in empty blog name
fix #63
6 years ago
Bat 857e1f1d6a Disallow naming an article 'new', or any already used slug
Fix #64

Also fixes a lot of potential bug with articles having the same slugs, but not in the same blog
6 years ago
Bat 1653a3ac74 Check for existing slug before creating a new blog
Fix #63
6 years ago
Bat 51571d6320 may_fail! macro
Returns an error template if an Option is None, else runs the given block
6 years ago
Bat 7e3cdec0b6 Add some to_json functions to models for serialization in templates 6 years ago
Bat b18aa33c70 Update to the latest version of Rocket, to use rocket_contrib::Template::custom 6 years ago
Bat 7fd152e270 Add a button to write a new article 6 years ago
Bat 78362feffb Use the activitypub crate 6 years ago
Trinity Pointard 8158f19b85 add fallback to url generating 404 6 years ago
Trinity Pointard a8aeb40b95 add trailing slashes to links where they were missing
Signed-off-by: Trinity Pointard <trinity.pointard@insa-rennes.fr>
6 years ago
Bat b55622f2b1 Reorganize use statements 6 years ago
Bat c779b1c58a WIP: use the activitystreams crate 6 years ago
Bat 91b19bccb5 Add a link to author's profile on article card
Use a macro to render those cards too
6 years ago
Bat 5e7d513a7e Make it possible to display remote blogs 6 years ago
Bat b8aade1e12 Delete likes 6 years ago
Bat b68e481b3f Make the website more mobile-friendly 6 years ago