Commit Graph

54 Commits (4ea718ef18c2171edf8ed0089fd0d28bdfb78ba1)

Author SHA1 Message Date
Eugen Rochko ddd30f331c
Improve support for aspects/circles (#8950)
* Add silent column to mentions

* Save silent mentions in ActivityPub Create handler and optimize it

Move networking calls out of the database transaction

* Add "limited" visibility level masked as "private" in the API

Unlike DMs, limited statuses are pushed into home feeds. The access
control rules between direct and limited statuses is almost the same,
except for counter and conversation logic

* Ensure silent column is non-null, add spec

* Ensure filters don't check silent mentions for blocks/mutes

As those are "this person is also allowed to see" rather than "this
person is involved", therefore does not warrant filtering

* Clean up code

* Use Status#active_mentions to limit returned mentions

* Fix code style issues

* Use Status#active_mentions in Notification

And remove stream_entry eager-loading from Notification
6 years ago
ThibG 63484ee17a Do not check for file existence when serializing ActivityPub actor (#8386)
When serializing an ActivityPub actor, Mastodon checks for the existence
of the avatar/header files. This is not necessary, only check if avatar/header
is set.

fd8bf49d38/README.md (checking-a-file-exists)
6 years ago
Eugen Rochko e55dce3176
Add federation relay support (#7998)
* Add federation relay support

* Add admin UI for managing relays

* Include actor on relay-related activities

* Fix i18n
6 years ago
Eugen Rochko fc09b3722a
Always send content for backwards-compatibility (#7844) 6 years ago
Eugen Rochko 908a9671d0
Serialize language into ActivityPub JSON (#7840)
* Serialize language into ActivityPub JSON

* Only use contentMap if language is present
6 years ago
Eugen Rochko 42cd363542
Bot nameplates (#7391)
* Store actor type in database

* Add bot nameplate to web UI, add setting to preferences, API, AP
Fix #7365

* Fix code style issues
7 years ago
Eugen Rochko 2f63d52b92
Fallback to old on-the-fly URI for follows/blocks if no stored URI (#7371)
Fix #7367
7 years ago
Eugen Rochko 6793bec4c6
Store URIs of follows, follow requests and blocks for ActivityPub (#7160)
Same URI passed between follow request and follow, since they are
the same thing in ActivityPub. Local URIs are generated during
creation using UUIDs and are passed to serializers.
7 years ago
Eugen Rochko 2c1f7b2ece
Better pagination for ActivityPub outbox (#7356) 7 years ago
Eugen Rochko 78ed4ab75f
Add bio fields (#6645)
* Add bio fields

- Fix #3211
- Fix #232
- Fix #121

* Display bio fields in web UI

* Fix output of links and missing fields

* Federate bio fields over ActivityPub as PropertyValue

* Improve how the fields are stored, add to Edit profile form

* Add rel=me to links in fields

Fix #121
7 years ago
David Underwood 123a343d11 [WIP] Enable custom emoji on account pages and in the sidebar (#6124)
Federate custom emojis with accounts
7 years ago
Eugen Rochko 9fe1619db9
Do not re-query mentions from serializers (#6858)
Fix performance regression from #6836
7 years ago
ThibG ff6b8a6443 Serialize mentions in the order they are added (#6836)
Up until now, the order seemed to be in the *opposite* order,
which caused the WebUI to populate mentions in reversed order
when replying to toots local to one's instance.
7 years ago
Eugen Rochko 89a52d6280
Fix wrong target URIs in ActivityPub Add/Remove (#6668) 7 years ago
Eugen Rochko e6520c0270
Fix #6657 - Use target instead of origin in Remove activity (#6664) 7 years ago
Eugen Rochko 9110db41c5
Federate pinned statuses over ActivityPub (#6610)
* Federate pinned statuses over ActivityPub

* Display pinned toots in web UI

Fix #6117

* Fix migration

* Fix tests

* Update outbox_serializer.rb

* Update remove_serializer.rb

* Update add_serializer.rb

* Update fetch_featured_collection_service.rb
7 years ago
Eugen Rochko 44829d8216
Fix missing focalPoint in ActivityPub JSON (#6609) 7 years ago
Eugen Rochko 41a01bec23
Federated reports (#6570)
* Fix #2176: Federated reports

* UI for federated reports

* Add spec for ActivityPub Flag handler

* Add spec for ReportService
7 years ago
Eugen Rochko b8535ad4df
Fix nil error in focal_point? (#6537) 7 years ago
beatrix 755aad534a fix typo in image serializer (#6530)
respond to!
7 years ago
Eugen Rochko 90f12f2e5a
Focal points (#6520)
* Add focus param to media API, center thumbnails on focus point

* Add UI for setting a focal point

* Improve focal point icon on upload item

* Use focal point in upload preview

* Add focalPoint property to ActivityPub

* Don't show focal point button for non-image attachments
7 years ago
Eugen Rochko 61ed133fea
Account archive download (#6460)
* Fix #201: Account archive download

* Export actor and private key in the archive

* Optimize BackupService

- Add conversation to cached associations of status, because
  somehow it was forgotten and is source of N+1 queries
- Explicitly call GC between batches of records being fetched
  (Model class allocations are the worst offender)
- Stream media files into the tar in 1MB chunks
  (Do not allocate media file (up to 8MB) as string into memory)
- Use #bytesize instead of #size to calculate file size for JSON
  (Fix FileOverflow error)
- Segment media into subfolders by status ID because apparently
  GIF-to-MP4 media are all named "media.mp4" for some reason

* Keep uniquely generated filename in Paperclip::GifTranscoder

* Ensure dumped files do not overwrite each other by maintaing directory partitions

* Give tar archives a good name

* Add scheduler to remove week-old backups

* Fix code style issue
7 years ago
Eugen Rochko dbda87c31f
Revert #5772 (#6221) 7 years ago
Eugen Rochko 02ba03d6db
Send one Delete of Actor in ActivityPub when account is suspended (#6172) 7 years ago
Akihiko Odaki 161c72d66d Allow to dereference Follow object for ActivityPub (#5772)
* Allow to dereference Follow object for ActivityPub

* Accept IRI as object representation for Accept activity
7 years ago
Eugen Rochko 58cede4808
Profile redirect notes (#5746)
* Serialize moved accounts into REST and ActivityPub APIs

* Parse federated moved accounts from ActivityPub

* Add note about moved accounts to public profiles

* Add moved account message to web UI

* Fix code style issues
7 years ago
unarist 8125fdc19f Use atomUri in Undo activity of Announce (#5376)
This allows deletion of reblogs which delivered before with OStatus URI.
7 years ago
Eugen Rochko 6e4046fc3f Fix #5178 - Use object URI only in Announce, instead of embedding (#5266) 7 years ago
Eugen Rochko 3a3475450e Encode custom emojis as resolveable objects in ActivityPub (#5243)
* Encode custom emojis as resolveable objects in ActivityPub

* Improve code style
7 years ago
Eugen Rochko 4ec1771165 Add ability to specify alternative text for media attachments (#5123)
* Fix #117 - Add ability to specify alternative text for media attachments

- POST /api/v1/media accepts `description` straight away
- PUT /api/v1/media/:id to update `description` (only for unattached ones)
- Serialized as `name` of Document object in ActivityPub
- Uploads form adjusted for better performance and description input

* Add tests

* Change undo button blend mode to difference
7 years ago
Akihiko Odaki bb4d005a83 Introduce OStatus::TagManager (#5008) 7 years ago
nullkal 7d16bb379d Use OrderedCollectionPage to return followers/following list (#4949) 7 years ago
Eugen Rochko 81cec35dbf Custom emoji (#4988)
* Custom emoji

- In OStatus: `<link rel="emoji" name="coolcat" href="http://..." />`
- In ActivityPub: `{ type: "Emoji", name: ":coolcat:", href: "http://..." }`
- In REST API: Status object includes `emojis` array (`shortcode`, `url`)
- Domain blocks with reject media stop emojis
- Emoji file up to 50KB
- Web UI handles custom emojis
- Static pages render custom emojis as `<img />` tags

Side effects:

- Undo #4500 optimization, as I needed to modify it to restore
  shortcode handling in emojify()
- Formatter#plaintext should now make sure stripped out line-breaks
  and paragraphs are replaced with newlines

* Fix emoji at the start not being converted
7 years ago
unarist 17bf3363ac Add published property to ActivityPub activity for reblogs (#5000)
Since reblogs are serialized as Announce activity, its published property can be used for the creation time of reblog.
7 years ago
unarist c30e6433de Fix AP serialization error when thread is missing (#4970)
`Status#reply?` may returns true even if the thread is missing.
e.g. the replied status was deleted or couldn't be fetched.

Then it raises NoMethodError on various AP json serialization.

This issue won't happen on Atom serialization because it checks thread
existence using `StreamEntry#threaded?` instead.
7 years ago
Eugen Rochko 4931eac280 Fix nil error for old toots that don't have a conversation (#4900) 7 years ago
Eugen Rochko 9b50a9dd83 Fix some ActivityPub JSON bugs (#4796)
- Fix assumption that `url` is always a string. Handle it if it's an
  array of strings, array of objects, object, or string, both for
  accounts and for objects
- `sharedInbox` is actually supposed to be under `endpoints`, handle
  both cases and adjust the serializer
7 years ago
Eugen Rochko 37fdddd927 Rename "locked" to "manuallyApprovesFollowers" in ActivityPub (#4779)
See: <https://www.w3.org/wiki/Activity_Streams_extensions#as:manuallyApprovesFollowers>
7 years ago
Eugen Rochko 1b5806b744 Define missing JSON-LD properties (#4767)
Using _: property names is discouraged, as in the future,
canonicalization may throw an error when encountering that instead
of discarding it silently like it does now.

We are defining some ActivityStreams properties which we expect
to land in ActivityStreams eventually, to ensure that future versions
of Mastodon will remain compatible with this even once that happens.
Those would be `locked`, `sensitive` and `Hashtag`

We are defining a custom context inline for some properties which we
do not expect to land in any other context. `atomUri`, `inReplyToAtomUri`
and `conversation` are part of the custom defined OStatus context.
7 years ago
Eugen Rochko 2db9ccaf3e Add sharedInbox to actors (#4737) 7 years ago
Eugen Rochko 0d5d11eeff Add _:inReplyToAtomUri to ActivityPub (#4702) 7 years ago
Eugen Rochko 884b085f53 Use Tombstone and _:atomUri in Delete activities as fallback (#4704) 7 years ago
Eugen Rochko 2a2698e450 Add ActivityPub serializer for Undo of Announce (#4703) 7 years ago
unarist b01a19fe39 Fetch reblogs as Announce activity instead of Note object (#4672)
* Process Create / Announce activity in FetchRemoteStatusService

* Use activity URL in ActivityPub for reblogs

* Redirect to the original status on StatusesController#show
7 years ago
Eugen Rochko 412ea87306 Improve ActivityPub/OStatus compatibility (#4632)
*Note: OStatus URIs are invalid for ActivityPub. But we have them for
as long as we want to keep old OStatus-sourced content and as long as
we remain OStatus-compatible.*

- In Announce handling, if object URI is not a URL, fallback to object URL
- Do not use specialized ThreadResolveWorker, rely on generalized handling
- When serializing notes, if parent's URI is not a URL, use parent's URL
7 years ago
Eugen Rochko 774b8661bc Revert #4616 (#4638) 7 years ago
Eugen Rochko 116b8a6363 Fix #4607 - Accept/reject activities use FollowRequest, which has inverse relations (#4616) 7 years ago
Eugen Rochko ad892dbc0c Add _:atomUri property for deduplicating OStatus/ActivityPub legacy records (#4593) 7 years ago
Eugen Rochko ccdd5a9576 Add serializing/unserializing of "locked" actor attribute (#4585) 7 years ago
Eugen Rochko dd7ef0dc41 Add ActivityPub inbox (#4216)
* Add ActivityPub inbox

* Handle ActivityPub deletes

* Handle ActivityPub creates

* Handle ActivityPub announces

* Stubs for handling all activities that need to be handled

* Add ActivityPub actor resolving

* Handle conversation URI passing in ActivityPub

* Handle content language in ActivityPub

* Send accept header when fetching actor, handle JSON parse errors

* Test for ActivityPub::FetchRemoteAccountService

* Handle public key and icon/image when embedded/as array/as resolvable URI

* Implement ActivityPub::FetchRemoteStatusService

* Add stubs for more interactions

* Undo activities implemented

* Handle out of order activities

* Hook up ActivityPub to ResolveRemoteAccountService, handle
Update Account activities

* Add fragment IDs to all transient activity serializers

* Add tests and fixes

* Add stubs for missing tests

* Add more tests

* Add more tests
7 years ago