mirror of
https://github.com/4gray/iptvnator.git
synced 2026-10-11 02:46:16 -08:00
fix: improve URL handling and add validation for EPG source input
This commit is contained in:
1 parent
b3682abd37
commit
d6dd9f14c7
1 file changed
+19
-2
@@ -97,6 +97,14 @@ export class SettingsComponent implements OnInit {
|
||||
id: VideoPlayer.VideoJs,
|
||||
label: 'VideoJs Player',
|
||||
},
|
||||
/* {
|
||||
id: VideoPlayer.DPlayer,
|
||||
label: 'DPlayer',
|
||||
},
|
||||
{
|
||||
id: VideoPlayer.ArtPlayer,
|
||||
label: 'ArtPlayer',
|
||||
}, */
|
||||
...(this.isTauri ? this.osPlayers : []),
|
||||
];
|
||||
|
||||
@@ -180,7 +188,9 @@ export class SettingsComponent implements OnInit {
|
||||
const URL_REGEX = /^(http|https|file):\/\/[^ "]+$/;
|
||||
|
||||
const urls = Array.isArray(epgUrls) ? epgUrls : [epgUrls];
|
||||
const filteredUrls = urls.filter((url) => url !== '');
|
||||
const filteredUrls = urls
|
||||
.map((url) => url.trim())
|
||||
.filter((url) => url !== '');
|
||||
|
||||
filteredUrls.forEach((url) => {
|
||||
this.epgUrl.push(
|
||||
@@ -313,7 +323,14 @@ export class SettingsComponent implements OnInit {
|
||||
* Initializes new entry in form array for EPG URL
|
||||
*/
|
||||
addEpgSource(): void {
|
||||
this.epgUrl.insert(this.epgUrl.length, new FormControl(''));
|
||||
this.epgUrl.insert(
|
||||
this.epgUrl.length,
|
||||
new FormControl('', {
|
||||
validators: [
|
||||
Validators.pattern(/^(http|https|file):\/\/[^ "]+$/),
|
||||
],
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in new issue
Block a user