From c81dfd31ede498fe12a9b44faf11ed25a4345364 Mon Sep 17 00:00:00 2001 From: Peiran Yao Date: Wed, 15 Jul 2020 17:15:52 -0600 Subject: [PATCH] fix unlisted mirror help 404 --- static/js/help.es6 | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/static/js/help.es6 b/static/js/help.es6 index 957d559..c684201 100644 --- a/static/js/help.es6 +++ b/static/js/help.es6 @@ -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();