niuma-codex 0.0.1-beta.20 → 0.0.1-beta.21
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.
- package/dist/assets/pairing-web/index.html +2 -1
- package/dist/assets/pairing-web/settings.js +10 -3
- package/dist/assets/pairing-web/style.css +5 -0
- package/dist/cli.js +39 -3
- package/dist/managed-tauri.js +1 -1
- package/dist/managed.js +1 -1
- package/package.json +1 -1
- package/resources/lite-release.json +7 -7
- package/resources/niuma-daemon-arm64.tgz +0 -0
- package/resources/niuma-lite-arm64.dmg +0 -0
|
@@ -13,7 +13,8 @@
|
|
|
13
13
|
</nav><p class="trust">仅允许你信任的设备连接。</p>
|
|
14
14
|
</aside>
|
|
15
15
|
<div class="content">
|
|
16
|
-
<section id="settings-panel" class="settings-panel" aria-labelledby="settings-title" hidden><header class="page-heading"><h2 id="settings-title">设置</h2><p>管理这台电脑上的 Niuma。</p></header><h3 class="settings-group-title">启动与运行</h3><div id="autostart-controls" class="autostart-row"><div><label id="autostart-label" for="autostart-enabled">登录后自动启动 Niuma</label><p id="autostart-description">登录这台 Mac 后自动启动后台服务。关闭后,当前服务仍会继续运行。</p><p id="autostart-hint" class="settings-hint">首次开启需要下载运行文件。</p></div><input id="autostart-enabled" type="checkbox" role="switch" aria-describedby="autostart-description" disabled></div><p id="autostart-message" role="status" aria-live="polite">正在读取设置…</p><button id="autostart-retry" class="text-button" hidden>重试</button
|
|
16
|
+
<section id="settings-panel" class="settings-panel" aria-labelledby="settings-title" hidden><header class="page-heading"><h2 id="settings-title">设置</h2><p>管理这台电脑上的 Niuma。</p></header><h3 class="settings-group-title">启动与运行</h3><div id="autostart-controls" class="autostart-row"><div><label id="autostart-label" for="autostart-enabled">登录后自动启动 Niuma</label><p id="autostart-description">登录这台 Mac 后自动启动后台服务。关闭后,当前服务仍会继续运行。</p><p id="autostart-hint" class="settings-hint">首次开启需要下载运行文件。</p></div><input id="autostart-enabled" type="checkbox" role="switch" aria-describedby="autostart-description" disabled></div><p id="autostart-message" role="status" aria-live="polite">正在读取设置…</p><button id="autostart-retry" class="text-button" hidden>重试</button>
|
|
17
|
+
<section id="app-about" class="app-about" aria-labelledby="app-about-title" hidden><h3 id="app-about-title" class="settings-group-title">关于 Niuma Lite</h3><dl class="app-version"><dt>版本</dt><dd id="app-version"></dd></dl></section></section>
|
|
17
18
|
<div id="device-workspace">
|
|
18
19
|
<div id="home-intro"></div>
|
|
19
20
|
<div id="flow-intro" hidden><button id="back" class="text-button back"><span class="icon icon-arrow" aria-hidden="true"></span>返回设备列表</button><h1>添加设备</h1><p>使用手机 Niuma 扫码,在此页面确认配对。</p><ol class="steps" aria-label="配对进度"><li id="step-1"><span class="step-number">1</span><span>扫描二维码</span></li><li id="step-2"><span class="step-number">2</span><span>允许配对</span></li><li id="step-3"><span class="step-number">3</span><span>完成连接</span></li></ol></div>
|
|
@@ -2,6 +2,13 @@
|
|
|
2
2
|
export function mountAutostartSettings(doc,win,request){
|
|
3
3
|
const $=id=>doc.getElementById(id);
|
|
4
4
|
const bridge=win.niumaLoginItem;
|
|
5
|
+
// 仅 Lite 宿主提供统一版本;静态信息不受登录项读取失败影响。
|
|
6
|
+
const about=$('app-about');
|
|
7
|
+
if(about){
|
|
8
|
+
const version=typeof bridge?.version==='string'?bridge.version:'';
|
|
9
|
+
about.hidden=!version;
|
|
10
|
+
$('app-version').textContent=version;
|
|
11
|
+
}
|
|
5
12
|
// 只有应用 preload 提供登录项能力;普通浏览器继续使用 npm 设置接口。
|
|
6
13
|
if(bridge){
|
|
7
14
|
$('autostart-label').textContent='登录时自动启动 Niuma';
|
|
@@ -13,7 +20,7 @@ export function mountAutostartSettings(doc,win,request){
|
|
|
13
20
|
if(init.method==='POST')await bridge.set(JSON.parse(init.body).enabled);
|
|
14
21
|
const current=await bridge.read();
|
|
15
22
|
// 宿主桥接返回实际登录项状态,映射到页面共用的系统启用字段。
|
|
16
|
-
return {ok:true,json:async()=>({code:0,data:{supported:current.available,registered:current.enabled,loaded:current.enabled,available:current.available,operation:null,reason:'请安装 Niuma 应用后设置登录自启动'}})};
|
|
23
|
+
return {ok:true,json:async()=>({code:0,data:{supported:current.available,registered:current.enabled||current.requiresApproval===true,loaded:current.enabled,available:current.available,operation:null,notice:current.message,reason:'请安装 Niuma 应用后设置登录自启动'}})};
|
|
17
24
|
}
|
|
18
25
|
let state=null,inFlight=false,changing=false,generation=0,timer=null;
|
|
19
26
|
const visible=()=>!$('settings-panel').hidden&&!doc.hidden;
|
|
@@ -31,8 +38,8 @@ export function mountAutostartSettings(doc,win,request){
|
|
|
31
38
|
$('autostart-enabled').disabled=!state||!state.supported||systemUnknown()||working||inFlight;
|
|
32
39
|
$('autostart-message').textContent=message||(working?(operation?.target_enabled===false?'正在关闭…':'正在开启…'):
|
|
33
40
|
!state?'正在读取设置…':!state.supported?(state.reason||'当前环境不支持登录自启动'):
|
|
34
|
-
systemUnknown()?'无法确认系统登录项状态,请刷新重试。':systemUnavailable()?'自启动尚未获系统启用,请检查系统设置中的登录项并允许 Niuma 在后台运行。':
|
|
35
|
-
state.registered&&!state.available?'已配置,但暂不可用。请重新配置。':state.registered?'已开启':'未开启');
|
|
41
|
+
state.notice||(systemUnknown()?'无法确认系统登录项状态,请刷新重试。':systemUnavailable()?(bridge?'请在系统设置的登录项中允许 Niuma 登录时打开,然后刷新状态。':'自启动尚未获系统启用,请检查系统设置中的登录项并允许 Niuma 在后台运行。'):
|
|
42
|
+
state.registered&&!state.available?'已配置,但暂不可用。请重新配置。':state.registered?'已开启':'未开启'));
|
|
36
43
|
$('autostart-retry').hidden=working||(!message&&!(state?.registered&&!state.available));
|
|
37
44
|
$('autostart-retry').textContent=systemUnavailable()?'刷新状态':state?.registered&&!state.available?'重新配置':'重试';
|
|
38
45
|
}
|
|
@@ -77,6 +77,11 @@
|
|
|
77
77
|
.autostart-row label{font-size:18px;font-weight:500}
|
|
78
78
|
.autostart-row p{max-width:60ch}
|
|
79
79
|
#autostart-enabled{margin-top:4px}
|
|
80
|
+
/* 关于区域沿用现有设置分组;版本使用普通文本,长版本号允许换行。 */
|
|
81
|
+
.app-about{margin-top:48px}
|
|
82
|
+
.app-version{display:flex;align-items:baseline;justify-content:space-between;gap:24px;margin:20px 0 0}
|
|
83
|
+
.app-version dt{color:var(--muted)}
|
|
84
|
+
.app-version dd{margin:0;overflow-wrap:anywhere;min-width:0}
|
|
80
85
|
/* 配对进度属于设备工作区,切换设置后仍保留原有流程。 */
|
|
81
86
|
#flow-intro .back{margin:0 0 16px;font-size:14px}
|
|
82
87
|
#flow-intro h1{font-size:28px;letter-spacing:0}
|
package/dist/cli.js
CHANGED
|
@@ -393,6 +393,36 @@ import path5 from "node:path";
|
|
|
393
393
|
import { createHash } from "node:crypto";
|
|
394
394
|
function createLiteLoginRemoval({ home, app, run = runProcess }) {
|
|
395
395
|
const file = path5.join(home, "Library/LaunchAgents", label + ".plist"), program = path5.join(app, "Contents/MacOS/niuma-lite"), service = `gui/${process.getuid?.()}/${label}`;
|
|
396
|
+
const native = async () => {
|
|
397
|
+
const marker = path5.join(app, "Contents/Resources/niuma-release.json");
|
|
398
|
+
let stat4;
|
|
399
|
+
try {
|
|
400
|
+
stat4 = await fs5.lstat(marker);
|
|
401
|
+
} catch (e) {
|
|
402
|
+
if (e.code === "ENOENT") return null;
|
|
403
|
+
throw e;
|
|
404
|
+
}
|
|
405
|
+
if (!stat4.isFile() || stat4.size > 65536) throw Error("\u5E94\u7528\u53D1\u884C\u6807\u8BB0\u4E0D\u53EF\u4FE1");
|
|
406
|
+
const release2 = JSON.parse(await fs5.readFile(marker, "utf8"));
|
|
407
|
+
if (release2.loginService === void 0) return null;
|
|
408
|
+
if (release2.loginService !== "main-app-v1") throw Error("\u5E94\u7528\u767B\u5F55\u9879\u80FD\u529B\u65E0\u6CD5\u8BC6\u522B\uFF0C\u8BF7\u4F7F\u7528\u5339\u914D\u7248\u672C\u5378\u8F7D");
|
|
409
|
+
for (const dir of [app, path5.join(app, "Contents"), path5.join(app, "Contents/MacOS"), path5.join(app, "Contents/Resources")]) {
|
|
410
|
+
const s = await fs5.lstat(dir);
|
|
411
|
+
if (!s.isDirectory() || s.uid !== process.getuid?.() || s.mode & 18 || await fs5.realpath(dir) !== dir) throw Error("\u5E94\u7528\u767B\u5F55\u9879\u76EE\u5F55\u4E0D\u53EF\u4FE1\u6216\u5305\u542B\u94FE\u63A5");
|
|
412
|
+
}
|
|
413
|
+
for (const f of [marker, program, path5.join(app, "Contents/Info.plist")]) {
|
|
414
|
+
const s = await fs5.lstat(f);
|
|
415
|
+
if (!s.isFile() || s.uid !== process.getuid?.() || s.mode & 18) throw Error("\u5E94\u7528\u767B\u5F55\u9879\u6587\u4EF6\u4E0D\u53EF\u4FE1\u6216\u5305\u542B\u94FE\u63A5");
|
|
416
|
+
}
|
|
417
|
+
if ((await run("/usr/libexec/PlistBuddy", ["-c", "Print :CFBundleIdentifier", path5.join(app, "Contents/Info.plist")])).trim() !== label) throw Error("\u5E94\u7528\u767B\u5F55\u9879\u8EAB\u4EFD\u4E0D\u5339\u914D");
|
|
418
|
+
await run("/usr/bin/codesign", ["--verify", "--strict", app]);
|
|
419
|
+
const request2 = async (flag) => {
|
|
420
|
+
const state = JSON.parse(await run(program, [flag]));
|
|
421
|
+
if (state.schema !== 1 || state.available !== true || typeof state.registered !== "boolean" || typeof state.enabled !== "boolean" || state.enabled && !state.registered) throw Error("\u539F\u751F\u767B\u5F55\u9879\u72B6\u6001\u65E0\u6CD5\u786E\u8BA4");
|
|
422
|
+
return state;
|
|
423
|
+
};
|
|
424
|
+
return { request: request2, state: await request2("--login-item-status") };
|
|
425
|
+
};
|
|
396
426
|
const read = async () => {
|
|
397
427
|
let stat4;
|
|
398
428
|
try {
|
|
@@ -426,11 +456,17 @@ function createLiteLoginRemoval({ home, app, run = runProcess }) {
|
|
|
426
456
|
inspect: async () => {
|
|
427
457
|
const registration = await read();
|
|
428
458
|
const loaded = await job();
|
|
429
|
-
|
|
459
|
+
const current2 = await native();
|
|
460
|
+
return !!registration || !!loaded || current2?.state.registered === true;
|
|
430
461
|
},
|
|
431
462
|
disable: async () => {
|
|
432
463
|
const before = await read();
|
|
433
464
|
await job();
|
|
465
|
+
const current2 = await native();
|
|
466
|
+
if (current2?.state.registered) {
|
|
467
|
+
const result = await current2.request("--login-item-disable");
|
|
468
|
+
if (result.registered || (await current2.request("--login-item-status")).registered) throw Error("\u539F\u751F\u767B\u5F55\u9879\u6CE8\u9500\u672A\u786E\u8BA4\uFF0C\u4FDD\u7559\u5E94\u7528\u4E0E\u65E7\u6CE8\u518C");
|
|
469
|
+
}
|
|
434
470
|
if (!before) return;
|
|
435
471
|
const after = await read();
|
|
436
472
|
if (JSON.stringify(before) !== JSON.stringify(after)) throw Error("\u767B\u5F55\u9879\u5DF2\u53D8\u5316\uFF0C\u672A\u5220\u9664");
|
|
@@ -9509,7 +9545,7 @@ var init_src = __esm({
|
|
|
9509
9545
|
// apps/desktop/src/release-version.ts
|
|
9510
9546
|
import { readFileSync } from "node:fs";
|
|
9511
9547
|
function desktopReleaseVersion() {
|
|
9512
|
-
return false ? null : "0.0.1-beta.
|
|
9548
|
+
return false ? null : "0.0.1-beta.21";
|
|
9513
9549
|
}
|
|
9514
9550
|
function desktopPresenceVersion() {
|
|
9515
9551
|
return desktopReleaseVersion() ?? sourcePresenceVersion;
|
|
@@ -18939,7 +18975,7 @@ async function runLiteInstall() {
|
|
|
18939
18975
|
if (process.platform !== "darwin") throw Error("\u8F7B\u91CF\u684C\u9762\u5E94\u7528\u4EC5\u652F\u6301 macOS\uFF0C\u8BF7\u4F7F\u7528 --background");
|
|
18940
18976
|
const version2 = desktopReleaseVersion();
|
|
18941
18977
|
if (!version2 || false || false) throw Error("\u6B64\u7248\u672C\u5C1A\u672A\u914D\u7F6E Tauri \u8F7B\u91CF\u53D1\u884C\u8D44\u6E90\uFF0C\u6682\u4E0D\u80FD\u901A\u8FC7 install-app \u5B89\u88C5\uFF1B\u7EAF\u540E\u53F0\u8BF7\u4F7F\u7528 --background");
|
|
18942
|
-
const manifest = validateManifest(JSON.parse('{\n "schema": 2,\n "source": "bundled",\n "mode": "experimental",\n "combinationId": "0.0.1-beta.
|
|
18978
|
+
const manifest = validateManifest(JSON.parse('{\n "schema": 2,\n "source": "bundled",\n "mode": "experimental",\n "combinationId": "0.0.1-beta.21",\n "cliVersion": "0.0.1-beta.21",\n "daemonVersion": "0.0.1-beta.21",\n "nodeRange": ">=18.20.5",\n "artifacts": {\n "darwin-arm64": {\n "app": {\n "path": "resources/niuma-lite-arm64.dmg",\n "size": 8103038,\n "sha256": "bf6f04b558f2da3418b66bf88e7a5b35e76d7fa49fe5b2ab01dd022f3b876f19"\n },\n "runtime": {\n "path": "resources/niuma-daemon-arm64.tgz",\n "size": 18317624,\n "sha256": "491d7d39d55fc8f0c981798aa4720e2a0c4bfea35c43c897f1d411a3ea29bb30"\n }\n }\n }\n}\n'), version2, process.arch);
|
|
18943
18979
|
if (manifest.schema === 2) await confirmExperimental(manifest.mode, !!process.stdin.isTTY && !!process.stdout.isTTY, async () => {
|
|
18944
18980
|
const prompt = createInterface3({ input: process.stdin, output: process.stdout });
|
|
18945
18981
|
try {
|
package/dist/managed-tauri.js
CHANGED
|
@@ -6881,7 +6881,7 @@ var init_src2 = __esm({
|
|
|
6881
6881
|
// apps/desktop/src/release-version.ts
|
|
6882
6882
|
import { readFileSync } from "node:fs";
|
|
6883
6883
|
function desktopReleaseVersion() {
|
|
6884
|
-
return false ? null : "0.0.1-beta.
|
|
6884
|
+
return false ? null : "0.0.1-beta.21";
|
|
6885
6885
|
}
|
|
6886
6886
|
function desktopPresenceVersion() {
|
|
6887
6887
|
return desktopReleaseVersion() ?? sourcePresenceVersion;
|
package/dist/managed.js
CHANGED
|
@@ -8487,7 +8487,7 @@ function parseAttachmentTaskV2StatusQuery(value) {
|
|
|
8487
8487
|
|
|
8488
8488
|
// apps/desktop/src/release-version.ts
|
|
8489
8489
|
function desktopReleaseVersion() {
|
|
8490
|
-
return false ? null : "0.0.1-beta.
|
|
8490
|
+
return false ? null : "0.0.1-beta.21";
|
|
8491
8491
|
}
|
|
8492
8492
|
var sourcePresenceVersion = (() => {
|
|
8493
8493
|
if (true) return null;
|
package/package.json
CHANGED
|
@@ -2,21 +2,21 @@
|
|
|
2
2
|
"schema": 2,
|
|
3
3
|
"source": "bundled",
|
|
4
4
|
"mode": "experimental",
|
|
5
|
-
"combinationId": "0.0.1-beta.
|
|
6
|
-
"cliVersion": "0.0.1-beta.
|
|
7
|
-
"daemonVersion": "0.0.1-beta.
|
|
5
|
+
"combinationId": "0.0.1-beta.21",
|
|
6
|
+
"cliVersion": "0.0.1-beta.21",
|
|
7
|
+
"daemonVersion": "0.0.1-beta.21",
|
|
8
8
|
"nodeRange": ">=18.20.5",
|
|
9
9
|
"artifacts": {
|
|
10
10
|
"darwin-arm64": {
|
|
11
11
|
"app": {
|
|
12
12
|
"path": "resources/niuma-lite-arm64.dmg",
|
|
13
|
-
"size":
|
|
14
|
-
"sha256": "
|
|
13
|
+
"size": 8103038,
|
|
14
|
+
"sha256": "bf6f04b558f2da3418b66bf88e7a5b35e76d7fa49fe5b2ab01dd022f3b876f19"
|
|
15
15
|
},
|
|
16
16
|
"runtime": {
|
|
17
17
|
"path": "resources/niuma-daemon-arm64.tgz",
|
|
18
|
-
"size":
|
|
19
|
-
"sha256": "
|
|
18
|
+
"size": 18317624,
|
|
19
|
+
"sha256": "491d7d39d55fc8f0c981798aa4720e2a0c4bfea35c43c897f1d411a3ea29bb30"
|
|
20
20
|
}
|
|
21
21
|
}
|
|
22
22
|
}
|
|
Binary file
|
|
Binary file
|