Compare commits

...

360 Commits

Author SHA1 Message Date
Ana Gelez 39edca5edc Add a way to change block type 2019-08-25 18:45:02 +02:00
Ana Gelez bce806ac63 Prototype for a WYSIWYG editor
We use pulldown-cmark in plume-front too now, but instead of using the provided
HTML renderer, we use a custom DOM renderer, which let us use contenteditable only where we want,
and which will allow us to add event listeners to provide a good contextual edition experience.

Also removed the character counter, as the API limits are almost unreachable.
2019-08-08 16:33:14 +02:00
Ana Gelez 3669a0097d Update rocket_csrf and re-enable it
Thank you @fdb-hiroshima for the fix!
2019-08-04 12:37:38 +02:00
Ana Gelez cc998e7c61 Rewrite article publication with the REST API
- Add a default App and ApiToken for each user, that is used by the front-end
- Add an API route to update an article (CSRF had to be disabled because of a bug in rocket_csrf)
- Use AJAX to publish and edit articles in the new editor, instead of weird hacks with HTML forms
2019-08-03 23:04:25 +02:00
Ana Gelez 4142e73018 Add a sidebar for the editor
- The layout now uses CSS grids
- We try to generate as much HTML as possible on the server, instead of using the DOM
- Placeholders are in pure CSS now!

