Closed plawatsch closed 8 years ago
Or you could simply look for /web/ instead
You can just use the anchor element to do this. Check out https://gist.github.com/jlong/2428561.
For Emby, we can just do
var urlLower = window.location.href.toLowerCase(); // Example: http://webmail.foo.bar.com:4473/web/stuff
var anchor = document.createElement('a');
anchor.href = urlLower;
var url = parser.protocol + parser.host; // http://webmail.foo.bar.com:4473
Hi,
after quite some debugging i found a nasty bug in the dashboard.
When determining the server address in "manual" mode there are some heuristics being run (in site.js around line 128):
Sadly this breaks if the hostname of the emby instance starts with "web". In my case I had a hostname like "webmail.xxx.yyy.zzz" and instead of correctly turning
https://webmail.xxx.yyy.zzz:someport/web into https://webmail.xxx.yyy.zzz:someport it actually ends up returning https:/
This obviously breaks quite a bit of stuff later on (lots of api requests going to https://emby/foo/bar etc).
I guess a fix could be to simply look for the last instance of "/web" or even better first split off https:// and then run the /web parse on the rest of the string.
I'd be happy to test potential fixes.
kind regards