Don't overwrite base path when constructing paths (#240)

* Don't overwrite base path for WebSockets

* Take base path into account while constructing stream URL
This commit is contained in:
sssionek 2023-11-19 09:18:06 -05:00 committed by GitHub
parent b3908a4130
commit 18af088774
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 2 additions and 2 deletions

View File

@ -18,7 +18,7 @@ export class JellyfinStreamBuilderService {
const accessToken = this.jellyfinService.getApi().accessToken; const accessToken = this.jellyfinService.getApi().accessToken;
const uri = new URL(api.basePath); const uri = new URL(api.basePath);
uri.pathname = `/Audio/${jellyfinItemId}/universal`; uri.pathname += `/Audio/${jellyfinItemId}/universal`;
uri.searchParams.set('UserId', this.jellyfinService.getUserId()); uri.searchParams.set('UserId', this.jellyfinService.getUserId());
uri.searchParams.set( uri.searchParams.set(
'DeviceId', 'DeviceId',

View File

@ -154,7 +154,7 @@ export class JellyfinWebSocketService implements OnModuleDestroy {
private buildSocketUrl(baseName: string, apiToken: string, device: string) { private buildSocketUrl(baseName: string, apiToken: string, device: string) {
const url = new URL(baseName); const url = new URL(baseName);
url.pathname = '/socket'; url.pathname += '/socket';
url.protocol = url.protocol.replace('http', 'ws'); url.protocol = url.protocol.replace('http', 'ws');
url.search = `?api_key=${apiToken}&deviceId=${device}`; url.search = `?api_key=${apiToken}&deviceId=${device}`;
return url; return url;