Update server.js
Browse files
server.js
CHANGED
|
@@ -45,8 +45,41 @@ app.use((req, res, next) => {
|
|
| 45 |
|
| 46 |
// 选择所有API源
|
| 47 |
if (typeof API_SITES !== 'undefined') {
|
|
|
|
| 48 |
window.selectedAPIs = Object.keys(API_SITES).filter(key => key !== 'aggregated' && key !== 'custom');
|
| 49 |
localStorage.setItem('selectedAPIs', JSON.stringify(window.selectedAPIs));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 50 |
}
|
| 51 |
|
| 52 |
// 默认关闭黄色内容过滤
|
|
@@ -85,8 +118,13 @@ app.use((req, res, next) => {
|
|
| 85 |
window.updateDoubanVisibility();
|
| 86 |
}
|
| 87 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 88 |
console.log('已应用强制设置');
|
| 89 |
-
},
|
| 90 |
});
|
| 91 |
</script>
|
| 92 |
`;
|
|
|
|
| 45 |
|
| 46 |
// 选择所有API源
|
| 47 |
if (typeof API_SITES !== 'undefined') {
|
| 48 |
+
// 获取所有API源的键(不包括自定义API和aggregated)
|
| 49 |
window.selectedAPIs = Object.keys(API_SITES).filter(key => key !== 'aggregated' && key !== 'custom');
|
| 50 |
localStorage.setItem('selectedAPIs', JSON.stringify(window.selectedAPIs));
|
| 51 |
+
|
| 52 |
+
// 延迟执行,确保界面元素加载完成
|
| 53 |
+
setTimeout(function() {
|
| 54 |
+
// 选择所有API复选框
|
| 55 |
+
const apiCheckboxes = document.querySelectorAll('#apiCheckboxes input[type="checkbox"]');
|
| 56 |
+
apiCheckboxes.forEach(checkbox => {
|
| 57 |
+
checkbox.checked = true;
|
| 58 |
+
});
|
| 59 |
+
|
| 60 |
+
// 选择所有自定义API复选框
|
| 61 |
+
const customApiCheckboxes = document.querySelectorAll('#customApisList input[type="checkbox"]');
|
| 62 |
+
customApiCheckboxes.forEach(checkbox => {
|
| 63 |
+
checkbox.checked = true;
|
| 64 |
+
|
| 65 |
+
// 获取自定义API索引并添加到selectedAPIs
|
| 66 |
+
const customIndex = checkbox.dataset.customIndex;
|
| 67 |
+
if (customIndex) {
|
| 68 |
+
const customApiId = 'custom_' + customIndex;
|
| 69 |
+
if (!window.selectedAPIs.includes(customApiId)) {
|
| 70 |
+
window.selectedAPIs.push(customApiId);
|
| 71 |
+
}
|
| 72 |
+
}
|
| 73 |
+
});
|
| 74 |
+
|
| 75 |
+
// 更新selectedAPIs到localStorage
|
| 76 |
+
localStorage.setItem('selectedAPIs', JSON.stringify(window.selectedAPIs));
|
| 77 |
+
|
| 78 |
+
// 如果存在updateSelectedApiCount函数,更新API计数显示
|
| 79 |
+
if (typeof updateSelectedApiCount === 'function') {
|
| 80 |
+
updateSelectedApiCount();
|
| 81 |
+
}
|
| 82 |
+
}, 500);
|
| 83 |
}
|
| 84 |
|
| 85 |
// 默认关闭黄色内容过滤
|
|
|
|
| 118 |
window.updateDoubanVisibility();
|
| 119 |
}
|
| 120 |
|
| 121 |
+
// 尝试调用全选API的函数
|
| 122 |
+
if (typeof selectAllAPIs === 'function') {
|
| 123 |
+
selectAllAPIs(true);
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
console.log('已应用强制设置');
|
| 127 |
+
}, 800);
|
| 128 |
});
|
| 129 |
</script>
|
| 130 |
`;
|