Commit graph

621 commits

Author SHA1 Message Date
Kitaiti Makoto
43b46a8be4 Make email_signups::create return ErrorPage on error 2022-01-12 09:20:20 +09:00
Kitaiti Makoto
9bbfc71fc8 Fix registration openess condition mistake 2022-01-12 09:19:48 +09:00
Kitaiti Makoto
5d58b31f1c Remove unreachable code 2022-01-12 09:00:04 +09:00
Kitaiti Makoto
e31a2238fb Respond with error status code when error 2022-01-12 08:58:42 +09:00
Kitaiti Makoto
7de37bc9b7 Hide password sign-up routings when it's disabled 2022-01-12 08:46:11 +09:00
Kitaiti Makoto
13f7734751 Hide email sign-up routings when it's disabled 2022-01-12 08:40:20 +09:00
Kitaiti Makoto
7c82b08615 Use into() instead of explicitly wrapping return values 2022-01-12 04:36:01 +09:00
Kitaiti Makoto
6498dbfbb7 Reuse form values 2022-01-12 04:28:02 +09:00
Kitaiti Makoto
74254aed4a Move require_logins from plume-common to plume 2022-01-12 04:18:13 +09:00
Kitaiti Makoto
61d5446113 Use plume_common::escape() instead of askama_escape::escape() directly 2022-01-07 05:47:08 +09:00
Kitaiti Makoto
800e74da67 Follow API change of validator 2022-01-07 04:55:49 +09:00
Kitaiti Makoto
efaf1295e9 Suppress clippy 2022-01-06 20:43:40 +09:00
Kitaiti Makoto
b6d38536e3 Add email signup feature 2022-01-06 20:18:20 +09:00
Kitaiti Makoto
ee6064eee8 Don't unwrap() 2022-01-03 23:28:05 +09:00
Kitaiti Makoto
8888dbba0a Initialize SMTP client with port number 2022-01-03 18:09:26 +09:00
Kitaiti Makoto
a599760891 Use smtp module from plume_models instead of lettre directly 2022-01-03 17:36:11 +09:00
Kitaiti Makoto
0058c3053d Move mail config from plume::mail::mailer to plume_models::CONFIG 2022-01-03 15:50:04 +09:00
Kitaiti Makoto
43656d8e46 Create instance for test 2021-12-06 00:33:48 +09:00
Kitaiti Makoto
05a98175bf Assign unsed return value to underscore variable 2021-12-05 21:56:00 +09:00
Kitaiti Makoto
346a67fe1c Create local instance user on start 2021-12-05 21:34:36 +09:00
Kitaiti Makoto
d3c035aa39 Remove needless code 2021-12-05 19:32:27 +09:00
Kitaiti Makoto
2f7a5cbf56 Cache local instance user on start 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
6345a57498 Don't modify article title for slug 2021-04-10 16:37:26 +09:00
Kitaiti Makoto
7b2bab0f9d Extract Post::ap_url() 2021-04-09 10:55:09 +09:00
Kitaiti Makoto
2ffd357d95 Update Post.ap_url when published 2021-03-29 01:38:28 +09:00
Kitaiti Makoto
8e50d95a7a Fix code according to clippy 2021-03-28 03:46:37 +09:00
Kitaiti Makoto
b7c7b6da9f Percent encode remote interact URI 2021-02-14 22:59:01 +09:00
Kitaiti Makoto
703328601c [BUG FIX] Don't append host part twice to remote interact URI 2021-02-14 22:15:32 +09:00
Kitaiti Makoto
e7ab80d5c8 Move worker tasks in routes::user::details to RemoteFetchActor 2021-02-01 00:51:37 +09:00
Kitaiti Makoto
61b68c3a42 Initialize RemoteFetchActor 2021-02-01 00:50:48 +09:00
Kitaiti Makoto
ad285898f6 Replace PlumeRocket.conn with DbConn 2021-01-31 21:58:44 +09:00
Kitaiti Makoto
dbf36ddf05 Cache fetched instance 2021-01-25 00:06:40 +09:00
Kitaiti Makoto
84a3d53075 Use uri! macro to generate URI strings 2021-01-24 23:30:24 +09:00
Kitaiti Makoto
b5eb2628f9 Don't remove records after testing 2021-01-24 23:30:20 +09:00
Kitaiti Makoto
4ef6561cc6 Extract login() from test function 2021-01-24 21:38:51 +09:00
Kitaiti Makoto
7f54f418a8 Suppress clippy 2021-01-24 19:49:49 +09:00
Kitaiti Makoto
8f90ea18bf Add tests for edit link presence 2021-01-24 19:37:49 +09:00
Kitaiti Makoto
e12528aae4 Extract launch_rocket() from main() as public within crate scope 2021-01-24 19:28:05 +09:00
Kitaiti Makoto
fc8ee1c3bc Remove searcher from arguments of Post::delete() and dependented methods 2021-01-16 16:38:18 +09:00
Kitaiti Makoto
864379fb81 Remove searcher from arguments of Post::update() 2021-01-16 16:34:36 +09:00
Kitaiti Makoto
6ad3359609 Remove searcher from arguments of Post::insert() 2021-01-16 16:25:36 +09:00
Kitaiti Makoto
e18be6ec95 Initialize SearchActor at start 2021-01-16 16:22:39 +09:00
Kitaiti Makoto
996dc309f7 Make Searcher::open_or_create() accept path and tokenizers 2021-01-16 16:22:38 +09:00
Kitaiti Makoto
09d9164a1c Extract Searcher::open_or_recreate() from main() 2021-01-16 16:22:38 +09:00
Kitaiti Makoto
26ffde726f Run cargo fmt 2021-01-16 01:13:45 +09:00
Kitaiti Makoto
f720dcbe9a Remove underscore prefix from route methods to suppress clippy 2021-01-15 23:58:48 +09:00
Kitaiti Makoto
33fceddc08 Use is_empty() instead of comparing with "" 2021-01-15 23:25:07 +09:00
Kitaiti Makoto
dfe83aafc5 Replace as_ref().map() with as_deref() 2021-01-15 23:21:33 +09:00
Kitaiti Makoto
0775c8f3f9 Fix redundant method chains 2021-01-15 23:19:47 +09:00
Kitaiti Makoto
012c8d2026 Remove redundant imports 2021-01-15 22:35:19 +09:00
Aiden McClelland
24aac22b89
proxy support 2021-01-11 13:27:52 -07:00
Kitaiti Makoto
b9b9af6c44 Initialize tracing subscriber 2021-01-11 09:15:34 +09:00
Kitaiti Makoto
4a4534d6f3 Run cargo fmt 2021-01-11 09:05:31 +09:00
Kitaiti Makoto
b93ebedaf3 Revert "Initialize Rocket early to initialize logger early"
This reverts commit 30093d3a9f.
2021-01-09 18:41:47 +09:00
Kitaiti Makoto
c1abd3d6f9 Use eprintln! instead of println! for console message 2021-01-06 21:40:14 +09:00
Kitaiti Makoto
becb40544c Replace println!()s with logging macros 2021-01-06 21:40:14 +09:00
Kitaiti Makoto
ee96d2b754 Fix a typo 2021-01-06 21:40:14 +09:00
Kitaiti Makoto
30093d3a9f Initialize Rocket early to initialize logger early 2021-01-06 21:40:14 +09:00
Kitaiti Makoto
29f2239e3f Extract dotenv initialization from init_pool because it affects not only database 2021-01-06 21:40:14 +09:00
Kitaiti Makoto
bca870f1f8 Percent encode URI for remote_interact 2021-01-03 05:49:45 +09:00
Kitaiti Makoto
51e5a401a5 Update Welsh translation 2021-01-02 22:45:04 +09:00
KitaitiMakoto
d44c034f6a Merge branch 'main' into better-caching 2020-12-06 17:31:53 +00:00
Kitaiti Makoto
50462204e8 Run cargo fmt 2020-12-07 02:04:37 +09:00
Kitaiti Makoto
4e6d7b70cf Keep tags as-is 2020-11-22 22:24:43 +09:00
Ana Gelez
f28ab19dc0 Merge branch 'serra-allgood/#754-display-error-for-duplicated-blocklist-email' of https://github.com/serra-allgood/Plume into gh-pr-818 2020-11-22 12:43:46 +01:00
Serra Allgood
43fde90387 Fix displaying not found page when submitting a duplicated blocklist email
Signed-off-by: Serra Allgood <serra@allgood.dev>
2020-10-05 20:17:30 -07:00
Trinity Pointard
d626f3366d add support for ldap 2020-10-04 12:18:22 +02:00
Trinity Pointard
b24f195e10 refactor login
first step toward ldap
should have no functionnal change
2020-10-03 13:21:31 +02:00
Kitaiti Makoto
5e30bede40 Don't care about needless return value of closures 2020-07-19 08:24:17 +09:00
Kitaiti Makoto
5cca66b346 Add action user can take to error message 2020-07-19 07:16:34 +09:00
Kitaiti Makoto
5fc827c1c9 Re-initialize search index when recreating is failed 2020-07-18 21:00:58 +09:00
Kitaiti Makoto
50753b3a65 Recreate search index if its format is outdated 2020-07-18 09:40:58 +09:00
Ana Gelez
719fec0828 Add a comment 2020-06-25 22:26:44 +02:00
Ana Gelez
90fdade566 Better caching
Based on @trinity-1686a's patch: https://github.com/Plume-org/Plume/issues/786#issuecomment-647170325
2020-06-25 22:20:31 +02:00
Gelez
d99b42582d
Add Persian to the list of languages (#782) 2020-06-17 18:33:58 +02:00
KITAITI Makoto
92a386277b
Switchable tokenizer (#776)
* [REFACTORING]Rename whitespace_tokenizer to tag_tokenizer for
registration

Name representing its purpose is preferred.

* Add lindera-tantivy to plume-model's dependencies

* Install lindera-tantivy

* Add SearchTokenizerConfig struct

* Add search tokenizers to config option

* Use CONFIG for tokenizers

* Use enum to hold tokenizer config instead of initializing on config phase

* Use guard instead of duplicate default values

* Use as_deref() instead of guard

* Move SearchTokenizer from plume-models to plume-models::search::tokenizer

* Rename SearchTokenizer to TokenizerKind

* Define SearchTokenierConfig::determine_tokenizer()

* Use determine_tokenizer in SearchTokenizerConfig::init()

* Pass tokenizer config to Searcher methods

* Add LowerCase filter to Lindera tokenizer

* Add test for Lindera tokenizer

* Define SEARCH_LANG env to specify tokenizers set

* Run cargo fmt

* Make Lindera tokenizer optional

* Fix typos
2020-06-17 16:57:28 +02:00
Daniel Watkins
efb76a3c17
remove dependency on runtime-fmt (#773)
Per the issue, "runtime-fmt uses perma-unstable rust APIs and is
therefore susceptible to breakage".

This replaces the two calls to rt_format! with .replace() and drops the
dependency.

Fixes #769
2020-05-18 20:18:07 +02:00
KITAITI Makoto
3be842c653
Make database connections configurable by environment variables (#768)
* Make env DB_MAX_SIZE and DB_MIN_IDLE recognizable

* Make database max size and minimum idle configurable

* Restore file permission

* Fail fast
2020-05-06 19:27:59 +02:00
KITAITI Makoto
180e34b07c
Fix Atom feed datetime format (#766) 2020-05-04 23:46:59 +02:00
KITAITI Makoto
847d6f7fac
Fix Atom feed (#764)
* Percent-encode URI segments in ap_url

* Fix invalid Atoms

* Remove redundant clone according to cargo clippy

* Revert "Percent-encode URI segments in ap_url"

This reverts commit 8253aa79bd.
ActivityPub(JSON-LD) accepts URI.
See https://github.com/Plume-org/Plume/pull/764#issuecomment-623105734

* Use absolute IRI for IDs in Atom

* Reuse formatted string

* Use parent element's creation date for Atom updated if there's no post

* Remove uncecessary UTC conversion

* Extract routes::build_atom_feed function
2020-05-04 15:28:52 +02:00
KITAITI Makoto
71e0a35e06
Use LenientForm instead Form for CSRF protected pages (#751) 2020-04-18 11:45:28 +02:00
KITAITI Makoto
b834d1c282
Fix #701 Preferable default theme (#746)
* Make it possible to update users.preferred_theme to NULL

* Make preferred them null when 'Default theme' is selected

* Run cargo fmt
2020-04-12 17:36:00 +02: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
Wilfried OLLIVIER
23049b638c WIP: Fix RSS issues (#720)
* Add id field to RSS feed

* Add published field to RSS feed
2020-01-13 19:30:32 -05:00
Violet White
f3c05dae62 Email blocklisting (#718)
* Interface complete for the email blacklisting

* Everything seems to work

* Neutralize language

* fix clippy warnings

* Add missing spaces

* Added matching test

* Correct primary key datatype for postgresql

* Address review comments

* Add placeholder when empty. Fix missing 'i'
2020-01-12 19:41:35 +01:00
Violet White
52d860d402 Paginate the outbox responses. Fixes #669 (#681)
* Paginate the outbox responses. Fixes #669

* Address Ana's review

* Make outbox_fetch page through instance outboxes

* Fix infinite loop in fetch_outbox

* Fix off by one
2019-10-30 11:22:28 +01:00
Violet White
866465c603 Add environmental variable to control path of media (#683) 2019-10-28 22:28:28 +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
Ana Gelez
309e1200d0 Make a distinction between moderators and admins (#619)
* Make a distinction between moderators and admins

And rework the user list in the moderation interface, to be able to run the same action on many users,
and to have a huge list of actions whithout loosing space.

* Make user's role an enum + make it impossible for a moderator to escalate privileges

With the help of diesel-derive-enum (maybe it could be used in other places too?)

Also, moderators are still able to grant or revoke moderation rights to other people, but maybe only admins should be able to do it?

* Cargo fmt

* copy/pasting is bad

* Remove diesel-derive-enum and use an integer instead

It was not compatible with both Postgres and SQlite, because for one it generated a schema
with the "User_role" type, but for the other it was "Text"…

* Reset translations

* Use an enum to avoid magic numbers + fix the tests

* Reset translations

* Fix down.sql
2019-09-13 12:28:36 +02:00
fdb-hiroshima
83cad55b22 update default license (#659)
fix #595
2019-08-27 21:47:45 +02:00
Ana Gelez
8ab690001d Replace the input! macro with an Input builder (#646)
* Replace the input! macro with an Input builder

* Use a BTreeMap instead of an HashMap

Followinf @fdb-hiroshima's advice

* Rename Input::to_html to Input::html

To make clippy happy

* Wrap error messages in red paragraphs
2019-08-27 16:50:24 +02:00
Ana Gelez
28fb50438e
Fix theme caching (#647) 2019-08-21 21:41:11 +02:00
Ana Gelez
a6c84daa1a
Theming (#624)
* Theming

- Custom CSS for blogs
- Custom themes for instance
- New dark theme
- UI to choose your instance theme
- Option to disable blog themes if you prefer to only have the instance theme
- UI to choose a blog theme
2019-08-21 00:42:04 +02:00
fdb-hiroshima
4f7c20fc26 Fix some federation issue (#573)
* send scheme as part of webfinger remote follow template

fix tsileo/microblog.pub#49

* bump webfinger to 0.4.1

* cargo fmt

* revert translations

* Use group: prefix for blog webfinger queries
2019-07-31 11:38:49 +02:00
Mostafa Ahangarha
54c6d21fc5 WIP - initial RTL support #575 (#577)
* initial RTL support

* fix dir in template-util

* fix dir in blogs new

* fix dir in blogs details

* fix dir in posts new

* fix dir in posts details

* fix dir in posts remote

* Fix dir in partials

some parts should be recheck carefully in real usage
2019-07-11 09:34:27 +02:00
Wilfried OLLIVIER
c031804464 Add clap to plume in order to print help and version (#631)
* Add clap in order to print help and version

Related to https://github.com/Plume-org/Plume/issues/594

* Update after_help text message
2019-07-03 19:36:42 +01:00
fdb-hiroshima
5289fe872a
don't ignore dotenv errors (#630) 2019-07-03 09:30:44 +02:00
Igor Galić
3d27e283ad
add enum containing all successful route returns (#614)
* add enum containing all successful route returns

This enum derives `Responder`, so it can be used as route result.
We also implement `From`, so it can be converted

* disable clippy warning about this enum

There's no use trying to chase this warning.
The next warning will be about `Redirect`, which itself is 360 byte,
according to @fdb-hiroshima (thanks for the research!)

So, if anything, we can try to get Rocket to work on that!

* refactor routes/posts to only use one level of Result

* admin settings error is not an ErrorPage, so dont use Result<>

* refactor: use early return to remove indent of main logic

This diff is absolutely atrocious.
but the resulting readability is worth it

* refactor routes/post for early returns & RespondOrRedirect

* refactor routes/session for early returns & use RespondOrRedirect

* refactor routes/user -- add another field to enum

* refactor routes/blogs for early returns & RespondOrRedirect

* refactor routes/blogs for early returns & RespondOrRedirect

This is a final refactor of `pub fn update()` for readability.
We're removing at least one indentation level.
2019-06-14 09:33:30 +02:00