/!\ Anyone interested in this Gist should look at the work of @danielchc ;)
-> https://gist.github.com/danielchc/c159626485a08c76856b2d30ae457e04
/!\ 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
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)
})
- 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>
# /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>
To be honest, there is no easy way to make Premiere work everywhere. It works for me, but my way may not suit everyone.
Emby server
I use the method described above (webserver with PHP script). I also have a DNS server running on my homelab (Adguard Home) so I pointed mb3admin.com to my local webserver. Nothing more to add to the instructions above.
Don't forget to edit
/opt/emby-server/etc/ssl/certs/ca-certificates.crt
and add your self-signed certificate at the end.Web client
I often use the web client outside my home, so more practical way is to patch the web UI (as described above) and replace mb3admin.com with your public domain pointing to the same web server (mb3.example.com for me) so it will work everywhere. You also need a valid SSL certificate for your custom domain (let's encrypt or just cloudflare will work).
For example (Debian 11 server):
iOS app / Android app
Inside my home network it works with the fake web server and DNS. Outside my home I usually connected to my home network using WireGuard so my DNS and web server are always accessible.
Android TV
As ATV app doesn't accept self-signed certificates and there is no way to install certs to the device (correct me?) I patched the emby app.
You need Android SDK and apktool installed on your computer. Next you disassemble, patch, build and sign the app.
For example (now I use my Windows PC):
Decompile the app:
.\apktool.bat d .\app-google-release.apk
Replace all
mb3admin.com
entries with yourmb3.example.com
domain in files:Build the app:
.\apktool.bat build --output patched.apk .\app-google-release\
Create an aligned APK file:
zipalign 4 .\patched.apk .\patched-sign.apk
Create a sign key:
keytool -genkey -v -keystore my-release-key.keystore -alias alias_name -keyalg RSA -keysize 2048 -validity 10000
Sign the APK:
apksigner.bat sign --ks .\my-keystore.keystore .\patched-sign.apk
Install signed APK to your device.
I'm not sure if you can patch an Apple TV or WebOS app. You also need to patch apps after every update and maintain PHP script with the API changes. IMO, it's not worth to waste time setting up and maintaining a web server, decompiling apps, etc. It was really fun to play with tools and things, but I got the Premiere. It really worth it.