Commit graph

831 commits

Author SHA1 Message Date
Ivan Tashkinov e6f43a831b [#1234] Permissions-related fixes / new functionality (Masto 2.4.3 scopes). 2019-09-15 18:22:08 +03:00
rinpatch 5c5ebd3861 Mastodon API: Respect post privacy in favourited/reblogged endpoints 2019-09-14 01:50:15 +03:00
lain 1be09bde2d Merge branch 'refactor/add_link_headers' into 'develop'
Refactor `add_link_headers/7` -> `add_link_headers/3`

See merge request pleroma/pleroma!1636
2019-09-13 17:06:38 +00:00
Haelwenn 46ae62d159 Merge branch 'patch-5' into 'develop'
Mastodon API: URI encode hashtag name in generated URLs

See merge request pleroma/pleroma!1642
2019-09-11 17:47:19 +00:00
lain fb7332aec7 Merge branch 'fix/oom-parallel-rendering' into 'develop'
Revert "Parallelize template rendering"

See merge request pleroma/pleroma!1654
2019-09-11 11:21:03 +00:00
rinpatch 43f02dfe38 Revert "Parallelize template rendering"
This reverts commit 1ad71592ad.

Since it had no limit on the number on concurrent processes it OOM killed
instances while rendering hellthreads. When I tried introducing a
concurrency limit with Task.async_stream/manual folds it lead to about 3 times
worse performance on threads larger than 1000 activities (we are talking
30s vs 1.2 minutes), I think this is not worth the about 1.5 times
performance increase on smaller threads when using it.
2019-09-10 22:01:45 +03:00
Egor Kislitsyn b40b10b53d Add an endpoint to get multiple statuses by IDs 2019-09-10 13:39:45 +07:00
Ivan Tashkinov b63faf9819 [#1234] Mastodon 2.4.3 hierarchical scopes initial support (WIP). 2019-09-08 15:00:03 +03:00
shadowfacts e5c6bf3673 Mastodon API: URI encode hashtag name in generated URLs
Otherwise hashtags with word characters other than those allowed in URLs (e.g. Japanese characters) produce hashtag URLs that are invalid.
2019-09-07 19:50:45 +00:00
Maksim Pechnikov ab2f21e470 tests for mastodon_api_controller.ex 2019-09-06 21:50:00 +03:00
Maksim Pechnikov eb74c3d5c7 Merge branch 'develop' into issue/1218 2019-09-06 14:01:07 +03:00
Egor Kislitsyn 40b3289c26 Refactor add_link_headers/7 -> add_link_headers/3 2019-09-06 17:08:47 +07:00
Haelwenn fe7cf44c40 Merge branch 'feature/mastoapi-accounts-external' into 'develop'
Mastdon API: Add ability to get a remote account by nickname to `/api/v1/accounts/:id`

See merge request pleroma/pleroma!1622
2019-09-05 12:48:27 +00:00
rinpatch 26fe6f70c9 Move checking for restrict_local to User.get_cached_by_id_or_nickname 2019-09-05 15:39:10 +03:00
rinpatch b312ca3d52 Mastodon API Poll view: Fix handling of polls without an end date 2019-09-05 12:03:39 +03:00
rinpatch 3e30f6e198 Merge branch 'fix/safe-render-notifications' into 'develop'
Do not crash if one notification failed to render

See merge request pleroma/pleroma!1630
2019-09-05 05:47:06 +00:00
rinpatch 558969a0fd Do not crash if one notification failed to render 2019-09-05 08:32:49 +03:00
rinpatch 3face45467 Mastodon API: Add pleroma.thread_muted to Status entity
Needed for pleroma-fe!941
2019-09-04 14:17:23 +03:00
rinpatch cc1d1ee406 Mastdon API: Add ability to get a remote account by nickname to
`/api/v1/accounts/:id`
2019-09-03 19:26:10 +03:00
Maksim Pechnikov 6ef0103ca0 added Emoji struct 2019-08-31 10:14:53 +03:00
Maksim Pechnikov d8098d142a added Emoji.Formatter 2019-08-30 22:04:17 +03:00
Maksim Pechnikov d7808b5db4 added code\path fields without html tags in ets 2019-08-30 07:30:54 +03:00
Egor Kislitsyn 4194abbc8f Move mastodon_api/*_controller.ex to mastodon_api/controllers/ 2019-08-26 19:37:57 +07:00
Egor Kislitsyn 30510ade0e Extract MastodonAPIController's list actions into MastodonAPI.ListController; Add more tests 2019-08-26 19:37:54 +07:00
Egor Kislitsyn 4d82bc8b0b Extract MastodonAPI.MastodonAPIController.errors/2 to MastodonAPI.FallbackController 2019-08-26 19:16:40 +07:00
kPherox 8ca4f145a5
Extract if block into private function 2019-08-26 17:09:32 +09:00
kPherox b15e226593
Change to delete empty name field 2019-08-25 07:34:15 +09:00
kPherox 705b5adfc4
Fix type of fields_attributes
Convert tuple list to map list when parameters is `:urlencoded` or `:multipart`
2019-08-25 07:34:14 +09:00
kPherox 45e21a9df4
Rename fields to fields_attributes 2019-08-25 07:34:11 +09:00
lain cc6c0b4ba6 Merge remote-tracking branch 'origin/develop' into sixohsix/pleroma-post_expiration 2019-08-24 15:48:33 +02:00
lain ef43016b2c Merge branch 'feature/custom-fields' into 'develop'
Add custom profile fields

See merge request pleroma/pleroma!1488
2019-08-20 12:44:14 +00:00
lain 7ab2dbbdb6 Merge branch 'pleroma-conversations' into 'develop'
Extended Pleroma Conversations

See merge request pleroma/pleroma!1535
2019-08-16 12:55:33 +00:00
rinpatch 1ad71592ad Parallelize template rendering 2019-08-15 18:05:50 +03:00
rinpatch bd5ad0af78 Cache follow state 2019-08-15 00:47:30 +03:00
lain 560dbad538 Merge remote-tracking branch 'origin/develop' into pleroma-conversations 2019-08-14 15:30:40 +02:00
Egor Kislitsyn f7bbf99caa Use info.fields instead of source_data for remote users 2019-08-14 14:52:54 +07:00
Egor Kislitsyn e0ac5c7a66 Add custom profile fields 2019-08-14 14:52:54 +07:00
rinpatch f4e087ee48 Preload thread mutes/bookmarks in get_context
Also removes filtering for creates (was done on the database side
already) and filtering for the requested activity (moved to the database
side) from application side.
2019-08-14 02:36:54 +03:00
Haelwenn 47c20ab796 Merge branch 'fix/mastoapi-more-object-preloads' into 'develop'
Mastodon API: Preloading and normalization optimizations

See merge request pleroma/pleroma!1558
2019-08-13 22:32:49 +00:00
Maksim 04da1166db tests for /web/mastodon_api/mastodon_api.ex 2019-08-13 21:12:37 +00:00
rinpatch c1b6952d2a Mastodon API: Preloading and normalization optimizations
- Try to normalize the activity instead of object wherever possible
- Put the `user` key on non-home timelines as well so bookmarks and
thread mutes are preloaded there as well
- Skip trying to get the user when rendering mentions if the id ==
as:Public or user's follower collection
- Preload the object when getting replied to activities and do not crash
if it's not present

This almost solves the problem of Pleroma hammering the db with a lot
of queries when rendering timelines, the things left are
1. When rendering mentions and the user is not in cache, save it for
later and request all uncached users in one go
2. Somehow get rid of needing to get the latest follow activity to
detect the value of `requested` in a relationship. (create a database
view for user relationship and cache it maybe?)
2019-08-13 20:34:34 +03:00
lain 511ccea5aa ConversationView: Align parameter names with other views. 2019-08-12 14:23:06 +02:00
lain 23c46f7e72 Conversations: Use 'recipients' for accounts in conversation view.
According to gargron, this is the intended usage.
2019-08-12 12:51:08 +02:00
kaniini 84808e1697 Merge branch 'develop' into 'fix/hide-follows-counters'
# Conflicts:
#   CHANGELOG.md
2019-08-10 18:49:04 +00:00
rinpatch 0802a08871 Mastodon API: Fix thread mute detection
It was calling CommonAPI.thread_muted? with post author's account
instead of viewer's one.
2019-08-10 16:27:46 +03:00
rinpatch 409bcad54b Mastodon API: Set follower/following counters to 0 when hiding
followers/following is enabled

We are already doing that in AP representation, so I think we should do
it here as well for consistency.
2019-08-09 16:53:55 +03:00
lain a2b98f6d58 Merge remote-tracking branch 'origin/develop' into pleroma-conversations 2019-08-08 16:04:20 +02:00
Thibaut Girka 9c0da1009a Return profile URL in MastodonAPI's url field 2019-08-07 21:40:53 +00:00
Thibaut Girka 089d53a961 Simplify logic to mention.js url field
`User.profile_url` already fallbacks to ap_id
2019-08-07 20:55:37 +00:00
Thibaut Girka a10c840aba Return profile URL when available instead of actor URI for MastodonAPI mention URL
Fixes #1165
2019-08-07 20:29:30 +00:00
lain 3af6d14da7 Pleroma Conversations API: Add a way to set recipients. 2019-08-05 15:09:19 +02:00
lain eee98aaa73 Pleroma API: Add endpoint to get conversation statuses. 2019-08-02 19:53:08 +02:00
lain 7483679a7b StatusView: Return direct conversation id. 2019-07-31 15:12:29 +02:00
Ariadne Conill b93498eb52 constants: add as_public constant and use it everywhere 2019-07-29 02:43:19 +00:00
Sachin Joshi 242f5c585e add account confirmation email resend in mastodon api 2019-07-28 20:30:10 +00:00
Sergey Suprunenko b20020da16 Show the url advertised in the Activity in the Status JSON response 2019-07-24 19:28:21 +00:00
Eugenij 4504135894 Add domain_blocking to the relationship API (GET /api/v1/accounts/relationships) 2019-07-24 15:12:27 +00:00
Mike Verdone 2c83eb0b15 Revert "squash! Expose expires_at datetime in mastoAPI only for the activity actor"
This reverts commit 2981821db8.
2019-07-24 17:09:59 +02:00
Mike Verdone 2981821db8 squash! Expose expires_at datetime in mastoAPI only for the activity actor
NOTE: rewrite the commit msg
2019-07-24 16:51:09 +02:00
Mike Verdone 3cb471ec06 Expose expires_at datetime in mastoAPI only for the activity actor
In the "pleroma" section of the MastoAPI for status activities you can
see an expires_at item that states when the activity will expire, or
nothing if the activity will not expire.

The expires_at date is only visible to the person who posted the
activity. This is the conservative approach in case some attacker
decides to write a logger for expiring posts. However, in the future of
OCAP, signed requests, and all that stuff, this attack might not be that
likely. Some other pleroma dev should remove the restriction in the code
at that time, if they're satisfied with the security implications of
doing so.
2019-07-24 14:47:22 +02:00
Sadposter a5d6287ba8 Hide blocked users from interactions 2019-07-22 02:42:29 +00:00
Mark Felder 9169f331b6 Merge branch 'develop' into feature/matstodon-statuses-by-name 2019-07-19 16:55:10 -05:00
Eugenij 4bf2bb9cff Fix password reset for non-test env
Fixes `Plug.Conn.NotSentError` that causes a 5xx error in response
instead of 404 and 400.

Fixes pattern matching error caused by different response format
in test and non-test env: `Pleroma.Emails.Mailer.deliver_async` returns
:ok when PleromaJobQueue is enabled and `{:ok, _}` when it's disabled.
In tests, it's disabled.
2019-07-17 18:09:31 +00:00
Alexander Strizhakov 10f82c88b8 mastoapi password reset
added rate limit to password reset

configure rate limit in runtime
2019-07-16 21:44:50 +00:00
Ivan Tashkinov 889dc17abd [#1094] Rate-limited follow & unfollow actions. 2019-07-16 19:18:30 +03:00
Eugenij 520ee6c591 Add pleroma.deactivated to the Account entity (Mastodon API) 2019-07-16 11:14:46 +00:00
Eugenij c4ca142e14 Add the blocked_by attribute to the relationship API (GET /api/v1/accounts/relationships) 2019-07-16 11:04:11 +00:00
rinpatch 996fd58ac4 Merge branch 'bugfix/poll-id-as-string' into 'develop'
Status View: Poll ids are strings.

See merge request pleroma/pleroma!1430
2019-07-16 06:06:22 +00:00
lain 1ed24bcc76 Status View: Poll ids are strings.
All ids in mastodon are strings, in general.
2019-07-16 12:47:40 +09:00
Mark Felder ffb4eb9779 Merge branch 'develop' into feature/matstodon-statuses-by-name 2019-07-15 17:10:27 -05:00
Sergey Suprunenko b74300bc7a Add more tests for MastodonAPIController and CommonAPI 2019-07-15 19:47:23 +00:00
Alexander Strizhakov e7c39b7ac8 Feature/1072 muting notifications 2019-07-14 13:29:31 +00:00
Ivan Tashkinov d72876c57d [#1041] Minor refactoring. 2019-07-13 15:21:50 +03:00
Ivan Tashkinov 369e9bb42f [#1041] Rate-limited status actions (per user and per user+status). 2019-07-13 14:49:39 +03:00
Eugenij 4198c3ac39 Extend Pleroma.Pagination to support offset-based pagination, use async/await to execute status and account search in parallel 2019-07-11 13:55:31 +00:00
Haelwenn (lanodan) Monnier 252e129b1e
MastoAPI: Add categories to custom emojis
Note: This isn’t in a release yet, can be seen in mastofe on the
rebase/glitch-soc branch.
2019-07-10 17:02:37 +02:00
Sergey Suprunenko ff55e3c16f Create mentions only for explicitly mentioned users 2019-07-10 13:29:50 +00:00
Egor Kislitsyn 5104f65b69 Wrap error messages into gettext helpers 2019-07-10 18:10:09 +07:00
Maksim 008c55e4e9 add test for search_controller/ 100% coverage 2019-07-10 08:28:03 +00:00
feld 93a0eeab16 Add license/copyright to all project files 2019-07-10 05:13:23 +00:00
kaniini 1417627d07 Merge branch 'remove-avatar-header' into 'develop'
Ability to reset avatar, profile banner and backgroud

See merge request pleroma/pleroma!1187
2019-07-09 17:51:41 +00:00
kaniini 1179a13533 Merge branch 'features/sec-websocket-protocol-header' into 'develop'
Features: MastoAPI streaming Sec-WebSocket-Protocol header

See merge request pleroma/pleroma!1381
2019-07-09 16:52:22 +00:00
rinpatch 72b88c82bc Mastodon API: Fix embedded relationships not being rendered inside of statuses 2019-07-08 12:07:08 +03:00
Haelwenn (lanodan) Monnier e174614eb9
MastoAPI Streaming: Keep compatibility with access_token 2019-07-07 08:49:29 +02:00
KokaKiwi a7885748c7
MastoAPI streaming: Replace access_token with Sec-WebSocket-Protocol 2019-07-06 20:29:17 +02:00
Eugenij 5184b0f41a Use fallback values for search queries
This is to make sure the entire request doesn't return a 500 error if
user or status search times out.
2019-07-03 10:19:51 +00:00
Eugenij 1f76740e10 Add hashtag filter to user statuses (GET /api/v1/accounts/:id/statuses) 2019-06-30 09:08:46 +00:00
Egor Kislitsyn 889a9c3a3f Polish IdempotencyPlug 2019-06-27 01:53:58 +07:00
Egor Kislitsyn 0b8aeac0f3 Remove previous idempotency implementation from post_status 2019-06-26 18:49:14 +07:00
Roman Chvanikov a7a54068f9 Fix Controller.render/4 deprecation 2019-06-26 03:28:02 +03:00
Sachin Joshi a0c65bbd6c Merge branch 'develop' into 'remove-avatar-header'
# Conflicts:
#   CHANGELOG.md
2019-06-23 03:25:50 +00:00
rinpatch df2dab69a7 Merge branch 'begone-the-dot-hack' into 'develop'
Remove the dot hack when posting from Mastodon API and add proper errors when the post exceeds character limits

See merge request pleroma/pleroma!1298
2019-06-19 10:22:23 +00:00
rinpatch c7acca2abb Mastodon API: Sanitize display names
Closes #1000
2019-06-18 14:12:11 +03:00
rinpatch dce27de733 Mastodon API: Remove the dot hack 2019-06-18 05:04:41 +03:00
Maksim a04bf131e0 [#570] add user:notification stream 2019-06-16 10:33:25 +00:00
lain 135c196769 Merge branch 'bugfix/980-polls-double-vote' into 'develop'
MastodonAPI Controller: Band-Aid double vote problem.

See merge request pleroma/pleroma!1275
2019-06-15 15:13:48 +00:00
lain a440cf856d Mastodon API: Return the token needed for the chat. 2019-06-15 10:59:35 +02:00
rinpatch 62ffc00a5d Merge branch 'feature/add-background-image-to-mastoapi' into 'develop'
AccountView: Add user background.

See merge request pleroma/pleroma!1280
2019-06-14 16:49:28 +00:00
Maksim ee4ed87fb4 [#948] /api/v1/account_search added optional parameters (limit, offset, following) 2019-06-14 11:39:57 +00:00
lain eac298083f MastodonAPI: Add a way to update the background image. 2019-06-14 11:19:22 +02:00
lain 5965efb216 AccountView: Add user background. 2019-06-13 19:08:05 +02:00
lain 966543379d MastodonAPI Controller: Band-Aid double vote problem. 2019-06-12 16:36:23 +02:00
Egor Kislitsyn ad04d12de6 Replace MastodonAPIController.account_register/2 rate limiter 2019-06-11 16:06:03 +07:00
Egor Kislitsyn bc8f059367 Add rate limiting for search endpoints 2019-06-11 14:28:39 +07:00
Egor Kislitsyn 93397fce3d Contain search for unauthenticated users 2019-06-05 16:37:43 +07:00
Maksim Pechnikov 4f2e359687 Merge branch 'develop' into issue/941 2019-06-04 09:49:08 +03:00
kaniini 9d2563a3de Merge branch 'generic-fe-settings' into 'develop'
Generic settings store for frontend user settings

See merge request pleroma/pleroma!1221
2019-06-04 05:43:43 +00:00
Maksim Pechnikov f13d6c7f78 update api to set skip_thread_containment 2019-06-03 21:02:57 +03:00
rinpatch dc91bcc0af Merge branch 'develop' into feature/polls-2-electric-boogalo 2019-06-03 13:16:17 +03:00
lambda 314758c25b Merge branch 'align-mastodon-conversations' into 'develop'
Mastodon Conversations API: Align to Mastodon behavior

See merge request pleroma/pleroma!1215
2019-06-03 09:48:37 +00:00
rinpatch 026b245dbc Merge branch 'develop' into feature/polls-2-electric-boogalo 2019-06-03 11:14:52 +03:00
rinpatch 1fd8e19d76 Remove a TODO comment as the tests for poll view were written 2019-06-02 23:46:17 +03:00
rinpatch e3c460353d Refresh the object in CommonAPI.vote instead of MastoAPI controller 2019-06-02 23:24:48 +03:00
rinpatch 6bc9e5c020 Mastodon API: Refresh the object before rendering it after voting 2019-06-01 21:41:49 +03:00
rinpatch 444406167b Mastodon API: actually check for poll votes 2019-06-01 21:41:23 +03:00
rinpatch 65db5e9f52 Resolve merge conflicts 2019-06-01 16:29:58 +03:00
rinpatch 300d94c628 Add poll votes
Also in this commit by accident:
- Fix query ordering causing exclude_poll_votes to not work
- Do not create notifications for Answer objects
2019-06-01 16:17:46 +03:00
Haelwenn (lanodan) Monnier 5d3ece2861
Remove now useless flavours switching 2019-06-01 01:44:10 +02:00
Haelwenn (lanodan) Monnier aa9f52edd2
mastodon_api_controller.ex: Remove vanilla from supported_flavours 2019-06-01 01:44:10 +02:00
lain 7861974ab2 MastodonAPI: Add extension to set and get pleroma_settings_store. 2019-05-31 14:50:18 +02:00
lain aaad85c4d9 AccountView: settings -> settings_store 2019-05-31 14:49:46 +02:00
lain eb2963bc43 User: Add settings store to Info, AccountView
This is to provide a generic frontend settings storage mechanism for all kinds
of frontends.
2019-05-31 14:27:15 +02:00
lain 97fb50d9fa Mastodon Conversation API: Don't return own account in 'accounts'. 2019-05-31 11:27:14 +02:00
Sergey Suprunenko 1690be991e Replace missing non-nullable Card attributes with empty strings 2019-05-30 21:03:31 +00:00
Mark Felder e7edfd9fec Permit fetching statuses from API with nickname or id 2019-05-29 12:20:18 -05:00
Mark Felder 672fddb721 Default search limit should be 40
https://docs.joinmastodon.org/api/rest/search/
2019-05-29 08:06:26 -05:00
Sachin Joshi 1452a96ad6 ability to set and reset avatar, profile banner and backgroud in Mastodon API 2019-05-27 15:31:01 +05:45
William Pitcock 9bec891eb4 kill @httpoison 2019-05-25 04:24:21 +00:00
rinpatch e6b175ed6c Fix credo issues 2019-05-22 21:57:46 +03:00
rinpatch cdac5efd10 Merge branch 'bugfix/account_view_source.note' into 'develop'
MastoAPI AccountView: fill source.note with plaintext version of note

Closes #926

See merge request pleroma/pleroma!1189
2019-05-22 05:39:01 +00:00
Haelwenn (lanodan) Monnier 0e2c215a00
MastoAPI AccountView: fill source.note with plaintext version of note
Closes: https://git.pleroma.social/pleroma/pleroma/issues/926
2019-05-22 07:22:19 +02:00
rinpatch 63b0b7190c MastoAPI: Add GET /api/v1/polls/:id 2019-05-21 20:40:35 +03:00
rinpatch 0407ffe75f Change validation error status codes to be more appropriate 2019-05-21 17:12:38 +03:00
rinpatch f28747858b Actual vote count in poll view 2019-05-21 14:27:09 +03:00
rinpatch 3f96b3e4b8 Enforce poll limits and add error handling for MastodonAPI's post endpoint 2019-05-21 10:54:20 +03:00
rinpatch 76a7429bef Add poll limits to /api/v1/instance and initial state 2019-05-21 09:13:10 +03:00
kaniini d4847b17ca Merge branch 'refactor/add-virtual-thread-muted-field' into 'develop'
Add virtual :thread_muted? field

Closes #901

See merge request pleroma/pleroma!1178
2019-05-20 23:30:19 +00:00
Aaron Tinio eb02edcad9 Add virtual :thread_muted? field
that may be set when fetching activities
2019-05-21 00:35:46 +08:00
Sadposter daeae8e2e7
Move default mascot configuration to config/ 2019-05-20 16:12:55 +01:00
Sadposter e81f0fc6d4
Add mascot get/set tests 2019-05-20 12:58:06 +01:00
Sadposter 54e9cb5c2d
Add API endpoints for a custom user mascot 2019-05-20 12:39:23 +01:00
rinpatch 1d90f9b969 Remove tags/mentions/rich text from poll options because Mastodon and
add custom emoji
2019-05-19 17:06:44 +03:00
rinpatch 5ece901af3 Resolve merge conflicts and remove IO.inspects 2019-05-18 13:37:38 +03:00
lain 412a3d8a0f Merge branch 'develop' of git.pleroma.social:pleroma/pleroma into rum-index 2019-05-17 12:26:59 +02:00
lambda 1dcdcd8871 Merge branch 'bugfix/903-mastoapi-relationship-requested' into 'develop'
MastoAPI account_view.ex: requested is false when following is true

Closes #903

See merge request pleroma/pleroma!1169
2019-05-17 10:07:51 +00:00
lambda 46684db84d Update account_view.ex 2019-05-17 09:53:44 +00:00
rinpatch 642a67dd44 Render polls in statuses 2019-05-17 11:44:47 +03:00
Alexander Strizhakov 7ed682213f Fix/902 random compile failing 2019-05-17 07:25:20 +00:00
Haelwenn (lanodan) Monnier 68c75a08e8
MastoAPI account_view.ex: requested is false when following is true
Closes: https://git.pleroma.social/pleroma/pleroma/issues/903
2019-05-17 07:44:09 +02:00
William Pitcock de114ffbb0 activitypub: remove contain_timeline() 2019-05-15 15:53:06 +00:00