commit e067d18d8d5c10237d220c3a6bc601b3eb33fd5c Author: Flechazo <2558755403@qq.com> Date: Sat Oct 24 23:08:10 2026 +0800 feat: add BD2 client and server download site diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..6313b56 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +* text=auto eol=lf diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..16bb595 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +.claude/ +__pycache__/ diff --git a/README.md b/README.md new file mode 100644 index 0000000..367e9b6 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# bd2-site + +BD2 私服的客户端与服务端下载站,部署在 。纯静态页面,无构建步骤。 + +- `site/`:站点根目录。`data/latest.json` 记录当前下载文件的版本、大小与 SHA-256;更新日志在浏览器中读取 `/releases/CHANGELOG.md`。 +- `/releases/` 由 Caddy 只读反代到 BD2 服务端的签名发布目录(`DATA_DIR/releases`),与启动器、服务端自动更新使用同一套文件。 +- `scripts/sync.py`:BD2 仓库 `bd2w release publish`、签名并上传发布材料后,运行它重新生成 `site/data/latest.json`,再提交、推送并部署。 +- `scripts/serve.py`:本地预览,`/releases/` 从发布主机获取。 + +```bash +python -I scripts/sync.py --release F:/code/go/bd2/.build/release-site +python -I scripts/serve.py --upstream https://bd2.flechazo.xin +``` + +部署:服务器 `/opt/bd2-site` 是本仓库的检出,Caddy 站点块位于 `server-infra/bd2-site/Caddyfile`。 + +```bash +cd /opt/bd2-site && git fetch origin && git checkout --detach +``` diff --git a/scripts/serve.py b/scripts/serve.py new file mode 100644 index 0000000..51edbff --- /dev/null +++ b/scripts/serve.py @@ -0,0 +1,43 @@ +#!/usr/bin/env python3 +"""Preview the site locally; /releases/ is fetched from the release host.""" +import argparse +import http.server +import urllib.request +from functools import partial +from pathlib import Path + +SITE = Path(__file__).resolve().parent.parent / "site" + + +class Handler(http.server.SimpleHTTPRequestHandler): + upstream = "" + + def do_GET(self): + if not self.path.startswith("/releases/"): + return super().do_GET() + try: + with urllib.request.urlopen(self.upstream + self.path, timeout=30) as response: + body = response.read() + self.send_response(response.status) + self.send_header("Content-Type", response.headers.get("Content-Type", "application/octet-stream")) + except urllib.error.HTTPError as error: + body = b"" + self.send_response(error.code) + self.send_header("Content-Length", str(len(body))) + self.end_headers() + self.wfile.write(body) + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--port", type=int, default=8790) + parser.add_argument("--upstream", default="https://bd2.flechazo.xin") + args = parser.parse_args() + Handler.upstream = args.upstream.rstrip("/") + server = http.server.ThreadingHTTPServer(("127.0.0.1", args.port), partial(Handler, directory=str(SITE))) + print(f"http://127.0.0.1:{args.port}/ (releases from {Handler.upstream})") + server.serve_forever() + + +if __name__ == "__main__": + main() diff --git a/scripts/sync.py b/scripts/sync.py new file mode 100644 index 0000000..f6fee55 --- /dev/null +++ b/scripts/sync.py @@ -0,0 +1,73 @@ +#!/usr/bin/env python3 +"""Write site/data/latest.json from the BD2 release materials. + +The input is the directory `bd2w release publish` writes (default +`/.build/release-site`) after it has been signed and uploaded to the +release host. Download links point at that host's /releases/ directory. +""" +import argparse +import hashlib +import json +from pathlib import Path +from urllib.parse import quote + +SITE = Path(__file__).resolve().parent.parent / "site" + + +def sha256(file): + with file.open("rb") as stream: + return hashlib.file_digest(stream, "sha256").hexdigest() + + +def link(relative): + return "/releases/" + "/".join(quote(part) for part in relative.split("/")) + + +def flat(release, name, platform, kind): + file = release / "downloads" / name + if not file.is_file(): + raise SystemExit(f"missing download: {file}") + return {"name": name, "platform": platform, "kind": kind, "size": file.stat().st_size, + "sha256": sha256(file), "url": link("downloads/" + name)} + + +def main(): + parser = argparse.ArgumentParser(description=__doc__) + parser.add_argument("--release", type=Path, default=Path("F:/code/go/bd2/.build/release-site")) + parser.add_argument("--output", type=Path, default=SITE / "data" / "latest.json") + args = parser.parse_args() + release = args.release + manifest = json.loads((release / "manifest.json").read_text(encoding="utf-8")) + signed = json.loads((release / "stable" / "release.json").read_text(encoding="utf-8"))["manifest"] + if signed != manifest: + raise SystemExit("stable/release.json does not sign manifest.json") + client, server = manifest["launcher"], manifest["server"] + game = manifest["fingerprint"]["game"]["game_version"] + + client_files = [flat(release, f"bd2client-{client['version']}-windows-x64.zip", "windows-x64", "bundle")] + server_files = [] + for f in server["files"]: + target = release / Path(f["url"].removeprefix("../")) + if sha256(target) != f["sha256"]: + raise SystemExit(f"{target} does not match the manifest") + server_files.append({"name": f["name"], "platform": f["platform"], "kind": "signed", "size": f["size"], + "sha256": f["sha256"], "url": link(f["url"].removeprefix("../"))}) + windows = f"bd2server-{server['version']}-windows-x64.zip" + if (release / "downloads" / windows).is_file(): + server_files.append(flat(release, windows, "windows-x64", "bundle")) + + latest = { + "published_at": manifest["published_at"], + "commit": manifest["commit"], + "game_version": game, + "client": {"version": client["version"], "date": client["date"], "files": client_files}, + "server": {"version": server["version"], "date": server["date"], + "migration": server["migration"]["kind"], "files": server_files}, + } + args.output.parent.mkdir(parents=True, exist_ok=True) + args.output.write_text(json.dumps(latest, ensure_ascii=False, indent=2) + "\n", encoding="utf-8", newline="\n") + print(f"{args.output}: client {client['version']}, server {server['version']}") + + +if __name__ == "__main__": + main() diff --git a/site/assets/app.css b/site/assets/app.css new file mode 100644 index 0000000..c952136 --- /dev/null +++ b/site/assets/app.css @@ -0,0 +1,161 @@ +:root { + --bg: #f6f5f1; + --surface: #ffffff; + --text: #161514; + --muted: #6f6b64; + --line: #e2dfd8; + --accent: #c2552b; + --invert: #f6f5f1; + --sans: "Inter", system-ui, -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Hiragino Sans", "Malgun Gothic", sans-serif; + --mono: ui-monospace, "JetBrains Mono", "Cascadia Mono", "SFMono-Regular", Consolas, monospace; + color-scheme: light; +} +@media (prefers-color-scheme: dark) { + :root { + --bg: #121211; + --surface: #1a1a19; + --text: #ecebe7; + --muted: #8f8b84; + --line: #2b2a28; + --accent: #e0774a; + --invert: #121211; + color-scheme: dark; + } +} + +* { box-sizing: border-box; } +html { scroll-behavior: smooth; scroll-padding-top: 72px; } +body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.65 var(--sans); -webkit-font-smoothing: antialiased; } +a { color: inherit; } +.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); } +.muted { color: var(--muted); } +::selection { background: var(--accent); color: var(--invert); } + +/* Bar */ +.bar { + position: sticky; top: 0; z-index: 2; + display: flex; align-items: center; gap: 28px; + height: 60px; padding: 0 clamp(20px, 5vw, 56px); + background: color-mix(in srgb, var(--bg) 88%, transparent); + backdrop-filter: blur(10px); + border-bottom: 1px solid var(--line); +} +.brand { display: flex; align-items: baseline; gap: 10px; text-decoration: none; } +.brand .mark { font-weight: 800; font-size: 17px; letter-spacing: .02em; } +.brand .mark::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 3px; background: var(--accent); } +.brand .sub { color: var(--muted); font-size: 13px; } +.bar nav { display: flex; gap: 24px; margin-left: auto; font-size: 14px; } +.bar nav a { text-decoration: none; color: var(--muted); position: relative; transition: color .2s; } +.bar nav a::after { content: ""; position: absolute; left: 0; right: 0; bottom: -4px; height: 1px; background: var(--text); transform: scaleX(0); transform-origin: left; transition: transform .25s ease; } +.bar nav a:hover { color: var(--text); } +.bar nav a:hover::after { transform: scaleX(1); } +.lang select { font: inherit; font-size: 13px; color: var(--text); background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; cursor: pointer; } +@media (max-width: 640px) { .bar nav { display: none; } .lang { margin-left: auto; } } + +main { max-width: 1080px; margin: 0 auto; padding: 0 clamp(20px, 5vw, 40px); } + +/* Hero */ +.hero { padding: clamp(64px, 12vw, 128px) 0 clamp(40px, 6vw, 64px); border-bottom: 1px solid var(--line); } +.eyebrow { margin: 0 0 24px; font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); } +.eyebrow b { color: var(--text); font-weight: 600; } +.hero h1 { margin: 0; max-width: 14em; font-size: clamp(34px, 6vw, 64px); line-height: 1.08; letter-spacing: -.025em; font-weight: 750; } +.lede { max-width: 34em; margin: 20px 0 0; color: var(--muted); font-size: clamp(16px, 1.8vw, 18px); } +.stamp { margin: 28px 0 0; font: 13px var(--mono); color: var(--muted); } + +/* Downloads */ +.cards { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); } +@media (max-width: 760px) { .cards { grid-template-columns: 1fr; } .card + .card { border-left: 0 !important; border-top: 1px solid var(--line); } } +.card { display: flex; flex-direction: column; gap: 22px; padding: 40px 0 44px; min-width: 0; } +.card + .card { border-left: 1px solid var(--line); padding-left: clamp(20px, 4vw, 48px); } +.card:first-child { padding-right: clamp(20px, 4vw, 48px); } +.tag { font: 500 12px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); } +.card h2 { margin: 12px 0 0; font-size: 28px; letter-spacing: -.015em; } +.ver { margin: 6px 0 0; font: 500 15px var(--mono); overflow-wrap: anywhere; } +.date { margin: 2px 0 0; font-size: 13px; color: var(--muted); } + +.notes h3 { margin: 0 0 6px; font-size: 15px; } +.notes ul { margin: 0; padding-left: 1.1em; color: var(--muted); } +.notes li + li { margin-top: 4px; } +.notes li::marker { color: var(--line); } +.notes .fold { max-height: 8.6em; overflow: hidden; mask-image: linear-gradient(#000 55%, transparent); transition: max-height .4s ease; } +.notes .fold.open { max-height: 60em; mask-image: none; } +.link { font: inherit; font-size: 13px; color: var(--text); background: none; border: 0; padding: 0; margin-top: 6px; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; text-decoration-color: var(--line); } +.link:hover { text-decoration-color: var(--text); } + +.files { border-top: 1px solid var(--line); } +.file { display: grid; grid-template-columns: 1fr auto; gap: 4px 16px; align-items: center; padding: 16px 0; border-bottom: 1px solid var(--line); } +.file .meta { display: flex; flex-direction: column; min-width: 0; } +.file .plat { font-weight: 650; } +.file .plat small { margin-left: 8px; font: 12px var(--mono); color: var(--muted); } +.file .size { font: 13px var(--mono); color: var(--muted); } +.file .name { display: none; } +.dl { + grid-row: 1 / span 2; grid-column: 2; + display: inline-flex; align-items: center; gap: 8px; + padding: 9px 16px; border-radius: 6px; + font-size: 14px; font-weight: 600; text-decoration: none; + color: var(--invert); background: var(--text); + transition: background .2s, transform .15s; +} +.dl:hover { background: var(--accent); } +.dl:active { transform: scale(.97); } +.dl svg { width: 15px; height: 15px; transition: transform .25s ease; } +.dl:hover svg { transform: translateY(2px); } +.sha { grid-column: 1 / -1; display: flex; align-items: center; gap: 10px; min-width: 0; margin-top: 4px; font: 12px var(--mono); color: var(--muted); } +.sha code { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } +.ghost { font: 12px var(--sans); color: var(--muted); background: none; border: 1px solid var(--line); border-radius: 4px; padding: 1px 8px; cursor: pointer; transition: color .2s, border-color .2s; } +.ghost:hover { color: var(--text); border-color: var(--text); } +.hint { margin: 0; font-size: 13px; color: var(--muted); } + +/* Changelog */ +.log { padding: 72px 0 40px; border-bottom: 1px solid var(--line); } +.log-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 32px; } +.log h2, .verify h2 { margin: 0; font-size: 28px; letter-spacing: -.015em; } +.filter { display: flex; gap: 20px; } +.filter button { font: inherit; font-size: 14px; color: var(--muted); background: none; border: 0; padding: 0 0 4px; cursor: pointer; border-bottom: 1px solid transparent; transition: color .2s, border-color .2s; } +.filter button:hover { color: var(--text); } +.filter button[aria-selected="true"] { color: var(--text); border-color: var(--text); } +.timeline { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); } +.entry { display: grid; grid-template-columns: 200px 1fr; gap: 8px 32px; padding: 24px 0; border-bottom: 1px solid var(--line); } +@media (max-width: 640px) { .entry { grid-template-columns: 1fr; } } +.entry .head { display: flex; flex-direction: column; gap: 2px; } +.entry .kind { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); } +.entry.server .kind { color: var(--accent); } +.entry code { font: 500 13px var(--mono); overflow-wrap: anywhere; } +.entry time { font-size: 13px; color: var(--muted); } +.entry .badge { align-self: flex-start; margin-top: 6px; font: 11px var(--mono); padding: 1px 6px; border: 1px solid var(--line); border-radius: 4px; color: var(--muted); } +.entry .badge.warn { color: var(--accent); border-color: var(--accent); } +.entry h3 { margin: 0 0 6px; font-size: 16px; } +.entry ul { margin: 0; padding-left: 1.1em; color: var(--muted); } +.entry li + li { margin-top: 3px; } +.entry li::marker { color: var(--line); } +.entry .body { min-width: 0; } +.entry.hidden { display: none; } +.more { display: block; margin: 28px auto 0; font: inherit; font-size: 14px; color: var(--text); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 8px 18px; cursor: pointer; transition: border-color .2s; } +.more:hover { border-color: var(--text); } +.source { margin: 24px 0 0; font-size: 13px; color: var(--muted); } +.source a { text-underline-offset: 3px; } + +/* Verify */ +.verify { padding: 72px 0; } +.verify > p { color: var(--muted); max-width: 40em; } +.shell { margin-top: 20px; border-top: 1px solid var(--line); } +.shell p { margin: 16px 0 6px; font-size: 13px; color: var(--muted); } +.shell pre { margin: 0; padding: 14px 16px; overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: 6px; } +.shell code { font: 13px var(--mono); } + +.foot { max-width: 1080px; margin: 0 auto; padding: 32px clamp(20px, 5vw, 40px) 56px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); } +.foot p { margin: 4px 0; max-width: 56em; } +.foot a { text-underline-offset: 3px; } + +.toast { position: fixed; left: 50%; bottom: 28px; z-index: 5; transform: translate(-50%, 12px); opacity: 0; pointer-events: none; padding: 8px 14px; border-radius: 6px; font-size: 13px; color: var(--invert); background: var(--text); transition: opacity .2s, transform .2s; } +.toast.on { opacity: 1; transform: translate(-50%, 0); } + +/* Entrance */ +.reveal { opacity: 0; transform: translateY(8px); transition: opacity .6s ease, transform .6s ease; } +.reveal.shown { opacity: 1; transform: none; } +@media (prefers-reduced-motion: reduce) { + *, *::before, *::after { transition: none !important; animation: none !important; } + html { scroll-behavior: auto; } + .reveal { opacity: 1; transform: none; } +} diff --git a/site/assets/app.js b/site/assets/app.js new file mode 100644 index 0000000..1f5f8bc --- /dev/null +++ b/site/assets/app.js @@ -0,0 +1,327 @@ +"use strict"; + +const LOCALES = ["zh_cn", "zh_tw", "en_us", "ja_jp", "ko_kr"]; +const HTML_LANG = { zh_cn: "zh-CN", zh_tw: "zh-TW", en_us: "en", ja_jp: "ja", ko_kr: "ko" }; + +const TEXT = { + zh_cn: { + title: "BD2 私服下载", brand: "私服", "nav.download": "下载", "nav.changelog": "更新日志", "nav.verify": "校验", lang: "语言", + "hero.game": "适配游戏版本", "hero.title": "BD2 私服下载", + "hero.lede": "棕色尘埃2 私服的客户端启动器和服务端。这里提供最新版本、更新日志和 SHA-256 校验值。", "hero.published": "发布于", + "client.tag": "客户端", "client.name": "启动器", "server.tag": "服务端", "server.name": "服务器", + "client.hint": "解压后运行 bd2client.exe,选择包含 BrownDust II.exe 的游戏目录,再填写服务器地址。", + "server.hint": "解压后运行 bd2server,单人本地服默认监听 8080 端口;网页管理台在 /admin/。", + loading: "载入中…", failed: "载入失败,请刷新重试。", download: "下载", copy: "复制", copied: "已复制 SHA-256", + expand: "展开全部", collapse: "收起", + "kind.bundle": "一键安装包", "kind.signed": "签名发布包", "plat.windows-x64": "Windows x64", "plat.linux-amd64": "Linux x86-64", "plat.linux-arm64": "Linux ARM64", + "log.title": "更新日志", "log.all": "全部", "log.more": "显示更早的版本", "log.source": "内容来自签名发布的", latest: "最新", + "migration.none": "无需迁移", "migration.reversible": "可回滚迁移", "migration.irreversible": "不可回滚迁移,更新前请备份", + "verify.title": "下载后校验", "verify.lede": "把计算结果与卡片上的 SHA-256 对比,完全一致才说明文件完整。", + "verify.signed": "启动器和服务端的自动更新另外校验 Ed25519 签名的发布清单。", + "foot.disclaimer": "非官方开发与研究项目,与 Brown Dust II 及其权利人无隶属或授权关系。仅供个人学习、研究和本地非商业测试,禁止转发或二次分发,详见 LICENSE。", + }, + zh_tw: { + title: "BD2 私服下載", brand: "私服", "nav.download": "下載", "nav.changelog": "更新日誌", "nav.verify": "校驗", lang: "語言", + "hero.game": "適配遊戲版本", "hero.title": "BD2 私服下載", + "hero.lede": "棕色塵埃2 私服的用戶端啟動器與伺服端。這裡提供最新版本、更新日誌與 SHA-256 校驗值。", "hero.published": "發布於", + "client.tag": "用戶端", "client.name": "啟動器", "server.tag": "伺服端", "server.name": "伺服器", + "client.hint": "解壓後執行 bd2client.exe,選擇包含 BrownDust II.exe 的遊戲目錄,再填寫伺服器位址。", + "server.hint": "解壓後執行 bd2server,單人本機服預設監聽 8080 連接埠;網頁管理台在 /admin/。", + loading: "載入中…", failed: "載入失敗,請重新整理。", download: "下載", copy: "複製", copied: "已複製 SHA-256", + expand: "展開全部", collapse: "收合", + "kind.bundle": "一鍵安裝包", "kind.signed": "簽章發布包", "plat.windows-x64": "Windows x64", "plat.linux-amd64": "Linux x86-64", "plat.linux-arm64": "Linux ARM64", + "log.title": "更新日誌", "log.all": "全部", "log.more": "顯示更早的版本", "log.source": "內容來自簽章發布的", latest: "最新", + "migration.none": "無需遷移", "migration.reversible": "可回復遷移", "migration.irreversible": "不可回復遷移,更新前請備份", + "verify.title": "下載後校驗", "verify.lede": "將計算結果與卡片上的 SHA-256 比對,完全一致才代表檔案完整。", + "verify.signed": "啟動器與伺服端的自動更新另外校驗 Ed25519 簽章的發布清單。", + "foot.disclaimer": "非官方開發與研究專案,與 Brown Dust II 及其權利人無隸屬或授權關係。僅供個人學習、研究與本機非商業測試,禁止轉發或二次散布,詳見 LICENSE。", + }, + en_us: { + title: "BD2 Private Server Downloads", brand: "Private Server", "nav.download": "Download", "nav.changelog": "Changelog", "nav.verify": "Verify", lang: "Language", + "hero.game": "Built for game version", "hero.title": "BD2 private server downloads", + "hero.lede": "The client launcher and server for a Brown Dust II private server, with the latest versions, changelog and SHA-256 checksums.", "hero.published": "Published", + "client.tag": "Client", "client.name": "Launcher", "server.tag": "Server", "server.name": "Server", + "client.hint": "Unzip and run bd2client.exe, pick the game folder that contains BrownDust II.exe, then enter the server address.", + "server.hint": "Unzip and run bd2server. A local single-player server listens on port 8080; the web console is at /admin/.", + loading: "Loading…", failed: "Could not load. Please refresh.", download: "Download", copy: "Copy", copied: "SHA-256 copied", + expand: "Show all", collapse: "Show less", + "kind.bundle": "One-step package", "kind.signed": "Signed release", "plat.windows-x64": "Windows x64", "plat.linux-amd64": "Linux x86-64", "plat.linux-arm64": "Linux ARM64", + "log.title": "Changelog", "log.all": "All", "log.more": "Show earlier versions", "log.source": "From the signed", latest: "Latest", + "migration.none": "No migration", "migration.reversible": "Reversible migration", "migration.irreversible": "Irreversible migration, back up first", + "verify.title": "Verify your download", "verify.lede": "Compare the result with the SHA-256 on the card. The file is intact only if they match exactly.", + "verify.signed": "Automatic updates of the launcher and server also verify the Ed25519-signed release manifest.", + "foot.disclaimer": "An unofficial development and research project, not affiliated with or authorized by Brown Dust II or its rights holders. For personal study, research and local non-commercial testing only; do not forward or redistribute. See LICENSE.", + }, + ja_jp: { + title: "BD2 プライベートサーバー ダウンロード", brand: "プライベートサーバー", "nav.download": "ダウンロード", "nav.changelog": "更新履歴", "nav.verify": "検証", lang: "言語", + "hero.game": "対応ゲームバージョン", "hero.title": "BD2 プライベートサーバー ダウンロード", + "hero.lede": "ブラウンダスト2 プライベートサーバーのクライアントランチャーとサーバーです。最新バージョン、更新履歴、SHA-256 チェックサムを掲載しています。", "hero.published": "公開日", + "client.tag": "クライアント", "client.name": "ランチャー", "server.tag": "サーバー", "server.name": "サーバー", + "client.hint": "展開して bd2client.exe を実行し、BrownDust II.exe があるゲームフォルダーを選んでからサーバーのアドレスを入力します。", + "server.hint": "展開して bd2server を実行します。ローカルのシングルサーバーは既定でポート 8080 で待ち受け、管理コンソールは /admin/ です。", + loading: "読み込み中…", failed: "読み込めませんでした。再読み込みしてください。", download: "ダウンロード", copy: "コピー", copied: "SHA-256 をコピーしました", + expand: "すべて表示", collapse: "折りたたむ", + "kind.bundle": "ワンステップパッケージ", "kind.signed": "署名付きリリース", "plat.windows-x64": "Windows x64", "plat.linux-amd64": "Linux x86-64", "plat.linux-arm64": "Linux ARM64", + "log.title": "更新履歴", "log.all": "すべて", "log.more": "以前のバージョンを表示", "log.source": "出典:署名付きの", latest: "最新", + "migration.none": "移行なし", "migration.reversible": "元に戻せる移行", "migration.irreversible": "元に戻せない移行、更新前にバックアップ", + "verify.title": "ダウンロード後の検証", "verify.lede": "計算結果をカードの SHA-256 と比べ、完全に一致すればファイルは正常です。", + "verify.signed": "ランチャーとサーバーの自動更新は Ed25519 で署名されたリリースマニフェストも検証します。", + "foot.disclaimer": "非公式の開発・研究プロジェクトであり、Brown Dust II およびその権利者とは提携・許諾関係にありません。個人の学習・研究とローカルでの非商用テストに限り、転送や再配布は禁止です。詳しくは LICENSE を参照してください。", + }, + ko_kr: { + title: "BD2 사설 서버 다운로드", brand: "사설 서버", "nav.download": "다운로드", "nav.changelog": "업데이트 내역", "nav.verify": "검증", lang: "언어", + "hero.game": "대응 게임 버전", "hero.title": "BD2 사설 서버 다운로드", + "hero.lede": "브라운더스트2 사설 서버용 클라이언트 런처와 서버입니다. 최신 버전, 업데이트 내역, SHA-256 체크섬을 제공합니다.", "hero.published": "게시일", + "client.tag": "클라이언트", "client.name": "런처", "server.tag": "서버", "server.name": "서버", + "client.hint": "압축을 풀고 bd2client.exe를 실행한 뒤 BrownDust II.exe가 있는 게임 폴더를 고르고 서버 주소를 입력하세요.", + "server.hint": "압축을 풀고 bd2server를 실행하세요. 로컬 1인 서버는 기본으로 8080 포트를 사용하며 웹 관리 콘솔은 /admin/입니다.", + loading: "불러오는 중…", failed: "불러오지 못했습니다. 새로 고침하세요.", download: "다운로드", copy: "복사", copied: "SHA-256을 복사했습니다", + expand: "모두 보기", collapse: "접기", + "kind.bundle": "원스텝 패키지", "kind.signed": "서명된 릴리스", "plat.windows-x64": "Windows x64", "plat.linux-amd64": "Linux x86-64", "plat.linux-arm64": "Linux ARM64", + "log.title": "업데이트 내역", "log.all": "전체", "log.more": "이전 버전 보기", "log.source": "출처: 서명된", latest: "최신", + "migration.none": "마이그레이션 없음", "migration.reversible": "되돌릴 수 있는 마이그레이션", "migration.irreversible": "되돌릴 수 없는 마이그레이션, 먼저 백업하세요", + "verify.title": "다운로드 후 검증", "verify.lede": "계산 결과를 카드의 SHA-256과 비교해 정확히 같아야 파일이 온전합니다.", + "verify.signed": "런처와 서버의 자동 업데이트는 Ed25519로 서명된 릴리스 매니페스트도 검증합니다.", + "foot.disclaimer": "비공식 개발·연구 프로젝트이며 Brown Dust II 및 그 권리자와 제휴하거나 허가받지 않았습니다. 개인 학습, 연구, 로컬 비상업 테스트 용도로만 사용하고 전달하거나 재배포하지 마세요. 자세한 내용은 LICENSE를 참고하세요.", + }, +}; + +const $ = (selector, root = document) => root.querySelector(selector); +const $$ = (selector, root = document) => [...root.querySelectorAll(selector)]; +const state = { locale: pickLocale(), latest: null, entries: null, filter: "all", expanded: false }; +const PAGE = 8; + +function pickLocale() { + const saved = localStorage.getItem("bd2.locale"); + if (LOCALES.includes(saved)) return saved; + for (const tag of navigator.languages || [navigator.language || ""]) { + const t = tag.toLowerCase(); + if (/^zh-(tw|hk|mo|hant)/.test(t)) return "zh_tw"; + if (t.startsWith("zh")) return "zh_cn"; + if (t.startsWith("ja")) return "ja_jp"; + if (t.startsWith("ko")) return "ko_kr"; + if (t.startsWith("en")) return "en_us"; + } + return "zh_cn"; +} + +const t = key => TEXT[state.locale][key] ?? TEXT.zh_cn[key] ?? key; + +function el(tag, attrs = {}, ...children) { + const node = document.createElement(tag); + for (const [k, v] of Object.entries(attrs)) { + if (k === "class") node.className = v; + else if (k === "text") node.textContent = v; + else node.setAttribute(k, v); + } + for (const child of children) if (child != null) node.append(child); + return node; +} + +function formatSize(bytes) { + const units = ["B", "KB", "MB", "GB"]; + let n = bytes, i = 0; + while (n >= 1024 && i < units.length - 1) { n /= 1024; i++; } + return `${n.toFixed(i ? 1 : 0)} ${units[i]}`; +} + +function formatDate(text) { + if (!text) return ""; + const date = new Date(text.length === 10 ? text + "T00:00:00" : text); + const options = text.length === 10 ? { year: "numeric", month: "long", day: "numeric" } + : { year: "numeric", month: "long", day: "numeric", hour: "2-digit", minute: "2-digit" }; + return new Intl.DateTimeFormat(HTML_LANG[state.locale], options).format(date); +} + +// CHANGELOG.md: "## server|client VERSION · DATE", "> key: value" metadata, +// then one "### locale: title" block of "- " bullets per language. +function parseChangelog(text) { + const entries = []; + let entry = null, block = null, fence = false; + for (const raw of text.split(/\r?\n/)) { + const line = raw.trimEnd(); + if (/^(```|~~~)/.test(line.trim())) { fence = !fence; continue; } + if (fence) continue; + let m; + if ((m = /^## (server|client) (\S+) · (\d{4}-\d{2}-\d{2})/.exec(line))) { + entry = { component: m[1], version: m[2], date: m[3], meta: {}, notes: {} }; + block = null; + entries.push(entry); + } else if (!entry) { + continue; + } else if ((m = /^> ([a-z_]+): (.+)$/.exec(line)) && !block) { + entry.meta[m[1]] = m[2].trim(); + } else if ((m = /^### ([a-z]{2}_[a-z]{2}): (.+)$/.exec(line))) { + block = entry.notes[m[1]] = { title: m[2].trim(), items: [] }; + } else if (block && (m = /^\s*[-*] (.+)$/.exec(line))) { + block.items.push(m[1].trim()); + } else if (block && line.trim() && block.items.length) { + block.items[block.items.length - 1] += " " + line.trim(); + } + } + return entries; +} + +const notesFor = entry => entry.notes[state.locale] || entry.notes.en_us || Object.values(entry.notes)[0] || { title: "", items: [] }; + +function renderTexts() { + document.documentElement.lang = HTML_LANG[state.locale]; + document.title = t("title"); + $$("[data-i18n]").forEach(node => { node.textContent = t(node.dataset.i18n); }); + $("#lang").value = state.locale; +} + +function renderCards() { + const latest = state.latest; + if (!latest) return; + $("#game-version").textContent = latest.game_version; + const published = $("#published"); + published.dateTime = latest.published_at; + published.textContent = formatDate(latest.published_at); + for (const component of ["client", "server"]) { + const info = latest[component]; + const card = $("#" + component); + $("[data-version]", card).textContent = info.version; + const date = $("[data-date]", card); + date.dateTime = info.date; + date.textContent = formatDate(info.date); + $("[data-files]", card).replaceChildren(...info.files.map(fileRow)); + renderNotes(card, component, info.version); + } +} + +function fileRow(file) { + const arrow = document.createElementNS("http://www.w3.org/2000/svg", "svg"); + arrow.setAttribute("viewBox", "0 0 24 24"); + arrow.setAttribute("aria-hidden", "true"); + const path = document.createElementNS("http://www.w3.org/2000/svg", "path"); + path.setAttribute("d", "M12 3v12m0 0-5-5m5 5 5-5M4 20h16"); + path.setAttribute("fill", "none"); + path.setAttribute("stroke", "currentColor"); + path.setAttribute("stroke-width", "2.4"); + path.setAttribute("stroke-linecap", "round"); + path.setAttribute("stroke-linejoin", "round"); + arrow.append(path); + const copy = el("button", { type: "button", class: "ghost", text: t("copy") }); + copy.addEventListener("click", () => copyText(file.sha256)); + return el("div", { class: "file" }, + el("div", { class: "meta" }, + el("span", { class: "plat" }, t("plat." + file.platform), el("small", { text: t("kind." + file.kind) })), + el("span", { class: "size", text: formatSize(file.size) }), + el("span", { class: "name", text: file.name })), + el("a", { class: "dl", href: file.url, download: file.name }, arrow, el("span", { text: t("download") })), + el("div", { class: "sha" }, el("span", { text: "SHA-256" }), el("code", { title: file.sha256, text: file.sha256 }), copy)); +} + +function renderNotes(card, component, version) { + const box = $("[data-notes]", card); + if (!state.entries) { + box.replaceChildren(el("p", { class: "muted", text: t(state.entries === false ? "failed" : "loading") })); + return; + } + const entry = state.entries.find(e => e.component === component && e.version === version); + if (!entry) { box.replaceChildren(); return; } + const notes = notesFor(entry); + const fold = el("div", { class: "fold" }, el("h3", { text: notes.title }), el("ul", {}, ...notes.items.map(item => el("li", { text: item })))); + box.replaceChildren(fold); + requestAnimationFrame(() => { + if (fold.scrollHeight <= fold.clientHeight + 4) { fold.classList.add("open"); return; } + const toggle = el("button", { type: "button", class: "link toggle", text: t("expand") }); + toggle.addEventListener("click", () => { + toggle.textContent = t(fold.classList.toggle("open") ? "collapse" : "expand"); + }); + box.append(toggle); + }); +} + +function renderTimeline() { + const list = $("#timeline"); + if (!state.entries) { + list.replaceChildren(el("li", { class: "muted", text: t(state.entries === false ? "failed" : "loading") })); + return; + } + const visible = state.entries.filter(e => state.filter === "all" || e.component === state.filter); + const latestOf = {}; + for (const e of state.entries) latestOf[e.component] ??= e.version; + list.replaceChildren(...visible.map((entry, index) => { + const notes = notesFor(entry); + const head = el("div", { class: "head" }, + el("span", { class: "kind", text: t(entry.component + ".tag") }), + el("code", { text: entry.version }), + el("time", { datetime: entry.date, text: formatDate(entry.date) })); + if (latestOf[entry.component] === entry.version) head.append(el("span", { class: "badge", text: t("latest") })); + const migration = entry.meta.migration; + if (migration && migration !== "none") head.append(el("span", { class: "badge warn", text: t("migration." + migration) })); + const item = el("li", { class: `entry ${entry.component}` }, head, + el("div", { class: "body" }, el("h3", { text: notes.title }), el("ul", {}, ...notes.items.map(text => el("li", { text }))))); + if (!state.expanded && index >= PAGE) item.classList.add("hidden"); + return item; + })); + $("#more").hidden = state.expanded || visible.length <= PAGE; + observeReveal(); +} + +let toastTimer = 0; +async function copyText(text) { + try { + await navigator.clipboard.writeText(text); + } catch { + const area = el("textarea", { readonly: "" }); + area.value = text; + document.body.append(area); + area.select(); + document.execCommand("copy"); + area.remove(); + } + const toast = $("#toast"); + toast.textContent = t("copied"); + toast.classList.add("on"); + clearTimeout(toastTimer); + toastTimer = setTimeout(() => toast.classList.remove("on"), 1600); +} + +let revealer = null; +function observeReveal() { + if (!("IntersectionObserver" in window)) { $$(".reveal").forEach(n => n.classList.add("shown")); return; } + revealer ??= new IntersectionObserver(items => { + for (const item of items) if (item.isIntersecting) { item.target.classList.add("shown"); revealer.unobserve(item.target); } + }, { rootMargin: "0px 0px -8% 0px" }); + $$(".reveal:not(.shown)").forEach(n => revealer.observe(n)); +} + +function render() { + renderTexts(); + renderCards(); + renderTimeline(); +} + +function bind() { + $("#lang").addEventListener("change", e => { + state.locale = e.target.value; + localStorage.setItem("bd2.locale", state.locale); + render(); + }); + $$(".filter button").forEach(button => button.addEventListener("click", () => { + state.filter = button.dataset.filter; + $$(".filter button").forEach(b => b.setAttribute("aria-selected", String(b === button))); + renderTimeline(); + })); + $("#more").addEventListener("click", () => { state.expanded = true; renderTimeline(); }); + $$(".hero, .cards").forEach(n => n.classList.add("reveal")); + observeReveal(); +} + +async function load() { + const [latest, changelog] = await Promise.allSettled([ + fetch("/data/latest.json", { cache: "no-cache" }).then(r => r.ok ? r.json() : Promise.reject(r.status)), + fetch("/releases/CHANGELOG.md", { cache: "no-cache" }).then(r => r.ok ? r.text() : Promise.reject(r.status)), + ]); + state.latest = latest.status === "fulfilled" ? latest.value : null; + state.entries = changelog.status === "fulfilled" ? parseChangelog(changelog.value) : false; + if (!state.latest) $$("[data-files]").forEach(n => n.replaceChildren(el("p", { class: "muted", text: t("failed") }))); + render(); +} + +bind(); +render(); +load(); diff --git a/site/assets/icon.svg b/site/assets/icon.svg new file mode 100644 index 0000000..131eb44 --- /dev/null +++ b/site/assets/icon.svg @@ -0,0 +1 @@ + diff --git a/site/data/latest.json b/site/data/latest.json new file mode 100644 index 0000000..5e00ae4 --- /dev/null +++ b/site/data/latest.json @@ -0,0 +1,50 @@ +{ + "published_at": "2026-10-24T15:00:02Z", + "commit": "a0d8388f1c3c8d51d19a45756746abb571eee9e5", + "game_version": "2.37.13", + "client": { + "version": "2.37.13+client.0.2.11", + "date": "2026-10-24", + "files": [ + { + "name": "bd2client-2.37.13+client.0.2.11-windows-x64.zip", + "platform": "windows-x64", + "kind": "bundle", + "size": 12190708, + "sha256": "a3e74f9420a08a6818d7ba625c068885fe46a370e453881e385b85597a97eeee", + "url": "/releases/downloads/bd2client-2.37.13%2Bclient.0.2.11-windows-x64.zip" + } + ] + }, + "server": { + "version": "2.37.13+server.0.2.1", + "date": "2026-10-24", + "migration": "none", + "files": [ + { + "name": "bd2server-2.37.13+server.0.2.1-linux-amd64.zip", + "platform": "linux-amd64", + "kind": "signed", + "size": 10658465, + "sha256": "a05765bfa509502edb6864515bad65b966433411091e5b141d08c775cd6cf9ce", + "url": "/releases/files/a05765bfa509502e/bd2server-2.37.13%2Bserver.0.2.1-linux-amd64.zip" + }, + { + "name": "bd2server-2.37.13+server.0.2.1-linux-arm64.zip", + "platform": "linux-arm64", + "kind": "signed", + "size": 9798516, + "sha256": "7d39c60b47888b4bad99064f07bb305c45a6e5e5493443ac0de806b04efaf954", + "url": "/releases/files/7d39c60b47888b4b/bd2server-2.37.13%2Bserver.0.2.1-linux-arm64.zip" + }, + { + "name": "bd2server-2.37.13+server.0.2.1-windows-x64.zip", + "platform": "windows-x64", + "kind": "bundle", + "size": 10798111, + "sha256": "f364ccb0ae2debaf9be10cb38376cdfe8a210a4b57f794edf955f9cd7c1d2985", + "url": "/releases/downloads/bd2server-2.37.13%2Bserver.0.2.1-windows-x64.zip" + } + ] + } +} diff --git a/site/index.html b/site/index.html new file mode 100644 index 0000000..3685ef1 --- /dev/null +++ b/site/index.html @@ -0,0 +1,107 @@ + + + + + +BD2 私服下载 + + + + + + + +
+ + BD2 + 私服 + + + +
+ +
+
+

