From b57d723d62fbbb5e287c14769ff3a034daa1af90 Mon Sep 17 00:00:00 2001 From: rainbow napkin Date: Sat, 1 Nov 2025 07:45:23 -0400 Subject: [PATCH] Fixed client-side IACDN setting. --- www/js/channel/channel.js | 1 + www/js/channel/panels/settingsPanel.js | 2 +- www/js/channel/player.js | 16 +++++++++++----- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/www/js/channel/channel.js b/www/js/channel/channel.js index 8bc9a24..5d50499 100644 --- a/www/js/channel/channel.js +++ b/www/js/channel/channel.js @@ -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(); } diff --git a/www/js/channel/panels/settingsPanel.js b/www/js/channel/panels/settingsPanel.js index d3949ef..e9f0519 100644 --- a/www/js/channel/panels/settingsPanel.js +++ b/www/js/channel/panels/settingsPanel.js @@ -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'); diff --git a/www/js/channel/player.js b/www/js/channel/player.js index 612d946..3303b14 100644 --- a/www/js/channel/player.js +++ b/www/js/channel/player.js @@ -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") != ""){ - //Generate and set new link - //data.media.rawLink = data.media.rawLink.replace("https://archive.org/download", `https://${localStorage.getItem("IACDN")}.archive.org/0/items`); + 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.combo[linkIndex][1] = link.replace("https://archive.org/download", `https://${localStorage.getItem("IACDN")}.archive.org/0/items`); + } } }