一分钟搭建影视站,支持Docker等部署方式
fix sourceCode
shinya0d596de3eae2
diff --git a/js/app.js b/js/app.jsindex a24c2a8..4b4c112 100644--- a/js/app.js+++ b/js/app.js@@ -880,7 +880,7 @@ async function showDetails(id, vod_name, sourceCode) {}// 更新播放视频函数,修改为在新标签页中打开播放页面,并保存到历史记录-function playVideo(url, vod_name, episodeIndex = 0, sourceCode) {+function playVideo(url, vod_name, sourceCode, episodeIndex = 0) {// 密码保护校验if (window.isPasswordProtected && window.isPasswordVerified) {if (window.isPasswordProtected() && !window.isPasswordVerified()) {@@ -944,7 +944,7 @@ function playPreviousEpisode(sourceCode) {if (currentEpisodeIndex > 0) {const prevIndex = currentEpisodeIndex - 1;const prevUrl = currentEpisodes[prevIndex];- playVideo(prevUrl, currentVideoTitle, prevIndex, sourceCode);+ playVideo(prevUrl, currentVideoTitle, sourceCode, prevIndex);}}@@ -953,7 +953,7 @@ function playNextEpisode(sourceCode) {if (currentEpisodeIndex < currentEpisodes.length - 1) {const nextIndex = currentEpisodeIndex + 1;const nextUrl = currentEpisodes[nextIndex];- playVideo(nextUrl, currentVideoTitle, nextIndex, sourceCode);+ playVideo(nextUrl, currentVideoTitle, sourceCode, nextIndex);}}@@ -970,7 +970,7 @@ function renderEpisodes(vodName, sourceCode) {// 根据倒序状态计算真实的剧集索引const realIndex = episodesReversed ? currentEpisodes.length - 1 - index : index;return `- <button id="episode-${realIndex}" onclick="playVideo('${episode}','${vodName.replace(/"/g, '"')}', ${realIndex}, ${sourceCode})"+ <button id="episode-${realIndex}" onclick="playVideo('${episode}','${vodName.replace(/"/g, '"')}', ${sourceCode}, ${realIndex})"class="px-4 py-2 bg-[#222] hover:bg-[#333] border border-[#333] rounded-lg transition-colors text-center episode-btn">第${realIndex + 1}集</button>diff --git a/player.html b/player.htmlindex ca3ed88..e6ab137 100644--- a/player.html+++ b/player.html@@ -275,8 +275,8 @@// 保存原始 js‑sha256 实现,避免被 password.js 覆盖window._jsSha256 = window.sha256;</script>- <script src="https://s4.zstatic.net/ajax/libs/hls.js/1.5.6/hls.min.js" integrity="sha256-X1GmLMzVcTBRiGjEau+gxGpjRK96atNczcLBg5w6hKA=" crossorigin="anonymous"></script>- <script src="https://s4.zstatic.net/ajax/libs/dplayer/1.26.0/DPlayer.min.js" integrity="sha256-OJg03lDZP0NAcl3waC9OT5jEa8XZ8SM2n081Ik953o4=" crossorigin="anonymous"></script>+ <script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/hls.min.js" crossorigin="anonymous"></script>+ <script src="https://s4.zstatic.net/ajax/libs/dplayer/1.27.1/DPlayer.min.js" crossorigin="anonymous"></script><script src="js/config.js"></script><script src="js/password.js"></script>@@ -331,7 +331,7 @@const urlParams = new URLSearchParams(window.location.search);const videoUrl = urlParams.get('url');const title = urlParams.get('title');- const sourceCode = urlParams.get('sourceCode');+ const sourceCode = urlParams.get('source_code');let index = parseInt(urlParams.get('index') || '0');const episodesList = urlParams.get('episodes'); // 新增:从URL获取集数信息@@ -398,7 +398,7 @@// 初始化播放器if (videoUrl) {- initPlayer(videoUrl);+ initPlayer(videoUrl, sourceCode);// 尝试从URL参数中恢复播放位置const position = urlParams.get('position');@@ -522,7 +522,7 @@}// 初始化播放器- function initPlayer(videoUrl) {+ function initPlayer(videoUrl, sourceCode) {if (!videoUrl) return;// 配置HLS.js选项@@ -692,7 +692,7 @@});}}- }+ }});// 全屏模式下锁定横屏dp.on('fullscreen', () => {@@ -1054,6 +1054,7 @@// 获取当前URL参数,保留source参数const urlParams = new URLSearchParams(window.location.search);const sourceName = urlParams.get('source') || '';+ const sourceCode = urlParams.get('source_code') || '';// 更新URL,不刷新页面,保留source参数const newUrl = new URL(window.location.href);@@ -1062,6 +1063,9 @@if (sourceName) {newUrl.searchParams.set('source', sourceName);}+ if (sourceCode) {+ newUrl.searchParams.set('source_code', sourceCode);+ }window.history.pushState({}, '', newUrl);// 更新播放器@@ -1078,16 +1082,16 @@playPromise.catch(error => {console.warn('播放失败,尝试重新初始化:', error);// 如果切换视频失败,重新初始化播放器- initPlayer(url);+ initPlayer(url, sourceCode);});}} catch (e) {console.error('切换视频出错,尝试重新初始化:', e);// 如果出错,重新初始化播放器- initPlayer(url);+ initPlayer(url, sourceCode);}} else {- initPlayer(url);+ initPlayer(url, sourceCode);}// 更新UI@@ -1227,6 +1231,7 @@// 尝试从URL中获取参数const urlParams = new URLSearchParams(window.location.search);const sourceName = urlParams.get('source') || '';+ const sourceCode = urlParams.get('source_code') || '';// 获取当前播放进度let currentPosition = 0;@@ -1241,7 +1246,7 @@const videoInfo = {title: currentVideoTitle,// 创建基础URL,使用标题作为唯一标识符- url: `player.html?title=${encodeURIComponent(currentVideoTitle)}&source=${encodeURIComponent(sourceName)}`,+ url: `player.html?title=${encodeURIComponent(currentVideoTitle)}&source=${encodeURIComponent(sourceName)}&source_code=${encodeURIComponent(sourceCode)}`,episodeIndex: currentEpisodeIndex,sourceName: sourceName,timestamp: Date.now(),