Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse

FòrumCAT

  1. Home
  2. Uncategorized
  3. Mastodon/Activity Pub question:

Mastodon/Activity Pub question:

Scheduled Pinned Locked Moved Uncategorized
17 Posts 6 Posters 1 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • sarahjamielewis@mastodon.socialS This user is from outside of this forum
    sarahjamielewis@mastodon.socialS This user is from outside of this forum
    sarahjamielewis@mastodon.social
    wrote last edited by
    #1

    Mastodon/Activity Pub question:

    As far as I can tell mastodon posts are expected to have a rich text / html-subset representation i.e. https://docs.joinmastodon.org/spec/activitypub/#sanitization)

    I'm writing a tiny activity pub service, mastodon is currently stripping out all html tags when displaying posts from my dev account (see e.g. https://mastodon.social/@sarah@tap.resistant.tech/114643976114333084), plain text posts work fine (see e.g. https://mastodon.social/@sarah@tap.resistant.tech/114643533179472725)

    I'm attempting to work out why that is the case, but this is proving to be a hard thing to search for.

    sarahjamielewis@mastodon.socialS julian@fietkau.socialJ 2 Replies Last reply
    0
    • sarahjamielewis@mastodon.socialS sarahjamielewis@mastodon.social

      Mastodon/Activity Pub question:

      As far as I can tell mastodon posts are expected to have a rich text / html-subset representation i.e. https://docs.joinmastodon.org/spec/activitypub/#sanitization)

      I'm writing a tiny activity pub service, mastodon is currently stripping out all html tags when displaying posts from my dev account (see e.g. https://mastodon.social/@sarah@tap.resistant.tech/114643976114333084), plain text posts work fine (see e.g. https://mastodon.social/@sarah@tap.resistant.tech/114643533179472725)

      I'm attempting to work out why that is the case, but this is proving to be a hard thing to search for.

      sarahjamielewis@mastodon.socialS This user is from outside of this forum
      sarahjamielewis@mastodon.socialS This user is from outside of this forum
      sarahjamielewis@mastodon.social
      wrote last edited by
      #2

      My current working theories in no particular order:

      - I've missed something about how create activities/notes are constructed which conveys some kind of explicit/implicit content type?

      - does mastodon do some form of tiered server trusting when it comes to deciding what to format?

      - a text encoding issue somewhere?

      sarahjamielewis@mastodon.socialS 1 Reply Last reply
      0
      • sarahjamielewis@mastodon.socialS sarahjamielewis@mastodon.social

        Mastodon/Activity Pub question:

        As far as I can tell mastodon posts are expected to have a rich text / html-subset representation i.e. https://docs.joinmastodon.org/spec/activitypub/#sanitization)

        I'm writing a tiny activity pub service, mastodon is currently stripping out all html tags when displaying posts from my dev account (see e.g. https://mastodon.social/@sarah@tap.resistant.tech/114643976114333084), plain text posts work fine (see e.g. https://mastodon.social/@sarah@tap.resistant.tech/114643533179472725)

        I'm attempting to work out why that is the case, but this is proving to be a hard thing to search for.

        julian@fietkau.socialJ This user is from outside of this forum
        julian@fietkau.socialJ This user is from outside of this forum
        julian@fietkau.social
        wrote last edited by
        #3

        @sarahjamielewis The JSON of 1749328245 looks normal/correct at a glance, but I can't pull it into my own Mastodon server because your WebFinger at https://tap.resistant.tech/.well-known/webfinger?resource=sarah%40tap.resistant.tech doesn't currently seem to resolve, so my Mastodon server fails to put together the actor's profile. Is that known and/or intentional? Maybe it was working previously and m.s cached it?

        sarahjamielewis@mastodon.socialS 1 Reply Last reply
        0
        • julian@fietkau.socialJ julian@fietkau.social

          @sarahjamielewis The JSON of 1749328245 looks normal/correct at a glance, but I can't pull it into my own Mastodon server because your WebFinger at https://tap.resistant.tech/.well-known/webfinger?resource=sarah%40tap.resistant.tech doesn't currently seem to resolve, so my Mastodon server fails to put together the actor's profile. Is that known and/or intentional? Maybe it was working previously and m.s cached it?

          sarahjamielewis@mastodon.socialS This user is from outside of this forum
          sarahjamielewis@mastodon.socialS This user is from outside of this forum
          sarahjamielewis@mastodon.social
          wrote last edited by
          #4

          @julian ah looks like the webfinger lookup was a little too restrictive (previously it only resolved acct:sarah@tap.resistant.tech), now it resolves other versions including the one you linked

          julian@fietkau.socialJ 1 Reply Last reply
          0
          • sarahjamielewis@mastodon.socialS sarahjamielewis@mastodon.social

            @julian ah looks like the webfinger lookup was a little too restrictive (previously it only resolved acct:sarah@tap.resistant.tech), now it resolves other versions including the one you linked

            julian@fietkau.socialJ This user is from outside of this forum
            julian@fietkau.socialJ This user is from outside of this forum
            julian@fietkau.social
            wrote last edited by
            #5

            @sarahjamielewis Ah, no, that's my mistake. Going by the standard, the "acct:" schema isn't optional, I just have a bad habit of forgetting about it. 😬

            But there's still something going on with fetching your AP URIs from Mastodon. I can pull up your profile if I search for the double-@ handle, but not if I search for the URI, even though you appear to serve correct AP. Might be the same reason why I can't fetch your test post. I tried from my Mastodon server and from https://activitypub.academy.

            julian@fietkau.socialJ 1 Reply Last reply
            0
            • julian@fietkau.socialJ julian@fietkau.social

              @sarahjamielewis Ah, no, that's my mistake. Going by the standard, the "acct:" schema isn't optional, I just have a bad habit of forgetting about it. 😬

              But there's still something going on with fetching your AP URIs from Mastodon. I can pull up your profile if I search for the double-@ handle, but not if I search for the URI, even though you appear to serve correct AP. Might be the same reason why I can't fetch your test post. I tried from my Mastodon server and from https://activitypub.academy.

              julian@fietkau.socialJ This user is from outside of this forum
              julian@fietkau.socialJ This user is from outside of this forum
              julian@fietkau.social
              wrote last edited by
              #6

              @sarahjamielewis Maaaaaybe it has something to do with the content type? It looks like you serve the HTML if explicitly asked for text/html, and the JSON otherwise. I usually do it the other way around.

              I think Mastodon refuses to load plain JSON documents, for security reasons (long story), this might be linked to that. Only sending the AP JSON for the content types listed in section 3.2 of the spec could be worth trying.

              I'm poking at this kinda blindly though. Tough situation to debug.

              julian@fietkau.socialJ 1 Reply Last reply
              0
              • julian@fietkau.socialJ julian@fietkau.social

                @sarahjamielewis Maaaaaybe it has something to do with the content type? It looks like you serve the HTML if explicitly asked for text/html, and the JSON otherwise. I usually do it the other way around.

                I think Mastodon refuses to load plain JSON documents, for security reasons (long story), this might be linked to that. Only sending the AP JSON for the content types listed in section 3.2 of the spec could be worth trying.

                I'm poking at this kinda blindly though. Tough situation to debug.

                julian@fietkau.socialJ This user is from outside of this forum
                julian@fietkau.socialJ This user is from outside of this forum
                julian@fietkau.social
                wrote last edited by
                #7

                @sarahjamielewis For what it's worth, @fedify fetches and parses your actor correctly (tested with https://github.com/fedify-dev/fedify/tree/main/examples/actor-lookup-cli), so it's gotta be something where Mastodon is more strict. 🤷

                1 Reply Last reply
                0
                • sarahjamielewis@mastodon.socialS sarahjamielewis@mastodon.social

                  My current working theories in no particular order:

                  - I've missed something about how create activities/notes are constructed which conveys some kind of explicit/implicit content type?

                  - does mastodon do some form of tiered server trusting when it comes to deciding what to format?

                  - a text encoding issue somewhere?

                  sarahjamielewis@mastodon.socialS This user is from outside of this forum
                  sarahjamielewis@mastodon.socialS This user is from outside of this forum
                  sarahjamielewis@mastodon.social
                  wrote last edited by
                  #8

                  What we have learned so far:

                  - taking the json my service produces and mirroring on another AP service results in mastodon rendering the HTML on the mirrored post - so it unlikely to be an issue with the Note object at least...

                  - just in case, I've tweaked a couple of things in webfinger, nodeinfo, and http header signing to better align the behaviour that mastodon is has, to no effect.

                  sarahjamielewis@mastodon.socialS 1 Reply Last reply
                  0
                  • sarahjamielewis@mastodon.socialS sarahjamielewis@mastodon.social

                    What we have learned so far:

                    - taking the json my service produces and mirroring on another AP service results in mastodon rendering the HTML on the mirrored post - so it unlikely to be an issue with the Note object at least...

                    - just in case, I've tweaked a couple of things in webfinger, nodeinfo, and http header signing to better align the behaviour that mastodon is has, to no effect.

                    sarahjamielewis@mastodon.socialS This user is from outside of this forum
                    sarahjamielewis@mastodon.socialS This user is from outside of this forum
                    sarahjamielewis@mastodon.social
                    wrote last edited by
                    #9

                    I have officially ran out of ideas...probably time to take a break....

                    Request: If anyone who knows anything about mastodon internals has any idea why plain text messages would show fine, but basic html formatted messages would show empty (see above) - I would greatly appreciate any insight.

                    Edit: Thanks all, This has been Solved! (https://mastodon.social/@sarah@tap.resistant.tech/114644828209750037)

                    jenniferplusplus@hachyderm.ioJ soatok@furry.engineerS 2 Replies Last reply
                    0
                    • sarahjamielewis@mastodon.socialS sarahjamielewis@mastodon.social

                      I have officially ran out of ideas...probably time to take a break....

                      Request: If anyone who knows anything about mastodon internals has any idea why plain text messages would show fine, but basic html formatted messages would show empty (see above) - I would greatly appreciate any insight.

                      Edit: Thanks all, This has been Solved! (https://mastodon.social/@sarah@tap.resistant.tech/114644828209750037)

                      jenniferplusplus@hachyderm.ioJ This user is from outside of this forum
                      jenniferplusplus@hachyderm.ioJ This user is from outside of this forum
                      jenniferplusplus@hachyderm.io
                      wrote last edited by
                      #10

                      @sarahjamielewis can you share a sample json you're sending?

                      sarahjamielewis@mastodon.socialS 1 Reply Last reply
                      0
                      • sarahjamielewis@mastodon.socialS sarahjamielewis@mastodon.social

                        I have officially ran out of ideas...probably time to take a break....

                        Request: If anyone who knows anything about mastodon internals has any idea why plain text messages would show fine, but basic html formatted messages would show empty (see above) - I would greatly appreciate any insight.

                        Edit: Thanks all, This has been Solved! (https://mastodon.social/@sarah@tap.resistant.tech/114644828209750037)

                        soatok@furry.engineerS This user is from outside of this forum
                        soatok@furry.engineerS This user is from outside of this forum
                        soatok@furry.engineer
                        wrote last edited by
                        #11

                        @sarahjamielewis Hey @evan any ideas?

                        evan@cosocial.caE 1 Reply Last reply
                        0
                        • jenniferplusplus@hachyderm.ioJ jenniferplusplus@hachyderm.io

                          @sarahjamielewis can you share a sample json you're sending?

                          sarahjamielewis@mastodon.socialS This user is from outside of this forum
                          sarahjamielewis@mastodon.socialS This user is from outside of this forum
                          sarahjamielewis@mastodon.social
                          wrote last edited by
                          #12

                          @jenniferplusplus

                          The note: https://tap.resistant.tech/sarah/posts/1749337528.json (doesn't include the wrapping Create activity, but sending plain text messages work, so I assume the Create activity is OK...I can pull one from the debug logs)

                          The empty render: https://mastodon.social/@sarah@tap.resistant.tech/114644584327450993

                          jenniferplusplus@hachyderm.ioJ 1 Reply Last reply
                          0
                          • soatok@furry.engineerS soatok@furry.engineer

                            @sarahjamielewis Hey @evan any ideas?

                            evan@cosocial.caE This user is from outside of this forum
                            evan@cosocial.caE This user is from outside of this forum
                            evan@cosocial.ca
                            wrote last edited by
                            #13

                            @soatok @sarahjamielewis they've got a list of tags they allow. Could you be using something at the top level that they sanitize out?

                            https://docs.joinmastodon.org/spec/activitypub/#sanitization

                            evan@cosocial.caE 1 Reply Last reply
                            0
                            • evan@cosocial.caE evan@cosocial.ca

                              @soatok @sarahjamielewis they've got a list of tags they allow. Could you be using something at the top level that they sanitize out?

                              https://docs.joinmastodon.org/spec/activitypub/#sanitization

                              evan@cosocial.caE This user is from outside of this forum
                              evan@cosocial.caE This user is from outside of this forum
                              evan@cosocial.ca
                              wrote last edited by
                              #14

                              @soatok @sarahjamielewis also, very excited to see your service!

                              1 Reply Last reply
                              0
                              • sarahjamielewis@mastodon.socialS sarahjamielewis@mastodon.social

                                @jenniferplusplus

                                The note: https://tap.resistant.tech/sarah/posts/1749337528.json (doesn't include the wrapping Create activity, but sending plain text messages work, so I assume the Create activity is OK...I can pull one from the debug logs)

                                The empty render: https://mastodon.social/@sarah@tap.resistant.tech/114644584327450993

                                jenniferplusplus@hachyderm.ioJ This user is from outside of this forum
                                jenniferplusplus@hachyderm.ioJ This user is from outside of this forum
                                jenniferplusplus@hachyderm.io
                                wrote last edited by
                                #15

                                @sarahjamielewis Nothing is obviously wrong with it. This is just a guess, but it might be the capitalization on the unicode escapes? Mastodon capitalizes them. Here's a mastodon note that I keep around for regression testing
                                https://github.com/Letterbook/Letterbook/blob/main/Tests/Letterbook.IntegrationTests/Data/mastodon_post.json

                                jenniferplusplus@hachyderm.ioJ julian@community.nodebb.orgJ 2 Replies Last reply
                                0
                                • jenniferplusplus@hachyderm.ioJ jenniferplusplus@hachyderm.io

                                  @sarahjamielewis Nothing is obviously wrong with it. This is just a guess, but it might be the capitalization on the unicode escapes? Mastodon capitalizes them. Here's a mastodon note that I keep around for regression testing
                                  https://github.com/Letterbook/Letterbook/blob/main/Tests/Letterbook.IntegrationTests/Data/mastodon_post.json

                                  jenniferplusplus@hachyderm.ioJ This user is from outside of this forum
                                  jenniferplusplus@hachyderm.ioJ This user is from outside of this forum
                                  jenniferplusplus@hachyderm.io
                                  wrote last edited by
                                  #16

                                  @sarahjamielewis I put this together to help with interop testing. It's really useful to have access to mastodon's logs while you're trying to do this stuff
                                  https://github.com/Letterbook/Sandcastles

                                  1 Reply Last reply
                                  0
                                  • jenniferplusplus@hachyderm.ioJ jenniferplusplus@hachyderm.io

                                    @sarahjamielewis Nothing is obviously wrong with it. This is just a guess, but it might be the capitalization on the unicode escapes? Mastodon capitalizes them. Here's a mastodon note that I keep around for regression testing
                                    https://github.com/Letterbook/Letterbook/blob/main/Tests/Letterbook.IntegrationTests/Data/mastodon_post.json

                                    julian@community.nodebb.orgJ This user is from outside of this forum
                                    julian@community.nodebb.orgJ This user is from outside of this forum
                                    julian@community.nodebb.org
                                    wrote last edited by
                                    #17

                                    jenniferplusplus@hachyderm.io I think it might be the Unicode escapes too. I don't think they're necessary.

                                    1 Reply Last reply
                                    0
                                    Reply
                                    • Reply as topic
                                    Log in to reply
                                    • Oldest to Newest
                                    • Newest to Oldest
                                    • Most Votes


                                    • Login

                                    • First post
                                      Last post
                                    0
                                    • Categories
                                    • Recent
                                    • Tags
                                    • Popular
                                    • World
                                    • Users
                                    • Groups