Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: pigeonbox/server
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.7.0
Choose a base ref
...
head repository: pigeonbox/server
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.8.0
Choose a head ref
  • 6 commits
  • 9 files changed
  • 1 contributor

Commits on Nov 9, 2026

  1. feat(pb): doctor 端点/凭据解析层 + --server/--api-key-file + 三态结论 (#117) (#118)

    此前 `pb doctor` 的端点与 API Key 只能来自环境变量(PB_SERVER / PB_API_KEY):
    裸跑 doctor 必落默认地址,必报「服务不可达」,而真实原因往往只是「没配」;
    API Key 只能走环境变量,进程环境在同主机其它用户可见;也无法在命令行
    显式指定端点。
    
    改动:
    
    1. 新增 cmd/pb/endpoint.go(解析层):
       - 端点来源优先级:命令行 --server > 环境变量 PB_SERVER > .env 的
         PB_SERVER > .env 的 PB_FRONTEND_PORT / PB_API_PORT(有序候选)。
         显式覆盖(--server / PB_SERVER)独占不回落;.env 属部署描述符,
         产出候选列表由 doctor 逐个探测。
       - .env 查找顺序:$PIGEONBOX_DIR/.env → ./.env → /opt/pigeonbox/.env →
         /etc/pigeonbox/.env;逐键取第一个命中文件并在输出里标注来源文件与键名。
       - 探测判据是「响应确实是 PigeonBox API」(JSON 且含 code 字段),
         不是「有 HTTP 响应」——否则 nginx 的 TLS 提示页会造成「可达但后续全 400」
         的假绿。
    
    2. cmd/pb/doctor.go:
       - 新增旗标 --server <url>(等价 --server=<url>)、--api-key-file <路径>;
         明文 --api-key 一律当用法错误拒绝(argv 会进 ps 与 shell 历史),
         指向 --api-key-file / PB_API_KEY。旗标缺值与空值均以退出码 2 退出。
       - 三态结论:ok(探到)/ fail(已配置但不可达 ⇒ 真故障)/ na(未配置 ⇒
         无法判定,不是故障)。na 单列统计,退出码仍为 1(「没检查 ≠ 检查通过」),
         但不计入故障数;未配置端点时不再误报「Key 无权限」。
       - 报告新增「端点来源」「凭据来源」「端点探测」三行,并输出未配置项计数。
    
    3. cmd/pb/main.go:applyEndpoint(resolveEndpoint()) 生效解析结果;新增全局
       serverURLSource / apiKeySource(只存来源标签,绝不存密钥明文);usage()
       增补 .env 查找顺序与新用法。cmdDoctor 结束时 defer 还原全局,无副作用。
    
    文案变更(既有单测已同步):
       - 「GET /api/config 失败:」→「端点不可达:GET /api/config 失败:」
       - 未配置场景新增「未配置端点:默认地址 … 不可达」
       - 结论行在存在 na 项时追加「N 项未配置」;na 为 0 时结论行与旧格式完全一致
       - 深度检查 advice 加入 --server / --api-key-file 提示
    
    单测(cmd/pb/endpoint_test.go,新增):
       .env 端点生效并标注来源 / 未配置报「未配置端点」而非「服务不可达」/
       --server 覆盖 .env / --api-key-file 的密钥不进 argv 与输出且服务端确实收到 /
       明文 --api-key 被拒 / 已配置但不可达判 fail / 候选顺序 / 候选全失败取首个错误 /
       旗标缺值与空值是用法错误 / .env 解析 / bind 地址归一。
    
    验证:gofmt -l . 干净;GOWORK=off go build ./... RC=0;GOWORK=off go vet ./...
    RC=0;GOWORK=off go test -race ./... 全绿(ok cmd/pb, ok cmd/server);
    GOWORK=off go mod verify 通过。真机(10.10.10.3)实测:裸跑自动定位
    http://127.0.0.1:56790 并标注来源 .env 的 PB_FRONTEND_PORT;--server 覆盖生效;
    明文 --api-key 退出码 2;--json 输出正常。
    
    Fixes #117
    zy84338719 authored Nov 9, 2026
    Configuration menu
    Copy the full SHA
    0d02cf1 View commit details
    Browse the repository at this point in the history

Commits on Nov 10, 2026

  1. Configuration menu
    Copy the full SHA
    88fedd2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    8605034 View commit details
    Browse the repository at this point in the history

Commits on Nov 11, 2026

  1. fix(ci): docs-consistency 补检出 pigeonbox/p2p——与 hub 门禁新射程兼容(pigeonbox#…

    …327) (#121)
    
    Refs pigeonbox/pigeonbox#327:hub 门禁绑定扫描源扩到 core+server+p2p
    (缺仓判红)⇒ 本仓 docs-consistency job 布局镜像同步补 hub/p2p 嵌套检出,
    否则 hub 侧合并后本仓 CI 当场红。
    zy84338719 authored Nov 11, 2026
    Configuration menu
    Copy the full SHA
    ad7ad15 View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2026

  1. Configuration menu
    Copy the full SHA
    8d27830 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b7858a7 View commit details
    Browse the repository at this point in the history
Loading