Take a look here https://discussbook.com/ and here view-source:https://discussbook.com/assets/plugin-third-party-6ae2c6dcefb0b7bf8b18b7b7f6c91a8882c9cde5f35e429cf3c2cb85fe77e855.js .
That books integration looks fascinating (though the previews don’t seem to work, I just get an empty lightbox). What I had in mind was oneboxing the preview, but this might also work (when it works), maybe even better.
I will have to look into that source code later to see what in those 1383 lines is relevant here (I am not a programmer).
Are you saying that the whole integration is done only via JS, no discourse plugin?
I have successfully added google books to the iframe whitelist using the whitelist-iframe plugin. and it works just perfectly when pasting the iframe code that google books provides by default.