From d688f4c644f59eeb12c468727cfe129a7bebc253 Mon Sep 17 00:00:00 2001 From: Zenithal Date: Wed, 19 Apr 2023 18:49:23 +0000 Subject: [PATCH] help: redirect remove/disbled mirror to mirrorz help --- _config.yml | 1 + static/js/help.es6 | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/_config.yml b/_config.yml index b8326b9..bceb2a7 100644 --- a/_config.yml +++ b/_config.yml @@ -35,6 +35,7 @@ hide_server_status: false hide_mirrorz: false mirrorz_desc: 校园网联合镜像站 mirrorz_link: "https://mirrors.cernet.edu.cn/list" +mirrorz_help_link: "https://help.mirrors.cernet.edu.cn/" # Build settings highlighter: rouge diff --git a/static/js/help.es6 b/static/js/help.es6 index 466587c..207c60f 100644 --- a/static/js/help.es6 +++ b/static/js/help.es6 @@ -57,7 +57,11 @@ $(document).ready(() => { }); console.log(window.mirrorId); if (!availableMirrorIds.has(window.mirrorId)) { - location.href = "/404-help-hidden.html"; // this will break 404 issue submission + if ({{ site.hide_mirrorz }}) { + location.href = "/404-help-hidden.html"; // this will break 404 issue submission + } else { + location.href = "{{ site.mirrorz_help_link }}" + window.mirrorId; // TODO: convert this to mirrorz cname + } } $('li').filter((_, node) => node.id && node.id.startsWith("toc-") && !availableMirrorIds.has(node.id.slice(4))).remove();