Commit Graph

239 Commits (f6d169567c922683be52f48164a2eabd7291107b)

Author SHA1 Message Date
Ana Gelez f6d169567c
Introduce Searcher::new
This function does what was previously done in main:
create a search index, and try to recover for errors
if possible.

This commit also fixes plume-cli to use the new Searcher
API (that depends on a DbPool, not on a single Connection).
4 years ago
Ana Gelez eaad38ad2c
Avoid unwrapping, return an Error instead 4 years ago
Mina Galić 962fbcc503
plume-model: refactor Searcher to have its own DbPool
this way, we don't need to pass along a conn into the function.
This should make splitting PlumeRocket up into its components a little
easier. This PR is another attempt at fixing #799.
4 years ago
Mina Galić f945e18bf1
Revert "Add an SearcherActor, wrapping Searcher & DbPool"
This reverts commit 0757f84397fc4d4ecba8a904e9d25f1b243b4292.
We'll attempt to use a strategy in #807
4 years ago
Mina Galić 5e17636b9d
Add an SearcherActor, wrapping Searcher & DbPool
and implement AddDocument message!
This code compiles, but hasn't been put to use yet.
4 years ago
Mina Galić d344e06efd
add riker as dependency, we will use it to replace searcher 4 years ago
Trinity Pointard 4da9b24cb1 cargo fmt 4 years ago
Trinity Pointard f40634aa97 address comments 4 years ago
Trinity Pointard 8975b0f9e9 cargo fmt 4 years ago
Trinity Pointard d626f3366d add support for ldap 4 years ago
Trinity Pointard b24f195e10 refactor login
first step toward ldap
should have no functionnal change
4 years ago
Kitaiti Makoto 484659fde2 Run cargo fmt 4 years ago
Kitaiti Makoto c5d03d300b Cause IndexInvalidDataError when search index is invalid 4 years ago
Mina Galić a107d35492
upgrade rocket* to the latest stable
before we embark on upgrading to async, and all the refactoring that
this will bring on us (see #797 & #799), we should keep our `main`
branch as stable and current as possible.
Let's start by upgrading rocket and its dependencies.
4 years ago
Kitaiti Makoto f9beb2383b Update lindera-tantivy to v0.1.3 4 years ago
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
4 years ago
Gelez 297d9fcf40
Don't show boosts and likes for "all" and "local" in timelines (#781)
Fixes #711
4 years ago
KITAITI Makoto ef70cb93e6
Upgrade Tantivy to v0.12.0 (#771)
* Upgrade Tantivy to 0.12.0

* Follow Tantivy Tokenizer's new type definition

* Wrap tokenizers with TextAnalyzer to use filter methods

* Replace async IndexWriter::garbage_collect_files with sync functions

* Update Cargo.toml
4 years ago
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
4 years ago
KITAITI Makoto 73aa301d4a
Fix user subscription URI so that plume::routes:interact accept it (#762) 4 years ago
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
4 years ago
Ana Gelez 5f8d6b8e0e Rust 2018! (#726) 4 years ago
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
4 years ago
Violet Myers 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'
4 years ago
Violet Myers 458baf5f78 Syntax highlighting (#691)
* Syntax highlighting mostly... Exists.

* Add dependency to dockerfile

* Handle non-existent languages better

* Make the default a bit nicer

* Improve highlighting. Clean up function

* Add dark theme, add the comment scope to the allowed classes

* update build env

* Address review comments

* Use find_syntax_by_token which produces the desired behavior

* Change flat_map into flatten
(commit cargo.lock)
4 years ago
Ana Gelez 597778fd2f release Alpha 4 (#709)
* Update version numbers

* Update translations again

* Translations?

* This time translations should be here
4 years ago
Wilfried OLLIVIER 3bd2305115 Fix #637 : Markdown footnotes (#700)
* Ensure footnotes classes generated are not filtered

pulldown-cmark add somes classes when footnotes html is generated. This commit ensure they are not filtered by html sanitizer

* Add some footnotes styling
4 years ago
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
5 years ago
Violet White 866465c603 Add environmental variable to control path of media (#683) 5 years ago
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
5 years ago
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
5 years ago
fdb-hiroshima 12c80f9981 delete notification on user deletion (#658)
* delete notification on user deletion

fix #651

* use the correct id for deletion

* add regression test

* push helpers too

* revert CI changes
5 years ago
fdb-hiroshima d46af6fe5b order media so that latest added are top (#660)
* order media so that latest added are top

partial fix for #621

* also order paginated medias
5 years ago
fdb-hiroshima ddbec3f204 fill entirely user on creation (#657)
fix #635
5 years ago
fdb-hiroshima 83cad55b22 update default license (#659)
fix #595
5 years ago
fdb-hiroshima bf7603d439
don't index drafts (#656) 5 years ago
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
5 years ago
fdb-hiroshima fb60236a54
update dependancies (#643)
* Bump activitystreams-derive from 0.1.0 to 0.1.1
* Bump tantivy from 0.9.1 to 0.10.1
* Bump rpassword from 3.0.2 to 4.0.1
* Bump num_cpus from 1.10.0 to 1.10.1
* Bump serde_qs from 0.4.6 to 0.5.0
* Bump stdweb-internal-runtime from 0.1.3 to 0.1.4
* [Security] Bump smallvec from 0.6.9 to 0.6.10
* Bump chrono from 0.4.6 to 0.4.7
* Bump bcrypt from 0.4.0 to 0.5.0
* Bump serde_json from 1.0.39 to 1.0.40
* Bump tokio from 0.1.21 to 0.1.22
* Bump scheduled-thread-pool from 0.2.0 to 0.2.2
* Bump stdweb from 0.4.14 to 0.4.18
* Bump hyper from 0.12.29 to 0.12.33
* Bump reqwest from 0.9.17 to 0.9.19
* Bump url from 1.7.2 to 2.1.0
5 years ago
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
5 years ago
Rob Watson 4b205fa995 Store password reset requests in database (#610)
* Store password reset requests in database

Signed-off-by: Rob Watson <rfwatson@users.noreply.github.com>

* Refactor password reset request expiry handling

* Integrate sqlite

* Fix formatting
5 years ago
Igor Galić 8c59c822b6 refactor code to use Shrinkwraprs and diesel-derive-newtype (#598)
* add shrinkwraprs and implement Id thru it

This also means we can automatically convert Id to String without using
.into()!

* cleanup with the help of clippy!

* cleanup with the help of cargo fmt!

* remove extra block

* Shrinkwrap Page, ContentLen and RemoteForm

* translations
5 years ago
fdb-hiroshima 5579f64dd0
update dependancies (#574)
[Security] Bump ammonia from 2.0.0 to 2.1.1
Bump bcrypt from 0.2.2 to 0.4.0
Bump clap from 2.32.0 to 2.33.0
Bump colored from 1.7.0 to 1.8.0
Bump ctrlc from 3.1.1 to 3.1.2
Bump diesel from 1.4.1 to 1.4.2
Bump dotenv from 0.13.0 to 0.14.0
Bump hyper from 0.12.25 to 0.12.28
Bump openssl from 0.10.19 to 0.10.22
Bump proc-macro2 from 0.4.27 to 0.4.30
Bump reqwest from 0.9.11 to 0.9.16
Bump rpassword from 2.1.0 to 3.0.2
Bump serde_derive from 1.0.80 to 1.0.82
Bump serde_derive from 1.0.89 to 1.0.91
Bump serde from 1.0.89 to 1.0.91
Bump serde_qs from 0.4.5 to 0.4.6
Bump stdweb from 0.4.14 to 0.4.17
Bump syn from 0.11.11 to 0.15.27
Bump whatlang from 0.7.0 to 0.7.1
5 years ago
fdb-hiroshima 773fbfe7c8 cache local instance (#572)
* cache local instance

fix #564

* don't use local instance cache for plm

* use instance cache for plm, but initialize it

* cargo fmt
5 years ago
fdb-hiroshima c52aac012c
make hashtags work in profile summary (#562)
* make hashtags work in profile summary

fix #541

* cargo fmt
5 years ago
fdb-hiroshima c9070930d2
Improve notification management (#561)
* Don't notify for comment when mentioned

fix #505

* Don't save notification for remote users

fix #472
5 years ago
fdb-hiroshima 33a0c7dcd3
reduce reqwest timeout to 5s (#557) 5 years ago
Baptiste Gelez 8f1ab3485e
Add some feedback when performing some actions (#552)
* Add a way to display flash messages

* Make the flash messages look nice

* Add actual feedback messages

* cargo fmt

* Move flash messages to PlumeRocket

And add trait to convert PlumeRocket to BaseContext

* Remove useless lifetime
5 years ago
fdb-hiroshima 49bb8cb0bc
import migrations and don't require diesel_cli for admins (#555)
* import migrations via macro

* panic on database not to the latest migration

* add subcommand to plm

* create migration that run tantivy index creation

* remove diesel_cli from places it was

* use our migration system for tests

* create table __diesel_schema_migrations if needed
5 years ago
Baptiste Gelez ec57f1e687
Remove Canapi (#540)
* Remove Canapi

It added more complexity than it helped.

* Fail if there are many blog, but none was specified

* cargo fmt
5 years ago
Baptiste Gelez 787eb7f399
Federate user deletion (#551)
* Federate user deletion

- When someone deletes their account
- When a local user is banned

Fixes #509

* cargo fmt
5 years ago