share 双远端同时推送;数据仓接入 Gitea 受限上传账号

This commit is contained in:
2026-10-09 22:05:59 +08:00
parent 55b6973e8e
commit 4797702e62
4 changed files with 10 additions and 11 deletions
+1 -1
View File
@@ -190,7 +190,7 @@ stdout 的 Markdown 依次包含以下章节。标题是解释规则的定位锚
- **导出**:`python scripts/share_export.py --archive <档案路径>`(或按 `--birth/--place/--gender` 检索定位),生成结构化 JSON 脱敏包到 `share/pending/<盘hash>.json`。完整度门槛:性别/四柱/大运齐全 + 至少一条反馈事件(任意核实状态),不满足则拒绝导出(退出码 2)。**未核实推测不得入包**:归纳小节的推测性结论一律不导出;反馈事件(带核实状态标签)可入包,自由文本(反馈原文、盘面细节、归纳文字)一律不入。
- **授权询问(强制)**:推送前必须先把脱敏包**全文展示**给用户,并询问是否授权推送——用户同意才执行推送;不同意则取消,脱敏包保留在 `share/pending/`(用户可随时删除),不影响技能正常使用。
- **推送**:`python scripts/share_push.py`,把 `share/pending/` 的包推送到 `share/config.json` 配置的共建远端(GitHub / Gitea 逐个尝试,至少一个成功即算成功;远端地址由授权方填写)。推送成功后包移入 `share/pushed/`,并告知用户新增授权次数(+10;该盘已计励过则不重复加)。推送失败(无 git / 无网络 / 远端不可达)保留 pending,不丢数据。
- **推送**:`python scripts/share_push.py`,把 `share/pending/` 的包推送到 `share/config.json` 配置的共建远端(GitHub 与 Gitea **两条线都推**,至少一个成功即算成功;远端地址由授权方填写)。推送成功后包移入 `share/pushed/`,并告知用户新增授权次数(+10;该盘已计励过则不重复加)。推送失败(无 git / 无网络 / 远端不可达)保留 pending,不丢数据。
## 版本与自更新
+3 -3
View File
@@ -3,7 +3,7 @@
".gitignore": "1e4671dee2d3123a45609ed82a4329531e0d41bf1b6895ab169ecd8813cfb8f5",
"LICENSE.md": "6b839540e0fd4ab75530ec31fc5c3cbc3c2d5de5fe85068ef1c0901e54be9315",
"README.md": "1e11e5d19856fbd9bb15068c74e184617a10b2e0b18c7e42d9b617cd0d8f534a",
"SKILL.md": "8b493ae2236b5941c88e282d4793126487e4d81a6f3c24976020fb26e50cf67a",
"SKILL.md": "d3d6791d2278ee7cb6e8b50bc5758de2406f89ef629f23941632804b2dcec428",
"VERSION": "76120c1f2c4311c2154c22a6b58e00e411e0ebe76afae0daf608d9196c61f114",
"data/.public_edition.json": "e8692c45d512c78903fc89a924d0e6d4dc9b95a78ca6b359bb7a5ef5c946ffee",
"data/cities.json": "00f17905c8843218162e25238a78aeb4c4a3bb5424b611cc30ed9e436db31854",
@@ -585,9 +585,9 @@
"scripts/render/markdown.py": "4b2bcc3fc6581728d74bbaa357bf1db2e8aec1d3ec54c2c27ca645b6c5179977",
"scripts/self_update.py": "95dc0302ca2b78d71b2893ebaced7e233dbc00944a5e3c5b06081b5c9a749f8a",
"scripts/share_export.py": "21396143ad5cc2d244c7cc060a3ece25702594465689a9f12438dfe92de3296f",
"scripts/share_push.py": "8a367a3a4aa1bad27fbf3e9b241ebf69bf687a134045a06842e06047b58458ae",
"scripts/share_push.py": "42683c27a93f12208c20b0a5cd2feb7cd81f9be3efb76b46d4789ad4d2aab4ca",
"share/README.md": "42ebed92285752af93c7c7af5eb4b6e84ed836408d0cedb57e1b32c796746b26",
"share/config.json": "22a5615dd7db5aa688e1ed8e464874c70d90d21e6aa126e214b9c7896b99c7cd",
"share/config.json": "b0747cb29b01e65c79e612062e1d572f6658c3046ae8bb5d97020ab2d7c6f04e",
"tests/golden/history_tz.yaml": "3fb74e90c4f53abebaac0a5de8825ac3794fc0b5b41dc84121201e70cecade47",
"tests/golden/longitudes.yaml": "6fda1e6b632d29c135362c9273b931c4416c9f24c31b07e2a7baadc6e2077bc2",
"tests/golden/time_boundary.yaml": "637090a1c081b9b824fc0073d29dad073d29138c3b48082bdf41ce77f5af3b37",
+4 -5
View File
@@ -105,13 +105,12 @@ def main() -> int:
n_ok = 0
for pkg in packages:
chart_hash = pkg.stem
ok_remote = None
ok_remotes = []
for name, remote in remotes:
with tempfile.TemporaryDirectory(prefix="ziping-share-") as td:
if _push_to_remote(remote, pkg, td):
ok_remote = name
break
if ok_remote is None:
ok_remotes.append(name)
if not ok_remotes:
print(f"FAIL {pkg.name}:所有远端推送失败(无网络或远端不可达),"
f"pending 保留。", file=sys.stderr)
continue
@@ -119,7 +118,7 @@ def main() -> int:
shutil.move(str(pkg), str(pushed / pkg.name))
note = (f"+{GRANT_USES} 次(新增计励)" if granted
else "该盘已计励过,本次不重复加次")
print(f"OK {pkg.name} → {ok_remote};{note}")
print(f"OK {pkg.name} → {'、'.join(ok_remotes)};{note}")
n_ok += 1
return 0 if n_ok else 3
+2 -2
View File
@@ -1,5 +1,5 @@
{
"github_remote": "https://github.com/mxiaonian/ZiPingEightChar-archives.git",
"gitea_remote": "https://git.lingyaomiaojie.com/moxiaonian/ZiPingEightChar-archives.git",
"_note": "脱敏包接收远端。推送时优先用本机 git 凭证;公开用户的免登录推送令牌待授权方签发受限账号后另行下发(勿在此写入管理员令牌)。亦可用环境变量 ZIPING_SHARE_GITHUB_REMOTE / ZIPING_SHARE_GITEA_REMOTE 覆盖(可在 URL 中内嵌凭证)。"
"gitea_remote": "https://archives-uploader:df6be7f4a974bf65d796cd24e850e014a7faa8fc@git.lingyaomiaojie.com/ziping-eightchar/ZiPingEightChar-archives.git",
"_note": "脱敏包接收远端。gitea_remote 内嵌的是 archives-uploader 受限账号令牌(仅数据仓可写,泄漏也只影响数据仓);GitHub 线路依赖本机 git 凭证。环境变量 ZIPING_SHARE_GITHUB_REMOTE / ZIPING_SHARE_GITEA_REMOTE 可覆盖。"
}