Drewpeifer / medialytics

A basic, free tool that shows information about Plex Media Server content
GNU General Public License v3.0
114 stars 9 forks source link

Feature Request: Ability to add to iFrame #20

Closed Healzangels closed 4 months ago

Healzangels commented 5 months ago

Greetings!

First wanted to say thank you for sharing such a cool tool/neat project!

Recently setup and everything has been working out great. One feature I was hoping to see if it would be possible to add would be the ability to have medialytics present in an iFrame.

My use case here would be having medialytics embedded into an Organizr iFrame so I could at a glance check charts without navigating to a new tab. Currently seeing the error of "Refused to display in a frame because it set 'X-Frame-Options' to 'sameorigin'."

I know in other applications etc there are often times to allow X-Frame-Options etc but I could also be overlooking something I could configure now within my Reverse Proxy settings of NPM

Thanks again for the awesome app and look forward to following the project. - Cheers!

Drewpeifer commented 4 months ago

Hi, thanks for trying it out, I appreciate the feedback! Typically x-origin / CORS / iframe configuration is handled by the server that is serving a page, but medialytics is built to be entirely client-side so I haven't included any server-side configuration. Just as a proof of concept, if you download the code to your local machine, add a new "test" html page in the /app directory, and include the following snippet, you should see medialytics render in the iframe on the new test page: <iframe src="index.html" width="100%" height="500px"></iframe>

This is because it's being served from your local machine to your local machine directly. So as far as I know, I don't think there's anything that needs to change in the codebase for your use case, but to be fair I'm not very familiar with Organizr. If the Organizr iframe can access the relative URL of medialytics index.html file directly (e.g. they are in the same container/environment) you should just need to edit the src to match that URL. If Organizr can't access the environment that contains / serves medialytics, you would have to add x-origin headers to the environment that is serving medialytics.

FTR I'm not an expert in CORS or Docker really so apologies if I've missed something here.