feat(xtream): use protocol, host, port, ignore params for serverUrl

This commit is contained in:
4gray committed 2024-09-03 21:59:48 +02:00
1 parent 789bf461e5
commit 41a187c6ba
1 file changed
+9 -1
@@ -62,8 +62,16 @@ export class XtreamCodeImportComponent {
store = inject(Store);
addPlaylist() {
const serverUrlAsString = this.form.value.serverUrl as string;
const url = new URL(serverUrlAsString);
const serverUrl = `${url.protocol}//${url.hostname}${url.port ? ':' + url.port : ''}`;
this.store.dispatch(
addPlaylist({ playlist: this.form.value as Playlist })
addPlaylist({
playlist: {
...this.form.value,
serverUrl,
} as Playlist,
})
);
this.addClicked.emit();
}