niuma-codex 0.0.1-beta.26 → 0.0.1-beta.28

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,12 +4,20 @@ export function mountAutostartSettings(doc,win,request){
4
4
  const bridge=win.niumaLoginItem;
5
5
  const approvalMessage='请前往「系统设置 → 通用 → 登录项与扩展」,允许 Niuma Lite 登录时打开。返回后将自动检查状态。';
6
6
  const errorMessage=(error,fallback)=>typeof error==='string'?error:error?.message||fallback;
7
- // 仅 Lite 宿主提供统一版本;静态信息不受登录项读取失败影响。
7
+ // Lite 版本来自宿主;浏览器单独查询当前 daemon,不依赖自启动状态。
8
8
  const about=$('app-about');
9
- if(about){
10
- const version=typeof bridge?.version==='string'?bridge.version:'';
11
- about.hidden=!version;
12
- $('app-version').textContent=version;
9
+ const hostVersion=typeof bridge?.version==='string'?bridge.version:'';
10
+ if(about&&hostVersion){about.hidden=false;$('app-version').textContent=hostVersion;}
11
+ async function loadVersion(){
12
+ if(!about||hostVersion)return;
13
+ try{
14
+ const response=await request('/api/v1/settings/version',{cache:'no-store'});
15
+ const payload=await response.json();
16
+ const version=response.ok&&payload.code===0&&typeof payload.data?.daemon_version==='string'?payload.data.daemon_version:'';
17
+ about.hidden=!version;
18
+ $('app-about-title').textContent='关于 Niuma daemon';
19
+ $('app-version').textContent=version;
20
+ }catch{about.hidden=true;}
13
21
  }
14
22
  // 只有应用 preload 提供登录项能力;普通浏览器继续使用 npm 设置接口。
15
23
  if(bridge){
@@ -88,7 +96,7 @@ export function mountAutostartSettings(doc,win,request){
88
96
  $('device-workspace').hidden=settings;
89
97
  $('settings-toggle').setAttribute('aria-current',settings?'page':'false');
90
98
  $('devices-nav').setAttribute('aria-current',settings?'false':'page');
91
- stop();if(visible())void load();
99
+ stop();if(visible()){void loadVersion();void load();}
92
100
  }
93
101
  $('settings-toggle').onclick=()=>navigate(true);
94
102
  $('devices-nav').onclick=()=>navigate(false);