一分钟搭建影视站,支持Docker等部署方式
refactor: update clearLocalStorage function to also clear cookies and adjust related UI messages
developer40549e8bb783
diff --git a/index.html b/index.htmlindex 51839f6..3565504 100644--- a/index.html+++ b/index.html@@ -184,7 +184,7 @@<label class="block text-sm font-medium text-gray-400 mb-3 border-b border-[#333] pb-1">一般功能</label><button onclick="importConfig()" class="px-4 py-2 w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 text-white rounded-lg text-sm transition-all duration-300 shadow-md hover:shadow-lg mb-2">导入配置</button><button onclick="exportConfig()" class="px-4 py-2 mb-2 w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 text-white rounded-lg text-sm transition-all duration-300 shadow-md hover:shadow-lg">导出配置</button>- <button onclick="clearLocalStorage()" class="px-4 py-2 w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 text-white rounded-lg text-sm transition-all duration-300 shadow-md hover:shadow-lg">清除页面缓存</button>+ <button onclick="clearLocalStorage()" class="px-4 py-2 w-full bg-gradient-to-r from-indigo-500 via-purple-500 to-pink-500 hover:from-indigo-600 hover:via-purple-600 hover:to-pink-600 text-white rounded-lg text-sm transition-all duration-300 shadow-md hover:shadow-lg">清除Cookie</button></div></div></div>diff --git a/js/config.js b/js/config.jsindex d42e38e..0dc84e8 100644--- a/js/config.js+++ b/js/config.js@@ -73,11 +73,6 @@ const API_SITES = {api: 'https://dbzy.com',name: '豆瓣资源',},- huya: {- api: 'https://www.huyaapi.com',- name: '虎牙资源',- detail: 'https://www.huyaapi.com',- },mozhua: {api: 'https://mozhuazy.com',name: '魔爪资源',diff --git a/js/ui.js b/js/ui.jsindex 757f340..bc05f2e 100644--- a/js/ui.js+++ b/js/ui.js@@ -658,7 +658,7 @@ function clearLocalStorage() {<div class="mb-0"><div class="text-sm font-medium text-gray-300">确定要清除页面缓存吗?</div>- <div class="text-sm font-medium text-gray-300 mb-4">此功能会删除你的观看记录和自定义 API 接口,<scan class="text-red-500 font-bold">此操作不可恢复!</scan></div>+ <div class="text-sm font-medium text-gray-300 mb-4">此功能会删除你的观看记录、自定义 API 接口和 Cookie,<scan class="text-red-500 font-bold">此操作不可恢复!</scan></div><div class="flex justify-end space-x-2"><button id="confirmBoxModal" class="ml-2 bg-gray-600 hover:bg-gray-700 text-white px-4 py-1 rounded">确定</button><button id="cancelBoxModal" class="ml-2 bg-pink-600 hover:bg-pink-700 text-white px-4 py-1 rounded">取消</button>@@ -676,7 +676,18 @@ function clearLocalStorage() {// 添加事件监听器 - 确定按钮document.getElementById('confirmBoxModal').addEventListener('click', function () {+ // 清除所有localStorage数据localStorage.clear();++ // 清除所有cookie+ const cookies = document.cookie.split(";");+ for (let i = 0; i < cookies.length; i++) {+ const cookie = cookies[i];+ const eqPos = cookie.indexOf("=");+ const name = eqPos > -1 ? cookie.substr(0, eqPos).trim() : cookie.trim();+ document.cookie = name + "=;expires=Thu, 01 Jan 1970 00:00:00 GMT;path=/";+ }+modal.innerHTML = `<div class="bg-[#191919] rounded-lg p-6 max-w-md w-full max-h-[90vh] overflow-y-auto relative"><button id="closeBoxModal" class="absolute top-4 right-4 text-gray-400 hover:text-white text-xl">×</button>@@ -684,7 +695,7 @@ function clearLocalStorage() {<h3 class="text-xl font-bold text-white mb-4">提示</h3><div class="mb-4">- <div class="text-sm font-medium text-gray-300 mb-4">页面缓存已清除,3 秒后自动刷新本页面。</div>+ <div class="text-sm font-medium text-gray-300 mb-4">页面缓存和Cookie已清除,3 秒后自动刷新本页面。</div></div></div>`;setTimeout(() => {