leather-io / extension

Leather browser extension
https://leather.io
MIT License
297 stars 142 forks source link

Show HTML previews for inscriptions (e.g. recursive) #4077

Closed markmhendrickson closed 10 months ago

markmhendrickson commented 1 year ago

https://ordinals.hiro.so/sat/390660864168

https://docs.ordinals.com/inscriptions.html#sandboxing

314159265359879 commented 1 year ago

If we want to use this solution to show this inscription https://ordinals.hiro.so/inscription/14effa0e0a947cc05cab869d50626cdaf2ad1cbc05f81dbc8d99cb763116f117i0

As it is displayed on ord.io: image

https://www.ord.io/bc1pd4fjc9cyg8wfgc3x7d3pcxc99tmn6vqw5gstp6hhmputm06rw2tqdqdtxd

Are there any changes needed from the ordinals-api too? Or rather the explorer so it is displayed there similarly too? @rafaelcr

markmhendrickson commented 1 year ago

@kyranjamie thoughts here on whether we can embed HTML previews safely in the wallet somehow, or whether we need to request a preview image (perhaps animated) from the API that can be used instead?

kyranjamie commented 1 year ago

I would be reluctant to add iframes tbh, even if we can have a very strict CSP to lock things down. Is this feature in demand?

Embeddable content just seems like it'd create such as cess pit of scammers.

314159265359879 commented 1 year ago

@kyranjamie I agree we do not want to create such a hole in the wallet for scammers to take advantage of. We should still show some placeholder in the wallet, perhaps even a warning/explanation about the type of ordinal?

314159265359879 commented 1 year ago

I see this PR for embedding iframes which can resolve this https://github.com/leather-wallet/extension/issues/4077

This recursive inscription doesn't load in that build (4269). Perhaps it is using something else. It should be displaying several .svg files on top of each other. Should this be covered by this PR or would that require a different kind of enhancement?

Example inscription: https://ordinals.hiro.so/inscription/6795bcea8de910906a20643a300484005b3df113a9246a43b7408efb8a0036a7i0 text/code of the inscription: `

`

314159265359879 commented 12 months ago

Another example of recursive inscriptions that do no currently show in the wallet, they will appear blank or black.

image

Here are two more examples of an ordinal that doesn't show yet on the Hiro explorer and the code it uses: https://ordinals.hiro.so/inscription/604fec792efe3526a8989d61c44ed52f30bdf5a807a34c86428edf1700055bcei0 https://ordinals.hiro.so/inscription/30a2fdd98d363d182f75ce96ddc6b3ffe1eeb29d2a05e748a208a49b033557a2i0

image

This is the original inscription being expected to be displayed recursively via the code in #32321985 (and #...88): https://ordinals.hiro.so/inscription/604fec792efe3526a8989d61c44ed52f30bdf5a807a34c86428edf1700055bcei0


This is an example of an ordinal showing up black in the wallet, although displaying correctly on explorer.hiro.so: https://ordinals.hiro.so/inscription/efba55d53fb0f11d091ee0eca2f8d5a0fab4d4fdde35733d03c40f9c5c429dd0i0

image

This is what is displayed in ordiscan.com (see code and submodules, avif and js) image

Is it safe to show this in the wallet? if not can we display a message about that in the wallet instead to help users understand why it is blank/black instead of displaying their inscription image?

314159265359879 commented 11 months ago

The owner of this inscription would like this displayed as an image if possible. It is a cursed recursive inscription:

Note the difference in short inscription number, reported here: https://github.com/hirosystems/ordhook/issues/202

https://ordinals.hiro.so/inscription/81433a25e784366a7db917af98393be6eba232a03646e1fc072904fc3b8803b2i2 image

https://www.ord.io/81433a25e784366a7db917af98393be6eba232a03646e1fc072904fc3b8803b2i2 image

markmhendrickson commented 11 months ago

We discussed this earlier this week with @kyranjamie and @janniks and concluded that it seems safe to attempt an iframing approach for HTML inscriptions, one in which iframes are loaded only when in view / within the viewport, to avoid possible performance issues to loading many on a given screen as the user scrolls.