Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion site/_app.html
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ <h1 class="title" id="where"></h1>
</script>
<script src="/assets/i18n.js?v=da677fcb"></script>
<script src="/assets/source-switch.js?v=220d0618"></script>
<script src="/assets/mirror-health.js?v=f3b4e464"></script>
<script src="/assets/mirror-health.js?v=455ace54"></script>

<script>

Expand Down
33 changes: 19 additions & 14 deletions site/assets/mirror-health.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
// Cells marked data-mirror-host (the mirrors page) show each mirror's worst state, and #mirror-facts (the
// status page) gets one row per mirror with each tree's state. A failed or slow request changes nothing, and
// neither does an answer whose mirror check is older than STALE seconds, since its marks may no longer hold;
// the status page then swaps its rows for #mirror-failed, which points to the status site.
// the status page then swaps its rows for #mirror-failed, which points to the status site. A mirror in RELAY
// answers with a redirect to another mirror and holds no files, so the lag the API measures through it is
// that mirror's: only whether it is reachable counts, and the status page gives it no row.
(function () {
'use strict';
var API = 'https://status.gentoozh.org/api/status';
Expand All @@ -18,15 +20,16 @@
var STALE = 2 * 3600;
var TEXT = {
'zh-cn': { behind: '落后约 {h} 小时', down: '上次检查时无法连接', ok: '已同步', gone: '无法连接',
pending: '尚未同步最新版',
pending: '尚未同步最新版', relay: '重定向至其他镜像站',
checked: '检查于 ' },
'zh-tw': { behind: '落後約 {h} 小時', down: '上次檢查時無法連線', ok: '已同步', gone: '無法連線',
pending: '尚未同步最新版',
pending: '尚未同步最新版', relay: '重新導向至其他鏡像站',
checked: '檢查於 ' },
en: { behind: 'About {h} hours behind', down: 'Unreachable at the last check', ok: 'In sync', gone: 'Unreachable',
pending: 'Latest not synced yet',
pending: 'Latest not synced yet', relay: 'Redirects to other mirrors',
checked: 'Checked ' },
};
var RELAY = { 'mirrors.cernet.edu.cn': true };
// The status page names each mirror by the mirrors page's i18n keys; an unlisted host shows as itself.
var NAMES = {
'ftp2.osuosl.org': 'mOsuosl', 'mirrors.cernet.edu.cn': 'mCernet', 'mirror.nju.edu.cn': 'mNju',
Expand Down Expand Up @@ -58,21 +61,22 @@
return stale > GRACE ? 'behind' : 'pending';
}

// One API entry as { down, level, stale, up, trees }, given ages, the age of the origin's newest index by
// tree: level the worst tree's (down, behind, pending or ok), down when that is down, stale the largest
// staleness of a tree that is behind, up the mirror's own flag, and trees each tree as { key, up, stale,
// level } with stale null when in sync.
// One API entry as { down, level, stale, up, relay, trees }, given ages, the age of the origin's newest index
// by tree: level the worst tree's (down, behind, pending or ok), down when that is down, stale the largest
// staleness of a tree that is behind, up the mirror's own flag, relay whether it is in RELAY, and trees each
// tree as { key, up, stale, level } with stale null when in sync or when the mirror is a relay.
function state(m, ages) {
var up = m.up !== false, worst = up ? 'ok' : 'down', stale = 0, trees = [];
var relay = RELAY[String(m.host || '').toLowerCase()] === true;
(m.trees || []).forEach(function (tr) {
if (!tr) return;
var key = String(tr.key || ''), s = staleness(tr.lagSec, ages && ages[key]);
var key = String(tr.key || ''), s = relay ? null : staleness(tr.lagSec, ages && ages[key]);
var t = { key: key, up: tr.up !== false, stale: s, level: level(!up || tr.up === false, s) };
if (RANK[t.level] > RANK[worst]) worst = t.level;
if (t.level === 'behind' && s > stale) stale = s;
trees.push(t);
});
return { down: worst === 'down', level: worst, stale: stale, up: up, trees: trees };
return { down: worst === 'down', level: worst, stale: stale, up: up, relay: relay, trees: trees };
}

// The answer as { at, hosts, list }: at when the check ran, hosts each mirror's state by lowercase host,
Expand Down Expand Up @@ -104,10 +108,10 @@
return lv === 'pending' ? t.pending : t.ok;
}

// A mirror's tooltip, only when it is down or behind, and its cell text.
// A mirror's tooltip, only when it is down or behind, and its cell text; a reachable relay says it redirects.
function words(s) {
var note = s.level === 'down' ? TEXT[lang()].down : s.level === 'behind' ? say(s.level, s.stale) : '';
return { note: note, cell: say(s.level, s.stale) };
return { note: note, cell: s.relay && !s.down ? TEXT[lang()].relay : say(s.level, s.stale) };
}

function escape(s) {
Expand All @@ -118,10 +122,11 @@


// The status page's rows, in the markup of status-data.js's fact(): the mirror, each tree's state, and
// when the check ran, in that script's relative wording when it is on the page.
// when the check ran, in that script's relative wording when it is on the page. The origin and relays
// have no sync state of their own and get no row.
function rows(h) {
var t = TEXT[lang()], age = window.MirrorStatus && window.MirrorStatus.age;
return h.list.filter(function (m) { return !m.origin; }).map(function (m) {
return h.list.filter(function (m) { return !m.origin && !m.relay; }).map(function (m) {
var key = NAMES[m.host];
var name = key && typeof window.MIRROR_T === 'function' ? window.MIRROR_T(key) : '';
var body = m.trees.map(function (tr) {
Expand Down
2 changes: 1 addition & 1 deletion site/binpkg-setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -506,7 +506,7 @@ <h2 id="key-download" data-i18n="q11">不安装 sec-keys 软件包时,如何
<script src="/assets/mode-switch.js?v=82bc392a"></script>
<script src="/assets/sudo-switch.js?v=281123b7"></script>
<script src="/assets/source-switch.js?v=220d0618"></script>
<script src="/assets/mirror-health.js?v=f3b4e464"></script>
<script src="/assets/mirror-health.js?v=455ace54"></script>
<script src="/assets/channel-switch.js?v=02d31d74"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion site/distfiles-setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -311,6 +311,6 @@ <h2 id="setup" data-i18n="h2setup">配置</h2>
<script src="/assets/mode-switch.js?v=82bc392a"></script>
<script src="/assets/sudo-switch.js?v=281123b7"></script>
<script src="/assets/source-switch.js?v=220d0618"></script>
<script src="/assets/mirror-health.js?v=f3b4e464"></script>
<script src="/assets/mirror-health.js?v=455ace54"></script>
</body>
</html>
6 changes: 3 additions & 3 deletions site/faq.html
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ <h2 id="mirrors" data-i18n-html="faqMirrors">镜像</h2>
<h3 id="q8" data-i18n="q8">中国大陆有哪些镜像,分别怎么配置?</h3>
<p data-i18n-html="s8">可使用教育网联合镜像站、南京大学、南阳理工学院和河南教育网等镜像,地址见<a href="/mirrors">镜像列表</a>。overlay 的 Git 仓库、distfiles 与 binary package 需分别配置,见 <a href="/overlay#adding-overlay">overlay 指南</a>、<a href="/distfiles-setup#setup">配置 distfiles</a> 和<a href="/binpkg-setup#setup">配置 binary package</a>。</p>
<h3 id="cernet-redirect" data-i18n-html="cernetRedirect">使用教育网联合镜像站时,为什么 Git 提示重定向?</h3>
<p data-i18n-html="cernetRedirectAnswer">教育网联合镜像站将请求重定向到就近的成员站,本身不保存文件。因此,Git 提示重定向是正常现象。</p>
<p data-i18n-html="cernetRedirectAnswer">教育网联合镜像站将请求重定向到就近的其他镜像站,本身不保存文件。因此,Git 提示重定向是正常现象。</p>
<h3 id="mirror-sync" data-i18n-html="mirrorSync">为什么各镜像的版本不一致?</h3>
<p data-i18n-html="mirrorSyncAnswer">各镜像按自己的计划同步,进度可能不同。某个镜像版本偏旧时,可换另一个镜像再同步;ISO 请选择对应目录中的最新版本。地址见<a href="/mirrors#list">镜像列表</a>。</p>
<h3 id="q9" data-i18n="q9">如何自行建立镜像?</h3>
Expand Down Expand Up @@ -348,7 +348,7 @@ <h3 id="q9" data-i18n="q9">如何自行建立镜像?</h3>
"overlaySyncAnswer": "2025 年 10 月起,Gentoo 官方不再為第三方倉庫提供快取鏡像。此前加入的 gentoo-zh 倉庫需更新同步來源。舊的 <code>microcai/gentoo-zh</code> 位址會重新導向 <code>gentoo-zh/overlay</code>,手動設定過 remote 的使用者也應更新位址。",
"overlaySyncLinks": "設定步驟見 <a href=\"/overlay#adding-overlay\">overlay 指南</a>;背景見<a href=\"https://gentoozh.org/posts/2025-10-07-thirdparty-repo-mirror-removal/\">快取鏡像停用說明</a>與<a href=\"https://gentoozh.org/posts/2026-07-02-gentoo-zh-repo-migration/\">倉庫遷移記錄</a>。",
"cernetRedirect": "使用教育網聯合鏡像站時,為什麼 Git 提示重新導向?",
"cernetRedirectAnswer": "教育網聯合鏡像站將請求重新導向鄰近的成員站,本身不儲存檔案。因此,Git 提示重新導向是正常現象。",
"cernetRedirectAnswer": "教育網聯合鏡像站將請求重新導向鄰近的其他鏡像站,本身不儲存檔案。因此,Git 提示重新導向是正常現象。",
"mirrorSync": "為什麼各鏡像的版本不一致?",
"mirrorSyncAnswer": "各鏡像依自己的排程同步,進度可能不同。某個鏡像版本偏舊時,可換另一個鏡像再同步;ISO 請選擇對應目錄中的最新版本。位址見<a href=\"/mirrors#list\">鏡像列表</a>。",
"binpkgKeyring": "匯入公鑰時出現 no writable keyring found,怎麼辦?",
Expand Down Expand Up @@ -416,7 +416,7 @@ <h3 id="q9" data-i18n="q9">如何自行建立镜像?</h3>
"overlaySyncAnswer": "Since October 2025, Gentoo no longer provides cache mirrors for third-party repositories. Update the sync source if you added gentoo-zh before then. The old <code>microcai/gentoo-zh</code> URL redirects to <code>gentoo-zh/overlay</code>; update manually configured remotes too.",
"overlaySyncLinks": "See the <a href=\"/overlay#adding-overlay\">overlay setup steps</a>, <a href=\"https://gentoozh.org/posts/2025-10-07-thirdparty-repo-mirror-removal/\">cache mirror retirement notice</a> and <a href=\"https://gentoozh.org/posts/2026-07-02-gentoo-zh-repo-migration/\">repository migration record</a>.",
"cernetRedirect": "Why does Git report a redirect when using CERNET?",
"cernetRedirectAnswer": "CERNET does not store the files itself. It redirects requests to a nearby member mirror, so Git’s redirect message is expected.",
"cernetRedirectAnswer": "CERNET does not store the files itself. It redirects requests to a nearby mirror, so Git’s redirect message is expected.",
"mirrorSync": "Why do mirrors have different versions?",
"mirrorSyncAnswer": "Mirrors synchronise on separate schedules. If a mirror has an older version, try another mirror and sync again. For ISOs, select the latest version in the directory. See the <a href=\"/mirrors#list\">mirror list</a>.",
"binpkgKeyring": "How do I fix no writable keyring found when importing the key?",
Expand Down
2 changes: 1 addition & 1 deletion site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ <h2 id="guide" data-i18n="h2start">开始使用</h2>
<script src="/assets/i18n.js?v=da677fcb"></script>
<script src="/assets/sudo-switch.js?v=281123b7"></script>
<script src="/assets/source-switch.js?v=220d0618"></script>
<script src="/assets/mirror-health.js?v=f3b4e464"></script>
<script src="/assets/mirror-health.js?v=455ace54"></script>
<script src="/assets/status-data.js?v=b07c7c3e"></script>

</body>
Expand Down
2 changes: 1 addition & 1 deletion site/internal/design.html
Original file line number Diff line number Diff line change
Expand Up @@ -1038,7 +1038,7 @@ <h2 id="credits" data-i18n="hCredit">来源与致谢</h2>
<script src="/assets/i18n.js?v=da677fcb"></script>
<script src="/assets/sudo-switch.js?v=281123b7"></script>
<script src="/assets/source-switch.js?v=220d0618"></script>
<script src="/assets/mirror-health.js?v=f3b4e464"></script>
<script src="/assets/mirror-health.js?v=455ace54"></script>
<script>
(function () {
// render-chrome.py writes the palettes and the zh-cn sizes from tokens.css for readers without scripts;
Expand Down
2 changes: 1 addition & 1 deletion site/mirrors.html
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,6 @@ <h2 id="own" data-i18n="q9">如何自行建立镜像?</h2>
};
</script>
<script src="/assets/i18n.js?v=da677fcb"></script>
<script src="/assets/mirror-health.js?v=f3b4e464"></script>
<script src="/assets/mirror-health.js?v=455ace54"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion site/overlay.html
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,6 @@ <h2 id="notes" data-i18n="overlay_065">注意事项</h2>
<script src="/assets/i18n.js?v=da677fcb"></script>
<script src="/assets/sudo-switch.js?v=281123b7"></script>
<script src="/assets/source-switch.js?v=220d0618"></script>
<script src="/assets/mirror-health.js?v=f3b4e464"></script>
<script src="/assets/mirror-health.js?v=455ace54"></script>
</body>
</html>
2 changes: 1 addition & 1 deletion site/status.html
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,6 @@ <h2 id="mirrors" data-i18n="h2mirrors">镜像同步</h2>
</script>
<script src="/assets/i18n.js?v=da677fcb"></script>
<script src="/assets/status-data.js?v=b07c7c3e"></script>
<script src="/assets/mirror-health.js?v=f3b4e464"></script>
<script src="/assets/mirror-health.js?v=455ace54"></script>
</body>
</html>
Loading
Loading