|
26 | 26 |
|
27 | 27 | CONFIG_DIR = os.path.join(os.path.expanduser("~"), ".packycode") |
28 | 28 | CONFIG_FILE = os.path.join(CONFIG_DIR, "config.json") |
| 29 | +DEFAULT_UPDATE_REPO = "jacksonon/packycode-macos-statusbar" |
29 | 30 |
|
30 | 31 | DEFAULT_CONFIG = { |
31 | 32 | "account_version": "shared", # shared | private | codex_shared |
|
37 | 38 | "title_include_requests": False, |
38 | 39 | # 自定义模板占位符:{d_pct} {m_pct} {d_spent} {d_limit} {m_spent} {m_limit} {bal} {d_req} |
39 | 40 | "title_custom": "D {d_pct}% | M {m_pct}%", |
40 | | - # GitHub 更新仓库(owner/repo),用于“检查/在线更新”,为空则提示未配置 |
41 | | - "update_repo": "", |
42 | 41 | # 期望的 Apple TeamIdentifier(可选,用于强校验签名) |
43 | 42 | "update_expected_team_id": "", |
44 | 43 | } |
@@ -427,17 +426,8 @@ def _compare_versions(self, a: str, b: str) -> int: |
427 | 426 | tb = self._parse_version_tuple(b) |
428 | 427 | return (ta > tb) - (ta < tb) |
429 | 428 |
|
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 |
441 | 431 |
|
442 | 432 | api = f"https://api.github.com/repos/{repo}/releases/latest" |
443 | 433 | try: |
@@ -528,13 +518,7 @@ def _current_app_bundle(self) -> Optional[str]: |
528 | 518 | return None |
529 | 519 |
|
530 | 520 | 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 |
538 | 522 | try: |
539 | 523 | latest = self._latest_release_asset(repo) |
540 | 524 | if not latest: |
|
0 commit comments