新增 DeepSeek / GLM 余额显示、菜单栏分段开关与应用内设置窗口 - #2
Open
RichardYi-SYSU wants to merge 6 commits into
Open
RichardYi-SYSU wants to merge 6 commits into
RichardYi-SYSU wants to merge 6 commits into
Conversation
- RemoteBalanceStore polls DeepSeek /user/balance and the BigModel CN account report endpoint; API keys live in UserDefaults (set via the in-app settings window), never in source or build products. - Menu bar title adapts to content width and renders Codex quota, DS and GLM balance segments; checkmark menu toggles show/hide each segment. - Settings window (设置…, ⌘,) edits keys with masked echo and saves them with instant effect.
- Status item now pops its menu manually so the menu's horizontal center tracks the item center regardless of which balance segments are shown. - Secure key fields set cell wraps=false + scrollable so long keys scroll on one line instead of wrapping dots to a second line. - 保存 now closes the settings window after persisting; the window also opens centered instead of cascading to the bottom-left.
- popUp(in:) made the menu inherit the status bar button's dark-tinted appearance, rendering dark menus in light mode; pin the menu to NSApp.effectiveAppearance so light/dark system modes both render with the standard menu material (HIG: menus follow the system appearance). - Drop the 3pt vertical offset so the menu's top edge sits flush with the bottom of the menu bar.
The manual popUp presentation rendered with the wrong (dark) appearance, sat 9pt inside the menu bar, and could reopen pre-scrolled with the first item hidden under the bar. Go back to the system-anchored presentation, which guarantees correct light/dark materials and flush placement, and achieve stable centering by pinning menu.minimumWidth to the status item width in menuNeedsUpdate (equal width + left anchor = visually centered). Settings window: secure fields scroll long keys on one line instead of wrapping dots; 保存 closes the window; the window opens centered.
- New AppSettings: refresh intervals persist in UserDefaults (interval.quotaSeconds / interval.balanceSeconds) with lower-bound clamping; the old hardcoded 60s/600s values remain as fallback defaults. - Settings window gains 额度刷新 / 余额刷新 pop-up buttons: quota presets 30s/1/2/5min, balance presets 1/2/3/4/5/10/15/20/25/30/60min per request; non-preset values (e.g. written via defaults) are echoed back as an extra row instead of being swallowed. - Both stores rebuild their timer on save (applySettings) and refresh immediately, so new intervals take effect without restarting the app. - defaults write com.wangjiaxuan666.CodexBar interval.* also works (picked up on next launch or settings save).
- Settings rows renamed: 额度刷新 → Codex额度刷新间隔, 余额刷新 → DS/GLM余额刷新间隔; label column and window widened to fit. - menuNeedsUpdate now rebuilds the menu items in place: reusing one NSMenu instance preserved the previous scroll offset, so reopening shifted every row up by one (first item hidden under the menu bar) and clicks meant for 设置… could land on 退出.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
概述
在原有 Codex 额度显示的基础上,菜单栏现在可以同时展示 DeepSeek 与智谱 GLM 的账户余额;菜单栏三段内容支持在状态菜单中勾选显隐;新增应用内设置窗口管理 API Key 与刷新间隔。全部配置存于本机 UserDefaults,源码与构建产物不再包含任何密钥(已核查全部历史对象)。
新增功能
1. 多模型余额显示
DS xx.xx¥与GLM xx.xx¥GET /user/balance(Bearer 认证),优先显示 CNY 余额www.bigmodel.cn/api/biz/account/query-customer-account-report;旧的open.bigmodel.cn/api/paas/v4/users/me/balance已 404 下线)DS --¥/GLM --¥2. 菜单栏分段开关
menubar.show*),默认全显,重启保留3. 应用内设置窗口(设置… ⌘,)
defaults write写入)回显为额外档位,不会被吞掉4. 菜单栏交互修复
minimumWidth跟随状态项宽度),显示分段增减时不再左右偏移测试
200 OK(CNY 余额正确);GLM200 OK(availableBalance 正确)git grep全历史对象检索确认无密钥残留注意事项