pektoral 17 Posted May 30, 2023 Share Posted May 30, 2023 Hallo zusammen, das es anscheinend niemanden groß interresiert das Emby immer noch alle Bilder ohne Authentifizierung ausliefert, habe ich mir hier was schnell selbst gebaut. Vielleicht kann es ja mal jemand gebrauchen.... Folgendes Prinzip habe ich dabei verwendet: Umleitung aller Emby Image Requests über Reverse Proxy (Nginx) auf ein PHP Script, prüfen ob User IP eingeloggt ist und Bilder ausliefern oder Zugriff verweigern. 1. Neuen Api Key in Emby anlegen, diesen Key kopieren 2. Php Script process.php wie folgt anlegen und auf den Nginx Proxy kopieren <?php $url = strip_tags($_SERVER['QUERY_STRING']); $url = str_replace('Primary&','Primary?',$url); $url = str_replace('Backdrop&','Backdrop?',$url); $url = str_replace('Banner&','Banner?',$url); $url = str_replace('Logo&','Logo?',$url); $url = str_replace('Thumb&','Thumb?',$url); $url = str_replace('Disc&','Disc?',$url); $url = str_replace('/0&','/0?',$url); $query = parse_url($url, PHP_URL_QUERY); parse_str($query, $result); $data = file_get_contents('http://127.0.0.1:8096/emby/Sessions?api_key=EMBY API KEY'); $decodedData = json_decode($data); foreach($decodedData as $d) { if ($result['ip'] == $d->RemoteEndPoint) { $size = getimagesize('http://127.0.0.1:8096'.$url); if (size) { header('Content-Type: '.$size['mime']); header('Content-Length: '.filesize('http://127.0.0.1:8096'.$url)); readfile('http://127.0.0.1:8096'.$url); exit; } } } echo 'Access denied!'; ?> 3. Emby Nginx Config anpassen (vor die Location /): location ~ /Images/ { rewrite (.*?)/Images/(.*?)$ /process.php?$1/Images/$2&ip=$remote_addr break; proxy_pass http://127.0.0.1; } Bitte beachten, das ganze dient nur als techn. Beispiel und kann, bzw. muss entprechend angepasst werden! pektoral 2 Link to comment Share on other sites More sharing options...
Luke 37112 Posted May 30, 2023 Share Posted May 30, 2023 hi, yes we are working on improving this. Thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now