Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
a5d3cf5cd7 |
No files matched your search
@@ -0,0 +1,10 @@
|
||||
{
|
||||
"domains": [
|
||||
{ "domain": "福云.com", "role": "primary", "access": "requires_proxy", "domainhub": "fuc.main-cn" },
|
||||
{ "domain": "fuuu.cloud", "role": "primary", "access": "requires_proxy", "domainhub": "fuc.main-en" },
|
||||
{ "domain": "福云123.com", "role": "direct", "access": "suspected_blocked", "domainhub": "fuc.direct-cn-backup" },
|
||||
{ "domain": "fuuu.online", "role": "direct", "domainhub": "fuc.fuuu-online" },
|
||||
{ "domain": "fu99.cloud", "role": "direct", "domainhub": "fuc.direct-current", "recommended": true },
|
||||
{ "domain": "fu-nav3.com", "role": "navigation", "domainhub": "fuc.navigation" }
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
# 项目域名清单与福云导航
|
||||
|
||||
项目面向用户的域名和用途维护在 [config/project-domains/](../../config/project-domains/)。每个项目使用独立的 JSON 文件,文件名为项目代号。DomainHub 继续维护 DNS、资源关系和地址发布台账;清单里的 `domainhub` 是对应记录代号,不包含凭据或私有入口。
|
||||
|
||||
- `role`:`primary` 永久主域名、`direct` 免翻墙域名、`navigation` 导航站域名。
|
||||
- `access`:按需填写 `requires_proxy`(需翻墙)或 `suspected_blocked`(疑似被墙)。未填写表示没有登记额外限制,不表示做过当地线路测试。
|
||||
- `recommended`:最多一个,只用于未标注限制的免翻墙域名。
|
||||
|
||||
```sh
|
||||
node scripts/project-domains/manage.mjs list
|
||||
node scripts/project-domains/manage.mjs list fuc
|
||||
node scripts/project-domains/manage.mjs build fuc
|
||||
node scripts/project-domains/manage.mjs check fuc
|
||||
```
|
||||
|
||||
[福云导航](https://fu-nav3.com/)从 [FUC 清单](../../config/project-domains/fuc.json)生成静态 HTML。调整清单或模板后,提交重新生成的页面。导航站本身登记在清单里,但不作为进入面板的选项。当前默认 fu99.cloud,其次是 fuuu.online;两条永久主域名显示「需翻墙」,福云123.com 保留在末尾并显示「疑似被墙」。选择入口、邀请码转交和手动倒计时沿用导航现有流程。
|
||||
|
||||
发布只从指定 Git 提交提取 `public/brand/fuc-navigation/` 下的 `index.html`、`clipboard.mjs`、`logo.svg`,落在 `/var/www/wwwroot/fuc-navigation/releases/<SHA>`,再切换 `current`。导航站运行时无需请求 XB 或 DomainHub。服务器侧回读根域与已登记的 tomtojapan 反代,确认默认入口和五条链接;异常时将 `current` 指回上一次验收的版本。
|
||||
@@ -1,4 +1,5 @@
|
||||
<!doctype html>
|
||||
<!-- 由 scripts/project-domains/manage.mjs 生成,请修改域名清单或模板。 -->
|
||||
<html lang="zh-CN" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
@@ -193,19 +194,23 @@
|
||||
<fieldset class="routes" aria-labelledby="entry-title">
|
||||
<label class="entry">
|
||||
<input type="radio" name="route" value="https://fu99.cloud/" data-domainhub-code="fuc.direct-current" checked>
|
||||
<span><strong>fu99.cloud</strong><small>免翻墙入口 · 推荐</small></span>
|
||||
<span><strong>fu99.cloud</strong><small>免翻墙域名 · 推荐</small></span>
|
||||
</label>
|
||||
<label class="entry">
|
||||
<input type="radio" name="route" value="https://xn--123-9i9dj97q.com/" data-domainhub-code="fuc.direct-cn-backup">
|
||||
<span><strong>福云123.com</strong><small>备用入口</small></span>
|
||||
<input type="radio" name="route" value="https://fuuu.online/" data-domainhub-code="fuc.fuuu-online">
|
||||
<span><strong>fuuu.online</strong><small>免翻墙域名</small></span>
|
||||
</label>
|
||||
<label class="entry">
|
||||
<input type="radio" name="route" value="https://xn--9kqy16h.com/" data-domainhub-code="fuc.main-cn">
|
||||
<span><strong>福云.com</strong><small>中文主域名</small></span>
|
||||
<span><strong>福云.com</strong><small>永久主域名(需翻墙)</small></span>
|
||||
</label>
|
||||
<label class="entry">
|
||||
<input type="radio" name="route" value="https://fuuu.cloud/" data-domainhub-code="fuc.main-en">
|
||||
<span><strong>fuuu.cloud</strong><small>英文主域名</small></span>
|
||||
<span><strong>fuuu.cloud</strong><small>永久主域名(需翻墙)</small></span>
|
||||
</label>
|
||||
<label class="entry">
|
||||
<input type="radio" name="route" value="https://xn--123-9i9dj97q.com/" data-domainhub-code="fuc.direct-cn-backup">
|
||||
<span><strong>福云123.com</strong><small>免翻墙域名(疑似被墙)</small></span>
|
||||
</label>
|
||||
</fieldset>
|
||||
<div class="panel-footer">
|
||||
|
||||
@@ -0,0 +1,101 @@
|
||||
import { readFileSync, readdirSync, writeFileSync } from 'node:fs';
|
||||
import { domainToASCII, domainToUnicode } from 'node:url';
|
||||
|
||||
const configs = new URL('../../config/project-domains/', import.meta.url);
|
||||
const roles = new Map([
|
||||
['primary', '永久主域名'],
|
||||
['direct', '免翻墙域名'],
|
||||
['navigation', '导航站域名'],
|
||||
]);
|
||||
const accessLabels = new Map([
|
||||
['requires_proxy', '需翻墙'],
|
||||
['suspected_blocked', '疑似被墙'],
|
||||
]);
|
||||
|
||||
function load(project) {
|
||||
if (!/^[a-z][a-z0-9-]*$/.test(project)) throw new Error('无效项目代号');
|
||||
const { domains } = JSON.parse(readFileSync(new URL(project + '.json', configs), 'utf8'));
|
||||
if (!Array.isArray(domains) || !domains.length) throw new Error(project + ' 未配置域名');
|
||||
const seenHosts = new Set();
|
||||
const seenCodes = new Set();
|
||||
const records = domains.map(({ domain, role, access, domainhub, recommended = false }) => {
|
||||
const fail = () => { throw new Error(project + ' 域名记录无效:' + domain); };
|
||||
if (typeof domain !== 'string' || /[\s:/@?#%\\]/u.test(domain)) fail();
|
||||
const host = domainToASCII(domain);
|
||||
const labels = host.split('.');
|
||||
if (host.length > 253 || labels.length < 2 || !/[a-z]/.test(labels.at(-1))
|
||||
|| labels.some(label => !/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/.test(label))
|
||||
|| seenHosts.has(host)) fail();
|
||||
if (!roles.has(role) || (access !== undefined && !accessLabels.has(access))
|
||||
|| typeof recommended !== 'boolean' || (recommended && (role !== 'direct' || access))) fail();
|
||||
if (domainhub !== undefined) {
|
||||
if (typeof domainhub !== 'string' || !/^[a-z0-9][a-z0-9.-]*$/.test(domainhub)
|
||||
|| !domainhub.startsWith(project + '.') || seenCodes.has(domainhub)) fail();
|
||||
seenCodes.add(domainhub);
|
||||
}
|
||||
seenHosts.add(host);
|
||||
return {
|
||||
name: domainToUnicode(host), origin: 'https://' + host + '/', role, access, domainhub, recommended,
|
||||
label: roles.get(role) + (access ? '(' + accessLabels.get(access) + ')' : '') + (recommended ? ' · 推荐' : ''),
|
||||
};
|
||||
});
|
||||
if (records.filter(record => record.recommended).length > 1) throw new Error(project + ' 有多个默认推荐域名');
|
||||
return records;
|
||||
}
|
||||
|
||||
function escapeHtml(value) {
|
||||
const entities = { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' };
|
||||
return value.replace(/[&<>"']/g, char => entities[char]);
|
||||
}
|
||||
|
||||
function renderNavigation(project, records) {
|
||||
const recommended = records.find(record => record.recommended);
|
||||
if (!recommended || records.filter(record => record.role === 'navigation').length !== 1) {
|
||||
throw new Error(project + ' 导航需要一个导航域名和一个默认推荐域名');
|
||||
}
|
||||
const panels = records.filter(record => record.role !== 'navigation');
|
||||
const priority = ({ recommended, role, access }) => recommended ? 0
|
||||
: role === 'direct' && access === undefined ? 1 : access === 'suspected_blocked' ? 3 : 2;
|
||||
panels.sort((a, b) => priority(a) - priority(b));
|
||||
const options = panels.map(({ origin, name, label, recommended, domainhub }) => {
|
||||
const code = domainhub ? ' data-domainhub-code="' + escapeHtml(domainhub) + '"' : '';
|
||||
return [
|
||||
' <label class="entry">',
|
||||
' <input type="radio" name="route" value="' + escapeHtml(origin) + '"' + code + (recommended ? ' checked' : '') + '>',
|
||||
' <span><strong>' + escapeHtml(name) + '</strong><small>' + escapeHtml(label) + '</small></span>',
|
||||
' </label>',
|
||||
].join('\n');
|
||||
}).join('\n');
|
||||
// FUC's design and invite behavior are specific to FUC; the catalog is reusable.
|
||||
const template = readFileSync(new URL('./navigation.template.html', import.meta.url), 'utf8');
|
||||
const tokens = { DOMAIN_OPTIONS: options, DEFAULT_NAME: escapeHtml(recommended.name), DEFAULT_ORIGIN: escapeHtml(recommended.origin) };
|
||||
const counts = new Set();
|
||||
const html = template.replace(/\{\{([A-Z_]+)\}\}/g, (_, key) => {
|
||||
if (!Object.hasOwn(tokens, key) || counts.has(key)) throw new Error('无效导航模板标记:' + key);
|
||||
counts.add(key);
|
||||
return tokens[key];
|
||||
});
|
||||
if (counts.size !== Object.keys(tokens).length) throw new Error('导航模板缺少标记');
|
||||
return html.replace('<!doctype html>', '<!doctype html>\n<!-- 由 scripts/project-domains/manage.mjs 生成,请修改域名清单或模板。 -->');
|
||||
}
|
||||
|
||||
try {
|
||||
const [action, project, ...rest] = process.argv.slice(2);
|
||||
if (action === 'list' && rest.length === 0) {
|
||||
const projects = project ? [project] : readdirSync(configs)
|
||||
.filter(name => /^[a-z][a-z0-9-]*\.json$/.test(name)).sort().map(name => name.slice(0, -5));
|
||||
for (const key of projects) {
|
||||
for (const record of load(key)) console.log([key, record.name, record.label, record.domainhub ?? ''].join('\t'));
|
||||
}
|
||||
} else if (['build', 'check'].includes(action) && project === 'fuc' && rest.length === 0) {
|
||||
const html = renderNavigation(project, load(project));
|
||||
const file = new URL('../../public/brand/fuc-navigation/index.html', import.meta.url);
|
||||
if (action === 'build') writeFileSync(file, html);
|
||||
else if (readFileSync(file, 'utf8') !== html) throw new Error('导航页已过期,请重新生成');
|
||||
} else {
|
||||
throw new Error('用法:manage.mjs list [项目代号] | build fuc | check fuc');
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error.message);
|
||||
process.exitCode = 1;
|
||||
}
|
||||
@@ -0,0 +1,278 @@
|
||||
<!doctype html>
|
||||
<html lang="zh-CN" data-theme="dark">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="referrer" content="no-referrer">
|
||||
<title>福云地址导航</title>
|
||||
<link rel="icon" href="./logo.svg" type="image/svg+xml">
|
||||
<style>
|
||||
:root {
|
||||
color-scheme: light;
|
||||
--page: #f5f3fb;
|
||||
--panel: #fff;
|
||||
--ink: #211b39;
|
||||
--muted: #625a76;
|
||||
--line: #e7e1f2;
|
||||
--accent: #5941bf;
|
||||
--action: #6045ce;
|
||||
--tint: #f0ebff;
|
||||
--glow: #e4dcff;
|
||||
--shadow: rgb(49 31 102 / 9%);
|
||||
font: 16px/1.55 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
|
||||
}
|
||||
|
||||
:root[data-theme="dark"] {
|
||||
color-scheme: dark;
|
||||
--page: #171426;
|
||||
--panel: #201c34;
|
||||
--ink: #f6f1ff;
|
||||
--muted: #bbb2d0;
|
||||
--line: #38304d;
|
||||
--accent: #c6b7ff;
|
||||
--action: #7256df;
|
||||
--tint: #332851;
|
||||
--glow: #2d214a;
|
||||
--shadow: rgb(0 0 0 / 20%);
|
||||
}
|
||||
|
||||
*, *::before, *::after { box-sizing: border-box; }
|
||||
|
||||
body {
|
||||
min-height: 100vh;
|
||||
margin: 0;
|
||||
color: var(--ink);
|
||||
background: radial-gradient(ellipse at 16% 30%, var(--glow), transparent 50%), var(--page);
|
||||
}
|
||||
|
||||
a { color: inherit; text-decoration: none; }
|
||||
button { color: inherit; font: inherit; cursor: pointer; }
|
||||
:is(a, button):focus-visible,
|
||||
.entry:has(input:focus-visible) { outline: 2px solid var(--accent); outline-offset: 4px; }
|
||||
|
||||
.wrap { width: min(1120px, calc(100% - 64px)); margin-inline: auto; }
|
||||
|
||||
header {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 16px;
|
||||
padding-block: 26px;
|
||||
border-bottom: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.brand { display: flex; align-items: center; gap: 12px; font-size: 20px; font-weight: 750; }
|
||||
.brand img { width: 38px; height: 38px; object-fit: contain; }
|
||||
.theme {
|
||||
display: grid;
|
||||
width: 42px;
|
||||
height: 42px;
|
||||
place-items: center;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 12px;
|
||||
background: var(--panel);
|
||||
}
|
||||
.theme:hover { color: var(--accent); border-color: var(--accent); }
|
||||
.theme svg { width: 19px; height: 19px; }
|
||||
[data-theme="dark"] .theme .moon, [data-theme="light"] .theme .sun { display: none; }
|
||||
|
||||
main {
|
||||
display: grid;
|
||||
grid-template-columns: .86fr 1fr;
|
||||
align-items: center;
|
||||
gap: clamp(28px, 6vw, 80px);
|
||||
min-height: min(680px, calc(100svh - 100px));
|
||||
padding-block: 64px;
|
||||
}
|
||||
|
||||
h1 { margin: 0 0 16px; font-size: clamp(38px, 6.5vw, 70px); line-height: 1.12; letter-spacing: -.045em; }
|
||||
.intro p { max-width: 23em; margin: 0; color: var(--muted); }
|
||||
.copy-control { position: relative; display: inline-block; }
|
||||
.copy-email {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
color: var(--accent);
|
||||
background: none;
|
||||
font-weight: 650;
|
||||
text-decoration: underline dotted;
|
||||
text-underline-offset: 4px;
|
||||
}
|
||||
.copy-email:hover { text-decoration-style: solid; }
|
||||
.copy-feedback {
|
||||
position: absolute;
|
||||
inset-inline-end: 0;
|
||||
inset-block-end: calc(100% + 6px);
|
||||
z-index: 1;
|
||||
width: max-content;
|
||||
max-width: 100%;
|
||||
padding: 3px 8px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 6px;
|
||||
color: var(--accent);
|
||||
background: var(--panel);
|
||||
box-shadow: 0 4px 12px var(--shadow);
|
||||
font-size: 12px;
|
||||
pointer-events: none;
|
||||
}
|
||||
.copy-feedback:empty { opacity: 0; }
|
||||
|
||||
.entries {
|
||||
padding: clamp(16px, 3vw, 28px);
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 24px;
|
||||
background: var(--panel);
|
||||
box-shadow: 0 22px 64px var(--shadow);
|
||||
}
|
||||
|
||||
.panel-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
gap: 12px;
|
||||
color: var(--muted);
|
||||
font-size: 12px;
|
||||
}
|
||||
.entries h2 { margin: 0 0 14px; font-size: 16px; }
|
||||
.routes { display: grid; gap: 10px; margin: 0; padding: 0; border: 0; min-width: 0; }
|
||||
|
||||
.entry {
|
||||
display: grid;
|
||||
grid-template-columns: 20px minmax(0, 1fr);
|
||||
align-items: center;
|
||||
gap: 14px;
|
||||
min-height: 80px;
|
||||
padding: 14px;
|
||||
border: 1px solid var(--line);
|
||||
border-radius: 14px;
|
||||
cursor: pointer;
|
||||
transition: border-color .16s ease, background-color .16s ease;
|
||||
}
|
||||
|
||||
.entry:has(input:checked), .entry:hover { background: var(--tint); border-color: var(--accent); }
|
||||
.entry input { width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
|
||||
|
||||
.entry strong, .entry small { display: block; }
|
||||
.entry strong { overflow-wrap: anywhere; font-size: 17px; }
|
||||
.entry small { margin-top: 2px; color: var(--muted); font-size: 12px; }
|
||||
|
||||
.panel-footer { min-height: 40px; margin-block: 12px 10px; }
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
.entry { transition: none; }
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="wrap">
|
||||
<a class="brand" href="/"><img src="./logo.svg" alt="">福云</a>
|
||||
<button class="theme" type="button" aria-label="切换到浅色">
|
||||
<svg class="sun" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><circle cx="12" cy="12" r="4"/><path d="M12 2v2m0 16v2M2 12h2m16 0h2M5 5l1.4 1.4m11.2 11.2L19 19M5 19l1.4-1.4m11.2-11.2L19 5"/></svg>
|
||||
<svg class="moon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6" aria-hidden="true"><path d="M20.9 13.3A9 9 0 0 1 10.7 3.1a9 9 0 1 0 10.2 10.2Z"/></svg>
|
||||
</button>
|
||||
</header>
|
||||
<main class="wrap">
|
||||
<section class="intro" aria-labelledby="page-title">
|
||||
<h1 id="page-title">福云地址导航</h1>
|
||||
<p>务必,请收藏我们的邮箱
|
||||
<span class="copy-control">
|
||||
<button class="copy-email" type="button" aria-label="复制邮箱地址 [email protected]">
|
||||
[email protected]
|
||||
<svg width="15" height="15" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.7" aria-hidden="true">
|
||||
<path d="M8 8h9l3 3v10H8V8Z M15 8V3H3v13h5"/>
|
||||
</svg>
|
||||
</button>
|
||||
<span class="copy-feedback" role="status"></span>
|
||||
</span>。导航地址被墙时,可发送任意邮件至我们的邮箱,会自动回复最新地址。
|
||||
</p>
|
||||
</section>
|
||||
<section class="entries" aria-labelledby="entry-title">
|
||||
<h2 id="entry-title">访问入口</h2>
|
||||
<fieldset class="routes" aria-labelledby="entry-title">
|
||||
{{DOMAIN_OPTIONS}}
|
||||
</fieldset>
|
||||
<div class="panel-footer">
|
||||
<span id="route-status" role="status">已选择 {{DEFAULT_NAME}}</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<a id="enter" class="enter" href="{{DEFAULT_ORIGIN}}#/register">立即进入 →</a>
|
||||
<button class="countdown" type="button">开始 8 秒跳转</button>
|
||||
</div>
|
||||
</section>
|
||||
</main>
|
||||
<script>
|
||||
const theme = document.querySelector('.theme');
|
||||
const routes = document.querySelector('.routes');
|
||||
const status = document.querySelector('#route-status');
|
||||
const enter = document.querySelector('#enter');
|
||||
const countdown = document.querySelector('.countdown');
|
||||
const invite = new URLSearchParams(location.search).get('code');
|
||||
const seconds = 8;
|
||||
let remaining = seconds;
|
||||
let timer;
|
||||
|
||||
function selectRoute() {
|
||||
const selected = routes.querySelector('input:checked');
|
||||
const origin = new URL(selected.value).origin;
|
||||
const code = invite && /^[A-Za-z0-9_-]{1,64}$/.test(invite) ? '?code=' + encodeURIComponent(invite) : '';
|
||||
enter.href = origin + '/#/register' + code;
|
||||
status.textContent = '已选择 ' + selected.closest('label').querySelector('strong').textContent;
|
||||
}
|
||||
|
||||
function pauseCountdown() {
|
||||
clearInterval(timer);
|
||||
timer = undefined;
|
||||
countdown.textContent = remaining === seconds ? '开始 8 秒跳转' : '继续跳转 ' + remaining + ' 秒';
|
||||
}
|
||||
|
||||
theme.addEventListener('click', () => {
|
||||
const dark = document.documentElement.dataset.theme === 'dark';
|
||||
document.documentElement.dataset.theme = dark ? 'light' : 'dark';
|
||||
theme.setAttribute('aria-label', dark ? '切换到深色' : '切换到浅色');
|
||||
});
|
||||
routes.addEventListener('change', () => {
|
||||
remaining = seconds;
|
||||
pauseCountdown();
|
||||
selectRoute();
|
||||
});
|
||||
countdown.addEventListener('click', () => {
|
||||
if (timer !== undefined) {
|
||||
pauseCountdown();
|
||||
return;
|
||||
}
|
||||
countdown.textContent = '暂停跳转 ' + remaining + ' 秒';
|
||||
timer = setInterval(() => {
|
||||
remaining -= 1;
|
||||
if (remaining === 0) {
|
||||
clearInterval(timer);
|
||||
timer = undefined;
|
||||
location.assign(enter.href);
|
||||
} else {
|
||||
countdown.textContent = '暂停跳转 ' + remaining + ' 秒';
|
||||
}
|
||||
}, 1000);
|
||||
});
|
||||
selectRoute();
|
||||
</script>
|
||||
<script type="module">
|
||||
import { copyText } from './clipboard.mjs';
|
||||
|
||||
const email = document.querySelector('.copy-email');
|
||||
const feedback = document.querySelector('.copy-feedback');
|
||||
let feedbackTimer;
|
||||
email.addEventListener('click', async () => {
|
||||
clearTimeout(feedbackTimer);
|
||||
feedback.textContent = '';
|
||||
try {
|
||||
await copyText(email.textContent.trim());
|
||||
feedback.textContent = '已复制';
|
||||
feedbackTimer = setTimeout(() => { feedback.textContent = ''; }, 1600);
|
||||
} catch {
|
||||
feedback.textContent = '复制失败,请选中邮箱地址手动复制。';
|
||||
}
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in new issue
Block a user