elk-zone / elk

A nimble Mastodon web client
https://elk.zone
MIT License
5.45k stars 561 forks source link

Alt text disappearing on elk.zone with GTS server #2663

Open loriw-dev opened 7 months ago

loriw-dev commented 7 months ago

The last several times I've attempted to post images with alt text on elk.zone, over at least the last two weeks, the alt text is missing when it is posted. I'm running GoToSocial 0.13.2 git-f5314c0 on my server.

stackblitz[bot] commented 7 months ago

Solve in StackBlitz Codeflow Start a new pull request in StackBlitz Codeflow.

shuuji3 commented 6 months ago

Thanks for the reporting! We noticed the issue on alt text input, and its fix was published on v0.12.0 (about 1 month ago): https://github.com/elk-zone/elk/releases/tag/v0.12.0#:~:text=Allow%20to%20edit%20alt%20description. The newer version could fix this issue.

loriw-dev commented 6 months ago

Thanks for the reporting! We noticed the issue on alt text input, and its fix was published on v0.12.0 (about 1 month ago): https://github.com/elk-zone/elk/releases/tag/v0.12.0#:~:text=Allow%20to%20edit%20alt%20description. The newer version could fix this issue.

I just tested it, elk.zone seems to be currently running v0.13.0. I posted this and it is still dropping the alt text: https://elk.zone/d-shoot.net/@kobld/statuses/01HSXZTB727E9VZPT9NKK4PXHZ The alt button shows up in the corner of the image after I add it, but when I hit post it's gone.

If there's anything further I can test to see what might be causing it I'm happy to try.

shuuji3 commented 6 months ago

Thanks for the confirmation. In that case, it seems that this is a specific issue for GoToSocial.

Here are the client(Elk)-server interactions about image upload, alt text update, and status post:

sequenceDiagram
    Elk->>Mastodon server: Upload an image (`POST /api/v1/media`)
    Elk->>Mastodon server: Save the alt text (`PUT /api/v1/media/<media-id>`)
    Elk->>Mastodon server: Publish the post (`POST /api/v1/statuses`)

The previous fix was about the internal issue of alt text before sending the alt text. So now the alt text should be sent to the server.

I guess GoToSocial might handle sent data from Elk a bit differently. If you are comfortable using the dev tool of the browser, you could compare the request and response data from the GoToSocial server with the following ones from the Mastodon server.

Interactions with Mastodon server

Example post: https://elk.zone/mastodon.social/@shuuji3_dev/112193179168956809

POST /api/v1/media

Response:

{
    "id": "112193162602827919",
    "type": "image",
    "url": "https://files.mastodon.social/media_attachments/files/112/193/162/602/827/919/original/12babc505daffc66.png",
    "preview_url": "https://files.mastodon.social/media_attachments/files/112/193/162/602/827/919/small/12babc505daffc66.png",
    "remote_url": null,
    "preview_remote_url": null,
    "text_url": null,
    "meta": {
        "original": {
            "width": 1432,
            "height": 402,
            "size": "1432x402",
            "aspect": 3.5621890547263684
        },
        "small": {
            "width": 905,
            "height": 254,
            "size": "905x254",
            "aspect": 3.562992125984252
        }
    },
    "description": null,
    "blurhash": "U2SigQ4mV?_3-=t6M{M{bCRiRjt8xrIUs:-;"
}

PUT /api/v1/media/<media-id>

Request:

{
  "description": "test"
}

Response:

{
  "id": "112193162602827919",
  "type": "image",
  "url": "https://files.mastodon.social/media_attachments/files/112/193/162/602/827/919/original/12babc505daffc66.png",
  "preview_url": "https://files.mastodon.social/media_attachments/files/112/193/162/602/827/919/small/12babc505daffc66.png",
  "remote_url": null,
  "preview_remote_url": null,
  "text_url": null,
  "meta": {
    "original": {
      "width": 1432,
      "height": 402,
      "size": "1432x402",
      "aspect": 3.5621890547263684
    },
    "small": {
      "width": 905,
      "height": 254,
      "size": "905x254",
      "aspect": 3.562992125984252
    }
  },
  "description": "test",
  "blurhash": "U2SigQ4mV?_3-=t6M{M{bCRiRjt8xrIUs:-;"
}

