badlogic / skyview

Thread reader for Bluesky
MIT License
31 stars 3 forks source link

oEmbed support #1

Open iantsch opened 1 year ago

iantsch commented 1 year ago

Since ther is already an embed.html (still not found), we could support the official oembed standard. Then the embeds should work in CMSes like WordPress, Drupal, ...

oembed Standard

{
    "url": "https://bsky.app/profile/nroettgen.bsky.social/post/3kbu5y35yhl2u",
    "author_name": "Norbert Röttgen",
    "author_url": "https://bsky.app/profile/nroettgen.bsky.social",
    "html": "<blockquote class=\"bsky-skeet\"><p lang=\"de\" dir=\"ltr\">&quot;Ab heute auch hier auf Bluesky. Ich wünsche allen einen guten Start in die Woche, schaut gerne mal vorbei und lasst unbedingt eine Follow-Empfehlung da. Ist noch etwas einsam hier...</p>&mdash; Norbert Röttgen (@nroettgen.bsky.social) <a href=\"https://bsky.app/profile/nroettgen.bsky.social/post/3kbu5y35yhl2u">October 16, 2023</a></blockquote>\n<script async src=\"https://skyview.social/widgets.js\" charset=\"utf-8\"></script>\n",
    "width": 550,
    "height": null,
    "type": "rich",
    "cache_age": "3153600000",
    "provider_name": "Blue Sky",
    "provider_url": "https://bsky.app",
    "version": "1.0"
}

and within widget.js we add the logic to modify the blockquote into the beautiful html with profile picture you already created.

iantsch commented 1 year ago

Additionally to the <head> embed.html

<link rel="alternate" type="application/json+oembed"
  href="http://skyview.social/oembed?url=https%3A%2F%2Fbsky.app%2Fprofile%2Fnroettgen.bsky.social%2Fpost%2F3kbu5y35yhl2u"
  title="Norbert Röttgen oEmbed Profile" />
badlogic commented 1 year ago

Let's stick to English on the tracker.

This would require the server to actually issue requests to bsky and render HTML based on the response. I'm afraid that won't happen.

On Mon, Oct 16, 2023, 21:35 Christian Tschugg @.***> wrote:

Zusätzlich noch der Header ins embed.html

<link rel="alternate" type="application/json+oembed" href=" http://skyview.social/oembed?url=https%3A%2F%2Fbsky.app%2Fprofile%2Fnroettgen.bsky.social%2Fpost%2F3kbu5y35yhl2u" title="Norbert Röttgen oEmbed Profile" />

— Reply to this email directly, view it on GitHub https://github.com/badlogic/skyview/issues/1#issuecomment-1765149835, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5QBAD6PADHNKASG4ZAJ3X7WEAZAVCNFSM6AAAAAA6CWGFCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGE2DSOBTGU . You are receiving this because you are subscribed to this thread.Message ID: @.***>

iantsch commented 1 year ago

mea culpa, updated previous comments to english. I guess I will create a PoC. Is the latest pushed?

badlogic commented 1 year ago

I'll push in 15 minutes.

If the PoC has the server do request, I'm aftaid I won't merge it :/

On Mon, Oct 16, 2023, 21:48 Christian Tschugg @.***> wrote:

mea culpa, updated previous comments to english. I guess I will create a PoC. Is the latest pushed?

— Reply to this email directly, view it on GitHub https://github.com/badlogic/skyview/issues/1#issuecomment-1765165573, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5QBF3JF4I4GSO42ZDN3DX7WFPTAVCNFSM6AAAAAA6CWGFCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONRVGE3DKNJXGM . You are receiving this because you commented.Message ID: @.***>

iantsch commented 1 year ago

Next steps:

badlogic commented 1 year ago

Sorry, I did a bunch of stuff which likely messed with your PR.

Anyways, the server now actually "renders" index.html and embed.html and adds <meta> tags. Guess we can add oEmbed that way as well.

iantsch commented 1 year ago

will adapt my PR

Message ID: @.***>

badlogic commented 1 year ago

See server.ts getMeta(), just need to generate the <link> element in there and call it a day.

iantsch commented 1 year ago

since you already "work" on the server, I thought I do it clean.

Q: Should I refactor to cache the bsky calls instead of the final meta tags? Then we decrease the amount of calls.

badlogic commented 1 year ago

by caching the meta we do much less work on a cache hit and the memory requirements are also much lower. i'd say we keep caching the meta, even if it means we need 3 calls per bsky url.

On Thu, Oct 19, 2023, 12:46 Christian Tschugg @.***> wrote:

since you already "work" on the server, I thought I do it clean.

Q: Should I refactor to cache the bsky calls instead of the final meta tags? Then we decrease the amount of calls.

— Reply to this email directly, view it on GitHub https://github.com/badlogic/skyview/issues/1#issuecomment-1770553037, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAD5QBBWYTFWZ2Q46LLXD6TYAEAJLAVCNFSM6AAAAAA6CWGFCCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTONZQGU2TGMBTG4 . You are receiving this because you commented.Message ID: @.***>