mirror of
https://github.com/tuna/mirror-web.git
synced 2025-12-25 20:32:46 +00:00
fix unlisted mirror help 404
This commit is contained in:
parent
6f39d14069
commit
c81dfd31ed
|
|
@ -1,5 +1,8 @@
|
|||
---
|
||||
---
|
||||
|
||||
const globalOptions = {% include options.json %}.options;
|
||||
|
||||
$(document).ready(() => {
|
||||
$("#help-content")
|
||||
.find('table')
|
||||
|
|
@ -39,9 +42,12 @@ $(document).ready(() => {
|
|||
$.getJSON("/static/tunasync.json", (statusData) => {
|
||||
// remove help items for disabled/removed mirrors
|
||||
let availableMirrorIds = new Set(statusData.map(x => x.name));
|
||||
globalOptions.unlisted_mirrors.forEach(elem => {
|
||||
availableMirrorIds.add(elem.name)
|
||||
});
|
||||
console.log(window.mirrorId);
|
||||
if (!availableMirrorIds.has(window.mirrorId)) {
|
||||
location.href = "/404.html"; // this will break 404 issue submission
|
||||
location.href = "/404-help-hidden.html"; // this will break 404 issue submission
|
||||
}
|
||||
|
||||
$('li').filter((_, node) => node.id && node.id.startsWith("toc-") && !availableMirrorIds.has(node.id.slice(4))).remove();
|
||||
|
|
|
|||
Loading…
Reference in New Issue