agy-family 0.6.1 → 0.6.3
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/README.md +8 -8
- package/README.zh-CN.md +12 -12
- package/package.json +1 -1
- package/packages/cli/bin/agy-family.mjs +61 -59
- package/packages/cli/src/hook.mjs +21 -21
- package/packages/cli/src/host.mjs +1 -1
- package/packages/core/src/sync.mjs +2 -2
- package/packages/server-core/src/index.mjs +28 -12
- package/packages/server-core/src/schema.mjs +4 -0
- package/packages/server-core/src/stats.mjs +64 -8
- package/packages/server-core/src/ui.mjs +41 -15
- package/packages/worker/migrations/0009_privacy_display.sql +3 -0
package/README.md
CHANGED
|
@@ -58,16 +58,16 @@ npm i -g agy-family
|
|
|
58
58
|
```
|
|
59
59
|
- **Open the web board passwordlessly** (60s one-time ticket -> 7-day `HttpOnly` cookie; manager machines auto-unlock Admin Console):
|
|
60
60
|
```sh
|
|
61
|
-
agy-family open
|
|
62
|
-
agy-family open <
|
|
63
|
-
agy-family open --joined
|
|
64
|
-
agy-family open --link
|
|
61
|
+
agy-family open # Open active hosted or joined family group board
|
|
62
|
+
agy-family open <group-name|index> # Open a specific hosted board when managing multiple family groups
|
|
63
|
+
agy-family open --joined # Open your joined family group board explicitly
|
|
64
|
+
agy-family open --link # Print a 5-minute single-use link for mobile
|
|
65
65
|
```
|
|
66
|
-
- **Overview all
|
|
66
|
+
- **Overview all family groups, accounts & switch hosts**:
|
|
67
67
|
```sh
|
|
68
|
-
agy-family ls # List all hosted
|
|
69
|
-
agy-family host use <
|
|
70
|
-
agy-family invite "Alice" --email "alice@gmail.com" --quota 20 # Prints ready-to-paste join command (optional `--
|
|
68
|
+
agy-family ls # List all hosted & joined family groups, URLs, members & active account (also `/family ls`)
|
|
69
|
+
agy-family host use <group-name|index> # Switch active hosted family group
|
|
70
|
+
agy-family invite "Alice" --email "alice@gmail.com" --quota 20 # Prints ready-to-paste join command (optional `--group <name>`)
|
|
71
71
|
npm i -g agy-family@latest && agy-family deploy # Idempotent zero-downtime upgrade
|
|
72
72
|
```
|
|
73
73
|
- **Join someone's family board & view dashboard** (works for both Antigravity Desktop IDE & `agy` CLI):
|
package/README.zh-CN.md
CHANGED
|
@@ -40,15 +40,15 @@ packages/
|
|
|
40
40
|
|
|
41
41
|
---
|
|
42
42
|
|
|
43
|
-
## 一、一个 CLI
|
|
43
|
+
## 一、一个 CLI:管理家庭组与加入家庭组全集成(零外部依赖、零密码)
|
|
44
44
|
|
|
45
|
-
只需全局安装一次 `agy-family
|
|
45
|
+
只需全局安装一次 `agy-family`,**成员加入**、**主号订阅余量同步**、**免密打开网页看板**和**管理员部署/发邀请/自托管**全部由这一个包独立完成(免 `git clone`、不依赖任何其他工具):
|
|
46
46
|
|
|
47
47
|
```sh
|
|
48
48
|
npm i -g agy-family
|
|
49
49
|
```
|
|
50
50
|
|
|
51
|
-
-
|
|
51
|
+
- **🏠 管理员免费部署家庭组看板**(Cloudflare Workers + D1 永久免费层,自动创建 D1、跑迁移、默认开启 `cli-only` 隐私保护、生成 Admin Key、同步 `models.dev` 三级定价,加 `--self` 顺便把自己加为主号成员):
|
|
52
52
|
```sh
|
|
53
53
|
agy-family deploy --self --member "你的名字" --email "主号@gmail.com" --daemon
|
|
54
54
|
```
|
|
@@ -58,24 +58,24 @@ npm i -g agy-family
|
|
|
58
58
|
```
|
|
59
59
|
- **🔐 零密码打开网页看板**(一次性 60s 票据换取 7 天 `HttpOnly` 会话,主号电脑自动免密解锁「家庭组管理」后台):
|
|
60
60
|
```sh
|
|
61
|
-
agy-family open #
|
|
62
|
-
agy-family open
|
|
63
|
-
agy-family open --joined #
|
|
61
|
+
agy-family open # 自动打开当前默认家庭组看板
|
|
62
|
+
agy-family open <组名或序号> # 管理多个家庭组时指定打开某一个
|
|
63
|
+
agy-family open --joined # 打开当前「我加入的家庭组」
|
|
64
64
|
agy-family open --link # 生成 5 分钟单次有效链接(方便手机临时看)
|
|
65
65
|
```
|
|
66
|
-
- **📋
|
|
66
|
+
- **📋 一览全部家庭组与账号信息 & 多组切换**:
|
|
67
67
|
```sh
|
|
68
|
-
agy-family ls #
|
|
69
|
-
agy-family host use
|
|
70
|
-
agy-family invite "成员名" --email "member@gmail.com" --quota 20 #
|
|
68
|
+
agy-family ls # 一条命令列出所有管理/加入的家庭组、网址、主号与成员(对话内也可发 /family ls)
|
|
69
|
+
agy-family host use <组名或序号> # 切换当前默认管理的家庭组
|
|
70
|
+
agy-family invite "成员名" --email "member@gmail.com" --quota 20 # 生成一行加入命令(可加 --group <组名>)
|
|
71
71
|
npm i -g agy-family@latest && agy-family deploy # 一键平滑升级云端看板(保留数据与密钥)
|
|
72
72
|
```
|
|
73
|
-
-
|
|
73
|
+
- **👥 家庭成员加入 & 查看面板**(桌面 IDE 和 `agy` CLI 通用):
|
|
74
74
|
```sh
|
|
75
75
|
agy-family join "agyfam://join?d=..." --daemon # 加入家庭组并开启后台同步
|
|
76
76
|
agy-family open # 零密码打开网页看板
|
|
77
77
|
```
|
|
78
|
-
-
|
|
78
|
+
- **🖥️ 本地 / VPS 自托管部署**(零依赖内置 SQLite):
|
|
79
79
|
```sh
|
|
80
80
|
agy-family serve --port 8787
|
|
81
81
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agy-family",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.3",
|
|
4
4
|
"description": "Zero-privacy-leak transparent usage dashboard, /family slash command, and fair-use budget guardrail for Google One / Antigravity family groups.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
upsertHostEntry,
|
|
72
72
|
} from '../src/host.mjs';
|
|
73
73
|
|
|
74
|
-
const CLI_VERSION = '0.6.
|
|
74
|
+
const CLI_VERSION = '0.6.3';
|
|
75
75
|
const THIS_CLI_PATH = fileURLToPath(import.meta.url);
|
|
76
76
|
const PACKAGE_ROOT = resolve(dirname(THIS_CLI_PATH), '..', '..', '..');
|
|
77
77
|
|
|
@@ -147,19 +147,19 @@ function readFlag(args, name) {
|
|
|
147
147
|
|
|
148
148
|
function printHelp() {
|
|
149
149
|
console.log(`agy-family v${CLI_VERSION} — Google Family Group Transparent Usage Board & /family Hook CLI
|
|
150
|
-
One CLI for both joining a
|
|
150
|
+
One CLI for both joining a Google Family Group and hosting your own family group board.
|
|
151
151
|
|
|
152
152
|
Overview & Quick Access:
|
|
153
|
-
agy-family ls [--offline] [--json] List all hosted
|
|
154
|
-
agy-family open [
|
|
155
|
-
Open a board in your browser passwordlessly via a one-time CLI ticket
|
|
153
|
+
agy-family ls [--offline] [--json] List all hosted & joined family groups, active Google account, members & daemon status
|
|
154
|
+
agy-family open [group] [--joined] [--link] [--readonly] [--ttl 60]
|
|
155
|
+
Open a family group board in your browser passwordlessly via a one-time CLI ticket
|
|
156
156
|
|
|
157
157
|
Join a Family Group (Member):
|
|
158
158
|
agy-family join <agyfam://join?...> [--no-hook] [--daemon]
|
|
159
159
|
Join a Google Family Group board & enable /family in IDE + CLI
|
|
160
160
|
agy-family sync [--dry-run] [--watch] [--full] [--quiet]
|
|
161
161
|
Sync local Desktop IDE + CLI numeric usage (delta by default)
|
|
162
|
-
agy-family status [--period today|7d|cycle|30d] [--
|
|
162
|
+
agy-family status [--period today|7d|cycle|30d] [--group <name|index>]
|
|
163
163
|
View your quota progress and family leaderboard
|
|
164
164
|
agy-family audit Inspect the exact last transmitted JSON payload
|
|
165
165
|
agy-family pricing [sync] View or sync 3-tier model pricing cache (models.dev / litellm)
|
|
@@ -168,14 +168,14 @@ Join a Family Group (Member):
|
|
|
168
168
|
agy-family leave Disconnect this device and delete local invite token
|
|
169
169
|
agy-family uninstall Remove hook, /family skill, OS daemon, and local credentials
|
|
170
170
|
|
|
171
|
-
Host Your Own Board (Family Manager — supports multiple
|
|
171
|
+
Host Your Own Board (Family Manager — supports multiple family groups):
|
|
172
172
|
agy-family deploy [--name agy-family] [--title "..."] [--admin-key <key>] [--self] [--member <name>] [--email <gmail>] [--daemon]
|
|
173
173
|
One-command deploy/upgrade on Cloudflare Workers + D1 (free tier, no git clone)
|
|
174
|
-
agy-family host [show|ls|use <
|
|
175
|
-
List, switch, link, or unlink hosted boards on this machine
|
|
176
|
-
agy-family master [bind|sync|set|status|unlink] [--
|
|
174
|
+
agy-family host [show|ls|use <group>|link|unlink [group]]
|
|
175
|
+
List, switch, link, or unlink hosted family group boards on this machine
|
|
176
|
+
agy-family master [bind|sync|set|status|unlink] [--group <group>] [--email <gmail>] [--daemon]
|
|
177
177
|
Bind master account & auto-capture live 5h / weekly subscription quota (100% standalone, zero secrets)
|
|
178
|
-
agy-family invite <name> [--
|
|
178
|
+
agy-family invite <name> [--group <group>] [--email <gmail>] [--quota <pct>] [--role member|manager]
|
|
179
179
|
Create a member and print their ready-to-paste one-line join command
|
|
180
180
|
agy-family serve [--port 8787] [--db path] [--admin-key <key>] [--title "..."]
|
|
181
181
|
Start a self-hosted Node.js + SQLite board server locally or on a VPS
|
|
@@ -630,7 +630,7 @@ async function main() {
|
|
|
630
630
|
return;
|
|
631
631
|
}
|
|
632
632
|
|
|
633
|
-
if (cmd === 'ls' || cmd === 'list' || cmd === 'info' || cmd === '
|
|
633
|
+
if (cmd === 'ls' || cmd === 'list' || cmd === 'info' || cmd === 'groups') {
|
|
634
634
|
const offline = args.includes('--offline') || args.includes('--no-net');
|
|
635
635
|
const asJson = args.includes('--json');
|
|
636
636
|
|
|
@@ -684,7 +684,9 @@ async function main() {
|
|
|
684
684
|
id: m.id,
|
|
685
685
|
name: m.name,
|
|
686
686
|
role: m.role || 'member',
|
|
687
|
-
emailHint:
|
|
687
|
+
emailHint: overview?.settings?.maskPublicEmail
|
|
688
|
+
? (m.email_hint || m.emailHint || '')
|
|
689
|
+
: (m.email_address || m.email_hint || m.emailHint || ''),
|
|
688
690
|
online: isOnline,
|
|
689
691
|
lastSeenAt: lastSeenAt || null,
|
|
690
692
|
quotaPct: m.effective_quota_pct ?? m.quotaPct ?? null,
|
|
@@ -778,7 +780,7 @@ async function main() {
|
|
|
778
780
|
return mode || '';
|
|
779
781
|
};
|
|
780
782
|
|
|
781
|
-
console.log(`agy-family v${CLI_VERSION} —
|
|
783
|
+
console.log(`agy-family v${CLI_VERSION} — 家庭组与账号总览\n`);
|
|
782
784
|
|
|
783
785
|
console.log('👤 本机当前 Antigravity 账号:');
|
|
784
786
|
if (localAcct) {
|
|
@@ -787,9 +789,9 @@ async function main() {
|
|
|
787
789
|
console.log(' (未检测到本地已登录的 Antigravity 账号)');
|
|
788
790
|
}
|
|
789
791
|
|
|
790
|
-
console.log(`\n
|
|
792
|
+
console.log(`\n🏠 我管理的家庭组 (Hosted Groups — ${hostInfos.length}):`);
|
|
791
793
|
if (hostInfos.length === 0) {
|
|
792
|
-
console.log(' (暂无 — 运行 "agy-family deploy --self --daemon"
|
|
794
|
+
console.log(' (暂无 — 运行 "agy-family deploy --self --daemon" 免费一键部署家庭组看板)');
|
|
793
795
|
} else {
|
|
794
796
|
for (const h of hostInfos) {
|
|
795
797
|
const star = h.active ? '★ ' : ' ';
|
|
@@ -829,18 +831,18 @@ async function main() {
|
|
|
829
831
|
}
|
|
830
832
|
}
|
|
831
833
|
|
|
832
|
-
console.log('\n
|
|
834
|
+
console.log('\n👥 我加入的家庭组 (Joined Group):');
|
|
833
835
|
if (!joinedInfo) {
|
|
834
|
-
console.log(' (
|
|
836
|
+
console.log(' (暂未加入 — 运行 "agy-family join <邀请码> --daemon" 加入家庭组)');
|
|
835
837
|
} else {
|
|
836
838
|
const sameTag = joinedInfo.sameAsHostedIndex
|
|
837
|
-
? ` (
|
|
839
|
+
? ` (同我管理的家庭组 [${joinedInfo.sameAsHostedIndex}] ${joinedInfo.sameAsHostedId})`
|
|
838
840
|
: '';
|
|
839
841
|
console.log(` 网址 : ${joinedInfo.url}${sameTag}`);
|
|
840
842
|
if (joinedInfo.boardTitle) console.log(` 看板 : ${joinedInfo.boardTitle}`);
|
|
841
843
|
const roleTag = joinedInfo.role === 'manager' ? ' [主号]' : joinedInfo.role ? ' [成员]' : '';
|
|
842
844
|
const onlineTag = joinedInfo.online === true ? ' · online' : joinedInfo.online === false ? ' · offline' : '';
|
|
843
|
-
console.log(`
|
|
845
|
+
console.log(` 成员 : ${joinedInfo.memberName || '(已绑定)'}${roleTag}${onlineTag}`);
|
|
844
846
|
if (joinedInfo.emailHint || joinedInfo.hasExpectedEmailHash) {
|
|
845
847
|
const matchLabel =
|
|
846
848
|
joinedInfo.accountMatch === 'matched'
|
|
@@ -863,16 +865,16 @@ async function main() {
|
|
|
863
865
|
|
|
864
866
|
console.log('\n快捷命令:');
|
|
865
867
|
if (hostInfos.length > 1) {
|
|
866
|
-
console.log('
|
|
867
|
-
console.log('
|
|
868
|
-
console.log('
|
|
868
|
+
console.log(' 切换默认家庭组 : agy-family host use <组名或序号>');
|
|
869
|
+
console.log(' 打开指定家庭组 : agy-family open <组名或序号> | agy-family open --joined');
|
|
870
|
+
console.log(' 邀请家庭成员 : agy-family invite "名字" --group <组名或序号> --email "xxx@gmail.com"');
|
|
869
871
|
} else {
|
|
870
872
|
console.log(' 免密打开看板 : agy-family open');
|
|
871
873
|
if (hostInfos.length === 1 && joinedInfo && !joinedInfo.sameAsHostedIndex) {
|
|
872
|
-
console.log('
|
|
874
|
+
console.log(' 打开加入的组 : agy-family open --joined');
|
|
873
875
|
}
|
|
874
876
|
if (hostInfos.length === 1) {
|
|
875
|
-
console.log('
|
|
877
|
+
console.log(' 新建家庭组 : agy-family deploy --name <组名> --title "<看板标题>"');
|
|
876
878
|
}
|
|
877
879
|
}
|
|
878
880
|
return;
|
|
@@ -886,10 +888,10 @@ async function main() {
|
|
|
886
888
|
const ttlSec = ttlFlag ? Number(ttlFlag) || 60 : printLinkOnly ? 300 : 60;
|
|
887
889
|
const urlOverride = readFlag(args, '--url');
|
|
888
890
|
const adminKeyOverride = readFlag(args, '--admin-key');
|
|
889
|
-
const
|
|
891
|
+
const groupFlag = readFlag(args, '--group') || readFlag(args, '--host');
|
|
890
892
|
|
|
891
|
-
const openValueFlags = new Set(['--ttl', '--url', '--admin-key', '--
|
|
892
|
-
let
|
|
893
|
+
const openValueFlags = new Set(['--ttl', '--url', '--admin-key', '--group', '--host']);
|
|
894
|
+
let groupPositional = '';
|
|
893
895
|
for (let i = 1; i < args.length; i++) {
|
|
894
896
|
const a = args[i];
|
|
895
897
|
if (openValueFlags.has(a)) {
|
|
@@ -897,15 +899,15 @@ async function main() {
|
|
|
897
899
|
continue;
|
|
898
900
|
}
|
|
899
901
|
if (a.startsWith('--')) continue;
|
|
900
|
-
if (!
|
|
902
|
+
if (!groupPositional) groupPositional = a;
|
|
901
903
|
}
|
|
902
|
-
const
|
|
904
|
+
const groupSelector = groupFlag || groupPositional;
|
|
903
905
|
|
|
904
906
|
let selectedHost = null;
|
|
905
|
-
if (
|
|
906
|
-
selectedHost = resolveHostEntry(
|
|
907
|
+
if (groupSelector) {
|
|
908
|
+
selectedHost = resolveHostEntry(groupSelector);
|
|
907
909
|
if (!selectedHost) {
|
|
908
|
-
console.error(`Hosted
|
|
910
|
+
console.error(`Hosted family group not found: "${groupSelector}". Run "agy-family ls" to see all family groups.`);
|
|
909
911
|
process.exit(1);
|
|
910
912
|
}
|
|
911
913
|
} else if (!openJoined) {
|
|
@@ -957,13 +959,13 @@ async function main() {
|
|
|
957
959
|
|
|
958
960
|
if (cmd === 'status') {
|
|
959
961
|
const cfg = getOrCreateClientConfig();
|
|
960
|
-
const
|
|
961
|
-
const host =
|
|
962
|
-
if (
|
|
963
|
-
console.error(`Hosted
|
|
962
|
+
const groupSelector = readFlag(args, '--group') || readFlag(args, '--host');
|
|
963
|
+
const host = groupSelector ? resolveHostEntry(groupSelector) : resolveHostEntry('');
|
|
964
|
+
if (groupSelector && !host) {
|
|
965
|
+
console.error(`Hosted family group not found: "${groupSelector}". Run "agy-family ls" to see all family groups.`);
|
|
964
966
|
process.exit(1);
|
|
965
967
|
}
|
|
966
|
-
const targetUrl = (
|
|
968
|
+
const targetUrl = (groupSelector ? host?.url : cfg.url || host?.url) || '';
|
|
967
969
|
if (!targetUrl) {
|
|
968
970
|
console.error('Not joined to any family group yet. Run: agy-family join <agyfam://join?...>');
|
|
969
971
|
process.exit(1);
|
|
@@ -1127,7 +1129,7 @@ async function main() {
|
|
|
1127
1129
|
}
|
|
1128
1130
|
|
|
1129
1131
|
if (cmd === 'invite') {
|
|
1130
|
-
const valueFlags = new Set(['--email', '--quota', '--role', '--color', '--url', '--admin-key', '--
|
|
1132
|
+
const valueFlags = new Set(['--email', '--quota', '--role', '--color', '--url', '--admin-key', '--group', '--host']);
|
|
1131
1133
|
const pos = [];
|
|
1132
1134
|
for (let i = 1; i < args.length; i++) {
|
|
1133
1135
|
const a = args[i];
|
|
@@ -1140,13 +1142,13 @@ async function main() {
|
|
|
1140
1142
|
}
|
|
1141
1143
|
const memberName = pos.join(' ').trim();
|
|
1142
1144
|
if (!memberName) {
|
|
1143
|
-
console.error('Usage: agy-family invite <name> [--
|
|
1145
|
+
console.error('Usage: agy-family invite <name> [--group <group>] [--email <gmail>] [--quota <pct>] [--role member|manager]');
|
|
1144
1146
|
process.exit(1);
|
|
1145
1147
|
}
|
|
1146
|
-
const
|
|
1147
|
-
const hostCfg =
|
|
1148
|
-
if (
|
|
1149
|
-
console.error(`Hosted
|
|
1148
|
+
const groupSelector = readFlag(args, '--group') || readFlag(args, '--host');
|
|
1149
|
+
const hostCfg = groupSelector ? resolveHostEntry(groupSelector) : resolveHostEntry('');
|
|
1150
|
+
if (groupSelector && !hostCfg) {
|
|
1151
|
+
console.error(`Hosted family group not found: "${groupSelector}". Run "agy-family ls" to see all family groups.`);
|
|
1150
1152
|
process.exit(1);
|
|
1151
1153
|
}
|
|
1152
1154
|
const url = readFlag(args, '--url') || hostCfg?.url || '';
|
|
@@ -1192,10 +1194,10 @@ async function main() {
|
|
|
1192
1194
|
const action = (args[1] || 'status').toLowerCase();
|
|
1193
1195
|
const urlOverride = readFlag(args, '--url');
|
|
1194
1196
|
const adminKeyOverride = readFlag(args, '--admin-key');
|
|
1195
|
-
const
|
|
1196
|
-
const host =
|
|
1197
|
-
if (
|
|
1198
|
-
console.error(`Hosted
|
|
1197
|
+
const groupSelector = readFlag(args, '--group') || readFlag(args, '--host');
|
|
1198
|
+
const host = groupSelector ? resolveHostEntry(groupSelector) : resolveHostEntry('');
|
|
1199
|
+
if (groupSelector && !host) {
|
|
1200
|
+
console.error(`Hosted family group not found: "${groupSelector}". Run "agy-family ls" to see all family groups.`);
|
|
1199
1201
|
process.exit(1);
|
|
1200
1202
|
}
|
|
1201
1203
|
const targetUrl = urlOverride || host?.url || '';
|
|
@@ -1358,7 +1360,7 @@ async function main() {
|
|
|
1358
1360
|
console.log(' Or link an existing board : agy-family host link --url <https://...> --admin-key <adm_...>');
|
|
1359
1361
|
return;
|
|
1360
1362
|
}
|
|
1361
|
-
console.log(`Hosted Family
|
|
1363
|
+
console.log(`Hosted Family Groups (${reg.hosts.length}) — Registry: ${hostsRegistryPath()}`);
|
|
1362
1364
|
reg.hosts.forEach((h, idx) => {
|
|
1363
1365
|
const star = h.id === reg.active ? '★' : ' ';
|
|
1364
1366
|
const tag = h.id === reg.active ? ' [active]' : '';
|
|
@@ -1366,21 +1368,21 @@ async function main() {
|
|
|
1366
1368
|
console.log(` URL : ${h.url || '(unknown)'}`);
|
|
1367
1369
|
console.log(` Infra : ${h.provider || 'cloudflare'}${h.workerName ? ` · Worker: ${h.workerName}` : ''}${h.databaseName ? ` · D1: ${h.databaseName}` : ''}`);
|
|
1368
1370
|
});
|
|
1369
|
-
console.log('\nSwitch active
|
|
1371
|
+
console.log('\nSwitch active family group: agy-family host use <name|index>');
|
|
1370
1372
|
return;
|
|
1371
1373
|
}
|
|
1372
1374
|
if (action === 'use' || action === 'switch') {
|
|
1373
1375
|
const selector = args[2] || '';
|
|
1374
1376
|
if (!selector) {
|
|
1375
|
-
console.error('Usage: agy-family host use <
|
|
1377
|
+
console.error('Usage: agy-family host use <group-name|index|url>');
|
|
1376
1378
|
process.exit(1);
|
|
1377
1379
|
}
|
|
1378
1380
|
const switched = setActiveHost(selector);
|
|
1379
1381
|
if (!switched) {
|
|
1380
|
-
console.error(`Hosted
|
|
1382
|
+
console.error(`Hosted family group not found: "${selector}". Run "agy-family host ls" to view saved family groups.`);
|
|
1381
1383
|
process.exit(1);
|
|
1382
1384
|
}
|
|
1383
|
-
console.log(`✓ Switched active
|
|
1385
|
+
console.log(`✓ Switched active family group -> ${switched.entry.id} (${switched.entry.boardTitle || 'Antigravity 家庭组'})`);
|
|
1384
1386
|
console.log(` Board URL : ${switched.entry.url}`);
|
|
1385
1387
|
return;
|
|
1386
1388
|
}
|
|
@@ -1427,12 +1429,12 @@ async function main() {
|
|
|
1427
1429
|
const selector = args[2] && !args[2].startsWith('--') ? args[2] : '';
|
|
1428
1430
|
const res = removeHostEntry(selector);
|
|
1429
1431
|
if (!res.removed) {
|
|
1430
|
-
console.log(selector ? `Hosted
|
|
1432
|
+
console.log(selector ? `Hosted family group not found: "${selector}".` : 'Local host config: not configured.');
|
|
1431
1433
|
return;
|
|
1432
1434
|
}
|
|
1433
|
-
console.log(`✓ Unlinked hosted
|
|
1435
|
+
console.log(`✓ Unlinked hosted family group "${res.removed.id}"${res.removed.url ? ` (${res.removed.url})` : ''}.`);
|
|
1434
1436
|
if (res.nextActive) {
|
|
1435
|
-
console.log(` Active
|
|
1437
|
+
console.log(` Active family group is now: ${res.nextActive.id} (${res.nextActive.url})`);
|
|
1436
1438
|
}
|
|
1437
1439
|
return;
|
|
1438
1440
|
}
|
|
@@ -1441,7 +1443,7 @@ async function main() {
|
|
|
1441
1443
|
const cfg = selector ? resolveHostEntry(selector) : resolveHostEntry('');
|
|
1442
1444
|
if (!cfg) {
|
|
1443
1445
|
if (selector) {
|
|
1444
|
-
console.error(`Hosted
|
|
1446
|
+
console.error(`Hosted family group not found: "${selector}". Run "agy-family host ls" to view saved family groups.`);
|
|
1445
1447
|
process.exit(1);
|
|
1446
1448
|
}
|
|
1447
1449
|
console.log('No hosted board configured on this machine yet.');
|
|
@@ -1453,7 +1455,7 @@ async function main() {
|
|
|
1453
1455
|
console.log(JSON.stringify(cfg, null, 2));
|
|
1454
1456
|
return;
|
|
1455
1457
|
}
|
|
1456
|
-
console.log(`Hosted Family
|
|
1458
|
+
console.log(`Hosted Family Group${reg.hosts.length > 1 ? ` (${cfg.id === reg.active ? 'active' : 'saved'}, ${reg.hosts.length} total)` : ''}:`);
|
|
1457
1459
|
console.log(` Name / ID : ${cfg.id || cfg.workerName || 'agy-family'}`);
|
|
1458
1460
|
console.log(` Provider : ${cfg.provider || 'cloudflare'}`);
|
|
1459
1461
|
console.log(` Board URL : ${cfg.url || '(unknown)'}`);
|
|
@@ -1471,7 +1473,7 @@ async function main() {
|
|
|
1471
1473
|
}
|
|
1472
1474
|
}
|
|
1473
1475
|
if (reg.hosts.length > 1) {
|
|
1474
|
-
console.log(' All
|
|
1476
|
+
console.log(' All Groups : run "agy-family ls" or "agy-family host ls"');
|
|
1475
1477
|
}
|
|
1476
1478
|
return;
|
|
1477
1479
|
}
|
|
@@ -42,8 +42,8 @@ description: View Google Family Group Antigravity usage board, agreed cap progre
|
|
|
42
42
|
|
|
43
43
|
When the \`agy-family\` \`PreInvocation\` hook is active in \`~/.gemini/config/hooks.json\`, bare commands such as:
|
|
44
44
|
- \`/family\` or \`/family today|7d|cycle|30d\`
|
|
45
|
-
- \`/family ls\` (list hosted
|
|
46
|
-
- \`/family open [
|
|
45
|
+
- \`/family ls\` (list hosted & joined family groups, URLs, and bound accounts)
|
|
46
|
+
- \`/family open [group]\` (passwordless one-time browser login link)
|
|
47
47
|
- \`/family sync\` or \`/family sync --full\`
|
|
48
48
|
- \`/family audit\`
|
|
49
49
|
- \`/family join agyfam://join?d=...\`
|
|
@@ -411,19 +411,19 @@ export function parseFamilySlashCommand(rawInput) {
|
|
|
411
411
|
if (flag && flag !== '--full' && flag !== 'full') return null;
|
|
412
412
|
return { kind: 'sync', fullSync: Boolean(flag) };
|
|
413
413
|
}
|
|
414
|
-
if ((sub === 'ls' || sub === 'list' || sub === 'info' || sub === '
|
|
414
|
+
if ((sub === 'ls' || sub === 'list' || sub === 'info' || sub === 'groups') && rest.length === 1) {
|
|
415
415
|
return { kind: 'ls' };
|
|
416
416
|
}
|
|
417
417
|
if (sub === 'open' && rest.length <= 2) {
|
|
418
418
|
const arg = rest[1] || '';
|
|
419
419
|
const low = arg.toLowerCase();
|
|
420
420
|
if (!arg || low === '--link' || low === 'link') {
|
|
421
|
-
return { kind: 'open', linkOnly: Boolean(arg),
|
|
421
|
+
return { kind: 'open', linkOnly: Boolean(arg), group: '', joined: false };
|
|
422
422
|
}
|
|
423
423
|
if (low === '--joined' || low === 'joined') {
|
|
424
|
-
return { kind: 'open', linkOnly: false,
|
|
424
|
+
return { kind: 'open', linkOnly: false, group: '', joined: true };
|
|
425
425
|
}
|
|
426
|
-
return { kind: 'open', linkOnly: false,
|
|
426
|
+
return { kind: 'open', linkOnly: false, group: arg, joined: false };
|
|
427
427
|
}
|
|
428
428
|
if (sub === 'audit' && rest.length === 1) {
|
|
429
429
|
return { kind: 'audit' };
|
|
@@ -642,8 +642,8 @@ export async function handlePreInvocation(
|
|
|
642
642
|
'### `/family` 指令速查 *(0 tokens)*',
|
|
643
643
|
'',
|
|
644
644
|
'- `/family` 或 `/family 7d` / `/family cycle` / `/family 30d` — 查看家庭组用量排行与主号订阅余量',
|
|
645
|
-
'- `/family ls` —
|
|
646
|
-
'- `/family open [
|
|
645
|
+
'- `/family ls` — 一览本机管理与加入的所有家庭组(网址、主号、成员与当前账号)',
|
|
646
|
+
'- `/family open [组名或序号]` — 生成一次性免密登录链接打开网页看板(无需密码)',
|
|
647
647
|
'- `/family sync` 或 `/family sync --full` — 立即增量/全量同步本机 IDE + CLI 用量',
|
|
648
648
|
'- `/family audit` — 查看最近一次上报的脱敏 JSON(隐私审计)',
|
|
649
649
|
'- `/family join agyfam://join?d=...` — 粘贴邀请码加入或切换家庭组',
|
|
@@ -659,15 +659,15 @@ export async function handlePreInvocation(
|
|
|
659
659
|
const mCfg = readMasterConfig({ home });
|
|
660
660
|
const tapSt = inspectStatusLineTap({ home });
|
|
661
661
|
|
|
662
|
-
const lines = ['### `agy-family`
|
|
662
|
+
const lines = ['### `agy-family` 家庭组与账号总览 *(0 tokens)*', ''];
|
|
663
663
|
lines.push(
|
|
664
664
|
`**本机当前 Antigravity 账号**:${localAcct ? `\`${localAcct.maskedEmail}\` (${localAcct.source})` : '未检测到本地登录'}`,
|
|
665
665
|
);
|
|
666
666
|
lines.push('');
|
|
667
667
|
|
|
668
|
-
lines.push(`####
|
|
668
|
+
lines.push(`#### 🏠 我管理的家庭组(${reg.hosts.length})`);
|
|
669
669
|
if (reg.hosts.length === 0) {
|
|
670
|
-
lines.push('- 暂无(终端运行 `agy-family deploy --self --daemon`
|
|
670
|
+
lines.push('- 暂无(终端运行 `agy-family deploy --self --daemon` 可一键免费部署家庭组看板)');
|
|
671
671
|
} else {
|
|
672
672
|
reg.hosts.forEach((h, idx) => {
|
|
673
673
|
const activeBadge = h.id === reg.active ? ' `当前默认`' : '';
|
|
@@ -678,13 +678,13 @@ export async function handlePreInvocation(
|
|
|
678
678
|
}
|
|
679
679
|
lines.push('');
|
|
680
680
|
|
|
681
|
-
lines.push('####
|
|
681
|
+
lines.push('#### 👥 我加入的家庭组');
|
|
682
682
|
if (!cfgLocal?.url) {
|
|
683
|
-
lines.push('-
|
|
683
|
+
lines.push('- 暂未加入(执行 `/family join agyfam://join?d=...` 加入家庭组)');
|
|
684
684
|
} else {
|
|
685
685
|
const joinedUrl = String(cfgLocal.url).replace(/\/+$/, '');
|
|
686
686
|
const sameIdx = reg.hosts.findIndex((h) => h.url === joinedUrl);
|
|
687
|
-
const sameNote = sameIdx >= 0 ? ` *(
|
|
687
|
+
const sameNote = sameIdx >= 0 ? ` *(同我管理的家庭组 [${sameIdx + 1}] ${reg.hosts[sameIdx].id})*` : '';
|
|
688
688
|
let acctNote = '';
|
|
689
689
|
if (cfgLocal.expectedEmailHash) {
|
|
690
690
|
if (localAcct?.emailHash) {
|
|
@@ -699,14 +699,14 @@ export async function handlePreInvocation(
|
|
|
699
699
|
lines.push(
|
|
700
700
|
`- **${cfgLocal.boardTitle || joinedUrl}**${sameNote} — ${joinedUrl}`,
|
|
701
701
|
);
|
|
702
|
-
lines.push(` -
|
|
702
|
+
lines.push(` - 成员:**${cfgLocal.memberName || '(已绑定)'}**${acctNote}`);
|
|
703
703
|
}
|
|
704
704
|
lines.push('');
|
|
705
705
|
|
|
706
706
|
lines.push(
|
|
707
707
|
`**主号余量采集**:${mCfg ? `\`${mCfg.maskedEmail || '已绑定'}\`(${tapSt.installed ? (tapSt.chained ? '已激活 · 链式共存' : '已激活 · 独立') : '未安装 statusLine'})` : '未绑定'}`,
|
|
708
708
|
);
|
|
709
|
-
lines.push('', '`终端完整实时详情:agy-family ls ·
|
|
709
|
+
lines.push('', '`终端完整实时详情:agy-family ls · 切换默认家庭组:agy-family host use <组名或序号>`');
|
|
710
710
|
return buildZeroTokenMarkdownResponse(lines.join('\n'));
|
|
711
711
|
}
|
|
712
712
|
|
|
@@ -769,11 +769,11 @@ export async function handlePreInvocation(
|
|
|
769
769
|
|
|
770
770
|
if (cmd.kind === 'open') {
|
|
771
771
|
let targetHost = null;
|
|
772
|
-
if (cmd.
|
|
773
|
-
targetHost = resolveHostEntry(cmd.
|
|
772
|
+
if (cmd.group) {
|
|
773
|
+
targetHost = resolveHostEntry(cmd.group, { home });
|
|
774
774
|
if (!targetHost) {
|
|
775
775
|
return buildZeroTokenMarkdownResponse(
|
|
776
|
-
`❌ 未找到名为 \`${cmd.
|
|
776
|
+
`❌ 未找到名为 \`${cmd.group}\` 的家庭组。输入 \`/family ls\` 查看所有已记录的家庭组。`,
|
|
777
777
|
);
|
|
778
778
|
}
|
|
779
779
|
} else if (!cmd.joined) {
|
|
@@ -804,7 +804,7 @@ export async function handlePreInvocation(
|
|
|
804
804
|
});
|
|
805
805
|
const roleNote = ticketRes.scope === 'admin' ? '管理员免密会话' : '成员免密会话';
|
|
806
806
|
return buildZeroTokenMarkdownResponse(
|
|
807
|
-
`### 一次性免密登录链接(${roleNote} · ${ticketRes.expiresInSec}s 单次有效 · 0 tokens)\n\n${ticketRes.enterUrl}\n\n也可在终端直接运行 \`agy-family open${cmd.
|
|
807
|
+
`### 一次性免密登录链接(${roleNote} · ${ticketRes.expiresInSec}s 单次有效 · 0 tokens)\n\n${ticketRes.enterUrl}\n\n也可在终端直接运行 \`agy-family open${cmd.group ? ` ${cmd.group}` : ''}\` 自动拉起浏览器。`,
|
|
808
808
|
);
|
|
809
809
|
} catch (err) {
|
|
810
810
|
return buildZeroTokenMarkdownResponse(`❌ 无法签发一次性登录票据:${err?.message || err}`);
|
|
@@ -890,7 +890,7 @@ export async function runHeadlessSync({ cfg, fullSync = false, home = homedir(),
|
|
|
890
890
|
const { payload, scan, nextSyncedHashes, nextAccountLedger } = await buildSyncPayload({
|
|
891
891
|
deviceId,
|
|
892
892
|
clientKind: 'cli',
|
|
893
|
-
clientVersion: '0.6.
|
|
893
|
+
clientVersion: '0.6.3',
|
|
894
894
|
home,
|
|
895
895
|
fileCache: cache,
|
|
896
896
|
syncedHashes: prevHashes,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Self-hosting & Cloudflare Workers + D1 deployment engine for the unified `agy-family` CLI.
|
|
2
|
-
// Lets any user
|
|
2
|
+
// Lets any user both join a Google Family Group (`agy-family join`) and host their own board (`agy-family deploy` / `invite` / `host` / `serve`)
|
|
3
3
|
// from a single global `npm i -g agy-family` installation — zero `git clone` required.
|
|
4
4
|
|
|
5
5
|
import { spawnSync } from 'node:child_process';
|
|
@@ -83,7 +83,7 @@ export function diffSyncBuckets(buckets, syncedHashes = null, { fullSync = false
|
|
|
83
83
|
export async function buildSyncPayload({
|
|
84
84
|
deviceId,
|
|
85
85
|
clientKind = 'cli',
|
|
86
|
-
clientVersion = '0.6.
|
|
86
|
+
clientVersion = '0.6.3',
|
|
87
87
|
home,
|
|
88
88
|
roots = null,
|
|
89
89
|
sourceFilter = 'all',
|
|
@@ -164,7 +164,7 @@ export async function buildSyncPayload({
|
|
|
164
164
|
deviceId: String(deviceId || deriveAnonymousDeviceId()).slice(0, 32),
|
|
165
165
|
client: {
|
|
166
166
|
kind: clientKind === 'extension' ? 'extension' : 'cli',
|
|
167
|
-
version: String(clientVersion || '0.6.
|
|
167
|
+
version: String(clientVersion || '0.6.3').slice(0, 24),
|
|
168
168
|
...(platformLabel ? { platform: platformLabel } : {}),
|
|
169
169
|
},
|
|
170
170
|
account: {
|
|
@@ -26,7 +26,7 @@ import {
|
|
|
26
26
|
import { FAVICON_SVG, renderDashboardHtml } from './ui.mjs';
|
|
27
27
|
import { dispatchWebhook, sendDedupedAlert, validateWebhookUrl } from './webhooks.mjs';
|
|
28
28
|
|
|
29
|
-
export const SERVER_VERSION = '0.6.
|
|
29
|
+
export const SERVER_VERSION = '0.6.3';
|
|
30
30
|
const MAX_BUCKETS_PER_SYNC = 1000;
|
|
31
31
|
const MAX_DEVICES_PER_MEMBER = 8;
|
|
32
32
|
const MAX_TOKENS_PER_BUCKET = 500_000_000;
|
|
@@ -50,6 +50,8 @@ const ALLOWED_SETTINGS_KEYS = new Set([
|
|
|
50
50
|
'webhookType',
|
|
51
51
|
'boardAccessMode',
|
|
52
52
|
'boardViewKey',
|
|
53
|
+
'maskPublicEmail',
|
|
54
|
+
'maskPublicIp',
|
|
53
55
|
]);
|
|
54
56
|
|
|
55
57
|
const SESSION_COOKIE_NAME = 'agf_session';
|
|
@@ -121,19 +123,19 @@ function maskEmailHintServer(cleanEmail) {
|
|
|
121
123
|
|
|
122
124
|
async function parseMemberEmailInput(rawVal) {
|
|
123
125
|
if (rawVal === undefined) return { action: 'keep' };
|
|
124
|
-
if (rawVal === null) return { action: 'clear', hash: null, hint: null };
|
|
126
|
+
if (rawVal === null) return { action: 'clear', hash: null, email: null, hint: null };
|
|
125
127
|
const s = String(rawVal).trim().toLowerCase();
|
|
126
128
|
if (!s || s === '-' || s === 'clear' || s === 'unbind' || s === 'none') {
|
|
127
|
-
return { action: 'clear', hash: null, hint: null };
|
|
129
|
+
return { action: 'clear', hash: null, email: null, hint: null };
|
|
128
130
|
}
|
|
129
131
|
if (/^[a-f0-9]{64}$/.test(s)) {
|
|
130
|
-
return { action: 'set', hash: s, hint: 'sha256:***' };
|
|
132
|
+
return { action: 'set', hash: s, email: null, hint: 'sha256:***' };
|
|
131
133
|
}
|
|
132
134
|
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(s)) {
|
|
133
135
|
throw new HttpError(400, 'Invalid Google Family email format (e.g. alice@gmail.com, or "-" to unbind).');
|
|
134
136
|
}
|
|
135
137
|
const hash = await sha256Hex(s);
|
|
136
|
-
return { action: 'set', hash, hint: maskEmailHintServer(s) };
|
|
138
|
+
return { action: 'set', hash, email: s, hint: maskEmailHintServer(s) };
|
|
137
139
|
}
|
|
138
140
|
|
|
139
141
|
class HttpError extends Error {
|
|
@@ -1198,7 +1200,7 @@ export function createApp({
|
|
|
1198
1200
|
if (normSubQuota) {
|
|
1199
1201
|
const isMismatch = accountStatus === 'mismatch';
|
|
1200
1202
|
const isExplicitMaster = Boolean(body.subscriptionQuota?.isMasterExplicit);
|
|
1201
|
-
const safeLabel = normSubQuota.accountLabel || member.email_hint || member.name || '';
|
|
1203
|
+
const safeLabel = normSubQuota.accountLabel || member.email_address || member.email_hint || member.name || '';
|
|
1202
1204
|
const normWithLabel = { ...normSubQuota, accountLabel: safeLabel };
|
|
1203
1205
|
if (!isMismatch) {
|
|
1204
1206
|
writeStmts.push({
|
|
@@ -1373,7 +1375,7 @@ export function createApp({
|
|
|
1373
1375
|
if (request.method === 'GET' && path === '/api/admin/overview') {
|
|
1374
1376
|
const settings = await loadSettings(db, envDefaults);
|
|
1375
1377
|
const membersRows = await db.all(
|
|
1376
|
-
"SELECT id, name, role, color, quota_pct, expected_email_hash, email_hint, last_account_status, daily_cap_usd, weekly_cap_usd, cycle_cap_usd, active, created_at, last_seen_at, last_client_kind, last_client_version FROM members ORDER BY CASE WHEN role = 'manager' THEN 0 ELSE 1 END, created_at ASC",
|
|
1378
|
+
"SELECT id, name, role, color, quota_pct, expected_email_hash, email_hint, email_address, last_account_status, daily_cap_usd, weekly_cap_usd, cycle_cap_usd, active, created_at, last_seen_at, last_client_kind, last_client_version FROM members ORDER BY CASE WHEN role = 'manager' THEN 0 ELSE 1 END, created_at ASC",
|
|
1377
1379
|
);
|
|
1378
1380
|
const resolvedQuotas = resolveFamilyQuotas((membersRows || []).filter((m) => m.active));
|
|
1379
1381
|
let deviceRows = [];
|
|
@@ -1465,6 +1467,7 @@ export function createApp({
|
|
|
1465
1467
|
const emailParsed = await parseMemberEmailInput(body.email);
|
|
1466
1468
|
const expectedEmailHash = emailParsed.action === 'set' ? emailParsed.hash : null;
|
|
1467
1469
|
const emailHint = emailParsed.action === 'set' ? emailParsed.hint : null;
|
|
1470
|
+
const emailAddress = emailParsed.action === 'set' ? emailParsed.email : null;
|
|
1468
1471
|
const initAccountStatus = expectedEmailHash ? 'unknown' : 'unbound';
|
|
1469
1472
|
const dailyCap = body.dailyCapUsd === null || body.dailyCapUsd === undefined ? null : Math.max(0, Number(body.dailyCapUsd));
|
|
1470
1473
|
const weeklyCap = body.weeklyCapUsd === null || body.weeklyCapUsd === undefined ? null : Math.max(0, Number(body.weeklyCapUsd));
|
|
@@ -1483,8 +1486,8 @@ export function createApp({
|
|
|
1483
1486
|
});
|
|
1484
1487
|
}
|
|
1485
1488
|
stmts.push({
|
|
1486
|
-
sql: `INSERT INTO members (id, name, role, color, token_hash, expected_email_hash, email_hint, last_account_status, quota_pct, daily_cap_usd, weekly_cap_usd, cycle_cap_usd, active, created_at)
|
|
1487
|
-
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?)`,
|
|
1489
|
+
sql: `INSERT INTO members (id, name, role, color, token_hash, expected_email_hash, email_hint, email_address, last_account_status, quota_pct, daily_cap_usd, weekly_cap_usd, cycle_cap_usd, active, created_at)
|
|
1490
|
+
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?)`,
|
|
1488
1491
|
params: [
|
|
1489
1492
|
id,
|
|
1490
1493
|
name,
|
|
@@ -1493,6 +1496,7 @@ export function createApp({
|
|
|
1493
1496
|
tokenHash,
|
|
1494
1497
|
expectedEmailHash,
|
|
1495
1498
|
emailHint,
|
|
1499
|
+
emailAddress,
|
|
1496
1500
|
initAccountStatus,
|
|
1497
1501
|
quotaPct,
|
|
1498
1502
|
dailyCap,
|
|
@@ -1525,6 +1529,7 @@ export function createApp({
|
|
|
1525
1529
|
quotaPct,
|
|
1526
1530
|
accountBound: Boolean(expectedEmailHash),
|
|
1527
1531
|
emailHint,
|
|
1532
|
+
emailAddress,
|
|
1528
1533
|
dailyCapUsd: dailyCap,
|
|
1529
1534
|
weeklyCapUsd: weeklyCap,
|
|
1530
1535
|
cycleCapUsd: cycleCap,
|
|
@@ -1598,14 +1603,17 @@ export function createApp({
|
|
|
1598
1603
|
const emailParsed = await parseMemberEmailInput(body.email);
|
|
1599
1604
|
let nextExpectedHash = existing.expected_email_hash || null;
|
|
1600
1605
|
let nextEmailHint = existing.email_hint || null;
|
|
1606
|
+
let nextEmailAddress = existing.email_address || null;
|
|
1601
1607
|
let nextAccountStatus = existing.last_account_status || (nextExpectedHash ? 'unknown' : 'unbound');
|
|
1602
1608
|
if (emailParsed.action === 'clear') {
|
|
1603
1609
|
nextExpectedHash = null;
|
|
1604
1610
|
nextEmailHint = null;
|
|
1611
|
+
nextEmailAddress = null;
|
|
1605
1612
|
nextAccountStatus = 'unbound';
|
|
1606
1613
|
} else if (emailParsed.action === 'set') {
|
|
1607
1614
|
nextExpectedHash = emailParsed.hash;
|
|
1608
1615
|
nextEmailHint = emailParsed.hint;
|
|
1616
|
+
nextEmailAddress = emailParsed.email;
|
|
1609
1617
|
const lastHash = existing.last_email_hash ? String(existing.last_email_hash).trim().toLowerCase() : '';
|
|
1610
1618
|
nextAccountStatus = lastHash ? (lastHash === nextExpectedHash ? 'verified' : 'mismatch') : 'unknown';
|
|
1611
1619
|
}
|
|
@@ -1618,13 +1626,14 @@ export function createApp({
|
|
|
1618
1626
|
});
|
|
1619
1627
|
}
|
|
1620
1628
|
stmts.push({
|
|
1621
|
-
sql: 'UPDATE members SET name = ?, role = ?, color = ?, expected_email_hash = ?, email_hint = ?, last_account_status = ?, quota_pct = ?, daily_cap_usd = ?, weekly_cap_usd = ?, cycle_cap_usd = ?, active = ? WHERE id = ?',
|
|
1629
|
+
sql: 'UPDATE members SET name = ?, role = ?, color = ?, expected_email_hash = ?, email_hint = ?, email_address = ?, last_account_status = ?, quota_pct = ?, daily_cap_usd = ?, weekly_cap_usd = ?, cycle_cap_usd = ?, active = ? WHERE id = ?',
|
|
1622
1630
|
params: [
|
|
1623
1631
|
nextName,
|
|
1624
1632
|
nextRole,
|
|
1625
1633
|
nextColor,
|
|
1626
1634
|
nextExpectedHash,
|
|
1627
1635
|
nextEmailHint,
|
|
1636
|
+
nextEmailAddress,
|
|
1628
1637
|
nextAccountStatus,
|
|
1629
1638
|
nextQuotaPct,
|
|
1630
1639
|
nextDaily,
|
|
@@ -1647,6 +1656,7 @@ export function createApp({
|
|
|
1647
1656
|
quotaPct: nextQuotaPct,
|
|
1648
1657
|
accountBound: Boolean(nextExpectedHash),
|
|
1649
1658
|
emailHint: nextEmailHint,
|
|
1659
|
+
emailAddress: nextEmailAddress,
|
|
1650
1660
|
accountStatus: nextAccountStatus,
|
|
1651
1661
|
active: Boolean(nextActive),
|
|
1652
1662
|
});
|
|
@@ -1685,6 +1695,12 @@ export function createApp({
|
|
|
1685
1695
|
if (body && body.boardAccessMode !== undefined) {
|
|
1686
1696
|
body.boardAccessMode = body.boardAccessMode === 'cli-only' ? 'cli-only' : 'public';
|
|
1687
1697
|
}
|
|
1698
|
+
if (body && body.maskPublicEmail !== undefined) {
|
|
1699
|
+
body.maskPublicEmail = Boolean(body.maskPublicEmail);
|
|
1700
|
+
}
|
|
1701
|
+
if (body && body.maskPublicIp !== undefined) {
|
|
1702
|
+
body.maskPublicIp = Boolean(body.maskPublicIp);
|
|
1703
|
+
}
|
|
1688
1704
|
if (body && body.monthlyPlanCurrency !== undefined) {
|
|
1689
1705
|
const cur = String(body.monthlyPlanCurrency || 'USD').toUpperCase();
|
|
1690
1706
|
body.monthlyPlanCurrency = ['USD', 'CNY', 'EUR', 'JPY'].includes(cur) ? cur : 'USD';
|
|
@@ -1712,10 +1728,10 @@ export function createApp({
|
|
|
1712
1728
|
400,
|
|
1713
1729
|
);
|
|
1714
1730
|
}
|
|
1715
|
-
const mgr = await db.get("SELECT id, email_hint, name FROM members WHERE role = 'manager' AND active = 1 LIMIT 1");
|
|
1731
|
+
const mgr = await db.get("SELECT id, email_address, email_hint, name FROM members WHERE role = 'manager' AND active = 1 LIMIT 1");
|
|
1716
1732
|
const normWithLabel = {
|
|
1717
1733
|
...norm,
|
|
1718
|
-
accountLabel: norm.accountLabel || mgr?.email_hint || mgr?.name || '',
|
|
1734
|
+
accountLabel: norm.accountLabel || mgr?.email_address || mgr?.email_hint || mgr?.name || '',
|
|
1719
1735
|
};
|
|
1720
1736
|
await db.run(
|
|
1721
1737
|
UPSERT_SUBSCRIPTION_QUOTA_SQL,
|
|
@@ -18,6 +18,7 @@ export const SCHEMA_STATEMENTS = Object.freeze([
|
|
|
18
18
|
token_hash TEXT NOT NULL UNIQUE,
|
|
19
19
|
expected_email_hash TEXT,
|
|
20
20
|
email_hint TEXT,
|
|
21
|
+
email_address TEXT,
|
|
21
22
|
quota_pct REAL,
|
|
22
23
|
daily_cap_usd REAL,
|
|
23
24
|
weekly_cap_usd REAL,
|
|
@@ -157,6 +158,8 @@ export const DEFAULT_SETTINGS = Object.freeze({
|
|
|
157
158
|
webhookType: 'auto',
|
|
158
159
|
boardAccessMode: 'public',
|
|
159
160
|
boardViewKey: '',
|
|
161
|
+
maskPublicEmail: false,
|
|
162
|
+
maskPublicIp: false,
|
|
160
163
|
});
|
|
161
164
|
|
|
162
165
|
export async function ensureSchema(db) {
|
|
@@ -177,6 +180,7 @@ export async function ensureSchema(db) {
|
|
|
177
180
|
for (const colSql of [
|
|
178
181
|
'ALTER TABLE members ADD COLUMN expected_email_hash TEXT',
|
|
179
182
|
'ALTER TABLE members ADD COLUMN email_hint TEXT',
|
|
183
|
+
'ALTER TABLE members ADD COLUMN email_address TEXT',
|
|
180
184
|
'ALTER TABLE members ADD COLUMN last_email_hash TEXT',
|
|
181
185
|
'ALTER TABLE members ADD COLUMN last_account_status TEXT',
|
|
182
186
|
]) {
|
|
@@ -162,6 +162,36 @@ export function maskIpAddress(rawIp) {
|
|
|
162
162
|
return '***';
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
+
export function maskEmailDisplay(rawEmail) {
|
|
166
|
+
const s = String(rawEmail || '').trim();
|
|
167
|
+
if (!s) return '';
|
|
168
|
+
const at = s.indexOf('@');
|
|
169
|
+
if (at <= 0) return s;
|
|
170
|
+
const local = s.slice(0, at);
|
|
171
|
+
const domain = s.slice(at + 1);
|
|
172
|
+
if (local.includes('***')) return s;
|
|
173
|
+
if (local.length <= 1) return `***@${domain}`;
|
|
174
|
+
if (local.length === 2) return `${local[0]}***@${domain}`;
|
|
175
|
+
return `${local.slice(0, 2)}***@${domain}`;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export function formatBoardEmail(emailAddress, emailHint, maskEmail = false) {
|
|
179
|
+
const full = String(emailAddress || '').trim();
|
|
180
|
+
const hint = String(emailHint || '').trim();
|
|
181
|
+
if (maskEmail) {
|
|
182
|
+
return hint || maskEmailDisplay(full) || '';
|
|
183
|
+
}
|
|
184
|
+
return full || hint || '';
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
export function formatBoardIp(rawIp, maskIp = false) {
|
|
188
|
+
const s = String(rawIp || '').trim();
|
|
189
|
+
if (!s) return '';
|
|
190
|
+
if (maskIp) return maskIpAddress(s);
|
|
191
|
+
if (s === '127.0.0.1' || s === '::1' || s === 'local') return 'local';
|
|
192
|
+
return s;
|
|
193
|
+
}
|
|
194
|
+
|
|
165
195
|
export function roundUsd(n) {
|
|
166
196
|
return Math.round((Number(n) || 0) * 10_000) / 10_000;
|
|
167
197
|
}
|
|
@@ -993,7 +1023,7 @@ export async function buildBoardPayload(
|
|
|
993
1023
|
}
|
|
994
1024
|
|
|
995
1025
|
const membersRaw = await db.all(
|
|
996
|
-
'SELECT id, name, role, color, quota_pct, expected_email_hash, email_hint, last_account_status, daily_cap_usd, weekly_cap_usd, cycle_cap_usd, active, created_at, last_seen_at, last_client_kind, last_client_version FROM members WHERE active = 1 ORDER BY created_at ASC',
|
|
1026
|
+
'SELECT id, name, role, color, quota_pct, expected_email_hash, email_hint, email_address, last_account_status, daily_cap_usd, weekly_cap_usd, cycle_cap_usd, active, created_at, last_seen_at, last_client_kind, last_client_version FROM members WHERE active = 1 ORDER BY created_at ASC',
|
|
997
1027
|
);
|
|
998
1028
|
const quotasMap = resolveFamilyQuotas(membersRaw);
|
|
999
1029
|
|
|
@@ -1251,6 +1281,8 @@ export async function buildBoardPayload(
|
|
|
1251
1281
|
const creditsPerUsd = Math.max(1, Number(settings.creditsPerUsd) || 100);
|
|
1252
1282
|
const quotaMode = poolTotalCredits > 0 ? 'pool' : 'relative';
|
|
1253
1283
|
const activeMemberCount = (membersRaw || []).length;
|
|
1284
|
+
const maskPublicEmail = Boolean(settings.maskPublicEmail);
|
|
1285
|
+
const maskPublicIp = Boolean(settings.maskPublicIp);
|
|
1254
1286
|
|
|
1255
1287
|
const members = (membersRaw || []).map((raw) => {
|
|
1256
1288
|
const agg = byMember.get(raw.id);
|
|
@@ -1324,7 +1356,8 @@ export async function buildBoardPayload(
|
|
|
1324
1356
|
sharePct,
|
|
1325
1357
|
deviceCount: mergedDeviceIds.size,
|
|
1326
1358
|
lastPlatform: latestDev?.platform || '',
|
|
1327
|
-
|
|
1359
|
+
lastIp: formatBoardIp(latestDev?.last_ip || '', maskPublicIp),
|
|
1360
|
+
lastMaskedIp: formatBoardIp(latestDev?.last_ip || '', maskPublicIp),
|
|
1328
1361
|
lastCountry: latestDev?.last_country || '',
|
|
1329
1362
|
sources: {
|
|
1330
1363
|
desktopUsd: roundUsd(agg.sources.desktop),
|
|
@@ -1338,7 +1371,8 @@ export async function buildBoardPayload(
|
|
|
1338
1371
|
lastClientVersion: agg.lastClientVersion,
|
|
1339
1372
|
online: !isOffline,
|
|
1340
1373
|
accountBound: Boolean(raw.expected_email_hash),
|
|
1341
|
-
|
|
1374
|
+
email: formatBoardEmail(raw.email_address, raw.email_hint, maskPublicEmail),
|
|
1375
|
+
emailHint: formatBoardEmail(raw.email_address, raw.email_hint, maskPublicEmail),
|
|
1342
1376
|
accountStatus: raw.expected_email_hash ? raw.last_account_status || 'unknown' : 'unbound',
|
|
1343
1377
|
integrityFlags7d: integrityByMember.get(raw.id) || 0,
|
|
1344
1378
|
};
|
|
@@ -1412,6 +1446,21 @@ export async function buildBoardPayload(
|
|
|
1412
1446
|
d.poolPct = poolTotalCredits > 0 ? roundPct((((Number(d.usd) || 0) * creditsPerUsd) / poolTotalCredits) * 100) : null;
|
|
1413
1447
|
}
|
|
1414
1448
|
|
|
1449
|
+
const mgrRow = (membersRaw || []).find((m) => m.role === 'manager') || null;
|
|
1450
|
+
let publicMasterQuota = masterSubscriptionQuota;
|
|
1451
|
+
if (masterSubscriptionQuota && masterSubscriptionQuota.configured) {
|
|
1452
|
+
const rawLbl = String(masterSubscriptionQuota.accountLabel || '').trim();
|
|
1453
|
+
const unmaskedLbl =
|
|
1454
|
+
!maskPublicEmail && mgrRow?.email_address && (!rawLbl || rawLbl === mgrRow.email_hint)
|
|
1455
|
+
? mgrRow.email_address
|
|
1456
|
+
: rawLbl;
|
|
1457
|
+
const finalLbl = maskPublicEmail ? maskEmailDisplay(unmaskedLbl) : unmaskedLbl;
|
|
1458
|
+
publicMasterQuota = {
|
|
1459
|
+
...masterSubscriptionQuota,
|
|
1460
|
+
accountLabel: finalLbl,
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
|
|
1415
1464
|
return {
|
|
1416
1465
|
boardTitle: settings.boardTitle,
|
|
1417
1466
|
period: win.period,
|
|
@@ -1443,6 +1492,8 @@ export async function buildBoardPayload(
|
|
|
1443
1492
|
pricingSource: settings.pricingCache?.source || 'builtin',
|
|
1444
1493
|
pricingCount: Object.keys(settings.pricingCache?.rates || {}).length,
|
|
1445
1494
|
pricingUpdatedAt: settings.pricingCache?.fetchedAt || null,
|
|
1495
|
+
maskPublicEmail,
|
|
1496
|
+
maskPublicIp,
|
|
1446
1497
|
},
|
|
1447
1498
|
cycleInfo: {
|
|
1448
1499
|
...cycleInfo,
|
|
@@ -1502,7 +1553,7 @@ export async function buildBoardPayload(
|
|
|
1502
1553
|
dailyTrend: dailyTrendList,
|
|
1503
1554
|
modelBreakdown,
|
|
1504
1555
|
creditsReconciliation,
|
|
1505
|
-
masterSubscriptionQuota,
|
|
1556
|
+
masterSubscriptionQuota: publicMasterQuota,
|
|
1506
1557
|
};
|
|
1507
1558
|
}
|
|
1508
1559
|
|
|
@@ -1572,12 +1623,14 @@ export async function buildMemberDetailPayload(
|
|
|
1572
1623
|
{ period = 'today', from = '', to = '', envDefaults = {}, now = Date.now() } = {},
|
|
1573
1624
|
) {
|
|
1574
1625
|
const member = await db.get(
|
|
1575
|
-
'SELECT id, name, role, color, quota_pct, expected_email_hash, email_hint, last_account_status, daily_cap_usd, weekly_cap_usd, cycle_cap_usd, active, created_at, last_seen_at, last_client_kind, last_client_version FROM members WHERE id = ? AND active = 1',
|
|
1626
|
+
'SELECT id, name, role, color, quota_pct, expected_email_hash, email_hint, email_address, last_account_status, daily_cap_usd, weekly_cap_usd, cycle_cap_usd, active, created_at, last_seen_at, last_client_kind, last_client_version FROM members WHERE id = ? AND active = 1',
|
|
1576
1627
|
[memberId],
|
|
1577
1628
|
);
|
|
1578
1629
|
if (!member) return null;
|
|
1579
1630
|
|
|
1580
1631
|
const settings = await loadSettings(db, envDefaults);
|
|
1632
|
+
const maskPublicEmail = Boolean(settings.maskPublicEmail);
|
|
1633
|
+
const maskPublicIp = Boolean(settings.maskPublicIp);
|
|
1581
1634
|
const activeMembers = await db.all(
|
|
1582
1635
|
'SELECT id, name, role, quota_pct, active FROM members WHERE active = 1 ORDER BY created_at ASC',
|
|
1583
1636
|
);
|
|
@@ -1778,7 +1831,7 @@ export async function buildMemberDetailPayload(
|
|
|
1778
1831
|
let knownDevices = [];
|
|
1779
1832
|
try {
|
|
1780
1833
|
knownDevices = await db.all(
|
|
1781
|
-
'SELECT device_id, platform, client_kind, client_version, last_ip, last_country, last_seen_at FROM member_devices WHERE member_id = ? ORDER BY last_seen_at DESC',
|
|
1834
|
+
'SELECT device_id, platform, client_kind, client_version, last_ip, last_country, last_city, last_seen_at FROM member_devices WHERE member_id = ? ORDER BY last_seen_at DESC',
|
|
1782
1835
|
[member.id],
|
|
1783
1836
|
);
|
|
1784
1837
|
} catch {
|
|
@@ -1807,8 +1860,10 @@ export async function buildMemberDetailPayload(
|
|
|
1807
1860
|
...d,
|
|
1808
1861
|
platform: meta?.platform || '',
|
|
1809
1862
|
clientVersion: meta?.client_version || '',
|
|
1810
|
-
|
|
1863
|
+
ip: formatBoardIp(meta?.last_ip || '', maskPublicIp),
|
|
1864
|
+
maskedIp: formatBoardIp(meta?.last_ip || '', maskPublicIp),
|
|
1811
1865
|
country: meta?.last_country || '',
|
|
1866
|
+
city: maskPublicIp ? '' : (meta?.last_city || ''),
|
|
1812
1867
|
lastUpdatedAt: Math.max(Number(d.lastUpdatedAt) || 0, Number(meta?.last_seen_at) || 0),
|
|
1813
1868
|
sharePct: periodUsd > 0 ? roundPct((d.totalUsd / periodUsd) * 100) : 0,
|
|
1814
1869
|
};
|
|
@@ -1866,7 +1921,8 @@ export async function buildMemberDetailPayload(
|
|
|
1866
1921
|
period: win.period,
|
|
1867
1922
|
online,
|
|
1868
1923
|
accountBound: Boolean(member.expected_email_hash),
|
|
1869
|
-
|
|
1924
|
+
email: formatBoardEmail(member.email_address, member.email_hint, maskPublicEmail),
|
|
1925
|
+
emailHint: formatBoardEmail(member.email_address, member.email_hint, maskPublicEmail),
|
|
1870
1926
|
accountStatus: member.expected_email_hash ? member.last_account_status || 'unknown' : 'unbound',
|
|
1871
1927
|
lastSeenAt: member.last_seen_at || null,
|
|
1872
1928
|
lastClientKind: member.last_client_kind || null,
|
|
@@ -1924,7 +1924,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
1924
1924
|
|
|
1925
1925
|
<footer class="foot">
|
|
1926
1926
|
<span data-i18n="privacyNote">隐私承诺:客户端仅只读扫描本地 SQLite 数值元数据,绝不上传 Prompt、代码、文件路径或 Google 凭据。</span>
|
|
1927
|
-
<span class="mono">agy-family v0.6.
|
|
1927
|
+
<span class="mono">agy-family v0.6.3 · MIT</span>
|
|
1928
1928
|
</footer>
|
|
1929
1929
|
</main>
|
|
1930
1930
|
|
|
@@ -2019,7 +2019,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
2019
2019
|
</div>
|
|
2020
2020
|
</div>
|
|
2021
2021
|
<div class="field">
|
|
2022
|
-
<label data-i18n="emailLbl">家庭组 Google 邮箱(选填 ·
|
|
2022
|
+
<label data-i18n="emailLbl">家庭组 Google 邮箱(选填 · 默认在看板展示,可在规则中开启脱敏遮挡;切其他号自动免计)</label>
|
|
2023
2023
|
<input id="newMemberEmail" class="mono" type="email" autocomplete="off" placeholder="如:alice@gmail.com(留空则不校验账号,服务端绝不存明文)" />
|
|
2024
2024
|
</div>
|
|
2025
2025
|
<div style="display:flex;align-items:center;gap:10px;flex-wrap:wrap">
|
|
@@ -2063,7 +2063,7 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
2063
2063
|
</select>
|
|
2064
2064
|
</div>
|
|
2065
2065
|
<div class="field">
|
|
2066
|
-
<label data-i18n="masterLabelLbl"
|
|
2066
|
+
<label data-i18n="masterLabelLbl">主号邮箱 / 备注(选填)</label>
|
|
2067
2067
|
<input id="mqLabelInput" class="mono" placeholder="如:主号 · cl***@gmail.com" />
|
|
2068
2068
|
</div>
|
|
2069
2069
|
</div>
|
|
@@ -2094,9 +2094,25 @@ export function renderDashboardHtml({ boardTitle = 'Antigravity 家庭组' } = {
|
|
|
2094
2094
|
<label data-i18n="accessModeLbl">看板访问权限</label>
|
|
2095
2095
|
<select id="setAccessMode">
|
|
2096
2096
|
<option value="cli-only">仅限 CLI / 成员登录(推荐 · 零密码 · agy-family open)</option>
|
|
2097
|
-
<option value="public"
|
|
2097
|
+
<option value="public">公开只读(知道网址即可查看看板)</option>
|
|
2098
2098
|
</select>
|
|
2099
2099
|
</div>
|
|
2100
|
+
<div class="row-2">
|
|
2101
|
+
<div class="field">
|
|
2102
|
+
<label data-i18n="maskEmailLbl">页面邮箱显示</label>
|
|
2103
|
+
<select id="setMaskEmail">
|
|
2104
|
+
<option value="false">默认公开完整邮箱(成员可见)</option>
|
|
2105
|
+
<option value="true">开启脱敏遮挡(如 xy***@gmail.com)</option>
|
|
2106
|
+
</select>
|
|
2107
|
+
</div>
|
|
2108
|
+
<div class="field">
|
|
2109
|
+
<label data-i18n="maskIpLbl">页面 IP 显示</label>
|
|
2110
|
+
<select id="setMaskIp">
|
|
2111
|
+
<option value="false">默认公开完整 IP(成员可见)</option>
|
|
2112
|
+
<option value="true">开启脱敏遮挡(如 104.233.*.*)</option>
|
|
2113
|
+
</select>
|
|
2114
|
+
</div>
|
|
2115
|
+
</div>
|
|
2100
2116
|
<div class="row-2">
|
|
2101
2117
|
<div class="field"><label data-i18n="planCostLbl">月订阅总费(可选,按占比算分摊)</label><input id="setPlanCost" class="mono" type="number" min="0" step="0.01" placeholder="如:249.99 或 1800" /></div>
|
|
2102
2118
|
<div class="field">
|
|
@@ -2223,15 +2239,16 @@ const I18N = {
|
|
|
2223
2239
|
addMember: '添加家庭成员', name: '成员姓名 / 昵称', roleLbl: '家庭组角色', roleMember: '家庭成员', roleManager: '主号(家庭组管理员)',
|
|
2224
2240
|
roleManagerShort: '主号', color: '标识色',
|
|
2225
2241
|
quotaPctLbl: '配额比例 (%) · 留空自动均分',
|
|
2226
|
-
emailLbl: '家庭组 Google 邮箱(选填 ·
|
|
2242
|
+
emailLbl: '家庭组 Google 邮箱(选填 · 默认在看板展示,可在规则中开启脱敏遮挡;切其他号自动免计)',
|
|
2227
2243
|
acctVerified: '✓ 家庭组号', acctMismatch: '非家庭组号 · 免计', acctPending: '待核验',
|
|
2228
2244
|
genInvite: '创建成员并生成邀请码', memberList: '已添加成员',
|
|
2229
2245
|
masterQuotaHead: '主号实时订阅额度', clearMasterQuota: '清除记录',
|
|
2230
2246
|
masterAutoSyncHead: '命令行自动同步主号订阅额度(推荐)',
|
|
2231
2247
|
masterManualHead: '手动更新主号订阅余量(兜底校准)',
|
|
2232
|
-
masterTierLbl: '订阅套餐等级', masterLabelLbl: '
|
|
2248
|
+
masterTierLbl: '订阅套餐等级', masterLabelLbl: '主号邮箱 / 备注(选填)', saveMasterQuota: '更新主号订阅额度',
|
|
2233
2249
|
rulesNote: '遵循 Google 家庭组规则(最多 6 人:1 位主号 + 最多 5 位家庭成员)。按「组内使用占比 (%) vs 分配份额 (%)」核算成员比例,主号实时同步套餐 5h / 周剩余额度。',
|
|
2234
2250
|
boardNameLbl: '家庭组看板名称', accessModeLbl: '看板访问权限',
|
|
2251
|
+
maskEmailLbl: '页面邮箱显示', maskIpLbl: '页面 IP 显示',
|
|
2235
2252
|
resetDay: '月度重置日', warnPct: '份额预警比例 (%)', offlineHrs: '离线判定 (h)',
|
|
2236
2253
|
tzLbl: '统计时区',
|
|
2237
2254
|
viewKeyLbl: '家庭组查看密码(留空则公开,新邀请码自动携带)',
|
|
@@ -2263,15 +2280,16 @@ const I18N = {
|
|
|
2263
2280
|
addMember: 'Add family member', name: 'Name', roleLbl: 'Role', roleMember: 'Family member', roleManager: 'Master (Family Manager)',
|
|
2264
2281
|
roleManagerShort: 'Master', color: 'Color',
|
|
2265
2282
|
quotaPctLbl: 'Quota share (%) · blank = auto-equal',
|
|
2266
|
-
emailLbl: 'Family Google email (optional ·
|
|
2283
|
+
emailLbl: 'Family Google email (optional · shown on board unless masking is enabled; skips non-family accounts)',
|
|
2267
2284
|
acctVerified: '✓ Family acct', acctMismatch: 'Other acct · paused', acctPending: 'Acct pending',
|
|
2268
2285
|
genInvite: 'Add member & generate invite', memberList: 'Current members',
|
|
2269
2286
|
masterQuotaHead: 'Live Master Subscription Quota', clearMasterQuota: 'Clear',
|
|
2270
2287
|
masterAutoSyncHead: 'Auto-sync Master Quota via CLI (Recommended)',
|
|
2271
2288
|
masterManualHead: 'Manual Master Quota Calibration',
|
|
2272
|
-
masterTierLbl: 'Subscription tier', masterLabelLbl: '
|
|
2289
|
+
masterTierLbl: 'Subscription tier', masterLabelLbl: 'Master email / label (optional)', saveMasterQuota: 'Update master quota',
|
|
2273
2290
|
rulesNote: 'Follows Google Family Group rules (up to 6 people: 1 master + 5 members). Shares are evaluated in percentages (%), while the master account syncs live 5h / weekly subscription quota.',
|
|
2274
2291
|
boardNameLbl: 'Board title', accessModeLbl: 'Board access mode',
|
|
2292
|
+
maskEmailLbl: 'Board email visibility', maskIpLbl: 'Board IP visibility',
|
|
2275
2293
|
resetDay: 'Billing reset day', warnPct: 'Share warn %', offlineHrs: 'Offline hours',
|
|
2276
2294
|
tzLbl: 'Timezone',
|
|
2277
2295
|
viewKeyLbl: 'Family group view key (optional; auto-carried in new invites)',
|
|
@@ -2955,9 +2973,10 @@ async function loadMemberDetail(memberId) {
|
|
|
2955
2973
|
? '<div class="dev-list">' + d.devices.slice(0, 4).map((dev) => {
|
|
2956
2974
|
const shortId = '#' + String(dev.deviceId || '').slice(-4);
|
|
2957
2975
|
const plat = dev.platform ? ' · ' + dev.platform : '';
|
|
2976
|
+
const geoTxt = dev.country ? (dev.city ? dev.country + ' · ' + dev.city : dev.country) : '';
|
|
2958
2977
|
const net = dev.maskedIp
|
|
2959
|
-
? ' · ' + dev.maskedIp + (
|
|
2960
|
-
: (
|
|
2978
|
+
? ' · ' + dev.maskedIp + (geoTxt ? ' (' + geoTxt + ')' : '')
|
|
2979
|
+
: (geoTxt ? ' · ' + geoTxt : '');
|
|
2961
2980
|
const usage = (dev.tokens || 0) > 0 ? ' · ' + fmtPct(dev.sharePct || 0, dev.totalUsd) + ' (' + fmtTok(dev.tokens || 0) + ')' : '';
|
|
2962
2981
|
return '<div class="dev-row mono">' +
|
|
2963
2982
|
'<span style="overflow:hidden;text-overflow:ellipsis;white-space:nowrap">' + esc(shortId + plat + net + usage) + '</span>' +
|
|
@@ -3599,6 +3618,10 @@ async function loadAdmin() {
|
|
|
3599
3618
|
document.getElementById('setBoardTitle').value = data.settings.boardTitle || '';
|
|
3600
3619
|
const amSel = document.getElementById('setAccessMode');
|
|
3601
3620
|
if (amSel) amSel.value = data.settings.boardAccessMode === 'cli-only' ? 'cli-only' : 'public';
|
|
3621
|
+
const meSel = document.getElementById('setMaskEmail');
|
|
3622
|
+
if (meSel) meSel.value = data.settings.maskPublicEmail ? 'true' : 'false';
|
|
3623
|
+
const miSel = document.getElementById('setMaskIp');
|
|
3624
|
+
if (miSel) miSel.value = data.settings.maskPublicIp ? 'true' : 'false';
|
|
3602
3625
|
document.getElementById('setResetDay').value = data.settings.cycleResetDay ?? 1;
|
|
3603
3626
|
document.getElementById('setWarnPct').value = data.settings.warnPct ?? 80;
|
|
3604
3627
|
document.getElementById('setOfflineHrs').value = data.settings.offlineAlertHours ?? 48;
|
|
@@ -3692,7 +3715,8 @@ async function loadAdmin() {
|
|
|
3692
3715
|
? '份额 ' + effPct + '%' + (m.is_auto_quota ? ' (均分)' : ' (指定)')
|
|
3693
3716
|
: 'Quota ' + effPct + '%' + (m.is_auto_quota ? ' (eq)' : ' (pin)'))
|
|
3694
3717
|
: '';
|
|
3695
|
-
const
|
|
3718
|
+
const adminEmail = m.email_address || m.email_hint || '';
|
|
3719
|
+
const emailInfo = adminEmail ? ' · ' + adminEmail : '';
|
|
3696
3720
|
const cliVer = m.last_client_version ? String(m.last_client_version) : '';
|
|
3697
3721
|
const isOutdatedCli = Boolean(cliVer && adminServerVersion && cliVer !== adminServerVersion);
|
|
3698
3722
|
const verTag = cliVer
|
|
@@ -3705,11 +3729,11 @@ async function loadAdmin() {
|
|
|
3705
3729
|
: m.account_status === 'unknown'
|
|
3706
3730
|
? ' <span class="ntag ntag-gray">' + esc(t('acctPending')) + '</span>'
|
|
3707
3731
|
: '';
|
|
3708
|
-
const editEmailPh =
|
|
3732
|
+
const editEmailPh = adminEmail
|
|
3709
3733
|
? (lang === 'zh'
|
|
3710
|
-
? '已绑 ' +
|
|
3711
|
-
: 'Bound ' +
|
|
3712
|
-
: (lang === 'zh' ? '如:alice@gmail.com
|
|
3734
|
+
? '已绑 ' + adminEmail + '(填新邮箱更换,填 - 解绑,留空不变)'
|
|
3735
|
+
: 'Bound ' + adminEmail + ' (new email to replace, "-" to unbind)')
|
|
3736
|
+
: (lang === 'zh' ? '如:alice@gmail.com(默认看板展示,可设遮挡)' : 'e.g. alice@gmail.com');
|
|
3713
3737
|
const devs = Array.isArray(m.devices) ? m.devices : [];
|
|
3714
3738
|
const distinctIps = new Set(devs.map((dv) => dv.lastIp).filter((ip) => ip && ip !== 'local'));
|
|
3715
3739
|
const multiDevTag = devs.length >= 2
|
|
@@ -4679,6 +4703,8 @@ document.getElementById('saveSettingsBtn').addEventListener('click', async () =>
|
|
|
4679
4703
|
body: JSON.stringify({
|
|
4680
4704
|
boardTitle: document.getElementById('setBoardTitle').value.trim(),
|
|
4681
4705
|
boardAccessMode: document.getElementById('setAccessMode')?.value === 'cli-only' ? 'cli-only' : 'public',
|
|
4706
|
+
maskPublicEmail: document.getElementById('setMaskEmail')?.value === 'true',
|
|
4707
|
+
maskPublicIp: document.getElementById('setMaskIp')?.value === 'true',
|
|
4682
4708
|
defaultDailyCapUsd: 0,
|
|
4683
4709
|
defaultWeeklyCapUsd: 0,
|
|
4684
4710
|
defaultCycleCapUsd: 0,
|