Commit graph

99 commits

Author SHA1 Message Date
Kitaiti Makoto c786569171 Define plume_common::escape() 2022-01-07 05:36:39 +09:00
Kitaiti Makoto 25fe2ad802 Use request::get() instead of ClientBuilder 2021-12-05 19:32:27 +09:00
Kitaiti Makoto 48fab8ad2c Impl From for request::Error 2021-12-05 19:32:27 +09:00
Kitaiti Makoto a7d8d49faf Define request::get() function 2021-12-05 19:32:27 +09:00
Kitaiti Makoto 388acd6738 Remove needless reference sign 2021-12-05 19:32:27 +09:00
Kitaiti Makoto 5a5c8bdac8 Make inbox test follow API change 2021-12-05 19:32:27 +09:00
Kitaiti Makoto 44f9d36df1 Make request test follow API change 2021-12-05 19:32:27 +09:00
Kitaiti Makoto f4d7dfb261 Sign GET request to other instances 2021-12-05 19:32:27 +09:00
Kitaiti Makoto 858806149a Use concrete Error for Signer 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 eedd5fe4e9 Define utility function to percent-encode for IRI 2021-09-06 17:49:10 +09:00
Kitaiti Makoto 24c9c7b5a1 Build client for every inbox in broadcast() 2021-02-09 18:15:14 +09:00
Kitaiti Makoto 1b9aeae53c Add test for signagure() 2021-02-05 10:34:33 +09:00
Kitaiti Makoto d08d2c6958 Care the case of invalid header value 2021-02-04 17:10:05 +09:00
Kitaiti Makoto 348259a14b Care about error case 2021-02-04 15:31:57 +09:00
Kitaiti Makoto 191239584b Define RequestTarget 2021-01-25 02:16:53 +09:00
Kitaiti Makoto bd1caaf5da Include (request-target) and Host header to HTTP Signature 2021-01-25 02:16:53 +09:00
Kitaiti Makoto be939cf169 Suppress clippy 2021-01-16 00:59:07 +09:00
Kitaiti Makoto 6eee4b0b65 Define custom errors 2021-01-16 00:43:41 +09:00
Kitaiti Makoto 012c8d2026 Remove redundant imports 2021-01-15 22:35:19 +09:00
Aiden McClelland f167aad0fb fix doc tests 2021-01-11 13:29:01 -07:00
Aiden McClelland 24aac22b89
proxy support 2021-01-11 13:27:52 -07:00
Kitaiti Makoto 4a4534d6f3 Run cargo fmt 2021-01-11 09:05:31 +09:00
Kitaiti Makoto becb40544c Replace println!()s with logging macros 2021-01-06 21:40:14 +09:00
Kitaiti Makoto 47c8711933 Run cargo fmt 2021-01-02 07:10:10 +09:00
Kitaiti Makoto 20a099c16f Replace Syntect's deprecated APIs with new APIs 2021-01-02 06:47:55 +09:00
Kitaiti Makoto c482b1b552 Run cargo fmt 2020-12-28 22:15:45 +09:00
Trinity Pointard 6187c62cb3 add bidi via forked pulldown-cmark 2020-12-27 21:02:37 +01:00
Trinity Pointard d6b5b9a721 upgrade to pulldown v0.8 2020-12-27 20:38:23 +01:00
Kitaiti Makoto d6a946f5b9 Validate spoofing for all activities 2020-12-22 16:31:12 +09:00
Kitaiti Makoto 2eadb80435 Validate attributedTo in the case it is an object 2020-12-11 00:35:20 +09:00
Kitaiti Makoto 5cd8ae9106 Validate spoofing of Create activity 2020-12-03 19:20:10 +09:00
Kitaiti Makoto 350697f89a Run cargo fmt 2020-12-03 19:20:10 +09:00
Kitaiti Makoto 4e6d7b70cf Keep tags as-is 2020-11-22 22:24:43 +09:00
KITAITI Makoto 197f0d7ecd
Add test for hash including ZWSP (#772)
* Add test for hash including ZWSP

* Run cargo fmt
2020-05-17 13:53:31 +02:00
KITAITI Makoto 6a3f210dfc
Keep atmarks and hashes in link (#765)
* [REFACTORING]Use DocumentContext during parsing Markdown

* Add test case for hash in link

* Make DocumentContext derive Debug

* Add in_link field in DocumentContext

* Don't make hash words tags in link

* Add test for atmark in link

* Don't make atmark words in link mentions
2020-05-03 14:50:32 +02:00
KITAITI Makoto edaccd1a31
Fixes #757 Allow Unicode hashtags (#758)
* Add test for Persian language hashtags

See https://github.com/Plume-org/Plume/issues/757

* Add regex-syntax with unicode-perl feature to dependencies

* Install regex-syntax

* Allow hashtag to use Unicode word characters

* Run cargo fmt
2020-04-29 15:13:31 +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
Violet White e6bdeb7c4b Fix #699 (#719) 2020-01-12 13:24:41 +01:00
Violet White 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)
2019-12-30 14:35:27 +01:00
Baptiste Gelez 7ea4acc289
Use futures and tokio to send activities (#620)
* Use futures and tokio to send activities

* Reset .po files

* Cargo fmt + small enhancements

- better error messages
- removed a TODO

* Log all messages at the same time when federation succeeds
2019-06-27 17:46:05 +01:00
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
2019-05-25 19:23:45 +01:00
fdb-hiroshima c52aac012c
make hashtags work in profile summary (#562)
* make hashtags work in profile summary

fix #541

* cargo fmt
2019-05-04 17:33:50 +02:00
fdb-hiroshima 33a0c7dcd3
reduce reqwest timeout to 5s (#557) 2019-04-30 23:30:13 +02:00
Baptiste Gelez 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
fdb-hiroshima 12c2078c89
Hide cw pictures behind a summary/details (#483)
* Hide cw pictures behind a summary/details
* refactor md_to_html a bit and add cw support
* use random id for cw checkbox
2019-04-06 19:20:33 +02:00
fdb-hiroshima 26fc2cde5d
use circleci instead of travis (#511)
Upgrade rust-toolchain
Upgrade Tantivy
Warning: tantivy now use a different file format, search index may need to be deleted and recreated to work as intended
try to run compile twice in a row because sometime oomk is evil
2019-04-01 20:28:23 +02:00
Baptiste Gelez 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 Gelez 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