适配游戏版本 —

+

BD2 私服下载

+

棕色尘埃2 私服的客户端启动器和服务端。这里提供最新版本、更新日志和 SHA-256 校验值。

+

发布于

+
+ +
+
+
+ 客户端 +

启动器

+

—

+

+
+

载入中…

+
+

解压后运行 bd2client.exe,选择包含 BrownDust II.exe 的游戏目录,再填写服务器地址。

+
+ +
+
+ 服务端 +

服务器

+

—

+

+
+

载入中…

+
+

解压后运行 bd2server,单人本地服默认监听 8080 端口;网页管理台在 /admin/。

+
+
+ +
+
+

更新日志

+
+ + + +
+
+
  1. 载入中…
+ +

内容来自签名发布的 CHANGELOG.md

+
+ +
+

下载后校验

+

把计算结果与卡片上的 SHA-256 对比,完全一致才说明文件完整。

+
+

Windows PowerShell

+
Get-FileHash .\bd2client-*.zip -Algorithm SHA256
+

Linux / macOS

+
sha256sum bd2server-*.zip
+
+

启动器和服务端的自动更新另外校验 Ed25519 签名的发布清单。

+
+
+ +
+

+ git.sighs.cc/Flechazo/bd2 + · GitHub +

+

非官方开发与研究项目,与 Brown Dust II 及其权利人无隶属或授权关系。仅供个人学习、研究和本地非商业测试,禁止转发或二次分发,详见 LICENSE。

+
+ +
+ +