Skip to content

Commit 96adfe0

Browse files
committed
feat: document advanced redirect domains
Assisted-by: OpenAI Codex (GPT-5)
1 parent b04c4b8 commit 96adfe0

5 files changed

Lines changed: 57 additions & 3 deletions

File tree

src/css/about.scss

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,16 @@
136136
}
137137
}
138138

139+
.about-redirect-patterns {
140+
code {
141+
font-size: 0.92em;
142+
}
143+
144+
p {
145+
margin: 2px 0 10px;
146+
}
147+
}
148+
139149
.about-logo {
140150
display: block;
141151
width: 52px;

src/i18n/emoji.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,10 @@
5757
"302_js_description": "Experimental redirects to a suitable mirror site.",
5858
"302_go": "302 Backend",
5959
"302_go_description": "Redirect to a participating site using network and health information.",
60+
"302_go_preferences": "Add mirror labels to the domain to prefer or exclude sites.",
61+
"302_go_prefer_one": "Prefer TUNA, with other sites as fallback candidates.",
62+
"302_go_prefer_multiple": "Prefer USTC, then TUNA; the rightmost label has higher priority.",
63+
"302_go_avoid": "Exclude TUNA completely.",
6064
"search": "Experimental Feature: Search Backend",
6165
"search_description": "Find a file path on a mirror site.",
6266
"monitor": "📈 Status",

src/i18n/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
"302_go": "302 Backend",
6060
"302_go_more": "Check help for mirrors for usage",
6161
"302_go_description": "Use one mirror address and be redirected to a participating site based on network location and site status. See mirror help for setup instructions.",
62+
"302_go_preferences": "You can also prefix the domain with mirror labels to express a preference or exclude a site. Paths work as on the regular address; for example, append /debian/ to any domain below.",
63+
"302_go_prefer_one": "Prefer TUNA; if it cannot be used, another candidate may still be selected.",
64+
"302_go_prefer_multiple": "Set an ordered preference list: prefer USTC, then TUNA. Labels farther to the right have higher priority.",
65+
"302_go_avoid": "Exclude TUNA completely and select from the remaining candidates, rather than merely lowering its priority.",
6266
"search": "Experimental Feature: Search Backend",
6367
"search_description": "Search for a file path inside a repository and continue to a mirror site that provides it. Results and availability can vary with synchronization status.",
6468
"monitor": "Service status",

src/i18n/zh.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,10 @@
5959
"302_go": "302 跳转后端",
6060
"302_go_more": "查看镜像帮助文档以使用该后端",
6161
"302_go_description": "使用统一的镜像地址,并根据网络位置和站点状态跳转到合适的参与站点。具体配置方法请查看镜像帮助。",
62+
"302_go_preferences": "还可以在域名前添加镜像站标签,指定偏好或排除特定站点。路径和普通地址相同,例如可在以下域名后继续添加 /debian/。",
63+
"302_go_prefer_one": "优先选择 TUNA;无法使用时仍会从其他候选站点中选择。",
64+
"302_go_prefer_multiple": "设置有顺序的偏好列表:优先选择 USTC,其次选择 TUNA。越靠后的标签优先级越高。",
65+
"302_go_avoid": "完全排除 TUNA,再从其余候选站点中选择,而不只是降低它的优先级。",
6266
"search": "实验性功能: 搜索后端",
6367
"search_description": "按仓库中的路径查找文件,并跳转到能够提供该文件的镜像站。搜索结果和可用性可能随同步状态变化。",
6468
"monitor": "运行状态",

src/ui/About.tsx

Lines changed: 35 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,26 @@ const UrlList = React.memo(({ urls }: { urls: string[] }) => (
5959
</ul>
6060
));
6161

62+
const redirectUrl = (label: string) => {
63+
const url = new URL(config.url);
64+
url.hostname = `${label}.${url.hostname}`;
65+
return url.toString();
66+
};
67+
68+
const RedirectPattern = React.memo(
69+
({ label, description }: { label: string; description: string }) => {
70+
const url = redirectUrl(label);
71+
return (
72+
<li>
73+
<a href={url}>
74+
<code>{new URL(url).hostname}</code>
75+
</a>
76+
<p>{description}</p>
77+
</li>
78+
);
79+
}
80+
);
81+
6282
export default React.memo(
6383
({ site }: { site: { site: Site; parsed: ParsedMirror[] }[] }) => {
6484
const { t } = useTranslation();
@@ -196,9 +216,21 @@ export default React.memo(
196216
<li>
197217
<h3>{t("about.302_go")}</h3>
198218
<p>{t("about.302_go_description")}</p>
199-
{config.about.includes("mirrors_help") && (
200-
<UrlList urls={[config.mirrors_help_url]} />
201-
)}
219+
<p>{t("about.302_go_preferences")}</p>
220+
<ul className="about-redirect-patterns">
221+
<RedirectPattern
222+
label="tuna"
223+
description={t("about.302_go_prefer_one")}
224+
/>
225+
<RedirectPattern
226+
label="tuna-ustc"
227+
description={t("about.302_go_prefer_multiple")}
228+
/>
229+
<RedirectPattern
230+
label="avoidtuna"
231+
description={t("about.302_go_avoid")}
232+
/>
233+
</ul>
202234
</li>
203235
)}
204236
</ul>

0 commit comments

Comments
 (0)