Fixed client-side IACDN setting.
This commit is contained in:
parent
ccb1d91a5b
commit
b57d723d62
|
|
@ -242,6 +242,7 @@ class channel{
|
|||
|
||||
//If we're playing a video from Internet Archive
|
||||
if(nowPlaying != null && nowPlaying.type == 'ia'){
|
||||
console.log("RELOAD");
|
||||
//Hard reload the media, forcing media handler re-creation
|
||||
this.player.hardReload();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ class settingsPanel extends panelObj{
|
|||
//If we hit enter
|
||||
if(event.key == "Enter"){
|
||||
//If we have an invalid server string
|
||||
if(!(this.iaCDN.value.match(/^ia[0-9]{6}\...$/g) || this.iaCDN.value == "")){
|
||||
if(!(this.iaCDN.value.match(/^(ia|dn)[0-9]{6}\...$/g) || this.iaCDN.value == "")){
|
||||
//reset back to what was set before
|
||||
this.iaCDN.value = localStorage.getItem('IACDN');
|
||||
|
||||
|
|
|
|||
|
|
@ -192,15 +192,21 @@ class player{
|
|||
this.mediaHandler = new hlsDailymotionHandler(this.client, this, data.media);
|
||||
//Otherwise, if we have a raw-file compatible source
|
||||
}else if(data.media.type == 'ia' || data.media.type == 'raw' || data.media.type == 'yt' || data.media.type == 'dm'){
|
||||
|
||||
//If we're running a source from IA
|
||||
if(data.media.type == 'ia'){
|
||||
//Replace specified CDN with generic URL, in-case of hard reload
|
||||
//data.media.rawLink = data.media.rawLink.replace(/^https(.*)archive\.org(.*)items/g, "https://archive.org/download")
|
||||
|
||||
//If we have an IA source and a custom IA CDN Server set
|
||||
if(data.media.type == 'ia' && localStorage.getItem("IACDN") != ""){
|
||||
for(const linkIndex in data.media.rawLink.combo){
|
||||
//Pull link to sprinkle on dat syntatic sugar (tasty)
|
||||
let link = data.media.rawLink.combo[linkIndex][1]
|
||||
|
||||
//Replace specified CDN with generic URL, in-case of hard reload
|
||||
link = link.replace(/^https(.*)archive\.org(.*)items/g, "https://archive.org/download");
|
||||
|
||||
//Generate and set new link
|
||||
//data.media.rawLink = data.media.rawLink.replace("https://archive.org/download", `https://${localStorage.getItem("IACDN")}.archive.org/0/items`);
|
||||
data.media.rawLink.combo[linkIndex][1] = link.replace("https://archive.org/download", `https://${localStorage.getItem("IACDN")}.archive.org/0/items`);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue