poc: proxy embed links when possible #2665
Draft
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
At the moment it only supports
Twitter->xcanceland this PR serves as a way to visualize #2664.ProxyLinkdetects a supported embed URL and applies the related proxy service (if available), e.g. twitter is replaced with xcancel.The places where the alternative link is shown:
ProxyLinkwill only show up if the user has enabledproxyEmbedsin the settings: show proxy links for 3rd party embedsScreenshots
Item title:

Embed:

Settings:

Additional Context
We can't embed xcancel because of their
frame-ancestors: noneCSP. So the next best thing is to show a small link that takes the user to a supported proxy.I'm not entirely sure that this is something we'd want to comfortably support, considering that proxies can go down. On the other hand, it's a really straightforward solution that doesn't require a bot.
Since the only supported proxy is for Twitter,
ProxyLinkis used only on that specific embed. The currentEmbedstructure forces us to repeatProxyLinkon every provider, but it can be refactored to avoid repetitions.I noticed that the setting
show images, video, and 3rd party embedsis not respected: we still show an embed if this is false.I'll open an issue
Checklist
Are your changes backward compatible? Please answer below:
For example, a change is not backward compatible if you removed a GraphQL field or dropped a database column.
Yes, added
proxyEmbedstoUserOn a scale of 1-10 how well and how have you QA'd this change and any features it might affect? Please answer below:
8, it's just a link replace but depends on xcancel status.
For frontend changes: Tested on mobile, light and dark mode? Please answer below:
Yes
Did you introduce any new environment variables? If so, call them out explicitly here:
No
Did you use AI for this? If so, how much did it assist you?
No
Note
Adds user-controlled proxy links for 3rd-party embeds (currently Twitter → xcancel) and wires it through UI, GraphQL, validation, and DB.
ProxyLinkcomponent and show alongside item URLs and Twitter embeds incomponents/item.jsandcomponents/embed.js.proxyEmbedscheckbox inpages/settings/index.js.SettingsInputandUserPrivateswithproxyEmbedsinapi/typeDefs/user.js.proxyEmbedsinfragments/users.js.proxyEmbedstosettingsSchemainlib/validate.js.proxyEmbedUrlandTWITTER_URL_REGEXP; use inparseEmbedUrlinlib/url.js.proxyEmbedsboolean tousers(Prisma schema + migration).[data-proxy-link]incomponents/item.module.css.Written by Cursor Bugbot for commit d2f53bc. This will update automatically on new commits. Configure here.