Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yashodhank/26e412c529ec4a5c98030bf8bf25e4fc to your computer and use it in GitHub Desktop.
Save yashodhank/26e412c529ec4a5c98030bf8bf25e4fc to your computer and use it in GitHub Desktop.
Emby Theater premiere bypass

DNS

/!\ I used bind9 on my local server to add mb3admin.com entry for all devices ( like android app ) Otherwise in hosts fie :

<your_server> mb3admin.com

Optionnal (electron app - Emby Theater) main.js update

C:\Users\<YOUR_USER>\AppData\Roaming\Emby-Theater\system\electronapp
Add after app.on('window-all-closed', function () { block L:18
To accept self certificate

app.on('certificate-error', (event, webContents, url, error, certificate, callback) => {
        event.preventDefault()
        callback(true)
})

On your web server

  • Create /var/www/mb3admin.com folder
  • In /var/www/mb3admin.com/ create file index.php with
<?php
if (false){
	$file = 'data.log';
	$content = file_get_contents($file);
	$content .= date('Y-m-d H:i:s').' : '.$_SERVER['REMOTE_ADDR'].' URL : '.$_SERVER['REDIRECT_URL'].' Query : '.json_encode($_REQUEST)."\r\n";
	file_put_contents($file, $content);
}

if ($_SERVER['REDIRECT_URL'] == '/admin/service/registration/validate'){
	header('content-type:application/json');
	$date = new DateTime();
	$date->add(new DateInterval('P14D'));
	echo '{"featId":"'.$_POST['feature'].'","registered":true,"expDate":"'.$date->format('Y-m-d').'","key":"'.$_POST['key'].'"}';
	
}elseif ($_SERVER['REDIRECT_URL'] == '/admin/service/registration/validateDevice'){
	header('content-type:application/json');
	echo '{"cacheExpirationDays":21,"resultCode":"GOOD","message":"Device Valid"}';
}
  • Create file .htaccess
Allow from all Options -Indexes <IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
    Options -MultiViews
</IfModule>
<IfModule mod_headers.c>
    Header set Access-Control-Allow-Origin "*"
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L] </IfModule>

Apache site conf

# /etc/apache2/sites-enabled/mb3admin.conf
<VirtualHost *:80>
        DocumentRoot "/var/www/mb3admin.com"
        ServerName mb3admin.com

        <Directory "/var/www/mb3admin.com/">
                Options MultiViews FollowSymlinks

                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
        TransferLog /var/log/apache2/mb3admin_access.log
        ErrorLog /var/log/apache2/mb3admin_error.log
</VirtualHost>

<VirtualHost *:443>
        DocumentRoot "/var/www/mb3admin.com"
        ServerName mb3admin.com

        SSLEngine on
        SSLCertificateFile      /etc/apache2/mb3admin.crt # Self signed certificate
        SSLCertificateKeyFile /etc/apache2/mb3admin.key


        <Directory "/var/www/mb3admin.com/">
                Options MultiViews FollowSymlinks

                AllowOverride All
                Order allow,deny
                Allow from all
        </Directory>
        TransferLog /var/log/apache2/mb3admin_access.log
        ErrorLog /var/log/apache2/mb3admin_error.log
</VirtualHost>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment