Commit graph

8619 commits

Author SHA1 Message Date
Tusooa Zhu
4edc867b87 Merge branch 'develop' into 'from/upstream-develop/tusooa/edits'
# Conflicts:
#   lib/pleroma/constants.ex
2022-07-03 22:24:57 +00:00
Haelwenn
de37583c49 Merge branch 'image_description_from_exif_data' into 'develop'
Use EXIF data of image for image description

See merge request pleroma/pleroma!3535
2022-07-03 21:14:25 +00:00
Haelwenn
a15b45a589 Merge branch 'bugfix/mime-validation-no-list' into 'develop'
Bugfix: Validate mediaType only by it's format

See merge request pleroma/pleroma!3597
2022-07-03 21:04:41 +00:00
Haelwenn
6b937d1473 Merge branch 'from/upstream-develop/tusooa/server-announcements' into 'develop'
Server announcements (1st pass)

See merge request pleroma/pleroma!3643
2022-07-03 20:58:20 +00:00
Ilja
56227ef7ba Descriptions from exif data with only whitespeces are considered empty
I noticed that pictures taken with Ubuntu-Touch have whitespace in one of the fields
This should just be ignored imo
2022-07-01 13:47:23 +02:00
Ilja
8c761942b1 update moduledoc 2022-07-01 12:15:02 +02:00
Ilja
81afaee374 Better way of getting keys
I used keyword_list[:key], but if the key doesn't exist, it will return nil. I actually expect a list and further down the code I use that list.
I believe the key should always be present, but in case it's not, it's better to return an empty list instead of nil. That way the code wont fail further down the line.
2022-07-01 12:15:02 +02:00
Ilja
d0d48a9e88 Add deprecation warnings 2022-07-01 12:15:02 +02:00
Ilja
8303af84ce Rename the Exiftool module
No migrations or checks yet
2022-07-01 12:15:02 +02:00
Ilja
551721e41a Rename the new module 2022-07-01 12:13:46 +02:00
Ilja
cd316d7269 Use EXIF data of image to prefill image description
During attachment upload Pleroma returns a "description" field. Pleroma-fe has an MR to use that to pre-fill the image description field, <https://git.pleroma.social/pleroma/pleroma-fe/-/merge_requests/1399>

* This MR allows Pleroma to read the EXIF data during upload and return the description to the FE
    * If a description is already present (e.g. because a previous module added it), it will use that
    * Otherwise it will read from the EXIF data. First it will check -ImageDescription, if that's empty, it will check -iptc:Caption-Abstract
    * If no description is found, it will simply return nil, just like before
* When people set up a new instance, they will be asked if they want to read metadata and this module will be activated if so

