agy-family 0.6.2 → 0.6.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agy-family",
3
- "version": "0.6.2",
3
+ "version": "0.6.4",
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.2';
74
+ const CLI_VERSION = '0.6.4';
75
75
  const THIS_CLI_PATH = fileURLToPath(import.meta.url);
76
76
  const PACKAGE_ROOT = resolve(dirname(THIS_CLI_PATH), '..', '..', '..');
77
77
 
@@ -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: m.email_hint || m.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,
@@ -782,7 +784,7 @@ async function main() {
782
784
 
783
785
  console.log('👤 本机当前 Antigravity 账号:');
784
786
  if (localAcct) {
785
- console.log(` ${localAcct.maskedEmail} (来源: ${localAcct.source})`);
787
+ console.log(` ${localAcct.email || localAcct.maskedEmail} (来源: ${localAcct.source})`);
786
788
  } else {
787
789
  console.log(' (未检测到本地已登录的 Antigravity 账号)');
788
790
  }
@@ -846,7 +848,7 @@ async function main() {
846
848
  joinedInfo.accountMatch === 'matched'
847
849
  ? '✓ 与本机当前账号匹配'
848
850
  : joinedInfo.accountMatch === 'mismatch'
849
- ? `⚠ 与本机当前账号(${localAcct?.maskedEmail || '未知'})不匹配,已暂停上报`
851
+ ? `⚠ 与本机当前账号(${localAcct?.email || localAcct?.maskedEmail || '未知'})不匹配,已暂停上报`
850
852
  : '已绑定 SHA-256 邮箱';
851
853
  console.log(` 绑定号 : ${joinedInfo.emailHint ? `${joinedInfo.emailHint} · ` : ''}${matchLabel}`);
852
854
  }
@@ -857,8 +859,13 @@ async function main() {
857
859
  console.log('\n⚙ 本地自动化:');
858
860
  console.log(` /family 钩子 : ${hookSt.hookInstalled && hookSt.hookEnabled ? '已启用' : '未启用'}`);
859
861
  console.log(` 定时守护进程 : ${daemonSt.installed ? `已安装 (${daemonSt.kind})` : '未安装'}`);
862
+ const masterDisplay = mCfg?.emailAddress || mCfg?.maskedEmail || '已绑定';
863
+ const masterMatchNote =
864
+ mCfg?.emailHash && localAcct?.emailHash && mCfg.emailHash !== localAcct.emailHash
865
+ ? ` · 当前本机为 ${localAcct.email || localAcct.maskedEmail}(已隔离保护,不覆盖主号)`
866
+ : '';
860
867
  console.log(
861
- ` 主号余量采集 : ${mCfg ? `${mCfg.maskedEmail || '已绑定'} · ${tapSt.installed ? (tapSt.chained ? '已激活 (与原状态栏链式共存)' : '已激活 (独立)') : '未安装 statusLine 钩子'}` : '未绑定'}`,
868
+ ` 主号余量采集 : ${mCfg ? `${masterDisplay} · ${tapSt.installed ? (tapSt.chained ? '已激活 (与原状态栏链式共存)' : '已激活 (独立)') : '未安装 statusLine 钩子'}${masterMatchNote}` : '未绑定'}`,
862
869
  );
863
870
 
864
871
  console.log('\n快捷命令:');
@@ -1259,20 +1266,43 @@ async function main() {
1259
1266
  if (action === 'bind') {
1260
1267
  const explicitEmail = readFlag(args, '--email').trim().toLowerCase();
1261
1268
  let emailHash = '';
1269
+ let emailAddress = '';
1262
1270
  let maskedEmail = '';
1271
+ let boundSource = '';
1272
+ let boardMgr = null;
1273
+
1274
+ if (targetUrl && targetKey) {
1275
+ try {
1276
+ const ov = await adminApiRequest({ url: targetUrl, adminKey: targetKey, path: '/api/admin/overview', timeoutMs: 8_000 });
1277
+ boardMgr = (ov.members || []).find((m) => m.role === 'manager' && m.active) || null;
1278
+ } catch {
1279
+ boardMgr = null;
1280
+ }
1281
+ }
1282
+
1263
1283
  if (explicitEmail) {
1264
1284
  emailHash = hashEmailSha256(explicitEmail);
1285
+ emailAddress = explicitEmail;
1265
1286
  maskedEmail = maskEmailHint(explicitEmail);
1287
+ boundSource = 'explicit';
1288
+ } else if (boardMgr && (boardMgr.expected_email_hash || boardMgr.email_address)) {
1289
+ emailAddress = String(boardMgr.email_address || '').trim().toLowerCase();
1290
+ emailHash = String(boardMgr.expected_email_hash || (emailAddress ? hashEmailSha256(emailAddress) : '')).trim().toLowerCase();
1291
+ maskedEmail = String(boardMgr.email_hint || (emailAddress ? maskEmailHint(emailAddress) : '')).trim();
1292
+ boundSource = 'board-manager';
1266
1293
  } else {
1267
1294
  const detected = readLocalActiveEmailHint();
1268
1295
  if (detected) {
1269
1296
  emailHash = detected.emailHash;
1297
+ emailAddress = detected.email || '';
1270
1298
  maskedEmail = detected.maskedEmail;
1299
+ boundSource = detected.source || 'local';
1271
1300
  }
1272
1301
  }
1273
1302
 
1274
1303
  const saved = {
1275
1304
  emailHash,
1305
+ ...(emailAddress ? { emailAddress } : {}),
1276
1306
  maskedEmail,
1277
1307
  boundAt: Date.now(),
1278
1308
  };
@@ -1282,12 +1312,30 @@ async function main() {
1282
1312
  cliPath: THIS_CLI_PATH,
1283
1313
  });
1284
1314
 
1285
- console.log(`✓ Bound Master Subscription Account${maskedEmail ? `: ${maskedEmail}` : ' (will lock onto active agy account)'}`);
1286
- console.log(` Master Config : ${cfgFile} (SHA-256 fingerprint only; zero Google tokens stored)`);
1315
+ const displayAcct = emailAddress || maskedEmail || '(will lock onto active agy account)';
1316
+ const srcNote = boundSource === 'board-manager' ? ` (aligned with board manager "${boardMgr?.name || 'Master'}")` : '';
1317
+ console.log(`✓ Bound Master Subscription Account: ${displayAcct}${srcNote}`);
1318
+ console.log(` Master Config : ${cfgFile} (zero Google tokens stored)`);
1287
1319
  console.log(
1288
1320
  ` Quota Capture : installed built-in statusLine tap (${tap.chained ? 'chained seamlessly with your existing statusLine' : 'standalone'})`,
1289
1321
  );
1290
1322
 
1323
+ if (boardMgr?.expected_email_hash && emailHash && boardMgr.expected_email_hash !== emailHash) {
1324
+ console.warn(
1325
+ `⚠ Warning: Board manager "${boardMgr.name}" is bound to ${boardMgr.email_address || boardMgr.email_hint}, which differs from ${displayAcct}. Server will reject mismatched quota updates until they match.`,
1326
+ );
1327
+ }
1328
+
1329
+ const localNow = readLocalActiveEmailHint();
1330
+ if (localNow?.emailHash && emailHash && localNow.emailHash !== emailHash) {
1331
+ console.log(
1332
+ `ℹ Note: Local Antigravity CLI is currently signed into ${localNow.email || localNow.maskedEmail} (not Master ${displayAcct}).`,
1333
+ );
1334
+ console.log(
1335
+ ` ${localNow.email || localNow.maskedEmail} will NEVER overwrite Master quota; quota auto-syncs whenever ${displayAcct} is active in agy CLI.`,
1336
+ );
1337
+ }
1338
+
1291
1339
  if (args.includes('--daemon')) {
1292
1340
  const d = installBackgroundDaemon({ executable: process.execPath, cliPath: THIS_CLI_PATH });
1293
1341
  if (d.kind === 'launchd' || d.kind === 'cron') {
@@ -1299,7 +1347,7 @@ async function main() {
1299
1347
  if (existingQ && targetUrl && targetKey) {
1300
1348
  await runMasterQuotaSync({ quiet: false, urlOverride: targetUrl, adminKeyOverride: targetKey });
1301
1349
  } else if (targetUrl && targetKey) {
1302
- console.log('ℹ Quota auto-captures on your next `agy` turn (0 secrets, 100% standalone), or calibrate immediately with `agy-family master set`.');
1350
+ console.log('ℹ Quota auto-captures on your next `agy` turn signed into the Master account, or calibrate immediately with `agy-family master set`.');
1303
1351
  } else {
1304
1352
  console.log('ℹ No hosted board linked yet — run "agy-family deploy" or "agy-family host link".');
1305
1353
  }
@@ -1309,9 +1357,20 @@ async function main() {
1309
1357
  // Default: `agy-family master status`
1310
1358
  const mCfg = readMasterConfig();
1311
1359
  const tapStatus = inspectStatusLineTap();
1360
+ const localNow = readLocalActiveEmailHint();
1312
1361
  console.log('Master Subscription Quota Status (100% Standalone · Zero Secrets):');
1313
1362
  if (mCfg) {
1314
- console.log(` Bound Account : ${mCfg.maskedEmail || '(any active agy account)'}`);
1363
+ const mDisp = mCfg.emailAddress || mCfg.maskedEmail || '(any active agy account)';
1364
+ console.log(` Bound Account : ${mDisp}`);
1365
+ if (localNow) {
1366
+ const matchStr =
1367
+ !mCfg.emailHash
1368
+ ? ''
1369
+ : localNow.emailHash === mCfg.emailHash
1370
+ ? ' (✓ matches Master)'
1371
+ : ' (≠ Master — protected from overwrite)';
1372
+ console.log(` Local CLI Now : ${localNow.email || localNow.maskedEmail}${matchStr}`);
1373
+ }
1315
1374
  console.log(
1316
1375
  ` Quota Capture : ${tapStatus.installed ? `active (${tapStatus.chained ? 'chained with existing statusLine' : 'standalone'})` : 'not installed (run "agy-family master bind --daemon")'}`,
1317
1376
  );
@@ -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.2',
893
+ clientVersion: '0.6.4',
894
894
  home,
895
895
  fileCache: cache,
896
896
  syncedHashes: prevHashes,
@@ -120,7 +120,7 @@ export function readLocalActiveEmailHint({ home = homedir(), platform = process.
120
120
  }
121
121
  }
122
122
  if (email) {
123
- return { emailHash: hashEmailSha256(email), maskedEmail: maskEmailHint(email), source: 'cli-token' };
123
+ return { email, emailHash: hashEmailSha256(email), maskedEmail: maskEmailHint(email), source: 'cli-token' };
124
124
  }
125
125
  } catch {}
126
126
  }
@@ -143,7 +143,7 @@ export function readLocalActiveEmailHint({ home = homedir(), platform = process.
143
143
  parsed?.['agy.onboarding.lastLoginUsername'] || parsed?.['agy.auth.email'] || parsed?.email || '',
144
144
  );
145
145
  if (email) {
146
- return { emailHash: hashEmailSha256(email), maskedEmail: maskEmailHint(email), source: 'desktop-app-storage' };
146
+ return { email, emailHash: hashEmailSha256(email), maskedEmail: maskEmailHint(email), source: 'desktop-app-storage' };
147
147
  }
148
148
  }
149
149
  return null;
@@ -262,8 +262,9 @@ export function ingestStatusLineQuotaPayload(payload, { home = homedir(), now =
262
262
  const matchedMaster = Boolean(mCfg && (!mHash || (emailHash && emailHash === mHash)));
263
263
 
264
264
  const quotaOut = {
265
+ emailHash: nextSlot.emailHash || '',
265
266
  planTier: nextSlot.planTier,
266
- accountLabel: nextSlot.accountLabel || mCfg?.maskedEmail || '',
267
+ accountLabel: (matchedMaster && mCfg?.emailAddress) || nextSlot.accountLabel || mCfg?.maskedEmail || '',
267
268
  source: nextSlot.source,
268
269
  isMasterExplicit: matchedMaster,
269
270
  observedAt: now,
@@ -320,8 +321,9 @@ export function extractLocalSubscriptionQuota({
320
321
  if (!buckets) return null;
321
322
 
322
323
  return {
324
+ emailHash: normalizeSha256Hex(slot.emailHash || mHash || cleanExpected || ''),
323
325
  planTier: normalizePlanTier(slot.planTier || slot.tier || mCfg?.planTier || ''),
324
- accountLabel: String(slot.accountLabel || mCfg?.maskedEmail || ''),
326
+ accountLabel: String((isMasterExplicit && mCfg?.emailAddress) || slot.accountLabel || mCfg?.maskedEmail || ''),
325
327
  source: String(slot.source || 'agy-family-statusline'),
326
328
  isMasterExplicit,
327
329
  observedAt: obs,
@@ -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.2',
86
+ clientVersion = '0.6.4',
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.2').slice(0, 24),
167
+ version: String(clientVersion || '0.6.4').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.2';
29
+ export const SERVER_VERSION = '0.6.4';
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,13 @@ 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 incomingQuotaHash = String(body.subscriptionQuota?.emailHash || '').trim().toLowerCase();
1204
+ const validIncomingHash = /^[a-f0-9]{64}$/.test(incomingQuotaHash) ? incomingQuotaHash : '';
1205
+ const mgrBoundHash = String(member.expected_email_hash || '').trim().toLowerCase();
1206
+ const quotaHashMatchesManager = mgrBoundHash
1207
+ ? (validIncomingHash ? validIncomingHash === mgrBoundHash : !isMismatch)
1208
+ : (!isMismatch || isExplicitMaster);
1209
+ const safeLabel = normSubQuota.accountLabel || member.email_address || member.email_hint || member.name || '';
1202
1210
  const normWithLabel = { ...normSubQuota, accountLabel: safeLabel };
1203
1211
  if (!isMismatch) {
1204
1212
  writeStmts.push({
@@ -1206,7 +1214,7 @@ export function createApp({
1206
1214
  params: buildSubscriptionQuotaParams(`member:${member.id}`, member.id, normWithLabel, now),
1207
1215
  });
1208
1216
  }
1209
- if (member.role === 'manager' && (!isMismatch || isExplicitMaster)) {
1217
+ if (member.role === 'manager' && quotaHashMatchesManager) {
1210
1218
  writeStmts.push({
1211
1219
  sql: UPSERT_SUBSCRIPTION_QUOTA_SQL,
1212
1220
  params: buildSubscriptionQuotaParams('master', member.id, normWithLabel, now),
@@ -1373,7 +1381,7 @@ export function createApp({
1373
1381
  if (request.method === 'GET' && path === '/api/admin/overview') {
1374
1382
  const settings = await loadSettings(db, envDefaults);
1375
1383
  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",
1384
+ "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
1385
  );
1378
1386
  const resolvedQuotas = resolveFamilyQuotas((membersRows || []).filter((m) => m.active));
1379
1387
  let deviceRows = [];
@@ -1403,11 +1411,11 @@ export function createApp({
1403
1411
 
1404
1412
  const members = (membersRows || []).map((m) => {
1405
1413
  const q = resolvedQuotas.get(m.id);
1406
- const { expected_email_hash, ...rest } = m;
1407
1414
  return {
1408
- ...rest,
1409
- account_bound: Boolean(expected_email_hash),
1410
- account_status: expected_email_hash ? m.last_account_status || 'unknown' : 'unbound',
1415
+ ...m,
1416
+ expected_email_hash: m.expected_email_hash || null,
1417
+ account_bound: Boolean(m.expected_email_hash),
1418
+ account_status: m.expected_email_hash ? m.last_account_status || 'unknown' : 'unbound',
1411
1419
  effective_quota_pct: q ? q.quotaPct : 0,
1412
1420
  is_auto_quota: q ? q.isAutoQuota : m.quota_pct === null || m.quota_pct === undefined,
1413
1421
  devices: devicesByMember.get(m.id) || [],
@@ -1465,6 +1473,7 @@ export function createApp({
1465
1473
  const emailParsed = await parseMemberEmailInput(body.email);
1466
1474
  const expectedEmailHash = emailParsed.action === 'set' ? emailParsed.hash : null;
1467
1475
  const emailHint = emailParsed.action === 'set' ? emailParsed.hint : null;
1476
+ const emailAddress = emailParsed.action === 'set' ? emailParsed.email : null;
1468
1477
  const initAccountStatus = expectedEmailHash ? 'unknown' : 'unbound';
1469
1478
  const dailyCap = body.dailyCapUsd === null || body.dailyCapUsd === undefined ? null : Math.max(0, Number(body.dailyCapUsd));
1470
1479
  const weeklyCap = body.weeklyCapUsd === null || body.weeklyCapUsd === undefined ? null : Math.max(0, Number(body.weeklyCapUsd));
@@ -1483,8 +1492,8 @@ export function createApp({
1483
1492
  });
1484
1493
  }
1485
1494
  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, ?)`,
1495
+ 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)
1496
+ VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 1, ?)`,
1488
1497
  params: [
1489
1498
  id,
1490
1499
  name,
@@ -1493,6 +1502,7 @@ export function createApp({
1493
1502
  tokenHash,
1494
1503
  expectedEmailHash,
1495
1504
  emailHint,
1505
+ emailAddress,
1496
1506
  initAccountStatus,
1497
1507
  quotaPct,
1498
1508
  dailyCap,
@@ -1525,6 +1535,7 @@ export function createApp({
1525
1535
  quotaPct,
1526
1536
  accountBound: Boolean(expectedEmailHash),
1527
1537
  emailHint,
1538
+ emailAddress,
1528
1539
  dailyCapUsd: dailyCap,
1529
1540
  weeklyCapUsd: weeklyCap,
1530
1541
  cycleCapUsd: cycleCap,
@@ -1598,14 +1609,17 @@ export function createApp({
1598
1609
  const emailParsed = await parseMemberEmailInput(body.email);
1599
1610
  let nextExpectedHash = existing.expected_email_hash || null;
1600
1611
  let nextEmailHint = existing.email_hint || null;
1612
+ let nextEmailAddress = existing.email_address || null;
1601
1613
  let nextAccountStatus = existing.last_account_status || (nextExpectedHash ? 'unknown' : 'unbound');
1602
1614
  if (emailParsed.action === 'clear') {
1603
1615
  nextExpectedHash = null;
1604
1616
  nextEmailHint = null;
1617
+ nextEmailAddress = null;
1605
1618
  nextAccountStatus = 'unbound';
1606
1619
  } else if (emailParsed.action === 'set') {
1607
1620
  nextExpectedHash = emailParsed.hash;
1608
1621
  nextEmailHint = emailParsed.hint;
1622
+ nextEmailAddress = emailParsed.email;
1609
1623
  const lastHash = existing.last_email_hash ? String(existing.last_email_hash).trim().toLowerCase() : '';
1610
1624
  nextAccountStatus = lastHash ? (lastHash === nextExpectedHash ? 'verified' : 'mismatch') : 'unknown';
1611
1625
  }
@@ -1618,13 +1632,14 @@ export function createApp({
1618
1632
  });
1619
1633
  }
1620
1634
  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 = ?',
1635
+ 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
1636
  params: [
1623
1637
  nextName,
1624
1638
  nextRole,
1625
1639
  nextColor,
1626
1640
  nextExpectedHash,
1627
1641
  nextEmailHint,
1642
+ nextEmailAddress,
1628
1643
  nextAccountStatus,
1629
1644
  nextQuotaPct,
1630
1645
  nextDaily,
@@ -1647,6 +1662,7 @@ export function createApp({
1647
1662
  quotaPct: nextQuotaPct,
1648
1663
  accountBound: Boolean(nextExpectedHash),
1649
1664
  emailHint: nextEmailHint,
1665
+ emailAddress: nextEmailAddress,
1650
1666
  accountStatus: nextAccountStatus,
1651
1667
  active: Boolean(nextActive),
1652
1668
  });
@@ -1685,6 +1701,12 @@ export function createApp({
1685
1701
  if (body && body.boardAccessMode !== undefined) {
1686
1702
  body.boardAccessMode = body.boardAccessMode === 'cli-only' ? 'cli-only' : 'public';
1687
1703
  }
1704
+ if (body && body.maskPublicEmail !== undefined) {
1705
+ body.maskPublicEmail = Boolean(body.maskPublicEmail);
1706
+ }
1707
+ if (body && body.maskPublicIp !== undefined) {
1708
+ body.maskPublicIp = Boolean(body.maskPublicIp);
1709
+ }
1688
1710
  if (body && body.monthlyPlanCurrency !== undefined) {
1689
1711
  const cur = String(body.monthlyPlanCurrency || 'USD').toUpperCase();
1690
1712
  body.monthlyPlanCurrency = ['USD', 'CNY', 'EUR', 'JPY'].includes(cur) ? cur : 'USD';
@@ -1712,10 +1734,25 @@ export function createApp({
1712
1734
  400,
1713
1735
  );
1714
1736
  }
1715
- const mgr = await db.get("SELECT id, email_hint, name FROM members WHERE role = 'manager' AND active = 1 LIMIT 1");
1737
+ const mgr = await db.get(
1738
+ "SELECT id, expected_email_hash, email_address, email_hint, name FROM members WHERE role = 'manager' AND active = 1 LIMIT 1",
1739
+ );
1740
+ const incomingHashRaw = String(body?.emailHash || '').trim().toLowerCase();
1741
+ const incomingHash = /^[a-f0-9]{64}$/.test(incomingHashRaw) ? incomingHashRaw : '';
1742
+ const mgrHash = String(mgr?.expected_email_hash || '').trim().toLowerCase();
1743
+ if (mgrHash && incomingHash && incomingHash !== mgrHash) {
1744
+ return adminJsonRes(
1745
+ {
1746
+ error:
1747
+ 'Master subscription quota rejected: active account emailHash does not match the board manager bound email.',
1748
+ code: 'MASTER_ACCOUNT_MISMATCH',
1749
+ },
1750
+ 409,
1751
+ );
1752
+ }
1716
1753
  const normWithLabel = {
1717
1754
  ...norm,
1718
- accountLabel: norm.accountLabel || mgr?.email_hint || mgr?.name || '',
1755
+ accountLabel: norm.accountLabel || mgr?.email_address || mgr?.email_hint || mgr?.name || '',
1719
1756
  };
1720
1757
  await db.run(
1721
1758
  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
- lastMaskedIp: maskIpAddress(latestDev?.last_ip || ''),
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
- emailHint: raw.email_hint || '',
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
- maskedIp: maskIpAddress(meta?.last_ip || ''),
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
- emailHint: member.email_hint || '',
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.2 · MIT</span>
1927
+ <span class="mono">agy-family v0.6.4 · 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 邮箱(选填 · 仅存 SHA-256 指纹,切其他号自动免计)</label>
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">主号脱敏备注(选填)</label>
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">公开只读(知道网址即可看脱敏看板)</option>
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 邮箱(选填 · 仅存 SHA-256 指纹,切其他号自动免计)',
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: '主号脱敏备注(选填)', saveMasterQuota: '更新主号订阅额度',
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 · SHA-256 only, skips non-family accounts)',
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: 'Masked account label (optional)', saveMasterQuota: 'Update master quota',
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 + (dev.country ? ' (' + dev.country + ')' : '')
2960
- : (dev.country ? ' · ' + dev.country : '');
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 emailInfo = m.email_hint ? ' · ' + m.email_hint : '';
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 = m.email_hint
3732
+ const editEmailPh = adminEmail
3709
3733
  ? (lang === 'zh'
3710
- ? '已绑 ' + m.email_hint + '(填新邮箱更换,填 - 解绑,留空不变)'
3711
- : 'Bound ' + m.email_hint + ' (new email to replace, "-" to unbind)')
3712
- : (lang === 'zh' ? '如:alice@gmail.com(仅存 SHA-256 指纹)' : 'e.g. alice@gmail.com (SHA-256 only)');
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,
@@ -0,0 +1,3 @@
1
+ -- Store optional full member email address on the family group's board
2
+ -- so full emails and IPs can be displayed by default and optionally masked by the manager.
3
+ ALTER TABLE members ADD COLUMN email_address TEXT;