Compare commits

..

3 commits

Author SHA1 Message Date
84109a3429 Fix badly stretched image attachments 2025-11-21 08:26:38 +01:00
33ebd5eb2a Start autoplaying gifs only on hover or tap 2025-11-21 07:44:15 +01:00
aea0c8f1f1 Remove ?code= parameter after fetching bearer token
This is to ensure that it's not stored in any bookmark. The parameter
only has a short validity, so it's mostly cosmetic, but the docs
[recommend treating it
securely](https://docs.joinmastodon.org/methods/oauth/#200-ok).

Unfortunately it will still show up in logs. We should consider
switching to `urn:ietf:wg:oauth:2.0:oob`.
2025-11-21 07:28:56 +01:00
2 changed files with 10 additions and 4 deletions

View file

@ -230,6 +230,7 @@
margin-top: 16px;
height: 320px;
display: flex;
align-items: flex-start;
max-width: 100%;
overflow: auto;
}

View file

@ -134,7 +134,9 @@
:redirect_uri (:redirect_uri application)}))})
(.then (fn [res]
(let [bearer-token (-> res :body :access_token)
application (assoc application :bearer_token bearer-token)]
application (assoc application :bearer_token bearer-token)
path (-> js/location .-pathname)]
(.replaceState js/history nil "" path) ; remove ?code= param
(db/put! ::db/application application)
application)))))
@ -356,9 +358,12 @@
"video" [:video {:controls true}
[:source {:type (str "video/" ext) :src remote-url}]
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]
"gifv" [:video {:loop true :autoplay true :muted true}
[:source {:type (str "video/" ext) :src remote-url}]
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]
"gifv" (let [autoplay (r/atom false)
toggle-autoplay #(swap! autoplay not)]
(fn []
[:video {:loop true :autoplay @autoplay :muted true :on-pointer-enter toggle-autoplay}
[:source {:type (str "video/" ext) :src remote-url}]
[:a {:href (:remote_url attachment)} (str "Original video at " (:remote_url attachment))]]))
[:div [:strong "Unsupported attachment"]
[debug attachment]])))