glitch-soc / mastodon

A glitchy but lovable microblogging server
https://glitch-soc.github.io/docs/
GNU Affero General Public License v3.0
683 stars 181 forks source link

Bring back image link hiding #71

Open MightyPork opened 7 years ago

MightyPork commented 7 years ago

I believe we could bring it back, unless I misunderstand the reasons for reverting it.

This was introduced here: https://github.com/tootsuite/mastodon/issues/552 (commit: https://github.com/Nyoho/mastodon/commit/32a0e31635a32e28847eff3067216da2c03b9cde)

Then someone found inconsistency in the implementation (https://github.com/tootsuite/mastodon/issues/2610) and Eugen axed it in https://github.com/tootsuite/mastodon/pull/2970 (https://github.com/tootsuite/mastodon/pull/2970/commits/7a0f4dfce4a51d194f89bc70886e9839be9fdf03)

Oddly, the revert doesn't have its own commit and isn't mentioned in the commit message.

This could be optional via the config modal

marrus-sh commented 6 years ago

I'm going to do what I can regarding this as part of the status redesign.

Images from non-glitch-soc instances still won't collapse but we can make ours do so when federating if we use the full image URL (text_url in the API should be obsoleted imo but that's a different issue). And local images will always collapse.

marrus-sh commented 6 years ago

It's possible to resolve shortlinks to their full URLs using a HEAD XMLHttpRequest, checking for a 302, checking the Location header to see if it matches one of the media URLs, and then if so replacing the link with the image button. (We can limit the number of requests we send by ensuring that the hostname of the URL matches one of the hostnames for the images before sending the request.) I can't tell if this is overkill or not.

codl commented 6 years ago

resolve shortlinks to their full URLs using a HEAD XMLHttpRequest

from the client? privacy wise this is sketchy. every remote server would then know who is looking at their posts and when by watching HEAD requests come in

marrus-sh commented 6 years ago

I think it's sketchy for a number of reasons lol. But it could be done server-side as well. The server would just need to set the text_url property for the attachment to the URL used in the status.

(Our problem comes from the fact that text_url doesn't federate.)