// 生成 https://d3nnqcgewrb4f0.cloudfront.net/source :逐文件展示媒体中转的全部源码。
import { readFileSync, writeFileSync, mkdirSync, copyFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';
const here = dirname(fileURLToPath(import.meta.url));
const FILES = ['lambda/index.mjs', 'lambda/sign.mjs', 'template.yaml', 'waf.yaml', 'cf-router.js', 'dist-patch.jq', 'deploy.sh', 'create-mirror-distribution.sh', 'gen-source-page.mjs'];
const sha = readFileSync(join(here, 'build/SOURCE_SHA256'), 'utf8').trim();
const esc = (s) => s.replace(/&/g, '&').replace(//g, '>');
const out = join(here, 'build/source');
mkdirSync(join(out, 'files/lambda'), { recursive: true });
const sections = FILES.map((f) => {
copyFileSync(join(here, f), join(out, 'files', f));
const body = readFileSync(join(here, f), 'utf8');
return `${f} 下载
${esc(body)}
陈仓的文字消息不经过任何服务器。语音、图片、视频先在手机上加密,再以密文形式经这里中转;App 内 24 小时后显示「已过期」,云端按 S3 生命周期约 1–2 天内自动删除。服务器拿不到任何密钥,也不记录 IP。下面就是线上运行的全部代码。
运营者声明的线上部署包 SHA-256:${sha}。可核对方法:下载 lambda/index.mjs 与 lambda/sign.mjs,按 deploy.sh 第 1 步打包后计算 SHA-256,与此值以及 curl -sI "https://d3nnqcgewrb4f0.cloudfront.net/api/upload" | grep x-cc-source-sha256 的结果比对——一致说明这份公开源码与运营者的声明相符,但这是一条可核对的声明,不是密码学证明(Lambda 真正执行代码的哈希只有账号所有者能看到)。