You can't publish articles anymore, but it looks nice!!
2019-08-02 23:10:05 +02:00
Ana Gelez 5d03331f0c Sticky toolbar 2019-08-02 16:53:28 +02:00
Ana Gelez 3198f30515 Editor: Make it clearer that editable areas are editable
- Add a border on the left when hovering
- Make full sentences to explain where you can write
2019-08-02 15:36:54 +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
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
Baptiste Gelez 6dbc043a7e Update some documents (#616)
* Redirect to the code of conduct in the docs

To centralize it, and because the version in the docs is more up-to-date

* Remove obsolete issue template

* Rework README
2019-06-15 21:42:24 +01:00
KemoNine fb1668ede7 Update dependencies which depended on nix -- fixes arm32 builds (#615) 2019-06-14 09:35:09 +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
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
2019-06-04 19:55:17 +01:00
KemoNine e7126ae335 Fix arm builds (#612) 2019-06-04 19:18:36 +01:00
Marek Ľach b2312d7f1b Update textarea overflow to scroll (#609)
* Update textarea overflow to scroll

* Update _forms.scss

* Update _forms.scss
2019-06-02 21:35:09 +01:00
Rob Watson bffce041d7 Confirm deletion of blog (#602) 2019-05-29 13:51:53 +01:00
Marek Ľach 037674ae13 Direct follow-up to #578 (#603) 2019-05-29 12:26:37 +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
Marek Ľach 59023e9602 Prevent comment form submit button distortion on iOS (#592)
Forgot about that one the last time :-)
2019-05-20 19:29:23 +01:00
Baptiste Gelez ad3a8b92d1 Theme update (#553)
* Start to update the theme

- Ligther colors
- No more border radius
- Buttons are now always colored
- Start to redesign the post page (according to the Figma mockups)

* Fix build script: it now recompiles everytime a scss file changed

* Make sure the article illustrations are not too big

* Make articles wider (70 characters)

* Better contrast between gray shades

* Various improvements

* Better mobile style

* New style for the footer

* Improve comment style

* Better responsiveness again

* Limit the size of the article cover

* Last details?

- Improve buttons on the media page
- Improve lists

* Pin the stdweb version that we use

It changed because I removed Cargo.lock to handle a merge conflict

I could have updated cargo web too, but it mean I should have re-built
the CI docker image and it was taking forever.

* Better contrast for links in the header of the article

* Add a basic privacy policy

* Remove "also"

* Fix a few issues

- Don't watch static/css in build.rs
- Another shade of white
- Remove useless margin rule for error messages
2019-05-18 13:09:51 +01:00
Marek Ľach c67f65e684 Fix occurrences of 'have been' to 'has been' (#578)
* Update comments.rs

* Update medias.rs

* Update posts.rs

* Update user.rs

* Update posts.rs

* Update user.rs
2019-05-14 11:54:16 +01:00
Baptiste Gelez d78b3a05ec Fix Crowdin upload (#576) 2019-05-12 20:14:59 +01:00
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
2019-05-12 10:41:47 +02:00
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
2019-05-10 21:59:34 +01:00
fdb-hiroshima 5b50f90d2b use openssl instead of sha256sum for build.rs (#568)
* use openssl instead of sha256sum for build.rs

* use a more portable flag for stat
2019-05-10 16:15:30 +02:00
fdb-hiroshima 90f6ef0380 upload artifact of wasm binary (#571)
fix #570
2019-05-10 15:38:43 +02:00
Marek Ľach 33619abdfb Fix certain improper rendering of forms (#560) 2019-05-06 19:18:53 +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 c9070930d2 Improve notification management (#561)
* Don't notify for comment when mentioned

fix #505

* Don't save notification for remote users

fix #472
2019-05-04 17:15:41 +02:00
fdb-hiroshima 918bda14ec rewrite circleci config (#558)
* rewrite circleci config with better syntax

and try using grcov for coverage

* attempt to use less memory and to rerun if memory lack

* actually remove use of kcov

* use the right var

* try looping

* run test serialized

* use feature where we should and make macro path independant

* cargo fmt and remove some '"'

* add zip to dependancies

* reduce number of used thread after first failure

* push translations to crowdin on commit to master

* don't cache result of coverage
2019-05-04 15:35:21 +02:00
fdb-hiroshima 33a0c7dcd3 reduce reqwest timeout to 5s (#557) 2019-04-30 23:30:13 +02:00
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
2019-04-30 11:04:25 +01:00
fdb-hiroshima 18ae6e26b3 remove the new index lock tantivy uses (#556) 2019-04-29 18:08:32 +01:00
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
2019-04-29 16:30:20 +02:00
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
2019-04-28 22:17:21 +01:00
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
2019-04-28 18:01:41 +01:00
Marek Ľach 85aa0883c8 Update follow_remote.rs.html grammar (#548)
* Update follow_remote.rs.html

* Update follow_remote.rs.html
2019-04-26 18:31:43 +01:00
Marek Ľach ff92ac0763 Make comments in styleshhets a bit clearer (#545)
* Update _variables.scss

* Make comments in stylesheets a bit more clear
2019-04-24 18:22:37 +02:00
fdb-hiroshima a20d2df50a Upload artifacts to pull request deploy environment (#539) 2019-04-20 23:07:50 +02:00
Baptiste Gelez 29e11f552f Remove r (#535)
I don't know why it was here 🤷‍♀️
2019-04-19 19:13:11 +01:00
Baptiste Gelez 3ad1f6968c Version bump: 0.3.0 (alpha 2) (#529) 2019-04-19 15:49:46 +01:00
Baptiste Gelez b572a1bd74 Fix #504 (#532)
- Add the `spaced` class to some article cards, to make them wider even on desktop
- Fix the CSS to always have a small margin for cards on mobile
2019-04-19 15:49:22 +01:00
fdb-hiroshima 6acb962e72 strip binary before packing (#533)
reduce by 35-40% size of binaries and archive
2019-04-19 16:13:40 +02:00
fdb-hiroshima 6bb4f8514f remove test after running it, and bump cache version (#531)
fix #523
2019-04-19 14:00:51 +01:00
Baptiste Gelez 68dd8602b2 New Crowdin translations (#479)
Enjoy!
2019-04-19 13:59:03 +01:00
fdb-hiroshima 4d4f2ba6ed increase default character limit (#530)
fix #524
2019-04-19 12:00:39 +01:00
fdb-hiroshima 3d82265b85 try to build release plume&plm on ci (#528)
ref Plume-org/docs#27
I should archive the artifacts before uploading
2019-04-19 11:36:45 +01:00
fdb-hiroshima 0d708e1639 Add support for remote interact (#519)
Add support for remote interaction ([this thing](https://eldritch.cafe/users/Barmaid/remote_follow) in mastodon)

- [x] create the endpoint dispatching remote interactions to local pages
- [x] add this endpoint to web-finger
- [x] propose remote interaction when following and not connected
- [x] propose remote interaction when liking/sharing and not connected
- [x] propose remote interaction when commenting and not connected
- [x] fetch posts/comments we don't know but remote interaction was requested for ?
2019-04-17 21:09:07 +01: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 c19c094e0c add diverse links and meta to head (#522) 2019-04-09 15:33:34 +02:00
Marek Ľach de296b633f Standard smallest screen is 600px (#520)
For devices that have a screen size so small they have to use the `max-width` property in CSS, the standard of a screen-size that has to be used here is `phones 600px and smaller`, not `900px`, which would have to use the `min-width` property instead, that would mean a widescreen size, because `min-width` means `a screen size of 900px, or more`, including desktops.
2019-04-08 21:48:15 +01:00
Baptiste Gelez d7de09ab81 Fix Atom feed link on user page (#518) 2019-04-07 05:53:38 +02:00
Baptiste Gelez 7645fdbf35 Fix tabs on user page (#516)
The "Articles" tab was always selected.
2019-04-06 19:03:00 +01:00
Baptiste Gelez 1bc2684af1 Run cargo fmt on plume-front (#515)
When `editor-improvements` was merged it was not run, because Travis was still used, but now it makes Circle CI fail on master.
2019-04-06 18:57:25 +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 eabe73ddc0 Add tests for plume webserver (#513)
* begin setup front-end test environment with selenium
* run migrations before tests
* use https for tests
2019-04-06 17:41:57 +02:00
Baptiste Gelez 1f7ff62c19 Editor improvements (#486)
- Make it possible to insert new paragraphs in the article body
- Make it impossible to copy formatted HTML (to make media insertion from markdown code work correctly)

TODO:

- [x] make it possible to escape draft mode
- [x] display errors from the server
- [x] button to go back to the "normal" editor
- [x] Avoid publishing placeholders
2019-04-06 14:20:12 +01:00
Marek Ľach 38701c8a40 Corrected grammar pointed out by translators (#514)
The user 'UniqueActive' pointed these issues out on Crowdin.

Thank you!
2019-04-04 20:06:37 +01:00
Marek Ľach 723d2c4600 Grammar corrections followup to #510 (#512)
A very small commit, but let's do all the string corrections while I am already at it :-)

Wraps up #510
2019-04-02 14:08:07 +01: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
Marek Ľach 2d12524cd1 English source strings corrected (#510)
Requires .po/.pot files to be rebuilt

This resolves #508
2019-04-01 19:09:29 +01:00
Hugh a674df3a77 Some corrections to English UI text (#506)
* Update some UI strings for more natural English

* Correct message text

* Correct message text

* Update the strings everywhere

Because they are also used as base messages for other languages
2019-03-29 20:12:21 +01:00
Valentin Brandl c7ee779f51 Delete notifications when deleting comments (#499)
* Implement find_for_comment for notifications

* Delete notifications when deleting a comment

This should tackle #463

* Apply rustfmt

* Implement `find_for_mention` and remove order by from `find_for_comment`

There is no need to order the notifications

* Delete notifications for mentions

* Fix notifications for comments and mentions
2019-03-26 12:45:17 +01:00
Valentin Brandl f0d6b9d1e8 Fix issue with sqlite migrations for comment_seers (#503) 2019-03-26 08:57:46 +01: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
Jean Lucas e93b8f4444 Change "Welcome on" to "Welcome to" (#501)
"Welcome on [noun]" is not grammatically correct as an introduction in
English. Let's fix that.
2019-03-25 08:57:26 +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
fdb-hiroshima 6cd9c8a01a Print help when subcommand is given without arguments (#498)
Fix #490
2019-03-21 23:25:22 +01:00
fdb-hiroshima ace6181c99 Allow to change logo from .env (#497)
Fix #273
2019-03-21 11:51:41 +01:00
fdb-hiroshima 65bb50e88f Centralize configuration and add some new config (#494)
Ideally, if someone could review the idea in [this comment](https://github.com/Plume-org/Plume/issues/273#issuecomment-474982184), I'd like to add the implementation to this pr too
2019-03-21 10:30:33 +01:00
Atul Bhosale b945d1f602 Run 'cargo fmt' to format code (#489) 2019-03-20 17:56:17 +01:00
Igor Galić 732f514da7 Refactor with the help of Clippy (#462)
We add clippy as our build — also rectifying the missing `plume-cli` build!

In the next step we follow clippy's advise and fix some of the "simple" mistakes in our code, such as style or map usage.

Finally, we refactor some hard bits that need extraction of new types, or refactoring of function call-types, especially those that thread thru macros, and, of course functions with ~15 parameters should probably be rethought.
2019-03-19 14:37:56 +01:00
fdb-hiroshima 570d7fe2d0 Add markdown support for summary (#482)
* Add markdown support for summary

* Save both md and html summary
2019-03-17 20:11:29 +01:00
fdb-hiroshima 191eb89958 Display error message when signin up with unmatching password (#484)
Fix #329
2019-03-17 20:10:45 +01:00
fdb-hiroshima a2b2e37aa0 Caching (#480)
* add basic caching support

* Use hash of static dir instead of rand

* Add support for ETag
2019-03-16 15:33:28 +01:00
Baptiste Gelez 90baf9beb1 Update Crowdin configuration file 2019-03-15 16:45:17 +01:00
Baptiste Gelez 9076dbaadc New editor (#458)
With this PR, when JS is activated and WASM supported, the article editor will be dynamically replaced with `contenteditable`s elements. This makes the editing interface simpler and less like a regular form. It will also allow us to easily add visual formatting with native browser APIs (and to insert images or videos directly). Here is a little demo:

![peek 05-03-2019 16-12](https://user-images.githubusercontent.com/16254623/53815536-1dc05680-3f62-11e9-94d3-b363ed84eb97.gif)

There is still a lot to do, but it is a good first step.

Fixes #255
2019-03-15 16:06:10 +01:00
Baptiste Gelez ffcbc0fde3 Update Crowdin configuration file 2019-03-15 14:41:51 +01:00
Kenneth Steimel 4ff56c6407 Added coloration for selections and contrasting (#476)
color for anchor elements when selected
2019-03-13 21:54:48 +01:00
Baptiste Gelez 42dca3daae Remove some unused #[derive] (#473)
We used to need them, probably when we were using Tera.
2019-03-12 19:40:54 +01:00
Baptiste Gelez 6405bd7261 Update issue templates (#471)
Use two different templates instead of one: one for bugs, one for feature requests.
2019-03-12 17:20:53 +01:00
Baptiste Gelez b52b8fc880 Fix wrong condition, resulting in 404 for valid NodeInfo endpoints (#464)
* Fix wrong condition, resulting in 404 for valid NodeInfo endpoints

* Forgot to remove that dbg!
2019-03-12 17:00:23 +01:00
Baptiste Gelez fe6e69d7c4 Add a fqn field to blogs and users (#457)
Fixes #319
2019-03-06 18:28:10 +01:00
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
2019-03-06 14:11:36 +01:00
Baptiste Gelez a5e0486da0 Make media extension parsing safer (#459)
Only keep it if contains letters and numbers only, otherwise remove it.

To be merged before #452
2019-03-06 14:09:43 +01:00
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
2019-03-04 21:35:03 +01:00
Baptiste Gelez 9b48b8a846 Update dependencies (#456)
(whatlang especially, since it received an update that removes many build dependencies, making our total dependency count go from 512 to 478)
2019-03-04 20:46:26 +01:00
Baptiste Gelez a2b9d7ec44 Password reset (#448)
* Password reset

* Various improvements and fixes for password reset

- Reorganize src/mail.rs to make it  cleaner
- add a build_mail function
- only make the requests invalid after 2 hours
- avoid infintely-growing list of requests by deleting them once completed, or after 24 hours
- avoid sending many requests for the same user
- validate the password reset form

* Avoid locking so many times

Fix durations

* Remove old requests even if the current one is not valid

* Remove unused feature

* Also remove the custom_derive and plugin features while we are at it

* Forgot a 0 è_é

* Avoid panicking while owning a request lock

* Use master branch of lettre so that we can build with the latest OpenSSL

* Fix the debug mailer
2019-02-27 13:29:26 +01:00
Baptiste Gelez e28371bbe4 Add a page listing people someone follows (#444)
Nothing exceptional, the layout is the same as the followers page.

Fixes #325
2019-02-26 13:13:00 +01:00
zcdunn 7bac70a483 Update nodeinfo (#446)
Fix #433

I added the repo link to Cargo.toml so that `software.repository` could be configurable like @rhaamo suggested. I don't know if it's ok to include `software.repository` without bumping the schema version, but I didn't know if that would break any clients that parse nodeinfo with a hardcoded schema version.
2019-02-17 13:42:59 +01:00
fdb-hiroshima 64d1944715 Upgrade tantivy to 0.8.2 (#445)
Fix arm build
2019-02-14 08:46:37 +01:00
Baptiste Gelez 576a4ed499 Pull i18n from Funkwhale's weblate (#439)
* Added translation using Weblate (Arabic)

* Translated using Weblate (Arabic)

Currently translated at 66.7% (124 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ar/

* Translated using Weblate (English)

Currently translated at 100.0% (186 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/en/

* Translated using Weblate (Japanese)

Currently translated at 100.0% (186 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ja/

* Translated using Weblate (Arabic)

Currently translated at 68.8% (128 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ar/

* Translated using Weblate (Norwegian Bokmål)

Currently translated at 96.8% (180 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/nb/

* Translated using Weblate (Arabic)

Currently translated at 95.7% (178 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ar/

* Added translation using Weblate (Spanish)

* Translated using Weblate (Spanish)

Currently translated at 3.8% (7 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/es/

* Added translation using Weblate (Portuguese (Portugal))

* Translated using Weblate (Arabic)

Currently translated at 99.5% (185 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/ar/

* Translated using Weblate (Portuguese (Portugal))

Currently translated at 95.7% (178 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/pt_PT/

* Translated using Weblate (Spanish)

Currently translated at 26.9% (50 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/es/

* Translated using Weblate (Spanish)

Currently translated at 34.9% (65 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/es/

* Translated using Weblate (Spanish)

Currently translated at 34.9% (65 of 186 strings)

Translation: Plume/Plume
Translate-URL: https://translate.funkwhale.audio/projects/plume/Plume/es/
2019-02-13 13:39:42 +01:00
Baptiste Gelez 77bfe635d7 Update dependencies (#440) 2019-02-13 13:39:30 +01:00
marcin mikołajczak a8b1f1107e i18n: Update Polish translation 🇵🇱 (#441) 2019-02-05 16:48:58 +01:00
Baptiste Gelez 7eef4643c8 Update rocket_i18n and add gettext_macros (#431)
Internationalization now uses proc-macros that generate the .pot file
automatically.
2019-02-02 15:23:50 +01:00
David Baucum 8696185d1e Fixed spelling error in instance command (#438) 2019-01-29 00:09:59 +01:00
Baptiste Gelez 5880dc1957 Improve search UI (#375) 2019-01-28 13:12:56 +01:00
fdb-hiroshima 716c58cb71 Lowercase extension before detemining media type (#437) 2019-01-27 13:44:09 +01:00
fdb-hiroshima e77e4d86e8 Better big form handling (#430)
* Allow customizing max form size from env vars

* Add error page for unprocessable entities

And change default http port to 7878

* Improve char counter: under the editor, more discrete, and give it a default value
2019-01-27 10:55:22 +01:00
zcdunn 06d6bd361a Add categories to web manifest (#434)
This pull request add a `categories` key to the web manifest. The categories key was [recently added](https://www.aaron-gustafson.com/notebook/categories-land-in-the-web-app-manifest/ "Blog post detailing the addition of categories to the spec") to the Web Manifest spec and is a list of categorizations you want to apply to your site that serves as a hint to search engines and webapp catalogs.

The categories can be anything and there is no standardized list of vaues. The W3C is maintaining a list of commonly used values [here](https://github.com/w3c/manifest/wiki/Categories). I added _social_ to Plume's manifest based on that list, but I think eventually allowing a user defined list would be better. I don't know if there's anything in Plume currently that would enable that.
2019-01-24 13:16:48 +01:00
KemoNine a2ddfb0ee9 Fix Plume arm builds (#427)
llvm latest svn commit is broken as of 2019/01/12. This patch pins the llvm+lld versions used for arm compiles.

It also tweaks the architecture detection to be more reliable in multi-lib/multi-arch situations where the CPU is 64bit but the runtime is 32bit.
2019-01-18 20:57:20 +01:00
fdb-hiroshima 944a9d08a7 Update dependencies (#428)
* Bump serde from 1.0.82 to 1.0.84
* Bump ructe from 0.5.4 to 0.5.6
* Bump colored from 1.6.1 to 1.7.0
* Bump itertools from 0.7.11 to 0.8.0
* Bump ammonia from 1.2.0 to 2.0.0
* Bump hyper from 0.12.19 to 0.12.20
* Bump serde_derive from 1.0.80 to 1.0.84
* Bump stdweb from 0.4.12 to 0.4.13
* Bump rsass from 0.9.4 to 0.9.6
* Bump failure from 0.1.3 to 0.1.5
* Bump reqwest from 0.9.5 to 0.9.8
* Bump serde_derive from 0.7.1 to 0.8.0
2019-01-18 19:22:36 +01:00
Dominique Feyer 09a26b4602 Better contrast for input fields (#417)
* Better contrat for input fields

This change set a white background for input field (text, select and textarea)
to have a better contrast with the page background and improve accessibility for
people with vision problem, and just crappy screen.

This change also remove the round corner for the input to have a clear difference
between editing field and buttons.

This max-width of the form element are a bit bigger too.

* Less space between label and input
2019-01-09 18:57:48 +01:00
Dominique Feyer 0490b698cb Use multi step build to limit the docker image size (#416)
* Use multi step build to limit the image size

This change replace the Dockerfile with a multi step build to avoid huge image
size (the new image should be around 130Mo including all layers), compared to
more that 1Go with the full build chain. It's also more safe. This image does
not include cargo (not needed in production), so the old Dockerfile is available
and renamed Dockerfile.slim for those who use Docker for development setup.

* Use correct path for local repository

* Use sleep between chmod and execution
2019-01-09 17:48:18 +01:00
Dominique Feyer 671c340aa8 Better header line height (#418)
This change also remote all units for line-height to have more consistent styles and better cascading support. This solve the too small line height for multi line header in article and also add styling for h1 to h6 (previously h3 to h6 was not styled at all)
2019-01-09 17:46:03 +01:00
fdb-hiroshima c4a4ea5b6c Support blind key rotation (#399)
* Allow receiving objects with new unknown key

* Rotate key after sending Delete activity

* Do the right check
2019-01-05 22:30:28 +01:00
fdb-hiroshima aa72334dc6 Allow for media cover deletion (#387)
* Allow for media cover deletion

Fix #356

* Fix sqlite migrations
2019-01-05 22:11:54 +01:00
fdb-hiroshima 7c8599b0a2 Disallow interaction with medias owned by others (#410)
Notably prevent media deletion by other users
2019-01-05 22:09:57 +01:00
fdb-hiroshima c502ae73f6 Encode redirect messages into valid url data (#409)
Ref #408
2019-01-05 19:36:55 +01:00
Marcin Mikołajczak 2993379aaf i18n: Update Polish translation (#407) 2019-01-04 18:46:48 +01:00
fdb-hiroshima 2333d898b9 Add new subcomand for plm to reset password (#406)
* Add new subcomand for plm to reset password

* Verify user exist before asking for new password
2019-01-03 16:45:27 +01:00
KemoNine dfa89e227a Plume front arm support (#402)
* Update plume-front build to use a shell script that adds the necessary dependencies on arm (x86 left untouched inside the script)

* Fix cleanup portion of plume-front.sh

* Break wasm dependencies for arm out so they are run before the main builds to improve layer caching on subsequent docker builds

* Fixup dockerfile so wasm-deps can run properly and with fewer assumptions

* Move new scripts to script/ folder

* Remove saving of path as it's not actually not necessary

* Add rust-toolchain to early copy so it pulls the right rust release (addresses #400)
2018-12-31 18:46:20 +01:00
fdb-hiroshima 2896eb1705 Fix login issue (#401)
Regression introduced by 4059a840be
2018-12-31 11:45:59 +01:00
Marek Ľach 3128e6a3b9 Tags grammar and admin string corrections (#397) 2018-12-29 17:40:11 +01:00
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)
2018-12-29 09:36:07 +01:00
Marek Ľach 4059a840be Batch of correnctions for text strings in plume.pot (#395) 2018-12-27 14:13:00 +01:00
Marek Ľach e2d5a5057c Update edit.rs.html string (#389) 2018-12-26 13:05:06 +01:00
fdb-hiroshima ccba485215 Trim email and username (#386)
Also forbid whitespaces in username
Fix #385
2018-12-25 18:00:21 +01:00
Marek Ľach 9b3b79ef9c A small batch of rephrashings for text strings (#378)
* A small batch of rephrashings for text strings

* Update plume.pot
2018-12-25 16:00:00 +01:00
Marek Ľach 07ecbde93c Small changes to text strings (#379) 2018-12-25 15:59:54 +01:00
Marek Ľach fefb189056 Expanded search text strings (#380) 2018-12-25 15:56:30 +01:00
Marek Ľach ec4b9d5067 Text strings for articles (#381) 2018-12-25 15:55:48 +01:00
Marek Ľach 8f6333029d Article detail text strings update (#382) 2018-12-25 15:55:18 +01:00
Marek Ľach 040a3b8688 Media upload strings update (#383) 2018-12-25 15:54:35 +01:00
Marek Ľach b5ddca2f64 Media details small strings correction (#384) 2018-12-25 15:54:08 +01:00
Baptiste Gelez 3fce5d6a14 Use Rust for the front-end too (#374)
Rust can compile to WASM, so let's use it for front-end code as well.

To compile the front-end:

```
cargo install cargo-web
cargo web deploy -p plume-front
```
2018-12-25 11:51:40 +01:00
Marek Ľach 22bc8c1d40 Text strings updated (#377)
* Texts strings updated

* Update plume.pot

* Update plume.pot

* Update plume.pot

* Update plume.pot

* Update plume.pot
2018-12-24 19:04:25 +01:00
Marek Ľach aa6c1ffd64 Change title from Edit account to Create account (#376) 2018-12-24 19:03:54 +01:00
Baptiste Gelez 4ec2480f50 Post creation API (#307) 2018-12-24 16:42:40 +01:00
fdb-hiroshima fdfeeed6d9 Comment visibility (#364)
Add some support for comment visibility, fix #217 

This add a new column to comment, denoting if they are public or not, and a new table linking private comments to those allowed to read them. There is currently no way to write a private comment from Plume.
Git is having a hard time what happened in Comment::from_activity, but most of it is just re-indentation because a new block was needed to please the borrow checker. I've marked with comments where things actually changed.
At this point only mentioned users can see private comments, even when posted as "follower only" or equivalent.

What should we do when someone isn't allowed to see a comment? Hide the whole thread, or just the comment? If hiding just the comment, should we mark there is a comment one can't see, but answers they can, or put other comments like if they answered to the same comment the hidden one do?
2018-12-24 11:23:04 +01:00
Marek Ľach 2621549f5e An attempt to fix disorted submit button on mobile devices like iPhone - please review (#370)
* Update _forms.scss

* Update _forms.scss

* Update _forms.scss
2018-12-23 17:30:57 +01:00
Baptiste Gelez 8ff6332784 I'm not the only one who made Plume è_é (#373) 2018-12-23 17:29:08 +01:00
Baptiste Gelez 04625b3fea Use Route159 for comment deletion button (#372)
For some reason it was not what was used.
2018-12-23 15:58:25 +01:00
Baptiste Gelez 5a682419cb Remove the docs folder (#371)
Since documentation now has its own repo.

I also modified a bit the dockerfile to make the image lighter.
2018-12-23 15:24:55 +01:00
fdb-hiroshima 5c5cf36b0d Allow for comment deletion (#363)
* Allow for comment deletion

Receive and emit deletion activity
Add button to delete comment

* Remove debug print and fix copy-past typo

* Improve style of comment deletion button
2018-12-23 11:13:36 +01:00
fdb-hiroshima 0df9c4d400 Give reshare and like ap_url before inserting (#369)
Fix #367
2018-12-23 11:13:02 +01:00
fdb-hiroshima 0ea1d57e48 Fix some federation issues (#357)
* Fix some follow issues

Fix not receiving notifications when followed by remote users
Fix imposibility to be unfollowed by Mastodon/Pleroma users (tested only against Pleroma)

* Fix notification on every post

* Fix issues with federation

Send Link instead of Object when emiting Follow request
Receive both Link and Object for Follow request
Don't panic when fetching user with no followers or posts from Pleroma
Reorder follower routes so Activity Pub one is reachable

* Generate absolute urls for mentions and tags

* Verify author when undoing activity by Link
2018-12-23 11:12:15 +01:00
fdb-hiroshima ab2998e214 Make Plume compile on release (#365)
* Remove use of String for body parameters

Create SignedJson and implement FromData for it

* Make Travis test on release

* Remove warning when installing and fix coverage
2018-12-22 18:27:21 +01:00
Baptiste Gelez 718e23ac85 Update README.md
Links to joinplu.me

Say that we have a CoC

Remove link to baptiste.gelez.xyz
2018-12-21 19:53:09 +01:00
Marcin Mikołajczak 61a79f426b i18n: Update Polish translation (#366) 2018-12-20 19:57:53 +01:00
fdb-hiroshima ce08346487 Remove ap_url from mention (#362) 2018-12-18 15:03:47 +01:00
Baptiste Gelez 9e799f2cf2 Use SCSS (#355)
- Use variables
- Split everything in various files

The SCSS is compiled with `cargo build`/`run`

I also fixed a few visual issues.
2018-12-15 22:06:27 +01:00
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
2018-12-14 23:16:18 +01:00
Baptiste Gelez b0089e59b7 Remove useless pagination routes (#351)
Rocket 0.4 let us have routes with optional query parameter
2018-12-13 22:20:19 +01:00
Baptiste Gelez e139008d35 Fix reshare button style 2018-12-13 21:56:26 +01:00
Trinity Pointard 21fe63665d Upgrade rocket_csrf
Fix #346
2018-12-13 10:22:43 +01:00
Trinity Pointard 2870642cfa Fix mentions containing underscores
Fix #338
2018-12-12 10:50:55 +01:00
Trinity Pointard fcbaf6eee3 Allow to keep query params in paginate
Fix #349
2018-12-12 00:52:26 +01:00
Kristof De Jaeger 144f5966dd Add a space between u-url class and href (#347)
There's a missing space, which probably causes the h-feed not to parse.
You can always use http://xray.p3k.io/ to validate the microformats on a page.

e.g. http://xray.p3k.io/parse?url=https%3A%2F%2Fbaptiste.gelez.xyz%2F%7E%2FFederationTesting%2Fplume-and-the-indie-web&pretty=true is fine, so that's good!

However, the h-feed isn't parsing right - http://xray.p3k.io/parse?expect=feed&url=https%3A%2F%2Fbaptiste.gelez.xyz%2F%40%2F0x1C3B00DA&pretty=true (you can always add 'expect=feed' to the get params if you are really sure it needs to be a feed)
2018-12-11 12:30:23 +01:00
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
2018-12-09 18:44:26 +01:00
Baptiste Gelez b73fbd3768 License federation (#343)
* Federate license

* Make it possible to use no license
2018-12-09 18:43:34 +01:00
fdb-hiroshima e9f2f769be Add microformat tags (#341)
Close #229 
Adding `<div>` might have broken the layout in some places. I've tried to fix it, tell me if I missed it somewhere
2018-12-08 21:52:46 +01:00
Ryo Nakano 4182e67dbf Update Japanese translation (#339) 2018-12-08 15:39:47 +01:00
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
2018-12-07 21:00:12 +01:00
Trinity Pointard b4e4b497ee Works on template
Use uri! to generate links instead of hardcoded urls
Fix #110
Fix invalid links needing to be POST forms
Translate login message for boost and like directly from template
Put js for search in its own file
2018-12-07 12:10:03 +01:00
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
2018-12-06 18:54:16 +01:00
Trinity Pointard 5f059c3e98 Fix issues with tags and mentions
Fix issue where leading @ or # of a mention/hashtag get duplicated
Fix issue where normal tags were being overwritten by hashtags
2018-12-06 15:10:07 +01:00
Trinity Pointard d6e220cc8d Actually index post_id in tantivy
Otherwise you can't remove/edit a document
2018-12-04 06:43:32 +01:00
Trinity Pointard 39deede935 Verify signature date
Fix #286
Remove indexed from post_id search field as it was added by mistake
2018-12-04 00:08:55 +01:00
Ryo Nakano 5ff3b65cc5 i18n: Add Japanese translation (#333)
Browsing the Demo instance, I sometimes found Japanese articles. So I decided to translate Plume into Japanese.
2018-12-03 19:06:10 +01:00
Trinity Pointard 24071a6229 Make plm search use cwd if no directory is given and update doc 2018-12-02 20:01:48 +01:00
Trinity Pointard ed71d24fe9 Verify remote user name and media url 2018-12-02 19:09:17 +01:00
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
2018-12-02 17:37:51 +01:00
Trinity Pointard 9714bafded Verify username for special characters on signup 2018-12-02 12:43:03 +01:00
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
2018-11-26 10:21:52 +01:00
fdb-hiroshima 8a4702df92 Add unit tests for main model parts (#310)
Add tests for following models:
- Blog
- Instance
- Media
- User
2018-11-24 12:44:17 +01:00
KokaKiwi 0b9727ed28 Generate valid follow Accept activity URI (#317)
For now it only generate a "fake" URI for accept follow activities, but it should be possible to get the URI dereferencable later.

Also I don't know if this URI looks ok, I tried to get something kind of future-proof, but I don't really know about the actual URIs conventions.

Closes #313
2018-11-23 13:23:46 +01:00
KokaKiwi 100f6307a7 Set Content-Type for ActivityPub request to correct value. (#315) 2018-11-23 13:18:33 +01:00
KokaKiwi 67fe28177e Decode unfollow activities in inbox properly (#316) 2018-11-23 13:17:37 +01:00
Trinity Pointard 00a205a882 Update debian installation doc
fix #305
Update debian installation doc
Remove need for libpq when compiling with sqlite backend
Remove some unneaded features of multipart to speed up compilation
2018-11-21 10:09:23 +01:00
Aaron W. Swenson 3ecd0e3c34 Correct Gentoo emerge instructions (#311)
Emerge doesn't care what order the packages are given; it'll figure out the correct build order and pull in the proper dependencies. Adding the -u switch will only perform the emerge if the package is not yet installed or needs to be updated. This avoids wasting time performing an emerge on something that has already been emerged.

While harmless, it is unnecessary to explicitly include eselect-postgresql in the list as the dev-db/postgresql ebuilds declare it as a dependency. There is no "sqlite3" or "libsqlite3-dev" ebuilds, so that command would fail.
2018-11-10 12:30:12 +01:00
Baptiste Gelez a64c4912cf Add support for CW in comments (#308)
All the backend/federation code was already, I just added the UI 🤷‍♀️ 

Fixes #253
2018-11-07 15:57:31 +01:00
Baptiste Gelez b28411da99 Test with PostgreSQL too (#309)
* Test with PostgreSQL too

* Add 'test' to Travis build stages

* Add test coverage for postgresql
2018-11-07 15:50:24 +01:00
Baptiste Gelez 3690e4cfb9 Fix the path of the media directory for Docker setups 2018-11-06 10:56:42 +01:00
Baptiste Gelez 94904fa3d5 Escape titles in RSS feeds 2018-11-06 10:49:46 +01:00
Baptiste Gelez f0b911a328 Fix RSS feed link on blog pages 2018-11-06 10:41:17 +01:00
Alexander d724eba772 i18n: Add Russian translation (#306) 2018-11-05 19:18:46 +01:00
Trinity Pointard dca91945af Try to take advantage of travis cache and build stages 2018-11-04 20:27:27 +01:00
Baptiste Gelez 8d5eaaec6a Add Codecov badge 2018-11-02 10:02:31 +01:00
Baptiste Gelez 6b2d9d4221 Tests infrastructure for plume-models (#302)
First step for testing `plume-models`. I only added one test for the moment, but we should add more in future PRs.
2018-11-01 22:23:38 +01:00
Marcin Mikołajczak 1bcde7fb86 i18n: Update Polish translation 2018-11-01 12:47:28 +01:00
Baptiste Gelez 57cf55fecc Fix RSS feed icon
Closes #289
2018-10-31 18:17:13 +01:00
Baptiste Gelez 67077267cf Add OpenGraph metadata 2018-10-31 16:14:26 +01:00
Baptiste Gelez 68a30cc80e Fix spacing for the delete article button 2018-10-31 15:22:49 +01:00
Baptiste Gelez 185cb5142a Better style for subtitles 2018-10-31 15:19:42 +01:00
Baptiste Gelez 25b7399e7f Only list images for possible covers 2018-10-31 15:07:40 +01:00
Baptiste Gelez f593ce40af Remove some debug messages 2018-10-31 15:07:40 +01:00
Baptiste Gelez 464832bb31 Avoid template errors when form.cover is not defined 2018-10-31 15:07:40 +01:00
Baptiste Gelez 1a49569bf2 Better style for <select> 2018-10-31 15:07:40 +01:00
Baptiste Gelez 4a2f5aeeeb Display article covers 2018-10-31 15:07:40 +01:00
Baptiste Gelez 95326c09e0 Federate article covers 2018-10-31 15:07:40 +01:00
Baptiste Gelez 485aac2e20 Add an interface to select an article illustration 2018-10-31 15:07:40 +01:00
Baptiste Gelez ab5edbc6a5 Add a cover field to posts
Referencing the media to use to illustrate the article
2018-10-31 15:07:40 +01:00
Baptiste Gelez 9f1b37648e Fix error in de.po 2018-10-31 15:06:00 +01:00
Baptiste Gelez f6227e7a42 Nicer default avatar 2018-10-31 15:03:21 +01:00
Baptiste Gelez 8e8aae17b1 Nginx docs: add 'unsafe-inline' to CSP header (to allow avatars to be loaded) 2018-10-31 14:56:17 +01:00
Baptiste Gelez 2e072affb5 Fix editor auto-expansion (#293) 2018-10-30 18:16:24 +01:00
Baptiste Gelez e26a150164 Make Authorization optional for read routes
Only require it when reading draft articles.
2018-10-30 18:13:49 +01:00
Baptiste Gelez c341179150 ApiToken: rename what to scope 2018-10-30 18:13:49 +01:00
Baptiste Gelez 28fbf35779 Use PhantomData intead of two Options useless for Authorization
And remove some warnings about unused parameters
2018-10-30 18:13:49 +01:00
fdb-hiroshima 9784d754b2 Use the full URL to refer to the Apps API
Co-Authored-By: BaptisteGelez <baptiste@gelez.xyz>
2018-10-30 18:13:49 +01:00
Baptiste Gelez 647a5af070 Make it impossible to know if an username is used or not with the API 2018-10-30 18:13:49 +01:00
Baptiste Gelez 0dbf9f519e AppEndpoint.name is required for both the client and server 2018-10-30 18:13:49 +01:00
Baptiste Gelez 31641b1ea1 New request guard: Authorization<Action, Scope>
Filter requests that don't have an API token authorized to read or write
a specific scope;
2018-10-30 18:13:49 +01:00
Baptiste Gelez cd4ae5b7f5 Document API authentication and apps API 2018-10-30 18:13:49 +01:00
Baptiste Gelez 9a13d804c5 impl FromRequest for ApiToken
and use it for the posts API
2018-10-30 18:13:49 +01:00
Baptiste Gelez 663ec52fea Disable CSRF for the whole API 2018-10-30 18:13:49 +01:00
Baptiste Gelez 2394ff424b Add an ApiToken model, and an endpoint to get one 2018-10-30 18:13:49 +01:00
Baptiste Gelez f2190adfc2 Add an API endpoint to register apps 2018-10-30 18:13:49 +01:00
Baptiste Gelez 4c8a727e9e Add a model for external apps
Stores their name, website, and credentials
2018-10-30 18:13:49 +01:00
Trinity Pointard 76ca76f068 Update tags and hashtags on remote post edition 2018-10-29 20:54:27 +01:00
Trinity Pointard c4fc656809 Update mentions on remote post edition 2018-10-29 20:54:27 +01:00
Trinity Pointard f147885f08 Detect if tags are hashtags when receiving new posts 2018-10-29 20:54:27 +01:00
Trinity Pointard 9d7ae694a8 Delete notification on post deletion 2018-10-29 20:54:27 +01:00
Trinity Pointard 2523f3b523 Prevent duplication of mention on post update
and delete mentions and notifications of user no longer mentioned
2018-10-29 20:54:27 +01:00
Trinity Pointard 1689813df4 Deduplicate tags and mentions
Use set to work on tags and mentions, allowing deduplication of them,
and clearer code
May also help with distinguishing tags and hashtags latter
2018-10-29 20:54:27 +01:00
fdb-hiroshima 83d6da29a5 Fix typos
Remove line breaks where not needed
2018-10-29 20:31:25 +01:00
Baptiste Gelez 1a2de6c88f Fix the NodeInfo example
Forgot to change that when I copy/pasted it from the source
code.
2018-10-29 20:31:25 +01:00
Baptiste Gelez 175a9edb77 Add documentation for our ActivityPub implementation
Fixes #262
2018-10-29 20:31:25 +01:00
Baptiste Gelez 6efcba46ad Merge pull request #297 from maximesrd/patch-8
Added startup script for openrc
2018-10-29 19:35:57 +01:00
Baptiste Gelez 8c2e0e680a Merge pull request #294 from silkevicious/master
Added Italian translation
2018-10-29 19:28:38 +01:00
maximesrd ae4c7e559c Added startup script for openrc 2018-10-29 12:39:14 +01:00
Trinity Pointard 0bb2e6293a Send Create activity when undrafting post
Send a Create activity when a post get undrafted, instead of sending an
	Update activity for a non federated post
Fix #221
2018-10-28 11:42:01 +01:00
Trinity Pointard cbbd0ca920 Group post by 12 instead of 10
Fix #251
2018-10-28 11:26:24 +01:00
Trinity Pointard 0bb719830a Fix incorrect media link
Fix #292
2018-10-27 19:21:50 +02:00
Sylke Vicious 9871f03d29 Added italian translation 2018-10-27 08:35:24 +02:00
Sylke Vicious 999e213eda Added IT to LINGUAS files 2018-10-27 08:34:51 +02:00
Baptiste Gelez b28c1a7568 Merge pull request #288 from maximesrd/patch-7
Adding MIGRATION_DIRECTORY
2018-10-22 19:24:20 +01:00
Baptiste Gelez 9000f2ba62 Merge pull request #287 from maximesrd/patch-6
Variable name error
2018-10-22 19:23:53 +01:00
maximesrd 15eac79123 Adding MIGRATION_DIRECTORY 2018-10-22 20:17:27 +02:00
maximesrd bbcea45e4b Variable name error 2018-10-22 20:13:15 +02:00
Baptiste Gelez fcf911fac9 ActivityPub: don't delete anything if the actor is not authorized 2018-10-22 16:29:25 +01:00
Baptiste Gelez fc5acac861 Merge pull request #283 from Plume-org/hashtags
Support hashtags
2018-10-21 13:53:15 +01:00
Baptiste Gelez 9187aefda0 Merge pull request #282 from Plume-org/blog-deletion
Add support for blog deletion
2018-10-21 13:39:41 +01:00
Trinity Pointard d47aff70f7 Add new string to translate for blog deletion 2018-10-21 12:09:22 +02:00
Trinity Pointard 9a8758d7fc Hide hashtags from tag list 2018-10-20 23:45:29 +02:00
Trinity Pointard 95ea248518 Add support for hashtag on user interface
Add migration to fix typo
Add support for linking hashtags with posts
Rework tag search page so it says a nicer message than page not found
when no post use that tag
Add new string to translation
2018-10-20 19:27:49 +02:00
Trinity Pointard 4fa3a0f6ee Add support for hashtags in md parser 2018-10-20 16:38:16 +02:00
Trinity Pointard eca458b0e5 Add support for blog deletion
fix #181
2018-10-20 15:03:59 +02:00
Trinity Pointard a6e73f4667 Allow tag deletion
Fix #232
2018-10-20 14:05:41 +02:00
Baptiste Gelez 879fde81ba Merge pull request #281 from Plume-org/panic-refactor
Panic less and with better messages
2018-10-20 10:56:29 +01:00
Trinity Pointard fd92383f87 Normalize panic message and return 400 or 404 when suitable 2018-10-20 11:04:20 +02:00
Trinity Pointard 4e6f3209d5 Normalize panic message
Change all unwrap to expect
Normalize expect's messages
Don't panic where it could be avoided easily
2018-10-20 08:44:33 +02:00
Baptiste Gelez 630ad0920d Merge pull request #279 from PhieF/patch-1
Apache config wasn't working
2018-10-18 19:21:09 +01:00
Baptiste Gelez 370dafc2dc Merge pull request #280 from anoadragon453/anoa/welcome
Fix Welcome banner grammar
2018-10-18 19:20:45 +01:00
Andrew Morgan 7eebfe991b Welcome on -> Welcome to 2018-10-18 17:52:26 +02:00
PhieF ca19747d2b Apache config wasn't working
SSLStaplingCache needs to be outside of VirtualHost and adding missing </Directory>
2018-10-18 14:49:53 +02:00
Bat 9d70eeae61 Don't register the media serving route (they are now served with other static files)
And remove some unused imports
2018-10-12 20:48:11 +01:00
Bat dde4583fd3 Database setup in Docker install instructions 2018-10-12 20:41:05 +01:00
Bat ab20fec147 Fix MIGRATION_DIR for Docker 2018-10-12 20:38:54 +01:00
Bat 14969d489c Save medias in static/media
Fixes #272
2018-10-12 20:32:34 +01:00
Baptiste Gelez f7c37ca6ca Merge pull request #277 from oliof/patch-1
Add caddyserver example configuration
2018-10-12 19:57:14 +01:00
Harald Wagener 5e248cc99f Add caddyserver example configuration
Add caddyserver example configuration
2018-10-12 20:50:41 +02:00
Trinity Pointard f9498828c4 Modify post slug only when it's still drafted
Fix #207
2018-10-11 14:23:23 +02:00
Trinity Pointard ed5bafbbc4 Update webfinger and reqwest
Update webfinger to 0.3.1
Update reqwest to 0.9
Fix #257
2018-10-11 13:51:45 +02:00
Baptiste Gelez 8fdb55a501 Merge pull request #256 from Plume-org/verify-signature
Verify activity's signature
2018-10-10 21:31:11 +01:00
Baptiste Gelez 09e7226c23 Don't lowercase URL for requests signatures 2018-10-10 20:23:39 +00:00
Trinity Pointard ba4695f490 Add support for signature verification on pseudo header
Add support for pseudo-header '(request-target)'
Add some logging for denied request
2018-10-10 21:10:43 +02:00
Baptiste Gelez ce09ca14c4 Merge pull request #276 from midzer/patch-1
Update de.po
2018-10-10 17:55:44 +01:00
midzer dda41b1c57 Update de.po 2018-10-10 18:51:10 +02:00
Bat d77d064a85 Add links to API.md and CLI.md on the docs homepage 2018-10-09 21:39:30 +01:00
Baptiste Gelez 3901ae835f Merge pull request #274 from Plume-org/logo
New logo!
2018-10-09 20:03:29 +01:00
Bat 1b9c3f69bf Add icons to Web Manifest 2018-10-09 19:38:01 +01:00
Bat 25f47a7951 Add a favicon 2018-10-09 19:23:36 +01:00
Bat 45c31b1c8a Add the new logo the header 2018-10-09 15:37:40 +01:00
Bat d5ba8864c3 Import @trwnh's logos
I would have liked to merge their commits in Plume's repository, but I have no idea how it could be done.

For reference, here is the repository they come from: https://github.com/trwnh/plumeLogos
2018-10-09 15:22:07 +01:00
Bat 3f18cdd38b Add .swp to .gitignore 2018-10-08 20:42:40 +01:00
Baptiste Gelez da7bfd50d0 Merge pull request #271 from yannicka/master
Update French translation
2018-10-08 20:11:35 +01:00
Yannick Armand 14bfb410ab Update French translation 2018-10-08 21:07:36 +02:00
Bat 3b7842d040 Rocket should manage DbConn, not Option<DbConn>
Otherwise it fails when using DbConn as a request guard
2018-10-08 20:02:17 +01:00
Bat 4f84b2a3ed Impl SQL traits for SafeString only for the selected backend
Fixes #269
2018-10-08 18:58:15 +01:00
Baptiste Gelez 0469b8dae2 Merge pull request #266 from Plume-org/cc-by-sa
Change default license to CC-BY-SA
2018-10-07 21:28:43 +01:00
Baptiste Gelez 3a13d80dc6 Merge pull request #267 from Plume-org/db-url
Replace DB_URL with DATABASE_URL
2018-10-07 21:28:28 +01:00
Bat fe3df74986 Fix Docker build (forgot --features)
And update diesel_cli in Docker too
2018-10-07 19:12:10 +01:00
Bat 9cc795d8be Replace DB_URL with DATABASE_URL
This way it is shared with diesel, which simplifies a lot the setup

Also fixes a few issues in the documentation, that are not directly related
2018-10-07 11:00:50 +01:00
Bat 915b9bb0e5 Use env!("CARGO_PKG_VERSION") instead of hardcoding version when possible
See https://doc.rust-lang.org/cargo/reference/environment-variables.html#environment-variables-cargo-sets-for-crates
2018-10-06 18:55:30 +01:00
Baptiste Gelez 7a64005ca9 Merge pull request #265 from Plume-org/sqlite-docs
Update docs for SQlite
2018-10-06 18:25:23 +01:00
Bat 387efbf3e9 Change default license to CC-BY-SA
Fixes #258
2018-10-06 18:19:45 +01:00
Bat f60f427358 Document --features 2018-10-06 16:39:33 +01:00
Bat a0920eb6cf Rephrase Mac OS dependencies installation 2018-10-06 16:35:39 +01:00
Bat b09360b270 Docs: correct dependencies for SQlite 2018-10-06 16:34:09 +01:00
Baptiste Gelez 046c9a011e Merge pull request #264 from maximesrd/patch-5
Missing dependencies
2018-10-06 16:29:10 +01:00
maximesrd 65900af763 Missing dependencies
sqlite was missing, which caused the compilation to fail, even if the database used is postgresql
2018-10-06 17:12:30 +02:00
Bat f84fb47fe7 Update docs for SQlite 2018-10-06 16:06:50 +01:00
Baptiste Gelez 00fe11fcbb Merge pull request #261 from Plume-org/setup-tools
CLI tools
2018-10-06 14:28:13 +01:00
Bat 478e9dcac9 Show your own posts in your feed
Fixes #213
2018-10-06 13:42:57 +01:00
Baptiste Gelez 4b8c090def Merge pull request #249 from Plume-org/delete-posts
Delete posts when deleting account
2018-10-06 13:05:22 +01:00
Bat 4d382d8014 Fix compatibility with SQlite
Also fixes a bug in plume-models
2018-10-06 12:59:08 +01:00
Bat d08c21d58d Delete posts when deleting account 2018-10-06 12:37:28 +01:00
Bat 5fa7a2a742 Remove legacy setup script 2018-10-06 12:31:00 +01:00
Bat caa4c38948 Update installation and update docs with the new plm tool
Also updates the Docker files
2018-10-06 12:19:48 +01:00
Bat d0d1210e21 Document new command-line tools 2018-10-06 12:19:48 +01:00
Bat d48a7796f1 User creation CLI tool 2018-10-06 12:19:48 +01:00
Bat 0da5d2e927 Improve the plm instance new command
Add long arguments
Fix the help messages
Actually write to StdOut when needed
Fallback to BASE_URL first if domain is not specified
2018-10-06 12:19:48 +01:00
Bat 6723432e52 CLI tools
- New sub-crate: plume-cli
- Creates a binary called 'plm'
- Uses clap to parse CLI arguments
- Add a first command: plm instance new (to init the local instance)
2018-10-06 12:19:48 +01:00
Baptiste Gelez b464671cf0 Merge pull request #226 from igalic/feat/sqlite
Add SQLite as supported database
2018-10-06 12:15:00 +01:00
Trinity Pointard 0d6a2af851 Code style improvement 2018-10-06 10:57:37 +02:00
Trinity Pointard 3466e55548 Implement JSON-ld signature verification
Implement JSON-ld signature verification
Move signature verification functions to the proper file
2018-10-06 10:06:06 +02:00
Trinity Pointard 62c94ed463 Refactor and verify http signature on personnal inbox
Verify signature on personnal inbox
Reduce code duplication
Put Headers in plume-models
2018-10-03 20:48:25 +02:00
Trinity Pointard 0a5d435249 Verify http signatures 2018-10-03 09:31:38 +02:00
Baptiste Gelez 96a97e4949 Fix a typo in README 2018-10-02 13:20:54 +01:00
Trinity Pointard d3ed2d8af5 Fix regression and update rocket_csrf
Fix account creation, introduced by fceb9ab
Update to latest rocket_csrf
2018-10-02 11:51:12 +02:00
Baptiste Gelez 6738883f2b Merge pull request #250 from fdb-hiroshima/feature/underlined_links
Add link underline for main body
2018-10-01 12:42:54 +01:00
Bat 07f2c979ec Make the REST API compatible with SQlite 2018-09-30 14:21:07 +01:00
Bat bd80430b1b Document model macros 2018-09-30 14:13:56 +02:00
Bat 743620eb6a Fix the SQlite build 2018-09-30 14:13:56 +02:00
Bat 535c68b423 Run Travis for SQlite too 2018-09-30 14:13:55 +02:00
Bat 38d737ed0c Introduce features to choose between SQlite or Postgres 2018-09-30 14:13:54 +02:00
Igor Galić 88456faf84 align types between sqlite & postgres
this one's achieved by adding "NOT NULL" at the *correct* position in
SQLite's create tables.
2018-09-30 14:13:53 +02:00
Igor Galić b28bef20a7 align types between sqlite & postgres
use DATETIME for SQLite's time type. This way, Diesel picks up on what
it's supposed to be.
2018-09-30 14:13:52 +02:00
Igor Galić 1f8680c4c5 add sqlite migrations
we move our PostgreSQL specific migrations to a subdirectory.
The SQLite migrations have been created by running `diesel` against a
copy, and then fixing what's broken.
In the end i reduced all modifications to a single create, since we
*are* starting out fresh with SQLite.

n.b.: i'm not entirely happy with the results yet, because diesel
heavily modifies our `plume-models/src/schema.rs`.
I'll keep fiddling until we have the same types between the two
databases.
2018-09-30 14:13:52 +02:00
Igor Galić e5691f7b23 add sqlite as diesel dependency 2018-09-30 14:13:42 +02:00
Trinity Pointard d610ed1641 Add verify() to the Signer trait
And implement it for Blog and User
2018-09-30 12:08:04 +02:00
Trinity Pointard eafe1ed490 Add content digest to signed http headers
Sign the Digest HTTP header
2018-09-30 12:08:04 +02:00
Trinity Pointard fceb9ab0cd Update cookie management a bit
Update to latest rocket_csrf
Make user_id a samesite lax cookie (see https://github.com/Plume-org/Plume/issues/233#issuecomment-422660275)
2018-09-30 11:56:12 +02:00
Dominik Pataky 31a3e6c825 Revert icon injection 2018-09-29 21:42:51 +02:00
Dominik Pataky 83c4387e94 Add link underline for main body; add link icon
Links in the main body part are now underlined on mouse hover.
<a> tags in the article content are expanded by an icon from
FontAwesome.

Fixes #140
2018-09-29 21:41:02 +02:00
Baptiste Gelez 1e3f40833d Add a link to Loomio in the README 2018-09-29 19:25:27 +01:00
Bat 6f8630df2e Use <div> for avatars
<img> is displayed as an error without src, in Chrome

Fixes #222
2018-09-29 18:29:22 +01:00
Baptiste Gelez 05f3ecabd6 Merge pull request #248 from maximesrd/patch-4
Bad commands in the update guide
2018-09-29 17:03:33 +01:00
maximesrd a1530791ef Update UPDATE.md 2018-09-29 18:00:48 +02:00
Baptiste Gelez 236cf14406 Merge pull request #245 from Plume-org/rest-api
Some API endpoints for articles
2018-09-29 16:33:31 +01:00
Bat 72fd9eb610 API: Filter posts in the list 2018-09-29 15:45:27 +01:00
maximesrd 3b288c2dad Update UPDATE.md 2018-09-29 15:34:59 +02:00
maximesrd b97b0233da Update UPDATE.md 2018-09-29 15:34:29 +02:00
maximesrd db4c939be8 Bad commands 2018-09-29 15:02:17 +02:00
Baptiste Gelez 975f8d0393 Merge pull request #246 from fediverse-pl/master
i18n: Update Polish translation
2018-09-27 19:25:12 +01:00
Marcin Mikołajczak 47eeed1008 i18n: Update Polish translation
Signed-off-by: Marcin Mikołajczak <me@m4sk.in>
2018-09-27 12:42:09 +02:00
Bat f893056d6d Mount the API endpoints 2018-09-25 20:45:32 +01:00
Bat 472da486e9 Fix the canapi::Provider impl for Post 2018-09-25 20:10:18 +01:00
Baptiste Gelez ba3dd3304c Merge pull request #243 from rhonda/master
Updated German translation
2018-09-25 15:38:58 +01:00
Rhonda D'Vine 88d8fb95c3 Updated German translation 2018-09-25 16:27:59 +02:00
Baptiste Gelez 9650fdbfb5 Merge pull request #242 from Atul9/fix-broken-link
#227 Fix broken link on blog page
2018-09-24 20:35:20 +01:00
Atul Bhosale 3dce53d899 Fix broken link on blog page 2018-09-24 23:46:32 +05:30
Baptiste Gelez 05fb7c9b42 Merge pull request #238 from Plume-org/csrf-issues
Fix CSRF issues
2018-09-21 13:37:35 +01:00
Baptiste Gelez 7afe249a75 Merge pull request #240 from OpenAlgeria/patch-1
Update INSTALL.md
2018-09-20 19:23:49 +01:00
OpenAlgeria 5d21e26406 Update INSTALL.md 2018-09-20 15:21:32 +02:00
Bat d8ca1d70b7 Fix CSRF issues
GET routes are not protected against CSRF. This commit changes the needed URLs to
POST and replace simple links with forms.

Thanks @fdb-hiroshima for noticing it!
2018-09-19 18:13:07 +01:00
Trinity Pointard f0fb030c7f Update recommended nginx config
Update recommended nginx config to allow iframes
close #234
2018-09-19 18:18:39 +02:00
Bat 1500267125 Add canapi and try to use for the API 2018-09-19 15:49:34 +01:00
Trinity Pointard fab6360100 Be less restrictive on authorized html tags
Allow users to add ids to tags
Allow users to use iframes
2018-09-19 10:51:27 +02:00
Baptiste Gelez 2bc6052a35 Replace plume by DATABASE_NAME in the docs
To make it clearer you can have multiple Plume instances/databases on the same server, and that this part of the URL may change too.
2018-09-18 21:40:20 +01:00
Baptiste Gelez d8bfd6d39f Create ISSUE_TEMPLATE.md 2018-09-18 15:40:17 +01:00
Baptiste Gelez 064c5961e7 Add a CoC
Finally!
2018-09-18 13:59:43 +01:00
Baptiste Gelez eb24ba1774 Merge pull request #223 from igalic/fix/safe-string
make blog/instance description a SafeString
2018-09-14 20:56:13 +01:00
Igor Galić fb074e6344 render SafeString thru |safe
thanks again to @fdb-hiroshima for pointing me in the right direction!
2018-09-14 21:44:32 +02:00
Igor Galić 06718a5c8a directly use SafeString in InstanceSettingsForm 2018-09-14 20:25:16 +02:00
Igor Galić d62c72dde0 allocate new SafeString in FromFormValue impl
thanks to @fdb-hiroshima for this review!
2018-09-14 19:50:59 +02:00
Igor Galić 0897088aa5 add implementation for FromFormValue for SafeString
thanks again to @pwoolcoc for this!
2018-09-14 18:26:42 +02:00
Igor Galić 65e213309b do not allocate empty strings
follow review from @pwoolcoc, and do not use

    SafeString::new(&<String>::new())

since this makes an allocation which will then just be thrown away.
Instead, we pass ""
2018-09-14 18:24:27 +02:00
Igor Galić f5c299f23c make blog/instance description a SafeString
long_description & short_description's documentation say they can be
Markdown, but they are String, not SafeString.

This led to escaped strings being printed in the editor
https://github.com/Plume-org/Plume/issues/220
2018-09-14 15:14:24 +02:00
Baptiste Gelez d355379e01 Merge pull request #219 from igalic/fix/env-howto
improve installation "docs"
2018-09-13 19:38:00 +01:00
Igor Galić e7b5d81687 gitignore docker-compose.yml 2018-09-13 17:21:20 +02:00
Igor Galić dfc76757bb fix comment in docker.sample.env
docker's sample .env file under docs/ which contains the wrong command
to generate a rocket secret_key
2018-09-13 17:18:25 +02:00
Bat 5b138df8ce Remove duplicated message in gl.po 2018-09-12 17:07:41 +01:00
Bat 0200a7b223 Only send notifications for mentions if the post is not a draft 2018-09-12 17:00:00 +01:00
Bat b01212f4a6 Make it impossible to view drafts if you are not the author
Even if you got the URL
2018-09-12 16:58:38 +01:00
553 changed files with 60209 additions and 11644 deletions
+256
View File
@@ -0,0 +1,256 @@
version: 2.1
executors:
default:
parameters:
postgres:
type: boolean
default: false
selenium:
type: boolean
default: false
docker:
- image: plumeorg/plume-buildenv:v0.0.7
- image: <<#parameters.postgres>>circleci/postgres:9.6-alpine<</parameters.postgres>><<^parameters.postgres>>alpine:latest<</parameters.postgres>>
environment:
POSTGRES_USER: postgres
POSTGRES_DB: plume
- image: <<#parameters.selenium>>elgalu/selenium:latest<</parameters.selenium>><<^parameters.selenium>>alpine:latest<</parameters.selenium>>
working_directory: ~/projects/Plume
environment:
RUST_TEST_THREADS: 1
FEATURES: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
DATABASE_URL: <<#parameters.postgres>>postgres://postgres@localhost/plume<</parameters.postgres>><<^parameters.postgres>>plume.sqlite<</parameters.postgres>>
commands:
restore_env:
description: checkout and pull cache
parameters:
cache:
type: enum
default: none
enum: ["none", "clippy", "postgres", "sqlite", "release-postgres", "release-sqlite"]
steps:
- checkout
- run: git config --global --remove-section url."ssh://git@github.com"
- restore_cache:
keys:
- v0-<< parameters.cache >>-{{ checksum "Cargo.lock" }}-{{ .Branch }}
- v0-<< parameters.cache >>-{{ checksum "Cargo.lock" }}-master
cache:
description: push cache
parameters:
cache:
type: enum
enum: ["clippy", "postgres", "sqlite", "release-postgres", "release-sqlite"]
steps:
- save_cache:
key: v0-<< parameters.cache >>-{{ checksum "Cargo.lock" }}-{{ .Branch }}
paths:
- ~/.cargo/
- ./target
clippy:
description: run cargo clippy
parameters:
package:
type: string
default: plume
no_feature:
type: boolean
default: false
steps:
- run: cargo clippy <<^parameters.no_feature>>--no-default-features --features="${FEATURES}"<</parameters.no_feature>> --release -p <<parameters.package>> -- -D warnings
run_with_coverage:
description: run command with environment for coverage
parameters:
cmd:
type: string
steps:
- run: |
export RUSTFLAGS="-Zprofile -Zfewer-names -Ccodegen-units=1 -Cinline-threshold=0 -Clink-dead-code -Coverflow-checks=off -Zno-landing-pads -Clink-arg=-Xlinker -Clink-arg=--no-keep-memory -Clink-arg=-Xlinker -Clink-arg=--reduce-memory-overheads"
export CARGO_INCREMENTAL=0
<< parameters.cmd >>
upload_coverage:
description: merge coverage files and upload to codecov.io
parameters:
type:
type: string
steps:
- run: zip -0 ccov.zip `find . -name 'plume*.gc*' -o -name 'plm*.gc*'`
- run: grcov ccov.zip -s . -t lcov --llvm --branch --ignore-not-existing --ignore-dir '/*' -o lcov.info
- run: bash <(curl -s https://codecov.io/bash) -f lcov.info -F <<parameters.type>>
- run: find . -name 'plume*.gc*' -delete -o -name 'plm*.gc*' -delete
- run: rm ccov.zip lcov.info
build:
description: build a package
parameters:
package:
type: string
default: plume
release:
type: boolean
default: false
steps:
- run: |
cmd="cargo build <<#parameters.release>>--release<</parameters.release>> --no-default-features --features="${FEATURES}" -p <<parameters.package>> -j"
for i in 36 4 2 1 1; do
$cmd $i && exit 0
done
exit 1
jobs:
cargo fmt:
executor:
name: default
steps:
- restore_env
- run: cargo fmt --all -- --check
clippy:
parameters:
postgres:
type: boolean
executor:
name: default
postgres: << parameters.postgres >>
steps:
- restore_env:
cache: clippy
- clippy
- clippy:
package: plume-cli
- clippy:
package: plume-front
no_feature: true
- cache:
cache: clippy
unit:
parameters:
postgres:
type: boolean
executor:
name: default
postgres: << parameters.postgres >>
steps:
- restore_env:
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
- run_with_coverage:
cmd: |
cmd="cargo test --all --exclude plume-front --exclude plume-macro --no-run --no-default-features --features=${FEATURES} -j"
for i in 36 4 2 1 1; do
$cmd $i && break
done
cargo test --all --exclude plume-front --exclude plume-macro --no-default-features --features="${FEATURES}" -j1 -- --test-threads=1
- upload_coverage:
type: unit
- cache:
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
integration:
parameters:
postgres:
type: boolean
executor:
name: default
postgres: << parameters.postgres >>
selenium: true
steps:
- restore_env:
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
- run: cargo web deploy -p plume-front
- run_with_coverage:
cmd: |
cmd="cargo install --debug --no-default-features --features="${FEATURES}",test --force --path . -j"
for i in 36 4 2 1 1; do
$cmd $i && exit 0
done
exit 1
- run_with_coverage:
cmd: |
cmd="cargo install --debug --no-default-features --features="${FEATURES}" --force --path plume-cli -j"
for i in 36 4 2 1 1; do
$cmd $i && exit 0
done
exit 1
- run:
name: run test
command: ./script/run_browser_test.sh
environment:
BROWSER: firefox
- upload_coverage:
type: integration
- cache:
cache: <<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
release:
parameters:
postgres:
type: boolean
executor:
name: default
postgres: << parameters.postgres >>
steps:
- restore_env:
cache: release-<<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
- run: cargo web deploy -p plume-front --release
- build:
package: plume
release: true
- build:
package: plume-cli
release: true
- cache:
cache: release-<<#parameters.postgres>>postgres<</ parameters.postgres>><<^parameters.postgres>>sqlite<</parameters.postgres>>
- run: ./script/generate_artifact.sh
- unless:
condition: << parameters.postgres >>
steps:
- run: ./script/upload_test_environment.sh
- store_artifacts:
path: plume.tar.gz
destination: plume.tar.gz
- store_artifacts:
path: wasm.tar.gz
destination: wasm.tar.gz
push translations:
executor:
name: default
steps:
- restore_env:
cache: none
- run: crowdin upload -b master
workflows:
version: 2
build and test:
jobs:
- cargo fmt
- clippy:
postgres: false
- clippy:
postgres: true
- unit:
postgres: false
- unit:
postgres: true
- integration:
postgres: false
- integration:
postgres: true
- release:
postgres: false
- release:
postgres: true
- push translations:
filters:
branches:
only:
- /^master/
@@ -0,0 +1,6 @@
localhost:443 {
proxy / localhost:7878 {
transparent
}
tls self_signed
}
@@ -0,0 +1,37 @@
FROM debian:stretch-20190326
ENV PATH="/root/.cargo/bin:${PATH}"
#install native/circleci/build dependancies
RUN apt update &&\
apt install -y --no-install-recommends git ssh tar gzip ca-certificates default-jre&&\
apt install -y --no-install-recommends binutils-dev build-essential cmake curl gcc gettext git libcurl4-openssl-dev libdw-dev libelf-dev libiberty-dev libpq-dev libsqlite3-dev libssl-dev make openssl pkg-config postgresql postgresql-contrib python zlib1g-dev python3-pip zip unzip &&\
rm -rf /var/lib/apt/lists/*
#install and configure rust
RUN curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain nightly-2019-03-23 -y &&\
rustup component add rustfmt clippy &&\
rustup component add rust-std --target wasm32-unknown-unknown
#compile some deps
RUN cargo install cargo-web &&\
cargo install grcov &&\
strip /root/.cargo/bin/* &&\
rm -fr ~/.cargo/registry
#set some compilation parametters
COPY cargo_config /root/.cargo/config
#install selenium for front end tests
RUN pip3 install selenium
#install and configure caddy
RUN curl https://getcaddy.com | bash -s personal
COPY Caddyfile /Caddyfile
#install crowdin
RUN mkdir /crowdin && cd /crowdin &&\
curl -O https://downloads.crowdin.com/cli/v2/crowdin-cli.zip &&\
unzip crowdin-cli.zip && rm crowdin-cli.zip &&\
cd * && mv crowdin-cli.jar /usr/local/bin && cd && rm -rf /crowdin &&\
/bin/echo -e '#!/bin/sh\njava -jar /usr/local/bin/crowdin-cli.jar $@' > /usr/local/bin/crowdin &&\
chmod +x /usr/local/bin/crowdin
+4
View File
@@ -0,0 +1,4 @@
#!/bin/bash
[ "$1" = "" ] && echo "you must provide one argument, the build version" && exit 1
docker build -t plumeorg/plume-buildenv:$1 .
docker push plumeorg/plume-buildenv:$1
@@ -0,0 +1,3 @@
[target.x86_64-unknown-linux-gnu]
# link dead code for coverage, attempt to reduce linking memory usage to not get killed
rustflags = ["-Clink-args=-Xlinker --no-keep-memory -Xlinker --reduce-memory-overheads"]
+26
View File
@@ -0,0 +1,26 @@
codecov:
notify:
require_ci_to_pass: yes
coverage:
precision: 2
round: down
range: "70...100"
status:
project: no
patch: no
changes: no
parsers:
gcov:
branch_detection:
conditional: yes
loop: yes
method: no
macro: no
comment:
layout: "header, diff"
behavior: default
require_changes: no
+3 -2
View File
@@ -5,10 +5,11 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.{js,rs,css,tera}]
[*.{js,rs,css,tera,html}]
charset = utf-8
indent_size = 4
[*.{rs,tera,css}]
[*.{rs,tera,css,html}]
indent_style = space
indent_size = 4
+18
View File
@@ -0,0 +1,18 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'C: Bug'
assignees: ''
---
<!-- Describe your bug, explaining how to reproduce it, and what was expected -->
<!-- Please fill the following information when relevant (or remove them if not) -->
- **Plume version:** You can find it in the footer of your instance. If you know the exact commit, please also add it.
- **Operating system:**
- **Web Browser:**
+20
View File
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: ''
assignees: ''
---
**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
**Describe the solution you'd like**
A clear and concise description of what you want to happen.
**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.
**Additional context**
Add any other context or screenshots about the feature request here.
+16 -3
View File
@@ -1,10 +1,23 @@
rls
/target
**/*.rs.bk
rls
translations
po/*.po~
*.po~
.env
Rocket.toml
media
!.gitkeep
static/media
docker-compose.yml
*.db
*.sqlite
*.sqlite3
*.swp
tags.*
!tags.rs
search_index
main.css
*.wasm
*.js
.buildconfig
__pycache__
-4
View File
@@ -1,4 +0,0 @@
language: rust
rust:
- nightly
cache: cargo
+2
View File
@@ -0,0 +1,2 @@
You can read our Code of Conduct [here](https://docs.joinplu.me/organization/code-of-conduct).
By contributing to this repository, you agree to be bound by this Code of Conduct.
Generated
+2079 -1197
View File
File diff suppressed because it is too large Load Diff
+55 -34
View File
@@ -1,61 +1,82 @@
[package]
authors = ["Bat' <baptiste@gelez.xyz>"]
authors = ["Plume contributors"]
name = "plume"
version = "0.2.0"
version = "0.3.0"
repository = "https://github.com/Plume-org/Plume"
[dependencies]
activitypub = "0.1.3"
askama_escape = "0.1"
atom_syndication = "0.6"
colored = "1.6"
dotenv = "0.13"
failure = "0.1"
gettext-rs = "0.4"
clap = "2.33"
colored = "1.8"
dotenv = "0.14"
gettext = { git = "https://github.com/Plume-org/gettext/", rev = "294c54d74c699fbc66502b480a37cc66c1daa7f3" }
gettext-macros = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
gettext-utils = { git = "https://github.com/Plume-org/gettext-macros/", rev = "a7c605f7edd6bfbfbfe7778026bfefd88d82db10" }
guid-create = "0.1"
heck = "0.3.0"
multipart = "0.15"
rpassword = "2.0"
lettre = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" }
lettre_email = { git = "https://github.com/lettre/lettre", rev = "c988b1760ad8179d9e7f3fb8594d2b86cf2a0a49" }
num_cpus = "1.0"
rocket = "0.4.0"
rocket_contrib = { version = "0.4.0", features = ["json"] }
rocket_i18n = { git = "https://github.com/Plume-org/rocket_i18n", rev = "e922afa7c366038b3433278c03b1456b346074f2" }
rpassword = "3.0"
runtime-fmt = "0.3.0"
scheduled-thread-pool = "0.2.0"
serde = "1.0"
serde_derive = "1.0"
serde_json = "1.0"
tera = "0.11"
validator = "0.7"
validator_derive = "0.7"
webfinger = "0.3"
workerpool = "1.1"
serde_qs = "0.4"
shrinkwraprs = "0.2.1"
validator = "0.8"
validator_derive = "0.8"
webfinger = "0.4.1"
[[bin]]
name = "plume"
path = "src/main.rs"
[dependencies.chrono]
features = ["serde"]
version = "0.4"
[dependencies.ctrlc]
features = ["termination"]
version = "3.1.2"
[dependencies.diesel]
features = ["postgres", "r2d2", "chrono"]
features = ["r2d2", "chrono"]
version = "*"
[dependencies.multipart]
default-features = false
features = ["server"]
version = "0.16"
[dependencies.plume-api]
path = "plume-api"
[dependencies.plume-common]
path = "plume-common"
[dependencies.plume-models]
path = "plume-models"
[dependencies.rocket]
git = "https://github.com/SergioBenitez/Rocket"
rev = "55459db7732b9a240826a5c120c650f87e3372ce"
[dependencies.rocket_codegen]
git = "https://github.com/SergioBenitez/Rocket"
rev = "55459db7732b9a240826a5c120c650f87e3372ce"
[dependencies.rocket_contrib]
features = ["tera_templates", "json"]
git = "https://github.com/SergioBenitez/Rocket"
rev = "55459db7732b9a240826a5c120c650f87e3372ce"
[dependencies.rocket_csrf]
git = "https://github.com/fdb-hiroshima/rocket_csrf"
rev = "5d23ba4c6c2ee4c41040d428d24344db3d29997f"
git = "https://github.com/Plume-org/rocket_csrf"
rev = "89ecb380266234f858c651354216bf5bf3cc09b2"
[dependencies.rocket_i18n]
git = "https://github.com/BaptisteGelez/rocket_i18n"
rev = "75a3bfd7b847324c078a355a7f101f8241a9f59b"
[build-dependencies]
ructe = "0.6.2"
rsass = "0.9"
[features]
default = ["postgres"]
postgres = ["plume-models/postgres", "diesel/postgres"]
sqlite = ["plume-models/sqlite", "diesel/sqlite"]
debug-mailer = []
test = []
[workspace]
members = ["plume-models", "plume-common"]
members = ["plume-api", "plume-cli", "plume-models", "plume-common", "plume-front", "plume-macro"]
+31 -6
View File
@@ -1,6 +1,7 @@
FROM rust:1-stretch
FROM rust:1-stretch as builder
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gettext \
postgresql-client \
libpq-dev \
@@ -10,11 +11,35 @@ RUN apt-get update && apt-get install -y --no-install-recommends \
make \
openssl \
libssl-dev
WORKDIR /scratch
COPY script/wasm-deps.sh .
RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
WORKDIR /app
COPY Cargo.toml Cargo.lock ./
RUN cargo install diesel_cli --no-default-features --features postgres --version '=1.2.0'
COPY Cargo.toml Cargo.lock rust-toolchain ./
RUN cargo install cargo-web
COPY . .
RUN cargo build
RUN rm -rf target/debug/incremental
CMD ["cargo", "run"]
RUN chmod a+x ./script/plume-front.sh && sleep 1 && ./script/plume-front.sh
RUN cargo install --path ./ --force --no-default-features --features postgres
RUN cargo install --path plume-cli --force --no-default-features --features postgres
RUN cargo clean
FROM debian:stretch-slim
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
libpq5 \
libssl1.1
WORKDIR /app
COPY --from=builder /app /app
COPY --from=builder /usr/local/cargo/bin/plm /bin/
COPY --from=builder /usr/local/cargo/bin/plume /bin/
CMD ["plume"]
EXPOSE 7878
+33
View File
@@ -0,0 +1,33 @@
FROM rust:1-stretch
RUN apt-get update && apt-get install -y --no-install-recommends \
ca-certificates \
gettext \
postgresql-client \
libpq-dev \
git \
curl \
gcc \
make \
openssl \
libssl-dev
WORKDIR /scratch
COPY script/wasm-deps.sh .
RUN chmod a+x ./wasm-deps.sh && sleep 1 && ./wasm-deps.sh
WORKDIR /app
COPY Cargo.toml Cargo.lock rust-toolchain ./
RUN cargo install diesel_cli --no-default-features --features postgres --version '=1.3.0'
RUN cargo install cargo-web
COPY . .
RUN chmod a+x ./script/plume-front.sh && sleep 1 && ./script/plume-front.sh
RUN cargo install --path ./ --force --no-default-features --features postgres
RUN cargo install --path plume-cli --force --no-default-features --features postgres
RUN cargo clean
CMD ["plume"]
EXPOSE 7878
+49 -7
View File
@@ -1,13 +1,55 @@
# Plume [![Build Status](https://travis-ci.org/Plume-org/Plume.svg?branch=master)](https://travis-ci.org/Plume-org/Plume)
<h1 align="center">
<img src="https://raw.githubusercontent.com/Plume-org/Plume/master/static/icons/trwnh/feather/plumeFeather64.png" alt="Plume's logo">
Plume
</h1>
<p align="center">
<a href="https://github.com/Plume-org/Plume/"><img alt="CircleCI" src="https://img.shields.io/circleci/build/gh/Plume-org/Plume.svg"></a>
<a href="https://codecov.io/gh/Plume-org/Plume"><img src="https://codecov.io/gh/Plume-org/Plume/branch/master/graph/badge.svg" alt="Code coverage"></a>
<a title="Crowdin" target="_blank" href="https://crowdin.com/project/plume"><img src="https://d322cqt584bo4o.cloudfront.net/plume/localized.svg"></a>
<a href="https://hub.docker.com/r/plumeorg/plume"><img alt="Docker Pulls" src="https://img.shields.io/docker/pulls/plumeorg/plume.svg"></a>
<a href="https://liberapay.com/Plume"><img alt="Liberapay patrons" src="https://img.shields.io/liberapay/patrons/Plume.svg"></a>
</p>
<p align="center">
<a href="https://joinplu.me/">Website</a>
<a href="https://docs.joinplu.me/">Documentation</a>
<a href="https://docs.joinplu.me/contribute">Contribute</a>
<a href="https://joinplu.me/#instances">Instances list</a>
</p>
Federated blogging engine, based on ActivityPub. It uses the Rocket framework, and Diesel to interact with the database.
Plume is a **federated blogging engine**, based on *ActivityPub*. It is written in *Rust*, with the *Rocket* framework, and *Diesel* to interact with the database.
The front-end uses *Ructe* templates, *WASM* and *SCSS*.
[**Demo instance**](https://baptiste.gelez.xyz/)
## Features
It is not yet ready for production use, but we have all the basic features (account management, blogs, articles, comments, etc) and a basic federation.
A lot of features are still missing, but what is already here should be quite stable. Current and planned features include:
Feel free to join our Matrix room: `#plume:disroot.org` to discuss about the project!
- **A blog-centric approach**: you can create as much blogs as you want with your account, to keep your different publications separated.
- **Media management**: you can upload pictures to illustrate your articles, but also audio files if you host a podcast, and manage them all from Plume.
- **Federation**: Plume is part of a network of interconnected websites called the Fediverse. Each of these websites (often called *instances*) have their own
rules and thematics, but they can all communicate with each other.
- **Collaborative writing**: invite other people to your blogs, and write articles together.
If you are interested in coding, check out the [development guide](https://github.com/Plume-org/Plume/blob/master/docs/DEVELOPMENT.md). You can also help by reporting issues, suggesting features, or writing documentation for instance.
## Get involved
If you would like to help by translating Plume, we also have [a guide for you](https://github.com/Plume-org/Plume/blob/master/docs/INTERNATIONALIZATION.md)!
If you want to have regular news about the project, the best place is probably [our blog](https://fediverse.blog/~/PlumeDev), or our Matrix room: [`#plume:disroot.org`](https://riot.im/app/#/room/#plume:disroot.org).
If you want to contribute more, a good first step is to read [our contribution guides](https://docs.joinplu.me/contribute). We accept all kind of contribution:
- [Back-end or front-end development](https://docs.joinplu.me/contribute/development/)
- [Translations](https://docs.joinplu.me/contribute/translations/)
- [Documentation](https://docs.joinplu.me/contribute/documentation/)
- UI and/or UX design (we don't have a dedicated guide yet, but [we can talk](https://docs.joinplu.me/contribute/discussion/) to see how we can work together!)
- [Taking part in discussions](https://docs.joinplu.me/contribute/discussion/)
- [Financial support](https://docs.joinplu.me/contribute/donations/)
But this list is not exhaustive and if you want to contribute differently you are welcome too!
As we want the various spaces related to the project (GitHub, Matrix, Loomio, etc) to be as safe as possible for everyone, we adopted [a code of conduct](https://docs.joinplu.me/organization/code-of-conduct). Please read it and make sure you accept it before contributing.
## Starting your own instance
We provide various way to install Plume: from source, with pre-built binaries, with Docker or with YunoHost.
For detailed explanations, please refer to [the documentation](https://docs.joinplu.me/installation/).
+76
View File
@@ -0,0 +1,76 @@
extern crate rsass;
extern crate ructe;
use ructe::*;
use std::process::{Command, Stdio};
use std::{env, fs::*, io::Write, path::PathBuf};
fn compute_static_hash() -> String {
//"find static/ -type f ! -path 'static/media/*' | sort | xargs stat -c'%n %Y' | openssl dgst -r"
let find = Command::new("find")
.args(&["static/", "-type", "f", "!", "-path", "static/media/*"])
.stdout(Stdio::piped())
.spawn()
.expect("failed find command");
let sort = Command::new("sort")
.stdin(find.stdout.unwrap())
.stdout(Stdio::piped())
.spawn()
.expect("failed sort command");
let xargs = Command::new("xargs")
.args(&["stat", "-c'%n %Y'"])
.stdin(sort.stdout.unwrap())
.stdout(Stdio::piped())
.spawn()
.expect("failed xargs command");
let mut sha = Command::new("openssl")
.args(&["dgst", "-r"])
.stdin(xargs.stdout.unwrap())
.output()
.expect("failed openssl command");
sha.stdout.resize(64, 0);
String::from_utf8(sha.stdout).unwrap()
}
fn main() {
let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap());
let in_dir = PathBuf::from(env::var("CARGO_MANIFEST_DIR").unwrap()).join("templates");
compile_templates(&in_dir, &out_dir).expect("compile templates");
println!("cargo:rerun-if-changed=static/css/_article.scss");
println!("cargo:rerun-if-changed=static/css/_forms.scss");
println!("cargo:rerun-if-changed=static/css/_global.scss");
println!("cargo:rerun-if-changed=static/css/_header.scss");
println!("cargo:rerun-if-changed=static/css/_variables.scss");
println!("cargo:rerun-if-changed=static/css/main.scss");
let mut out = File::create("static/css/main.css").expect("Couldn't create main.css");
out.write_all(
&rsass::compile_scss_file(
"static/css/main.scss".as_ref(),
rsass::OutputStyle::Compressed,
)
.expect("Error during SCSS compilation"),
)
.expect("Couldn't write CSS output");
let cache_id = &compute_static_hash()[..8];
println!("cargo:rerun-if-changed=target/deploy/plume-front.wasm");
copy("target/deploy/plume-front.wasm", "static/plume-front.wasm")
.and_then(|_| read_to_string("target/deploy/plume-front.js"))
.and_then(|js| {
write(
"static/plume-front.js",
js.replace(
"\"plume-front.wasm\"",
&format!("\"/static/cached/{}/plume-front.wasm\"", cache_id),
),
)
})
.ok();
println!("cargo:rustc-env=CACHE_ID={}", cache_id)
}
+8
View File
@@ -0,0 +1,8 @@
"project_identifier": "plume"
"api_key_env": CROWDIN_API_KEY
preserve_hierarchy: true
files:
- source: /po/plume/plume.pot
translation: /po/plume/%two_letters_code%.po
- source: /po/plume-front/plume-front.pot
translation: /po/plume-front/%two_letters_code%.po
+5
View File
@@ -0,0 +1,5 @@
# For documentation on how to configure this file,
# see diesel.rs/guides/configuring-diesel-cli
[print_schema]
file = "plume-models/src/schema.rs"
-87
View File
@@ -1,87 +0,0 @@
# Development Guide
## Installing the development environment
Please refer to the [installation guide](INSTALL.md).
## Testing the federation
To test the federation, you'll need to setup another database (see "Setup the database"),
also owned by the "plume" user, but with a different name. Then, you'll need to run the
migrations for this database too.
```
diesel migration run --database-url postgres://plume:plume@localhost/my_other_plume_db
```
To run this other instance, you'll need to give two environment variables:
- `ROCKET_PORT`, the port on which your app will run
- `DB_NAME`, the name of the database you just created
```
ROCKET_PORT=3033 DB_NAME=my_other_plume_db cargo run
```
If you don't want to setup HTTPS locally, you can also disable it by running your instance with `USE_HTTPS=0` set.
```
USE_HTTPS=0 cargo run
```
## Making a Pull Request
To create an upstream fork of the repository in GitHub, click "Fork" in the top right button on the main page of the [Plume repository](https://github.com/Plume-org/Plume). Now, in the command line, set another remote for the repository by running the following command, replacing `myname` with the name under which you forked the repo. You can use another name besides `upstream` if you prefer. Using [SSH](https://help.github.com/articles/connecting-to-github-with-ssh/) is recommended.
```
git remote add upstream git@github.com/myname/Plume.git
# Alt # git remote add upstream https://github.com/myname/Plume.git
```
Now, make any changes to the code you want. After committing your changes, push to the upstream fork. Once your changes are made, visit the GitHub page for your fork and select "New pull request". Add descriptive text, any issue numbers using hashtags to reference the issue number, screenshots of your changes if relevant, a description of how you tested your changes, and any other information that will help the project maintainers be able to quickly accept your pull requests.
The project maintainers may suggest further changes to improve the pull request even more. After implementing this locally, you can push to your upstream fork again and the changes will immediately show up in the pull request after pushing. Once all the suggested changes are made, the pull request may be accepted. Thanks for contributing.
## When working with Tera templates
When working with the interface, or any message that will be displayed to the final user, keep in mind that Plume is an internationalized software. To make sure that the parts of the interface you are changing are translatable, you should:
- Use the `_` and `_n` filters instead of directly writing strings in your HTML markup
- Add the strings to translate to the `po/plume.pot` file
Here is an example: let's say we want to add two strings, a simple one and one that may deal with plurals. The first step is to add them to whatever template we want to display them in:
```jinja
<p>{{ "Hello, world!" | _ }}</p>
<p>{{ "You have {{ count }} new notifications" | _n(singular="You have one new notification", count=n_notifications) }}</p>
```
As you can see, the `_` doesn't need any special argument to work, but `_n` requires `singular` (the singular form, in English) and `count` (the number of items, to determine which form to use) to be present. Note that any parameters given to these filters can be used as regular Tera variables inside of the translated strings, like we are doing with the `count` variable in the second string above.
The second step is to add them to POT file. To add a simple message, just do:
```po
msgid "Hello, world" # The string you used with your filter
msgstr "" # Always empty
```
For plural forms, the syntax is a bit different:
```po
msgid "You have one new notification" # The singular form
msgid_plural "You have {{ count }} new notifications" # The plural one
msgstr[0] ""
msgstr[1] ""
```
And that's it! Once these new messages will have been translated, they will correctly be displayed in the requested locale!
## Code Style
For Rust, use the standard style. `rustfmt` can help you keeping your code clean.
For CSS, the only rule is to use One True Brace Style.
For JavaScript, we use [the JavaScript Standard Style](https://standardjs.com/).
For HTML/Tera templates, we use HTML5 syntax.
-22
View File
@@ -1,22 +0,0 @@
# Useful Environment Variables
Plume relies on some environment variables for some configuration options. You can either set them before
starting the app with `cargo run` or write them in a `.env` file to have automatically loaded.
Here are the variables that Plume uses:
- `BASE_URL`: the domain name, or IP and port on which Plume is listening. It is used in all federation-related code.
- `DB_URL`: the URL of the PostgreSQL database, used by Plume (`postgres://plume:plume@localhost/plume` by default).
- `POSTGRES_USER`: if you just want to use a different PostgreSQL user name, and keep the rest of the default URL.
- `POSTGRES_PASSWORD`: same as `POSTGRES_USER`, but for the password.
- `USE_HTTPS`: if it is `0`, federation and medias will be using HTTP by default (`1` by default).
- `ROCKET_ADDRESS`: the adress on which Plume should listen (`0.0.0.0` by default).
- `ROCKET_PORT`: the port on which Plume should listen ([`7878` by default](https://twitter.com/ag_dubs/status/852559264510070784))
- `ROCKET_SECRET_KEY`: key used to sign private cookies and for CSRF protection. If it is not set, it will be regenerated everytime you restart Plume,
meaning that all your users will get disconnected. You can generate one with `openssl rand -base64 32`.
## Diesel
Diesel, the tool we use to run migrations may be configured with the `DATABASE_URL` which should contain the URL of the
PostgreSQL database. Otherwise, you can specify `--database-url YOUR-URL` everytime you run a `diesel` command.
-423
View File
@@ -1,423 +0,0 @@
# Installing Plume (for development or production)
## Prerequisites
In order to be installed and to work correctly, Plume needs:
- *Git* (to get the code)
- *Curl* (for RustUp, the Rust installer)
- *GCC* and *make* (to compile C dependencies)
- *PostgreSQL* (for the database)
- *GetText* (to manage translations)
- *Rust* and *Cargo* (to build the code)
- *OpenSSL* and *OpenSSL librairies* (for security)
All the following instructions will need a terminal.
Here are the commands to install PostgreSQL and GetText on various operating systems.
Some of them may need root permissions.
You can also install the project using Docker and docker-compose, please refer
to the `Docker install` section.
On **Debian**:
```bash
apt update
apt install gettext postgresql postgresql-contrib libpq-dev git curl gcc make openssl libssl-dev
```
On **Fedora**, **CentOS** or **RHEL**:
```bash
dnf install postgresql-server postgresql-contrib mariadb-devel libsq3-devel libpqxx libpqxx-devel git curl gcc make openssl openssl-devel gettext
```
On **Gentoo**:
```bash
emerge --sync
emerge -av postgresql eselect-postgresql gettext && emerge --ask dev-vcs/git
```
On **Mac OS X**, with [Homebrew](https://brew.sh/):
```bash
brew update
brew install postgres gettext git
```
## Creating a new user (optional)
This step is recommended if you are in a **production environment**, but it is not necessary.
```bash
adduser plume
su - plume
cd ~
```
Creating a new user will let you use systemd to manage Plume if you want (see the dedicated section below).
## Installing Rust and Cargo
We said that Plume needed Rust and Cargo to work, but we didn't install them at the same time as PostgreSQL and GetText, because there is an universal installation method called RustUp.
You can install it on **GNU/Linux** and **Mac OS X** with:
```bash
curl https://sh.rustup.rs -sSf | sh
```
When asked, choose the *"1) Proceed with installation (default)"* option.
Then run this command to be able to run cargo in the current session:
```bash
export PATH="$PATH:/home/plume/.cargo/bin:/home/plume/.local/bin:/usr/local/sbin"
```
On **Windows**, you'll need, if you don't already have them, to download and install the [Visual C++ 2015 Build Tools](https://www.microsoft.com/en-us/download/details.aspx?id=48159). Then, download the [rustup installer](https://www.rust-lang.org/en-US/install.html) and run it.
## Getting and compiling the Plume source code
Plume needs to be compiled from source.
```bash
git clone https://github.com/Plume-org/Plume.git
cd Plume
# This may take some time as RustUp will download all
# the required Rust components, and Cargo will download
# and compile all dependencies.
cargo build
```
We may provide precompiled packages and Docker images in the future; if you have experience in these fields and want to help, feel free to discuss this in issues and to propose pull-requests!
## Configuring PostgreSQL
You can either run PostgreSQL from the machine that runs Plume, or from another server. We recommend you to use the first setup for development environments, or in production for small instances.
In the first case, just run this command after the PostgreSQL installation, to start it:
```
service postgresql start
```
If you want to have two separate machines, run these commands on the database server once you've installed the dependencies mentioned above on both servers:
```bash
service postgresql start
su - postgres
createuser -d -P plume
createdb -O plume plume
```
## Running migrations
Migrations are scripts used to update the database. They are run by a tool called Diesel, which can be installed with:
```bash
cargo install diesel_cli --no-default-features --features postgres --version '=1.2.0'
```
Plume should normally run migrations on your behalf as needed, but if you want to run them manually, use the following command:
```bash
diesel migration run --database-url postgres://USER:PASSWORD@IP:PORT/plume
```
This command may be useful if you decided to use a separate database server.
## Starting Plume
When you launch Plume for the first time, it will ask you a few questions to setup your instance before it actually launches. To start it, run these commands.
```
# Optional, only do it if the database URL is not
# postgres://plume:plume@localhost/plume
export DB_URL=postgres://plume:PASSWORD@DBSERVERIP:DBPORT/plume
# Create the media directory, where uploads will be stored
mkdir media
# Actually start Plume
cargo run
```
## Docker install
You can use `docker` and `docker-compose` in order to manage your Plume instance and
have it isolated from your host:
```
git clone git@github.com:Plume-org/Plume.git
cd Plume
cp docs/docker-compose.sample.yml docker-compose.yml
cp docs/docker.sample.env .env
# build the containers
docker-compose build
# launch the database
docker-compose up -d postgres
# run the migrations
docker-compose run --rm plume diesel migration run
# run interactive setup
docker-compose run --rm plume bash
cargo run
# copy the env file and paste it in your host .env file
cat .env
# leave the container
exit
# launch your instance for good
docker-compose up -d
```
Then, you can configure your reverse proxy.
## Configuring Nginx
Here is a sample Nginx configuration for a Plume instance (replace `blog.example.com` with your domain name):
```nginx
server {
listen 80;
listen [::]:80;
server_name blog.example.com;
location /.well-known/acme-challenge {}
location / {
return 301 https://$host$request_uri;
}
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name blog.example.org;
access_log /var/log/nginx/access.log;
root /home/plume/Plume/ ;
SSLCertificateFile /etc/letsencrypt/live/blog.example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/blog.example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/blog.example.com/chain.pem
# for ssl conf: https://cipherli.st/
ssl_protocols TLSv1.2 TLSv1.3;# Requires nginx >= 1.13.0 else use TLSv1.2
ssl_prefer_server_ciphers on;
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;# openssl dhparam -out /etc/letsencrypt/ssl-dhparam.pem 4096
ssl_ciphers ECDHE-RSA-AES256-GCM-SHA512:DHE-RSA-AES256-GCM-SHA512:ECDHE-RSA-AES256-GCM-SHA384:DHE-RSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-SHA384;
ssl_ecdh_curve secp384r1; # Requires nginx >= 1.1.0
ssl_session_timeout 10m;
ssl_session_cache shared:SSL:10m;
ssl_session_tickets off; # Requires nginx >= 1.5.9
ssl_stapling on; # Requires nginx >= 1.3.7
ssl_stapling_verify on; # Requires nginx => 1.3.7
resolver 9.9.9.9 80.67.169.12 valid=300s;
resolver_timeout 5s;
add_header Strict-Transport-Security "max-age=63072000; includeSubDomains; preload";
add_header X-Frame-Options DENY;
add_header X-Content-Type-Options nosniff;
add_header X-XSS-Protection "1; mode=block";
add_header Content-Security-Policy "default-src 'self';";
add_header Content-Security-Policy "frame-ancestors 'self'";
location ~* \.(jpg|jpeg|png|gif|ico|js|pdf)$ {
add_header Cache-Control "public";
expires 7d;
}
location / {
proxy_pass http://localhost:7878/;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
client_max_body_size 10m;
}
}
```
## Configuring Apache
If you prefer Apache, you can use this configuration (here too, replace `blog.example.com` with your domain):
```apache
<VirtualHost *:80>
ServerName blog.example.com
Redirect / https://blog.example.com/
</VirtualHost>
<VirtualHost *:443>
ServerAdmin admin@example.com
ServerName blog.example.com
<Directory "/home/plume/Plume">
Header always set Referrer-Policy "strict-origin-when-cross-origin"
Header always set Strict-Transport-Security "max-age=31536000"
SSLEngine on
# for cipher conf: https://cipherli.st/
SSLCipherSuite EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
SSLProtocol All -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
SSLHonorCipherOrder On
Header always set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
Header always set X-Frame-Options DENY
Header always set X-Content-Type-Options nosniff
SSLCompression off
SSLUseStapling on
SSLStaplingCache "shmcb:logs/stapling-cache(150000)"
# Requires Apache >= 2.4.11
SSLSessionTickets Off
SSLCertificateFile /etc/letsencrypt/live/blog.example.com/cert.pem
SSLCertificateKeyFile /etc/letsencrypt/live/blog.example.com/privkey.pem
SSLCertificateChainFile /etc/letsencrypt/live/blog.example.com/chain.pem
ProxyPreserveHost On
RequestHeader set X-Forwarded-Proto "https"
ProxyPass / http://127.0.0.1:7878/
ProxyPassReverse / http://127.0.0.1:7878/
</VirtualHost>
```
## Systemd integration
If you want to manage your Plume instance with systemd, you can use the following unit file (to be saved in `/etc/systemd/system/plume.service`):
```toml
[Unit]
Description=plume
[Service]
Type=simple
User=plume
WorkingDirectory=/home/plume/Plume
ExecStart=/home/plume/.cargo/bin/cargo run
TimeoutSec=30
Restart=always
[Install]
WantedBy=multi-user.target
```
## SysVinit integration
This script can also be useful if you are using SysVinit.
```bash
#!/bin/sh
### BEGIN INIT INFO
# Provides:
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Start daemon at boot time
# Description: Federated blogging
# Based on https://raw.githubusercontent.com/fhd/init-script-template/master/template
### END INIT INFO
dir="/home/plume/Plume"
cmd="/home/plume/.cargo/bin/cargo run"
user="plume"
name=`basename $0`
pid_file="/var/run/$name.pid"
stdout_log="/home/plume/Plume/plume.log"
stderr_log="/home/plume/Plume/plume.err"
get_pid() {
cat "$pid_file"
}
is_running() {
[ -f "$pid_file" ] && ps -p `get_pid` > /dev/null 2>&1
}
case "$1" in
start)
if is_running; then
echo "Already started"
else
echo "Starting $name"
cd "$dir"
if [ -z "$user" ]; then
sudo $cmd >> "$stdout_log" 2>> "$stderr_log" &
else
sudo -u "$user" $cmd >> "$stdout_log" 2>> "$stderr_log" &
fi
echo $! > "$pid_file"
if ! is_running; then
echo "Unable to start, see $stdout_log and $stderr_log"
exit 1
fi
fi
;;
stop)
if is_running; then
echo -n "Stopping $name.."
kill `get_pid`
for i in 1 2 3 4 5 6 7 8 9 10
# for i in `seq 10`
do
if ! is_running; then
break
fi
echo -n "."
sleep 1
done
echo
if is_running; then
echo "Not stopped; may still be shutting down or shutdown may have failed"
exit 1
else
echo "Stopped"
if [ -f "$pid_file" ]; then
rm "$pid_file"
fi
fi
else
echo "Not running"
fi
;;
restart)
$0 stop
if is_running; then
echo "Unable to stop, will not attempt to start"
exit 1
fi
$0 start
;;
status)
if is_running; then
echo "Running"
else
echo "Stopped"
exit 1
fi
;;
*)
echo "Usage: $0 {start|stop|restart|status}"
exit 1
;;
esac
exit 0
```
## Caveats:
- Pgbouncer is not supported yet (named transactions are used).
- Rust nightly is a moving target, dependancies can break and sometimes you need to check a few versions to find the one working (run `rustup override set nightly-2018-05-15` or `rustup override set nightly-2018-05-31` in the Plume directory if you have issues during the compilation)
- Rust nightly 2018-06-28 is known to be failing to compile diesel 1.3.2
## Acknowledgements
Most of this documentation has been written by *gled-rs*. The systemd unit file, Nginx and Apache configurations have been written by *nonbinaryanargeek*. Some parts (especially the instructions to install native dependencies) are from the [Aardwolf project](https://github.com/Aardwolf-Social/aardwolf).
-39
View File
@@ -1,39 +0,0 @@
# Making Plume available in your language
*You will need to have basic git and GitHub knownledge to follow this guide. But we plan to setup a more user-friendly translation tool in the future.*
To translate Plume in your language, you'll first need to make sure it is listed in the `po/LINGUAS` file. If it is not, you can ask anybody with a development environment to add it (or do it yourself if you have a development environment). Once it will be here, Plume must be launched once to generate all the needed files.
Then you can start translating. Find the file corresponding to your locale, which is `po/YOUR_LOCALE.po`, and open it. Inside, you have a list of strings to translate. There are two kind of translatable strings.
## Simple strings
They look like this:
```po
msgid "Hello, world"
msgstr ""
```
What is next to `msgid` is the string in English. To translate it, just fill the `msgstr` field with the translation.
## Strings with plural forms
Sometimes, strings may change depending on a number (for instance, a post counter). In the `.po` files, these strings look like this:
```
msgid "One post"
msgid_plural "{{ count }} posts"
msgstr[0] ""
msgstr[1] ""
```
Then you should fill the two `msgstr` field, one with the singular form, the second with the plural one. If your language as more than two forms, you can add another one by following the same pattern (`msgstr[n] ""`).
## Interpolation
Strings you translate may contain data from Plume (a username for instance). To tell Plume where to put these data, surround their identifier by `{{` and `}}`. The identifier is also present in this form in the English string to translate (this what you can see above, with the `{{ count }} posts` message).
## Note
When translating, please try to be as inclusive as possible.
-7
View File
@@ -1,7 +0,0 @@
# Plume documentation
- [Installing Plume (for development or production)](INSTALL.md)
- [Updating your instance](UPDATE.md)
- [Useful Environment Variables](ENV-VARS.md)
- [Development Guide](DEVELOPMENT.md)
- [Making Plume available in your language](INTERNATIONALIZATION.md)
-15
View File
@@ -1,15 +0,0 @@
# Updating your instance
To update your instance, run these commands with `plume` user if you created it, or with your default user, in the Plume directory.
```
git pull origin master
# If you are not using systemd
cargo run
# If you are using systemd
service plume restart
```
That's it!
-1
View File
@@ -1 +0,0 @@
theme: jekyll-theme-cayman
-18
View File
@@ -1,18 +0,0 @@
version: '3'
services:
postgres:
image: postgres:10.5
env_file: .env
restart: unless-stopped
volumes:
- "./data/postgres:/var/lib/postgresql/data"
plume:
build: .
env_file: .env
restart: unless-stopped
volumes:
- "./data/plume/static/media:/app/media"
- "./.env:/app/.env"
ports:
- "127.0.0.1:7878:7878"
-12
View File
@@ -1,12 +0,0 @@
BASE_URL=yourdomain.com
# generate one with openssl rand -base64 45
ROCKET_SECRET_KEY=randomstringhere
# you can safely leave those defaults
POSTGRES_USER=plume
POSTGRES_PASSWORD=plume
DB_URL=postgres://plume:plume@postgres:5432/plume
DATABASE_URL=postgres://plume:plume@postgres:5432/plume
USE_HTTPS=1
ROCKET_ADDRESS=0.0.0.0
ROCKET_PORT=7878

Some files were not shown because too many files have changed in this diff Show More