This was taken from an MR i did on Pleroma and isn't finished yet.
2022-07-01 12:13:46 +02:00
Tusooa Zhu
014096aeef
Make outbound transmogrifier aware of edit history 2022-06-25 11:20:46 -04:00
Tusooa Zhu
5321fd0012
Do not put meta[:object_data] for local Updates 2022-06-25 10:03:19 -04:00
Tusooa Zhu
9c6dae942d
Fix local updates causing emojis to be lost 2022-06-25 09:23:09 -04:00
Tusooa Zhu
40953a8f5c
Reuse formerRepresentations from remote if possible 2022-06-25 01:03:46 -04:00
Tusooa Zhu
99a6f50316
Unify the logic of updating objects 2022-06-25 00:32:22 -04:00
Tusooa Zhu
e0d6da4e7d
Fix CommonAPITest 2022-06-24 10:54:11 -04:00
Tusooa Zhu
ee07383191
Use meta[:object_data] in SideEffects for Update 2022-06-24 10:28:58 -04:00
Tusooa Zhu
01321c88b5
Convert incoming Updated object into Pleroma format 2022-06-24 10:25:22 -04:00
Tusooa Zhu
06da000c5d
Add editing to features 2022-06-21 12:32:44 -04:00
Tusooa Zhu
44613db853
Show original status at the first of history 2022-06-11 19:52:07 -04:00
Tusooa Zhu
95b3922328
Workaround with_index does not support function in Elixir 1.9 2022-06-11 17:02:29 -04:00
Tusooa Zhu
7451f0e81f
Send the correct update in streamer
get_create_by_ap_id_with_object() seems to fetch the old object.
Why this happens needs further investigation.
2022-06-11 12:02:16 -04:00
Tusooa Zhu
27f3d802f2
Expose history and source apis to anon users 2022-06-11 10:35:36 -04:00
Tusooa Zhu
c3593639ad
Fix incorrectly cached content after editing 2022-06-09 11:39:51 -04:00
Tusooa Zhu
aafd7a687d
Return the corresponding object id in attachment view 2022-06-08 11:45:24 -04:00
Tusooa Zhu
237b220d71
Add object id to uploaded attachments 2022-06-08 11:05:48 -04:00
Tusooa Zhu
d2d3532e5f
Lint 2022-06-05 16:35:01 -04:00
Tusooa Zhu
532f6ae3ed
Return update notification in mastodon api 2022-06-05 16:34:42 -04:00
Tusooa Zhu
06a3998013
Create Update notifications 2022-06-05 15:02:25 -04:00
Tusooa Zhu
fe2d4778ee
Expose content type of status sources 2022-06-04 12:57:30 -04:00
Tusooa Zhu
3249ac1f12
Show edited_at in MastodonAPI/show 2022-06-03 21:47:40 -04:00
Tusooa Zhu
8bac8147d4
Stream out edits 2022-06-03 21:15:17 -04:00
Tusooa Zhu
fa31ae50e6
Inject history when object is refetched 2022-06-01 19:49:04 -04:00
Tusooa Zhu
410e177b2a
Strip internal fields in formerRepresentation 2022-06-01 12:02:03 -04:00
Tusooa Zhu
b613a9ec6b
Implement mastodon api for editing status 2022-05-31 14:32:28 -04:00
Pierre-Louis Bonicoli
a158774364
hackney adapter helper & reverse proxy client: enable TLSv1.3
The list of TLS versions was added by
8bd2b6eb13 when hackney version was
pinned to 1.15.2. Later hackney version was upgraded
(166455c884) but the list of TLS
versions wasn't removed. From the hackney point of view, this list has
been replaced by the OTP defaults since 0.16.0
(734694ea4e24f267864c459a2f050e943adc6694).

It looks like the same issue already occurred before:
0cb7b0ea84.

A way to test this issue (where example.com is an ActivityPub site
which uses TLSv1.3 only):

   $ PLEROMA_CONFIG_PATH=/path/to/config.exs pleroma start_iex
   Erlang/OTP 22 [erts-10.7.2.16] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

   Erlang/OTP 22 [erts-10.7.2.16] [source] [64-bit] [smp:2:2] [ds:2:2:10] [async-threads:1] [hipe]

   Interactive Elixir (1.10.4) - press Ctrl+C to exit (type h() ENTER for help)
   iex(pleroma@127.0.0.1)2> Pleroma.Object.Fetcher.fetch_and_contain_remote_object_from_id("https://example.com/@/Nick/")
   {:error,
    {:tls_alert,
     {:protocol_version,
      'TLS client: In state hello received SERVER ALERT: Fatal - Protocol Version\n'}}}