POST /api/v1/statuses

Request:

{
  "status": "",
  "visibility": "public",
  "sensitive": false,
  "spoiler_text": "",
  "language": "en",
  "media_ids": [
    "112193162602827919"
  ]
}

Response:

{
  "id": "112193179168956809",
  "created_at": "2024-04-01T00:40:55.191Z",
  "in_reply_to_id": null,
  "in_reply_to_account_id": null,
  "sensitive": false,
  "spoiler_text": "",
  "visibility": "public",
  "language": "en",
  "uri": "https://mastodon.social/users/shuuji3_dev/statuses/112193179168956809",
  "url": "https://mastodon.social/@shuuji3_dev/112193179168956809",
  "replies_count": 0,
  "reblogs_count": 0,
  "favourites_count": 0,
  "edited_at": null,
  "favourited": false,
  "reblogged": false,
  "muted": false,
  "bookmarked": false,
  "pinned": false,
  "content": "",
  "filtered": [],
  "reblog": null,
  "application": {
    "name": "Elk",
    "website": "https://elk.zone"
  },
  "account": {
    "id": "112155296361434777",
    "username": "shuuji3_dev",
    "acct": "shuuji3_dev",
    "display_name": "shuuji3_dev",
    "locked": false,
    "bot": false,
    "discoverable": null,
    "indexable": false,
    "group": false,
    "created_at": "2024-03-25T00:00:00.000Z",
    "note": "<p>Testing the latest Mastodon server for Fediverse development and integration! 🌐</p>",
    "url": "https://mastodon.social/@shuuji3_dev",
    "uri": "https://mastodon.social/users/shuuji3_dev",
    "avatar": "https://files.mastodon.social/accounts/avatars/112/155/296/361/434/777/original/586a6f1d4c93aea6.png",
    "avatar_static": "https://files.mastodon.social/accounts/avatars/112/155/296/361/434/777/original/586a6f1d4c93aea6.png",
    "header": "https://mastodon.social/headers/original/missing.png",
    "header_static": "https://mastodon.social/headers/original/missing.png",
    "followers_count": 1,
    "following_count": 1,
    "statuses_count": 9,
    "last_status_at": "2024-04-01",
    "hide_collections": null,
    "noindex": false,
    "emojis": [],
    "roles": [],
    "fields": [
      {
        "name": "Main account",
        "value": "<a href=\"https://m.webtoo.ls/@shuuji3\" target=\"_blank\" rel=\"nofollow noopener noreferrer me\" translate=\"no\"><span class=\"invisible\">https://</span><span class=\"\">m.webtoo.ls/@shuuji3</span><span class=\"invisible\"></span></a>",
        "verified_at": null
      }
    ]
  },
  "media_attachments": [
    {
      "id": "112193162602827919",
      "type": "image",
      "url": "https://files.mastodon.social/media_attachments/files/112/193/162/602/827/919/original/12babc505daffc66.png",
      "preview_url": "https://files.mastodon.social/media_attachments/files/112/193/162/602/827/919/small/12babc505daffc66.png",
      "remote_url": null,
      "preview_remote_url": null,
      "text_url": null,
      "meta": {
        "original": {
          "width": 1432,
          "height": 402,
          "size": "1432x402",
          "aspect": 3.5621890547263684
        },
        "small": {
          "width": 905,
          "height": 254,
          "size": "905x254",
          "aspect": 3.562992125984252
        }
      },
      "description": "test",
      "blurhash": "U2SigQ4mV?_3-=t6M{M{bCRiRjt8xrIUs:-;"
    }
  ],
  "mentions": [],
  "tags": [],
  "emojis": [],
  "card": null,
  "poll": null
}