Skip to content

Commit 38fcfc7

Browse files
committed
feat: add req count
1 parent 3dd0b6a commit 38fcfc7

File tree

2 files changed

+8
-25
lines changed

2 files changed

+8
-25
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@
2020
- 设置 Token(支持 JWT 或 API Key,均使用 Bearer 头)
2121
- 标题格式:百分比 或 自定义模板
2222
- 刷新/隐藏标题/打开控制台/延迟监控(测速:https://packy.te.sb/)/推广(PackyCode / Codex)
23-
- 检查更新:对比 GitHub 最新 release 的 tag 与本地版本
24-
- 在线更新:直接下载最新 release 的 macOS 压缩包并替换 .app 后重启
23+
- 检查更新:对比 GitHub 最新 release 的 tag 与本地版本(固定仓库:`jacksonon/packycode-macos-statusbar`
24+
- 在线更新:直接下载最新 release 的 macOS 压缩包并替换 .app 后重启(固定仓库,不可修改)
2525

2626
## 运行
2727
```bash
@@ -82,17 +82,16 @@ python3 setup.py py2app
8282
"poll_interval": 180,
8383
"title_mode": "percent | custom",
8484
"title_custom": "D {d_pct}% | M {m_pct}%",
85-
"update_repo": "owner/repo",
8685
"update_expected_team_id": ""
8786
}
8887
```
8988

9089
检查更新:
91-
- `update_repo` 填写你的 GitHub 仓库 `owner/repo`(例如 `packycode/packycode`
90+
- 固定使用 `jacksonon/packycode-macos-statusbar`
9291
- 菜单中点击“检查更新”,会调用 GitHub Releases API 比较最新 `tag_name` 与当前版本,若有新版本会提示并可跳转至发布页下载
9392

9493
在线更新:
95-
- 同样需要配置 `update_repo`
94+
- 固定使用 `jacksonon/packycode-macos-statusbar`
9695
- 点击“在线更新”,会下载最新 release 的 zip,解压并自动替换本机正在使用的 `.app`(通过临时脚本在退出后替换),随后自动重启应用;若当前以源码方式运行,会打开 Finder 供你手动拖拽替换。
9796
- 安全校验:
9897
- 若 Release 同时提供 `.sha256`/`.sha256sum`/`sha256.txt`,会自动核对压缩包 SHA256,不匹配则中止

main.py

Lines changed: 4 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".packycode")
2828
CONFIG_FILE = os.path.join(CONFIG_DIR, "config.json")
29+
DEFAULT_UPDATE_REPO = "jacksonon/packycode-macos-statusbar"
2930

3031
DEFAULT_CONFIG = {
3132
"account_version": "shared", # shared | private | codex_shared
@@ -37,8 +38,6 @@
3738
"title_include_requests": False,
3839
# 自定义模板占位符:{d_pct} {m_pct} {d_spent} {d_limit} {m_spent} {m_limit} {bal} {d_req}
3940
"title_custom": "D {d_pct}% | M {m_pct}%",
40-
# GitHub 更新仓库(owner/repo),用于“检查/在线更新”,为空则提示未配置
41-
"update_repo": "",
4241
# 期望的 Apple TeamIdentifier(可选,用于强校验签名)
4342
"update_expected_team_id": "",
4443
}
@@ -427,17 +426,8 @@ def _compare_versions(self, a: str, b: str) -> int:
427426
tb = self._parse_version_tuple(b)
428427
return (ta > tb) - (ta < tb)
429428

430-
def check_update_now(self, _: Optional[rumps.MenuItem] = None):
431-
repo = (self._cfg.get("update_repo") or "").strip()
432-
if not repo or "/" not in repo:
433-
rumps.alert(
434-
title="检查更新",
435-
message=(
436-
"未配置更新仓库。请在 ~/.packycode/config.json 中设置 update_repo 为 \"owner/repo\"\n"
437-
"例如:\"packycode/packycode\""
438-
),
439-
)
440-
return
429+
def check_update_now(self, _: Optional[rumps.MenuItem] = None):
430+
repo = DEFAULT_UPDATE_REPO
441431

442432
api = f"https://api.github.com/repos/{repo}/releases/latest"
443433
try:
@@ -528,13 +518,7 @@ def _current_app_bundle(self) -> Optional[str]:
528518
return None
529519

530520
def update_online_now(self, _: Optional[rumps.MenuItem] = None):
531-
repo = (self._cfg.get("update_repo") or "").strip()
532-
if not repo or "/" not in repo:
533-
rumps.alert(
534-
title="在线更新",
535-
message=("未配置更新仓库。请在 ~/.packycode/config.json 设置 update_repo 为 \"owner/repo\"。"),
536-
)
537-
return
521+
repo = DEFAULT_UPDATE_REPO
538522
try:
539523
latest = self._latest_release_asset(repo)
540524
if not latest:

0 commit comments

Comments
 (0)