With this patch, the output is the expected one:

   iex(pleroma@127.0.0.1)3> Pleroma.Object.Fetcher.fetch_and_contain_remote_object_from_id("https://example.com/@/Nick/")
   {:error,
   {:ok,
    %{
      "@context" => [
        "https://www.w3.org/ns/activitystreams",
        "https://w3id.org/security/v1",
        %{
          "Emoji" => "toot:Emoji",
          "Hashtag" => "as:Hashtag",
          "atomUri" => "ostatus:atomUri",
          "conversation" => "ostatus:conversation",
          "featured" => "toot:featured",
          "focalPoint" => %{"@container" => "@list", "@id" => "toot:focalPoint"},
          "inReplyToAtomUri" => "ostatus:inReplyToAtomUri",
          "manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
          "movedTo" => "as:movedTo",
          "ostatus" => "http://ostatus.org#",
          "sensitive" => "as:sensitive",
          "toot" => "http://joinmastodon.org/ns#"
        }
      ],
      "endpoints" => %{"sharedInbox" => "https://example.com/inbox"},
      "followers" => "https://example.com/@/Nick/followers",
      "following" => nil,
      "icon" => %{
        "type" => "Image",
        "url" => "https://example.com/static/media/[...].png"
      },
      "id" => "https://example.com/@/Nick/",
      "inbox" => "https://example.com/@/Nick/inbox",
      "liked" => nil,
      "name" => "Nick",
      "outbox" => "https://example.com/@/Nick/outbox",
      "preferredUsername" => "Nick",
      "publicKey" => %{
        "id" => "https://example.com/@/Nick/#main-key",
        "owner" => "https://example.com/@/Nick/",
        "publicKeyPem" => "[...]
      },
      "summary" => "",
      "type" => "Person",
      "url" => "https://example.com/@/Nick/"
    }}

A way to test the reverse proxy bits of this issue (where example.com allows TLSv1.3 only):

    iex(pleroma@127.0.0.1)1> Pleroma.ReverseProxy.Client.Hackney.request("GET", "https://example.com", [], [])
    {:error,
     {:tls_alert,
      {:protocol_version,
       'TLS client: In state hello received SERVER ALERT: Fatal - Protocol Version\n'}}}
2022-05-31 00:51:45 +02:00
Tusooa Zhu
393b508846
Implement viewing source 2022-05-30 00:59:23 -04:00
Tusooa Zhu
c004eb0fa2
Implement mastodon api for showing edit history 2022-05-29 23:50:31 -04:00
Tusooa Zhu
8acfe95f3e
Allow updating polls 2022-05-29 22:16:03 -04:00
Tusooa Zhu
5e8aac0e07
Record edit history for Note and Question Updates 2022-05-29 13:54:16 -04:00
Tusooa Zhu
0f6a5eb9a2
Handle Note and Question Updates 2022-05-29 12:54:57 -04:00
Tusooa Zhu
547def67a7
Allow Updates by every actor on the same origin 2022-05-29 11:36:00 -04:00
Hélène
a74ce2d77a
StealEmojiPolicy: fix String rejected_shortcodes
* rejected_shortcodes is defined as a list of strings in the
  configuration description. As such, database-based configuration was
  led to handle those settings as strings, and not as the actually
  expected type, Regex.
* This caused each message passing through this MRF, if a rejected
  shortcode was set and the emoji did not exist already on the instance,
  to fail federating, as an exception was raised, swiftly caught and
  mostly silenced.
* This commit fixes the issue by introducing new behavior: strings are
  now handled as perfect matches for an emoji shortcode (meaning that if
  the emoji-to-be-pulled's shortcode is in the blacklist, it will be
  rejected), while still supporting Regex types as before.
2022-05-18 21:25:10 +02:00
Haelwenn
4605efe272 Merge branch 'improve_anti_followbot_policy' into 'develop'
Also use actor_type to determine if an account is a bot in antiFollowbotPolicy

Closes #2561

See merge request pleroma/pleroma!3498
2022-05-08 18:10:40 +00:00
Ilja
a8093732bd Also use actor_type to determine if an account is a bot in antiFollowbotPolicy 2022-05-08 18:10:40 +00:00
Tusooa Zhu
57c030a0a7 Skip cache when /objects or /activities is authenticated
Ref: fix-local-public
2022-05-06 10:23:26 +02:00
Tusooa Zhu
e2d24eda57 Allow to skip cache in Cache plug
Ref: fix-local-public
2022-05-06 10:23:26 +02:00
Tusooa Zhu
be08d9305b
Fix incorrect fallback when English is set to first language 2022-04-17 22:39:52 -04:00
Tusooa Zhu
7d1dae3bef
Restrict mastodon api announcements to logged-in users only 2022-04-02 02:25:13 -04:00