@gruu6y/page-clean-login 0.2.6 → 0.2.7

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/ui/app.js CHANGED
@@ -3,17 +3,21 @@
3
3
  // There is no fake state: everything shown comes from /api/bootstrap.
4
4
 
5
5
  import {
6
+ PROXY_BULK_LIMIT,
6
7
  createConfirmController,
7
8
  createRequestGuard,
8
9
  formatAddress,
9
10
  normalizeProxyForm,
11
+ parseBulkProxies,
12
+ proxyConnectionKey,
10
13
  proxyFingerprint,
11
14
  statusView,
12
15
  } from "./proxy-state.js";
13
- import { distinctKeywords, distinctRegions, filterProxies } from "./proxy-filter.js";
16
+ import { distinctKeywords, distinctRegions, filterProxies, sortProxies } from "./proxy-filter.js";
14
17
  import {
15
18
  EMPTY_TARGETS,
16
19
  findTarget,
20
+ genericProxyView,
17
21
  normalizeProxyTargets,
18
22
  proxyForTarget,
19
23
  resolveTargetId,
@@ -24,7 +28,9 @@ import { isScoreActive, isScoreSettled, scoreView } from "./proxy-score.js";
24
28
  import {
25
29
  PLUGIN_SCAN_POLL_INTERVAL_MS,
26
30
  PLUGIN_SCAN_POLL_MAX_ATTEMPTS,
31
+ countAccountsByProvider,
27
32
  filterProviders,
33
+ filterProvidersByCategory,
28
34
  localizedText,
29
35
  methodCategory,
30
36
  methodCategoryText,
@@ -53,12 +59,16 @@ import {
53
59
  retiredAccounts,
54
60
  } from "./account-state.js";
55
61
  import {
62
+ EXPIRING_SOON_MS,
56
63
  accountView,
64
+ countAccountsByProxy,
57
65
  filterAccounts,
58
66
  formatCheckSummary,
59
67
  formatExit,
68
+ formatExpiryBadge,
60
69
  hostingStateLabel,
61
70
  hostingTone,
71
+ isHostingPaused,
62
72
  normalizeHosting,
63
73
  sortAccounts,
64
74
  } from "./account-view.js";
@@ -624,6 +634,63 @@ const messages = {
624
634
  toastAssetSaved: "Asset saved.",
625
635
  toastAssetDeleted: "Asset deleted.",
626
636
  assetLoadFailed: "Could not load assets.",
637
+ providersCategoryLabel: "Category",
638
+ providersCatAll: "All",
639
+ providersCatSignable: "Signable",
640
+ providersCatHasAccounts: "Has accounts",
641
+ providersCatCatalog: "Catalog",
642
+ providersRefresh: "Refresh",
643
+ providersRefreshed: "Providers refreshed.",
644
+ providerAccountsCount: "{count} accounts",
645
+ providerViewAccounts: "View accounts ({count})",
646
+ proxiesTestAll: "Test all",
647
+ proxiesTestingAll: "Testing {done}/{total}…",
648
+ proxiesTestCancel: "Cancel tests",
649
+ proxiesTestAllDone: "Tested {total} proxies.",
650
+ proxiesBulkOpen: "Bulk import",
651
+ filterSearchLabel: "Search",
652
+ filterSearchPlaceholder: "Name, host or exit IP",
653
+ filterStatusLabel: "Status",
654
+ filterStatusAll: "All",
655
+ filterStatusOk: "Available",
656
+ filterStatusError: "Failed",
657
+ filterStatusUntested: "Untested",
658
+ filterUsageLabel: "Usage",
659
+ filterUsageAll: "All",
660
+ filterUsageUsed: "In use",
661
+ filterUsageUnused: "Unused",
662
+ proxySortLabel: "Sort",
663
+ proxySortDefault: "Default",
664
+ proxySortLatency: "Latency",
665
+ proxySortScore: "Trust score",
666
+ proxySortUsage: "In use",
667
+ proxySortName: "Name",
668
+ proxyUsageCount: "{count} used",
669
+ proxyUsageUnused: "Unused",
670
+ proxyClearPassword: "Clear saved password",
671
+ proxyBulkTitle: "Bulk import proxies",
672
+ proxyBulkCopy: "Paste one proxy per line (URL, host:port, host:port:user:pass, or Name|URL).",
673
+ proxyBulkTypeLabel: "Default type",
674
+ proxyBulkPrefixLabel: "Name prefix",
675
+ proxyBulkPrefixPlaceholder: "Optional prefix (e.g. SG)",
676
+ proxyBulkInputLabel: "Proxy list",
677
+ proxyBulkPlaceholder: "127.0.0.1:7890\\nSG|10.0.0.2:1080:user:pass",
678
+ proxyBulkSubmit: "Import",
679
+ proxyBulkSubmitting: "Importing…",
680
+ proxyBulkSummary: "Parsed: {ready} ready · {duplicates} duplicate · {invalid} invalid (limit {limit})",
681
+ proxyBulkSummaryTruncated: "Parsed: {ready} ready · {duplicates} duplicate · {invalid} invalid ({truncated} over limit {limit})",
682
+ proxyBulkEmpty: "Enter at least one valid proxy line.",
683
+ proxyBulkDone: "Imported {created} proxies ({skipped} duplicate, {errors} failed).",
684
+ proxyBulkErrorTooLarge: "Bulk input exceeds 100 KB.",
685
+ accountFilterHostingPaused: "Renewal paused",
686
+ accountFilterExpiringSoon: "Expiring soon",
687
+ accountExpiryExpired: "Expired",
688
+ accountExpirySoon: "{hours}h left",
689
+ accountExpiryDays: "{days}d left",
690
+ accountDetailEmail: "Email",
691
+ accountDetailMethod: "Sign-in method",
692
+ accountDetailExpiresAt: "Token expires",
693
+ signInEgressWarning: "Warning: {detail}",
627
694
  },
628
695
  "zh-Hans": {
629
696
  title: "干净登录",
@@ -1152,6 +1219,63 @@ const messages = {
1152
1219
  toastAssetSaved: "已保存资产。",
1153
1220
  toastAssetDeleted: "已删除资产。",
1154
1221
  assetLoadFailed: "无法加载资产列表。",
1222
+ providersCategoryLabel: "分类",
1223
+ providersCatAll: "全部",
1224
+ providersCatSignable: "可登录",
1225
+ providersCatHasAccounts: "已有账号",
1226
+ providersCatCatalog: "市场目录",
1227
+ providersRefresh: "刷新",
1228
+ providersRefreshed: "供应商列表已刷新。",
1229
+ providerAccountsCount: "{count} 个账号",
1230
+ providerViewAccounts: "查看账号({count})",
1231
+ proxiesTestAll: "全部测试",
1232
+ proxiesTestingAll: "测试中 {done}/{total}…",
1233
+ proxiesTestCancel: "取消测试",
1234
+ proxiesTestAllDone: "已完成 {total} 个代理测试。",
1235
+ proxiesBulkOpen: "批量导入",
1236
+ filterSearchLabel: "搜索",
1237
+ filterSearchPlaceholder: "名称、主机或出口 IP",
1238
+ filterStatusLabel: "状态",
1239
+ filterStatusAll: "全部",
1240
+ filterStatusOk: "可用",
1241
+ filterStatusError: "失败",
1242
+ filterStatusUntested: "未测试",
1243
+ filterUsageLabel: "使用中",
1244
+ filterUsageAll: "全部",
1245
+ filterUsageUsed: "已绑定",
1246
+ filterUsageUnused: "空闲",
1247
+ proxySortLabel: "排序",
1248
+ proxySortDefault: "默认",
1249
+ proxySortLatency: "延迟",
1250
+ proxySortScore: "信任分",
1251
+ proxySortUsage: "使用中",
1252
+ proxySortName: "名称",
1253
+ proxyUsageCount: "{count} 个账号在用",
1254
+ proxyUsageUnused: "空闲",
1255
+ proxyClearPassword: "清除已保存的密码",
1256
+ proxyBulkTitle: "批量导入代理 IP",
1257
+ proxyBulkCopy: "每行一个代理(支持 URL、host:port、host:port:user:pass 或 名称|URL)。",
1258
+ proxyBulkTypeLabel: "默认类型",
1259
+ proxyBulkPrefixLabel: "名称前缀",
1260
+ proxyBulkPrefixPlaceholder: "可选前缀(如 SG)",
1261
+ proxyBulkInputLabel: "代理列表",
1262
+ proxyBulkPlaceholder: "127.0.0.1:7890\\nSG|10.0.0.2:1080:user:pass",
1263
+ proxyBulkSubmit: "导入",
1264
+ proxyBulkSubmitting: "导入中…",
1265
+ proxyBulkSummary: "解析结果:{ready} 条可导入 · {duplicates} 条重复 · {invalid} 条无效(上限 {limit})",
1266
+ proxyBulkSummaryTruncated: "解析结果:{ready} 条可导入 · {duplicates} 条重复 · {invalid} 条无效(超出上限 {limit} 的 {truncated} 条将略过)",
1267
+ proxyBulkEmpty: "请至少输入一条有效代理记录。",
1268
+ proxyBulkDone: "已导入 {created} 个代理({skipped} 条重复,{errors} 条失败)。",
1269
+ proxyBulkErrorTooLarge: "批量导入文本不能超过 100 KB。",
1270
+ accountFilterHostingPaused: "续期已暂停",
1271
+ accountFilterExpiringSoon: "即将过期",
1272
+ accountExpiryExpired: "已过期",
1273
+ accountExpirySoon: "{hours} 小时后到期",
1274
+ accountExpiryDays: "{days} 天后到期",
1275
+ accountDetailEmail: "邮箱",
1276
+ accountDetailMethod: "登录方式",
1277
+ accountDetailExpiresAt: "凭证过期时间",
1278
+ signInEgressWarning: "提示:{detail}",
1155
1279
  },
1156
1280
  "zh-Hant": {
1157
1281
  title: "乾淨登入",
@@ -1680,6 +1804,63 @@ const messages = {
1680
1804
  toastAssetSaved: "已儲存資產。",
1681
1805
  toastAssetDeleted: "已刪除資產。",
1682
1806
  assetLoadFailed: "無法載入資產列表。",
1807
+ providersCategoryLabel: "分類",
1808
+ providersCatAll: "全部",
1809
+ providersCatSignable: "可登入",
1810
+ providersCatHasAccounts: "已有帳號",
1811
+ providersCatCatalog: "市場目錄",
1812
+ providersRefresh: "重新整理",
1813
+ providersRefreshed: "供應商列表已更新。",
1814
+ providerAccountsCount: "{count} 個帳號",
1815
+ providerViewAccounts: "查看帳號({count})",
1816
+ proxiesTestAll: "全部測試",
1817
+ proxiesTestingAll: "測試中 {done}/{total}…",
1818
+ proxiesTestCancel: "取消測試",
1819
+ proxiesTestAllDone: "已完成 {total} 個代理測試。",
1820
+ proxiesBulkOpen: "批次匯入",
1821
+ filterSearchLabel: "搜尋",
1822
+ filterSearchPlaceholder: "名稱、主機或出口 IP",
1823
+ filterStatusLabel: "狀態",
1824
+ filterStatusAll: "全部",
1825
+ filterStatusOk: "可用",
1826
+ filterStatusError: "失敗",
1827
+ filterStatusUntested: "未測試",
1828
+ filterUsageLabel: "使用狀態",
1829
+ filterUsageAll: "全部",
1830
+ filterUsageUsed: "使用中",
1831
+ filterUsageUnused: "閒置",
1832
+ proxySortLabel: "排序",
1833
+ proxySortDefault: "預設",
1834
+ proxySortLatency: "延遲",
1835
+ proxySortScore: "信任分",
1836
+ proxySortUsage: "使用中",
1837
+ proxySortName: "名稱",
1838
+ proxyUsageCount: "{count} 個帳號在用",
1839
+ proxyUsageUnused: "閒置",
1840
+ proxyClearPassword: "清除已儲存的密碼",
1841
+ proxyBulkTitle: "批次匯入代理 IP",
1842
+ proxyBulkCopy: "每行一個代理(支援 URL、host:port、host:port:user:pass 或 名稱|URL)。",
1843
+ proxyBulkTypeLabel: "預設類型",
1844
+ proxyBulkPrefixLabel: "名稱前綴",
1845
+ proxyBulkPrefixPlaceholder: "可選前綴(如 SG)",
1846
+ proxyBulkInputLabel: "代理清單",
1847
+ proxyBulkPlaceholder: "127.0.0.1:7890\\nSG|10.0.0.2:1080:user:pass",
1848
+ proxyBulkSubmit: "匯入",
1849
+ proxyBulkSubmitting: "匯入中…",
1850
+ proxyBulkSummary: "解析結果:{ready} 筆可匯入 · {duplicates} 筆重複 · {invalid} 筆無效(上限 {limit})",
1851
+ proxyBulkSummaryTruncated: "解析結果:{ready} 筆可匯入 · {duplicates} 筆重複 · {invalid} 筆無效(超出上限 {limit} 的 {truncated} 筆將略過)",
1852
+ proxyBulkEmpty: "請至少輸入一筆有效代理記錄。",
1853
+ proxyBulkDone: "已匯入 {created} 個代理({skipped} 筆重複,{errors} 筆失敗)。",
1854
+ proxyBulkErrorTooLarge: "批次匯入內容不可超過 100 KB。",
1855
+ accountFilterHostingPaused: "續期已暫停",
1856
+ accountFilterExpiringSoon: "即將過期",
1857
+ accountExpiryExpired: "已過期",
1858
+ accountExpirySoon: "{hours} 小時後到期",
1859
+ accountExpiryDays: "{days} 天後到期",
1860
+ accountDetailEmail: "信箱",
1861
+ accountDetailMethod: "登入方式",
1862
+ accountDetailExpiresAt: "憑證過期時間",
1863
+ signInEgressWarning: "提示:{detail}",
1683
1864
  },
1684
1865
  ja: {
1685
1866
  title: "クリーンログイン",
@@ -2208,6 +2389,63 @@ const messages = {
2208
2389
  toastAssetSaved: "資産を保存しました。",
2209
2390
  toastAssetDeleted: "資産を削除しました。",
2210
2391
  assetLoadFailed: "資産を読み込めませんでした。",
2392
+ providersCategoryLabel: "分類",
2393
+ providersCatAll: "すべて",
2394
+ providersCatSignable: "ログイン可能",
2395
+ providersCatHasAccounts: "アカウントあり",
2396
+ providersCatCatalog: "カタログ",
2397
+ providersRefresh: "更新",
2398
+ providersRefreshed: "プロバイダー一覧を更新しました。",
2399
+ providerAccountsCount: "{count} 件",
2400
+ providerViewAccounts: "アカウントを見る ({count})",
2401
+ proxiesTestAll: "すべてテスト",
2402
+ proxiesTestingAll: "テスト中 {done}/{total}…",
2403
+ proxiesTestCancel: "テストを中止",
2404
+ proxiesTestAllDone: "{total} 件のプロキシをテストしました。",
2405
+ proxiesBulkOpen: "一括インポート",
2406
+ filterSearchLabel: "検索",
2407
+ filterSearchPlaceholder: "名前・ホスト・出口 IP",
2408
+ filterStatusLabel: "状態",
2409
+ filterStatusAll: "すべて",
2410
+ filterStatusOk: "利用可能",
2411
+ filterStatusError: "失敗",
2412
+ filterStatusUntested: "未テスト",
2413
+ filterUsageLabel: "使用状況",
2414
+ filterUsageAll: "すべて",
2415
+ filterUsageUsed: "使用中",
2416
+ filterUsageUnused: "未使用",
2417
+ proxySortLabel: "並び替え",
2418
+ proxySortDefault: "既定",
2419
+ proxySortLatency: "遅延",
2420
+ proxySortScore: "スコア",
2421
+ proxySortUsage: "使用数",
2422
+ proxySortName: "名前",
2423
+ proxyUsageCount: "{count} 件で使用",
2424
+ proxyUsageUnused: "未使用",
2425
+ proxyClearPassword: "保存済みのパスワードを削除",
2426
+ proxyBulkTitle: "プロキシの一括インポート",
2427
+ proxyBulkCopy: "1 行に 1 件ずつ入力してください(URL、host:port、host:port:user:pass、名前|URL)。",
2428
+ proxyBulkTypeLabel: "既定の種類",
2429
+ proxyBulkPrefixLabel: "名前の接頭辞",
2430
+ proxyBulkPrefixPlaceholder: "任意(例: SG)",
2431
+ proxyBulkInputLabel: "プロキシ一覧",
2432
+ proxyBulkPlaceholder: "127.0.0.1:7890\\nSG|10.0.0.2:1080:user:pass",
2433
+ proxyBulkSubmit: "インポート",
2434
+ proxyBulkSubmitting: "インポート中…",
2435
+ proxyBulkSummary: "解析結果: 追加 {ready} 件 · 重複 {duplicates} 件 · 無効 {invalid} 件(上限 {limit})",
2436
+ proxyBulkSummaryTruncated: "解析結果: 追加 {ready} 件 · 重複 {duplicates} 件 · 無効 {invalid} 件(上限 {limit} 超過 {truncated} 件は省略)",
2437
+ proxyBulkEmpty: "有効なプロキシ行を 1 件以上入力してください。",
2438
+ proxyBulkDone: "{created} 件をインポートしました(重複 {skipped} 件・失敗 {errors} 件)。",
2439
+ proxyBulkErrorTooLarge: "一括入力は 100 KB 以内にしてください。",
2440
+ accountFilterHostingPaused: "更新停止中",
2441
+ accountFilterExpiringSoon: "間もなく期限切れ",
2442
+ accountExpiryExpired: "期限切れ",
2443
+ accountExpirySoon: "残り {hours} 時間",
2444
+ accountExpiryDays: "残り {days} 日",
2445
+ accountDetailEmail: "メール",
2446
+ accountDetailMethod: "ログイン方式",
2447
+ accountDetailExpiresAt: "有効期限",
2448
+ signInEgressWarning: "注意:{detail}",
2211
2449
  },
2212
2450
  };
2213
2451
 
@@ -2289,7 +2527,24 @@ const PROXY_TARGET_RETRY_MAX = 8;
2289
2527
  const PROXY_TARGET_RETRY_MS = 1500;
2290
2528
  // Filter state is per document and never persisted: magpie mounts the page in
2291
2529
  // an opaque-origin sandbox frame where web storage is not available.
2292
- const proxyFilter = { regions: new Set(), keywords: new Set(), minLatency: "", maxLatency: "" };
2530
+ const proxyFilter = {
2531
+ regions: new Set(),
2532
+ keywords: new Set(),
2533
+ minLatency: "",
2534
+ maxLatency: "",
2535
+ search: "",
2536
+ status: "all",
2537
+ usage: "all",
2538
+ };
2539
+ let proxySort = "default";
2540
+ let bulkTestController = null;
2541
+ let bulkTestActive = false;
2542
+ let bulkTestDone = 0;
2543
+ let bulkTestTotal = 0;
2544
+ let proxyBulkBusy = false;
2545
+ let providerCategory = "all";
2546
+ let providersRefreshing = false;
2547
+ let renderedProviderCounts = {};
2293
2548
  let scoreJob = null;
2294
2549
  let scoreStarting = false;
2295
2550
  let scoreStartingId = "";
@@ -2398,6 +2653,7 @@ const errorKeys = {
2398
2653
  not_found: "errorNotFound",
2399
2654
  invalid_json: "errorInvalidJson",
2400
2655
  payload_too_large: "errorTooLarge",
2656
+ bulk_too_large: "proxyBulkErrorTooLarge",
2401
2657
  unauthorized: "errorUnauthorized",
2402
2658
  forbidden: "errorForbidden",
2403
2659
  internal: "errorInternal",
@@ -2743,6 +2999,47 @@ function applyText() {
2743
2999
  byId("asset-delete-confirm").textContent = text.assetDeleteConfirm;
2744
3000
  byId("asset-delete-cancel").textContent = text.assetCancel;
2745
3001
  byId("asset-delete-close").setAttribute("aria-label", text.close);
3002
+ // --- wave 1 & wave 2 controls ---
3003
+ byId("providers-category-label").textContent = text.providersCategoryLabel;
3004
+ byId("providers-cat-all").textContent = text.providersCatAll;
3005
+ byId("providers-cat-signable").textContent = text.providersCatSignable;
3006
+ byId("providers-cat-has-accounts").textContent = text.providersCatHasAccounts;
3007
+ byId("providers-cat-catalog").textContent = text.providersCatCatalog;
3008
+ byId("providers-refresh").textContent = text.providersRefresh;
3009
+ byId("proxies-test-all").textContent = text.proxiesTestAll;
3010
+ byId("proxies-test-cancel").textContent = text.proxiesTestCancel;
3011
+ byId("proxies-bulk-open").textContent = text.proxiesBulkOpen;
3012
+ byId("filter-search-label").textContent = text.filterSearchLabel;
3013
+ byId("filter-search").placeholder = text.filterSearchPlaceholder;
3014
+ byId("filter-search").setAttribute("aria-label", text.filterSearchPlaceholder);
3015
+ byId("filter-status-label").textContent = text.filterStatusLabel;
3016
+ byId("filter-status-all").textContent = text.filterStatusAll;
3017
+ byId("filter-status-ok").textContent = text.filterStatusOk;
3018
+ byId("filter-status-error").textContent = text.filterStatusError;
3019
+ byId("filter-status-untested").textContent = text.filterStatusUntested;
3020
+ byId("filter-usage-label").textContent = text.filterUsageLabel;
3021
+ byId("filter-usage-all").textContent = text.filterUsageAll;
3022
+ byId("filter-usage-used").textContent = text.filterUsageUsed;
3023
+ byId("filter-usage-unused").textContent = text.filterUsageUnused;
3024
+ byId("proxy-sort-label").textContent = text.proxySortLabel;
3025
+ byId("proxy-sort-default").textContent = text.proxySortDefault;
3026
+ byId("proxy-sort-latency").textContent = text.proxySortLatency;
3027
+ byId("proxy-sort-score").textContent = text.proxySortScore;
3028
+ byId("proxy-sort-usage").textContent = text.proxySortUsage;
3029
+ byId("proxy-sort-name").textContent = text.proxySortName;
3030
+ byId("proxy-clear-password-label").textContent = text.proxyClearPassword;
3031
+ byId("proxy-bulk-title").textContent = text.proxyBulkTitle;
3032
+ byId("proxy-bulk-copy").textContent = text.proxyBulkCopy;
3033
+ byId("proxy-bulk-type-label").textContent = text.proxyBulkTypeLabel;
3034
+ byId("proxy-bulk-prefix-label").textContent = text.proxyBulkPrefixLabel;
3035
+ byId("proxy-bulk-prefix").placeholder = text.proxyBulkPrefixPlaceholder;
3036
+ byId("proxy-bulk-input-label").textContent = text.proxyBulkInputLabel;
3037
+ byId("proxy-bulk-input").placeholder = text.proxyBulkPlaceholder;
3038
+ byId("proxy-bulk-cancel").textContent = text.cancel;
3039
+ byId("proxy-bulk-submit").textContent = text.proxyBulkSubmit;
3040
+ byId("proxy-bulk-close").setAttribute("aria-label", text.close);
3041
+ byId("account-filter-hosting-paused-label").textContent = text.accountFilterHostingPaused;
3042
+ byId("account-filter-expiring-soon-label").textContent = text.accountFilterExpiringSoon;
2746
3043
  }
2747
3044
 
2748
3045
  function selectTab(name) {
@@ -3031,7 +3328,7 @@ function proxyScoreCell(proxy) {
3031
3328
  return cell;
3032
3329
  }
3033
3330
 
3034
- function proxyRow(proxy) {
3331
+ function proxyRow(proxy, usageCount = 0) {
3035
3332
  const row = document.createElement("div");
3036
3333
  row.className = "proxy-row tbl-row";
3037
3334
  row.dataset.proxyId = proxy.id;
@@ -3042,14 +3339,22 @@ function proxyRow(proxy) {
3042
3339
  title.textContent = proxy.name || proxy.id;
3043
3340
  const type = document.createElement("small");
3044
3341
  type.textContent = String(proxy.type || "").toUpperCase();
3342
+ const usageBadge = document.createElement("span");
3343
+ usageBadge.className = `proxy-usage-badge${usageCount > 0 ? " is-used" : ""}`;
3344
+ usageBadge.textContent = usageCount > 0
3345
+ ? text.proxyUsageCount.replace("{count}", String(usageCount))
3346
+ : text.proxyUsageUnused;
3347
+ type.append(document.createTextNode(" "), usageBadge);
3045
3348
  name.append(title, type);
3046
3349
 
3047
3350
  const address = document.createElement("div");
3048
3351
  address.className = "proxy-address";
3352
+ address.setAttribute("data-label", text.colAddress);
3049
3353
  address.textContent = formatAddress(proxy);
3050
3354
 
3051
3355
  const region = document.createElement("div");
3052
3356
  region.className = "proxy-region";
3357
+ region.setAttribute("data-label", text.colRegion);
3053
3358
  region.textContent = proxy.region || text.unknown;
3054
3359
  if (proxy.exitIp) {
3055
3360
  // The exit IP must stay readable: an ellipsized `111.24…` is useless for
@@ -3071,6 +3376,7 @@ function proxyRow(proxy) {
3071
3376
 
3072
3377
  const statusCell = document.createElement("div");
3073
3378
  statusCell.className = "proxy-status-cell";
3379
+ statusCell.setAttribute("data-label", text.colStatus);
3074
3380
  const view = statusView(proxy, text, rowTests.has(proxy.id));
3075
3381
  const status = document.createElement("span");
3076
3382
  status.className = `proxy-status ${view.state}`;
@@ -3105,9 +3411,11 @@ function proxyRow(proxy) {
3105
3411
 
3106
3412
  const checked = document.createElement("div");
3107
3413
  checked.className = "proxy-checked";
3414
+ checked.setAttribute("data-label", text.colChecked);
3108
3415
  checked.textContent = formatTime(proxy.lastCheckedAt);
3109
3416
 
3110
3417
  const scoreCell = proxyScoreCell(proxy);
3418
+ scoreCell.setAttribute("data-label", text.colScore);
3111
3419
 
3112
3420
  const actions = document.createElement("div");
3113
3421
  actions.className = "proxy-actions";
@@ -3209,6 +3517,19 @@ function renderTargetNote() {
3209
3517
  note.hidden = false;
3210
3518
  }
3211
3519
 
3520
+ function renderBulkTestButton() {
3521
+ const testAll = byId("proxies-test-all");
3522
+ const cancelBtn = byId("proxies-test-cancel");
3523
+ if (!testAll || !cancelBtn) return;
3524
+ testAll.disabled = proxies.length === 0 || bulkTestActive;
3525
+ testAll.textContent = bulkTestActive
3526
+ ? text.proxiesTestingAll
3527
+ .replace("{done}", String(bulkTestDone))
3528
+ .replace("{total}", String(bulkTestTotal))
3529
+ : text.proxiesTestAll;
3530
+ cancelBtn.hidden = !bulkTestActive;
3531
+ }
3532
+
3212
3533
  function renderProxies() {
3213
3534
  const list = byId("proxies-list");
3214
3535
  const empty = byId("proxies-empty");
@@ -3220,30 +3541,41 @@ function renderProxies() {
3220
3541
  table.hidden = !hasProxies;
3221
3542
  filters.hidden = !hasProxies;
3222
3543
  list.textContent = "";
3544
+ renderBulkTestButton();
3223
3545
  if (!hasProxies) {
3224
3546
  renderScoreBar();
3225
3547
  return;
3226
3548
  }
3227
3549
  renderFilterChips();
3228
3550
  const target = currentTestTarget();
3551
+ const usageCounts = countAccountsByProxy(accountIdentities);
3552
+ const usedIds = new Set(Object.keys(usageCounts));
3229
3553
  // With a provider selected, the latency filter and the status number use
3230
3554
  // that provider's own measurement. The generic default leaves both the
3231
3555
  // records and the original filter call untouched.
3232
3556
  proxyFilter.latencyOf = target
3233
3557
  ? (proxy) => proxyForTarget(proxy, target, proxyTargets).latency
3234
3558
  : null;
3559
+ proxyFilter.usedIds = usedIds;
3560
+ proxyFilter.statusOf = (proxy) =>
3561
+ (target ? proxyForTarget(proxy, target, proxyTargets) : genericProxyView(proxy)).status;
3235
3562
  const visible = filterProxies(proxies, proxyFilter);
3563
+ const sorted = sortProxies(visible, proxySort, {
3564
+ latencyOf: proxyFilter.latencyOf || ((proxy) => genericProxyView(proxy).latency),
3565
+ usageCounts,
3566
+ });
3236
3567
  byId("filter-count").textContent = text.filterCount
3237
- .replace("{shown}", String(visible.length))
3568
+ .replace("{shown}", String(sorted.length))
3238
3569
  .replace("{total}", String(proxies.length));
3239
- if (visible.length === 0) {
3570
+ if (sorted.length === 0) {
3240
3571
  const note = document.createElement("p");
3241
3572
  note.className = "proxy-filter-empty";
3242
3573
  note.textContent = text.filterNoMatch;
3243
3574
  list.append(note);
3244
3575
  } else {
3245
- for (const proxy of visible) {
3246
- list.append(proxyRow(proxyForTarget(proxy, target, proxyTargets)));
3576
+ for (const proxy of sorted) {
3577
+ const displayProxy = target ? proxyForTarget(proxy, target, proxyTargets) : genericProxyView(proxy);
3578
+ list.append(proxyRow(displayProxy, usageCounts[proxy.id] || 0));
3247
3579
  }
3248
3580
  }
3249
3581
  renderScoreBar();
@@ -3346,11 +3678,77 @@ function resetProxyFilters() {
3346
3678
  proxyFilter.keywords.clear();
3347
3679
  proxyFilter.minLatency = "";
3348
3680
  proxyFilter.maxLatency = "";
3681
+ proxyFilter.search = "";
3682
+ proxyFilter.status = "all";
3683
+ proxyFilter.usage = "all";
3684
+ proxySort = "default";
3349
3685
  byId("filter-latency-min").value = "";
3350
3686
  byId("filter-latency-max").value = "";
3687
+ byId("filter-search").value = "";
3688
+ byId("filter-status").value = "all";
3689
+ byId("filter-usage").value = "all";
3690
+ byId("proxy-sort").value = "default";
3351
3691
  renderProxies();
3352
3692
  }
3353
3693
 
3694
+ function cancelBulkTests() {
3695
+ if (!bulkTestActive && !bulkTestController) return;
3696
+ bulkTestController?.abort();
3697
+ bulkTestController = null;
3698
+ bulkTestActive = false;
3699
+ for (const id of [...rowTests.keys()]) cancelRowTest(id);
3700
+ renderBulkTestButton();
3701
+ renderProxies();
3702
+ }
3703
+
3704
+ async function testAllVisibleProxies() {
3705
+ if (bulkTestActive || proxies.length === 0) return;
3706
+ const target = currentTestTarget();
3707
+ const usageCounts = countAccountsByProxy(accountIdentities);
3708
+ proxyFilter.latencyOf = target
3709
+ ? (proxy) => proxyForTarget(proxy, target, proxyTargets).latency
3710
+ : null;
3711
+ proxyFilter.usedIds = new Set(Object.keys(usageCounts));
3712
+ proxyFilter.statusOf = (proxy) =>
3713
+ (target ? proxyForTarget(proxy, target, proxyTargets) : genericProxyView(proxy)).status;
3714
+ const visible = filterProxies(proxies, proxyFilter);
3715
+ const ids = visible.map((proxy) => proxy.id).filter((id) => id && !rowTests.has(id));
3716
+ if (ids.length === 0) return;
3717
+ bulkTestActive = true;
3718
+ bulkTestDone = 0;
3719
+ bulkTestTotal = ids.length;
3720
+ const controller = new AbortController();
3721
+ bulkTestController = controller;
3722
+ renderBulkTestButton();
3723
+ let cursor = 0;
3724
+ const worker = async () => {
3725
+ while (!controller.signal.aborted && cursor < ids.length) {
3726
+ const id = ids[cursor];
3727
+ cursor += 1;
3728
+ try {
3729
+ await testRowProxy(id);
3730
+ } finally {
3731
+ if (!controller.signal.aborted) {
3732
+ bulkTestDone += 1;
3733
+ renderBulkTestButton();
3734
+ }
3735
+ }
3736
+ }
3737
+ };
3738
+ try {
3739
+ await Promise.all(Array.from({ length: Math.min(4, ids.length) }, worker));
3740
+ if (!controller.signal.aborted) {
3741
+ toast(text.proxiesTestAllDone.replace("{total}", String(ids.length)));
3742
+ }
3743
+ } finally {
3744
+ if (bulkTestController === controller) {
3745
+ bulkTestActive = false;
3746
+ bulkTestController = null;
3747
+ renderBulkTestButton();
3748
+ }
3749
+ }
3750
+ }
3751
+
3354
3752
  // --- Trust Score -----------------------------------------------------------
3355
3753
  //
3356
3754
  // Clicking a row's Score button starts POST /api/proxies/<id>/score and then
@@ -3532,6 +3930,13 @@ async function loadScoreStatus() {
3532
3930
  }
3533
3931
 
3534
3932
  function providerCard(provider) {
3933
+ const counts = renderedProviderCounts;
3934
+ const countKey = counts[provider.id]
3935
+ ? provider.id
3936
+ : provider.signInProvider && counts[provider.signInProvider]
3937
+ ? provider.signInProvider
3938
+ : provider.id;
3939
+ const acctCount = Number(counts[countKey]) || 0;
3535
3940
  const card = document.createElement("article");
3536
3941
  card.className = "provider-card";
3537
3942
  card.dataset.providerId = provider.id;
@@ -3593,6 +3998,12 @@ function providerCard(provider) {
3593
3998
  : text.providerOriginMagpie;
3594
3999
  head.append(originTag);
3595
4000
  }
4001
+ if (acctCount > 0) {
4002
+ const acctBadge = document.createElement("span");
4003
+ acctBadge.className = "provider-accounts-badge";
4004
+ acctBadge.textContent = text.providerAccountsCount.replace("{count}", String(acctCount));
4005
+ head.append(acctBadge);
4006
+ }
3596
4007
 
3597
4008
  const description = document.createElement("p");
3598
4009
  description.className = "provider-description";
@@ -3711,6 +4122,19 @@ function providerCard(provider) {
3711
4122
  });
3712
4123
  actions.append(install);
3713
4124
  }
4125
+ if (acctCount > 0) {
4126
+ const viewAccounts = document.createElement("button");
4127
+ viewAccounts.type = "button";
4128
+ viewAccounts.className = "button provider-view-accounts";
4129
+ viewAccounts.dataset.providerId = countKey;
4130
+ viewAccounts.textContent = text.providerViewAccounts.replace("{count}", String(acctCount));
4131
+ viewAccounts.addEventListener("click", () => {
4132
+ selectTab("accounts");
4133
+ setAccountProvider(countKey);
4134
+ loadAccountIdentities();
4135
+ });
4136
+ actions.append(viewAccounts);
4137
+ }
3714
4138
  // Reporting is offered on every card, including the ones that offer no way in
3715
4139
  // at all: a card with nothing to click is exactly the one worth reporting.
3716
4140
  const report = document.createElement("button");
@@ -4074,6 +4498,7 @@ async function loadAccountIdentities() {
4074
4498
  // identities arrive. The split does not depend on them: no card moves
4075
4499
  // between the main list and the collapsed catalog.
4076
4500
  renderProviders(providerCatalog);
4501
+ renderProxies();
4077
4502
  }
4078
4503
  }
4079
4504
 
@@ -4448,6 +4873,9 @@ function renderSignIn() {
4448
4873
  for (const input of inputs.querySelectorAll("[data-input-key]")) {
4449
4874
  input.disabled = active || context.busy;
4450
4875
  }
4876
+ if (flow?.egressWarning) {
4877
+ setSignInNotice(text.signInEgressWarning.replace("{detail}", String(flow.egressWarning)));
4878
+ }
4451
4879
  }
4452
4880
 
4453
4881
  function renderSignInProxies() {
@@ -4919,7 +5347,12 @@ async function startSignIn() {
4919
5347
  // the code and is waiting for the user to type it back. Asking the service
4920
5348
  // for the real state keeps this honest instead of assuming a browser.
4921
5349
  const state = typeof result?.flow?.state === "string" ? result.flow.state : "waiting-login";
4922
- context.flow = { state, accountKey: null, instructions: result?.instructions || "" };
5350
+ context.flow = {
5351
+ state,
5352
+ accountKey: null,
5353
+ instructions: result?.instructions || "",
5354
+ egressWarning: typeof result?.flow?.egressWarning === "string" ? result.flow.egressWarning : "",
5355
+ };
4923
5356
  setSignInNotice(state === "waiting-code" ? text.signInCodePrompt : text.signInOpened);
4924
5357
  renderSignIn();
4925
5358
  startSignInPolling();
@@ -5231,14 +5664,25 @@ function renderProviders(items) {
5231
5664
  const moreList = byId("providers-more-list");
5232
5665
  const empty = byId("providers-empty");
5233
5666
  byId("provider-count").textContent = String(providerCatalog.length);
5234
- const { primary, other } = partitionProviders(providerCatalog, accountCounts());
5667
+ const counts = countAccountsByProvider(accountIdentities);
5668
+ renderedProviderCounts = counts;
5669
+ const { primary, other } = partitionProviders(providerCatalog, counts);
5235
5670
  // The query narrows both grids, the collapsed one included: a provider the
5236
5671
  // user cannot find is the same to them as a provider that is not there.
5237
5672
  const searching = providerQuery.trim().length > 0;
5238
- const shownPrimary = filterProviders(primary, providerQuery, langKey);
5239
- const shownOther = filterProviders(other, providerQuery, langKey);
5673
+ const categoryActive = providerCategory !== "all";
5674
+ const shownPrimary = filterProvidersByCategory(
5675
+ filterProviders(primary, providerQuery, langKey),
5676
+ providerCategory,
5677
+ counts,
5678
+ );
5679
+ const shownOther = filterProvidersByCategory(
5680
+ filterProviders(other, providerQuery, langKey),
5681
+ providerCategory,
5682
+ counts,
5683
+ );
5240
5684
  const shown = shownPrimary.length + shownOther.length;
5241
- byId("providers-search-status").textContent = searching
5685
+ byId("providers-search-status").textContent = (searching || categoryActive)
5242
5686
  ? text.providersSearchCount
5243
5687
  .replace("{shown}", String(shown))
5244
5688
  .replace("{total}", String(providerCatalog.length))
@@ -5248,6 +5692,10 @@ function renderProviders(items) {
5248
5692
  const noMatch = searching && providerCatalog.length > 0;
5249
5693
  byId("providers-empty-title").textContent = noMatch ? text.providersNoMatchTitle : text.providersEmptyTitle;
5250
5694
  byId("providers-empty-copy").textContent = noMatch ? text.providersNoMatchCopy : text.providersEmptyCopy;
5695
+ if (!noMatch && categoryActive && providerCatalog.length > 0) {
5696
+ byId("providers-empty-title").textContent = text.providersNoMatchTitle;
5697
+ byId("providers-empty-copy").textContent = text.providersNoMatchCopy;
5698
+ }
5251
5699
  empty.hidden = shown > 0;
5252
5700
  list.hidden = shownPrimary.length === 0;
5253
5701
  list.textContent = "";
@@ -5268,6 +5716,29 @@ function revealProviderMatches() {
5268
5716
  if (byId("providers-more-list").children.length > 0) more.open = true;
5269
5717
  }
5270
5718
 
5719
+ async function refreshProviders() {
5720
+ if (providersRefreshing) return;
5721
+ providersRefreshing = true;
5722
+ byId("providers-refresh").disabled = true;
5723
+ try {
5724
+ const merged = await api("api/provider-sources", {
5725
+ method: "POST",
5726
+ body: { magpie: magpiePayloadFromHash(), refresh: true },
5727
+ });
5728
+ if (merged?.providerSources) {
5729
+ applyProviderSources(merged.providerSources);
5730
+ startPluginScanPolling();
5731
+ }
5732
+ await Promise.all([loadProxyTargets(), loadAccountIdentities()]);
5733
+ toast(text.providersRefreshed);
5734
+ } catch (error) {
5735
+ toast(apiErrorText(error));
5736
+ } finally {
5737
+ providersRefreshing = false;
5738
+ byId("providers-refresh").disabled = false;
5739
+ }
5740
+ }
5741
+
5271
5742
  function render(data) {
5272
5743
  const view = data?.providerSources;
5273
5744
  providerSourcesView = view || null;
@@ -5670,6 +6141,9 @@ function cleanupProxyDialog() {
5670
6141
  context.testGuard.cancel();
5671
6142
  context.testAbort?.abort();
5672
6143
  }
6144
+ byId("proxy-clear-password").checked = false;
6145
+ byId("proxy-clear-password-field").hidden = true;
6146
+ byId("proxy-password").disabled = false;
5673
6147
  setFormError("");
5674
6148
  clearTestResult();
5675
6149
  setDialogBusy(false);
@@ -5697,6 +6171,9 @@ function openProxyDialog(proxy = null) {
5697
6171
  byId("proxy-port").value = proxy?.port != null ? String(proxy.port) : "";
5698
6172
  byId("proxy-username").value = proxy?.username || "";
5699
6173
  byId("proxy-password").value = "";
6174
+ byId("proxy-password").disabled = false;
6175
+ byId("proxy-clear-password").checked = false;
6176
+ byId("proxy-clear-password-field").hidden = !proxy?.hasPassword;
5700
6177
  const hint = byId("proxy-password-hint");
5701
6178
  if (proxy?.hasPassword) {
5702
6179
  hint.textContent = text.passwordKeepHint;
@@ -5803,6 +6280,9 @@ async function saveProxy() {
5803
6280
  setDialogBusy(true);
5804
6281
  try {
5805
6282
  const payload = payloadFor(values);
6283
+ if (context.mode === "edit" && !values.password && byId("proxy-clear-password").checked) {
6284
+ payload.clearPassword = true;
6285
+ }
5806
6286
  const data = context.mode === "edit"
5807
6287
  ? await api(`api/proxies/${encodeURIComponent(context.id)}`, { method: "PATCH", body: payload })
5808
6288
  : await api("api/proxies", { method: "POST", body: payload });
@@ -5830,6 +6310,107 @@ async function saveProxy() {
5830
6310
  }
5831
6311
  }
5832
6312
 
6313
+ function setProxyBulkError(message) {
6314
+ const node = byId("proxy-bulk-error");
6315
+ node.textContent = message || "";
6316
+ node.hidden = !message;
6317
+ }
6318
+
6319
+ function parseProxyBulkInput() {
6320
+ const raw = byId("proxy-bulk-input").value;
6321
+ const defaultType = byId("proxy-bulk-type").value || "http";
6322
+ const prefix = byId("proxy-bulk-prefix").value || "";
6323
+ const parsed = parseBulkProxies(raw, {
6324
+ defaultType,
6325
+ prefix,
6326
+ existingNames: proxies.map((item) => item.name),
6327
+ existingKeys: proxies.map(proxyConnectionKey).filter(Boolean),
6328
+ limit: PROXY_BULK_LIMIT,
6329
+ });
6330
+ return { raw, defaultType, prefix, parsed };
6331
+ }
6332
+
6333
+ function updateProxyBulkSummary() {
6334
+ const summary = byId("proxy-bulk-summary");
6335
+ const { raw, parsed } = parseProxyBulkInput();
6336
+ if (!raw.trim()) {
6337
+ summary.textContent = "";
6338
+ return;
6339
+ }
6340
+ const template = parsed.truncated > 0
6341
+ ? text.proxyBulkSummaryTruncated
6342
+ : text.proxyBulkSummary;
6343
+ summary.textContent = template
6344
+ .replace("{ready}", String(parsed.items.length))
6345
+ .replace("{duplicates}", String(parsed.duplicates.length))
6346
+ .replace("{invalid}", String(parsed.invalid.length))
6347
+ .replace("{limit}", String(PROXY_BULK_LIMIT))
6348
+ .replace("{truncated}", String(parsed.truncated));
6349
+ }
6350
+
6351
+ function openProxyBulkDialog() {
6352
+ const dialog = byId("proxy-bulk-dialog");
6353
+ if (dialog.open || proxyBulkBusy) return;
6354
+ byId("proxy-bulk-type").value = "http";
6355
+ byId("proxy-bulk-prefix").value = "";
6356
+ byId("proxy-bulk-input").value = "";
6357
+ byId("proxy-bulk-summary").textContent = "";
6358
+ byId("proxy-bulk-submit").disabled = false;
6359
+ byId("proxy-bulk-cancel").disabled = false;
6360
+ byId("proxy-bulk-submit").textContent = text.proxyBulkSubmit;
6361
+ setProxyBulkError("");
6362
+ dialog.showModal();
6363
+ byId("proxy-bulk-input").focus();
6364
+ }
6365
+
6366
+ function closeProxyBulkDialog() {
6367
+ if (proxyBulkBusy) return;
6368
+ const dialog = byId("proxy-bulk-dialog");
6369
+ if (dialog.open) dialog.close();
6370
+ setProxyBulkError("");
6371
+ }
6372
+
6373
+ async function submitProxyBulk() {
6374
+ if (proxyBulkBusy) return;
6375
+ const { raw, defaultType, prefix, parsed } = parseProxyBulkInput();
6376
+ if (parsed.items.length === 0) {
6377
+ setProxyBulkError(text.proxyBulkEmpty);
6378
+ byId("proxy-bulk-input").focus();
6379
+ return;
6380
+ }
6381
+ proxyBulkBusy = true;
6382
+ byId("proxy-bulk-submit").disabled = true;
6383
+ byId("proxy-bulk-cancel").disabled = true;
6384
+ byId("proxy-bulk-submit").textContent = text.proxyBulkSubmitting;
6385
+ setProxyBulkError("");
6386
+ try {
6387
+ const data = await api("api/proxies/bulk", {
6388
+ method: "POST",
6389
+ body: { text: raw, defaultType, prefix },
6390
+ });
6391
+ const created = Array.isArray(data?.created) ? data.created : [];
6392
+ const skipped = Array.isArray(data?.skipped) ? data.skipped : [];
6393
+ const errors = Array.isArray(data?.errors) ? data.errors : [];
6394
+ for (const item of created) replaceProxy(item);
6395
+ proxyBulkBusy = false;
6396
+ closeProxyBulkDialog();
6397
+ renderProxies();
6398
+ toast(
6399
+ text.proxyBulkDone
6400
+ .replace("{created}", String(created.length))
6401
+ .replace("{skipped}", String(skipped.length))
6402
+ .replace("{errors}", String(errors.length)),
6403
+ );
6404
+ } catch (error) {
6405
+ setProxyBulkError(apiErrorText(error));
6406
+ } finally {
6407
+ proxyBulkBusy = false;
6408
+ byId("proxy-bulk-submit").disabled = false;
6409
+ byId("proxy-bulk-cancel").disabled = false;
6410
+ byId("proxy-bulk-submit").textContent = text.proxyBulkSubmit;
6411
+ }
6412
+ }
6413
+
5833
6414
  function askDelete(proxy) {
5834
6415
  const dialog = byId("confirm-dialog");
5835
6416
  if (dialog.open) return;
@@ -5976,6 +6557,16 @@ function accountRow(account) {
5976
6557
  const small = document.createElement("small");
5977
6558
  small.textContent = `${view.providerLabel} · ${view.key}`;
5978
6559
  name.append(line, small);
6560
+ const metaParts = [
6561
+ view.methodLabel,
6562
+ view.email && view.email !== view.name ? view.email : "",
6563
+ ].filter(Boolean);
6564
+ if (metaParts.length) {
6565
+ const metaLine = document.createElement("small");
6566
+ metaLine.className = "account-meta-line";
6567
+ metaLine.textContent = metaParts.join(" · ");
6568
+ name.append(metaLine);
6569
+ }
5979
6570
 
5980
6571
  const fingerprint = accountCell(
5981
6572
  "proxy-address account-fingerprint account-cell-fingerprint",
@@ -6032,6 +6623,17 @@ function accountRow(account) {
6032
6623
  paused: text.accountHostingPaused,
6033
6624
  });
6034
6625
  statusCell.append(hostingLine);
6626
+ const expiry = formatExpiryBadge(view.expiresAt, Date.now(), {
6627
+ expired: text.accountExpiryExpired,
6628
+ soon: text.accountExpirySoon,
6629
+ ok: text.accountExpiryDays,
6630
+ });
6631
+ if (expiry.state !== "none") {
6632
+ const expiryNode = document.createElement("small");
6633
+ expiryNode.className = `account-expiry-badge${expiry.state === "expired" ? " is-expired" : expiry.state === "soon" ? " is-soon" : ""}`;
6634
+ expiryNode.textContent = expiry.label;
6635
+ statusCell.append(expiryNode);
6636
+ }
6035
6637
 
6036
6638
  const actions = accountCell("proxy-actions account-cell-actions", text.accountColActions);
6037
6639
  const busy = Boolean(accountCheckContext?.active);
@@ -6235,6 +6837,8 @@ function renderAccountFilterSummary() {
6235
6837
  statusLabels: {
6236
6838
  signedIn: text.accountFilterSignedIn,
6237
6839
  signedOut: text.accountFilterSignedOut,
6840
+ hostingPaused: text.accountFilterHostingPaused,
6841
+ expiringSoon: text.accountFilterExpiringSoon,
6238
6842
  },
6239
6843
  });
6240
6844
  const summary = byId("account-active-filters");
@@ -6268,16 +6872,26 @@ function renderAccounts() {
6268
6872
  const empty = byId("accounts-empty");
6269
6873
  const notice = byId("accounts-notice");
6270
6874
  renderHostingAlert();
6875
+ const nowMs = Date.now();
6271
6876
  const total = accountIdentities.length;
6272
6877
  const signedIn = accountIdentities.filter((item) => item?.signedIn === true).length;
6878
+ const hostingPaused = accountIdentities.filter((item) => isHostingPaused(item)).length;
6879
+ const expiringSoon = accountIdentities.filter((item) => {
6880
+ const state = formatExpiryBadge(accountView(item).expiresAt, nowMs).state;
6881
+ return state === "soon" || state === "expired";
6882
+ }).length;
6273
6883
  byId("account-count").textContent = String(total);
6274
6884
  byId("account-filter-all-count").textContent = String(total);
6275
6885
  byId("account-filter-signed-in-count").textContent = String(signedIn);
6276
6886
  byId("account-filter-signed-out-count").textContent = String(total - signedIn);
6887
+ byId("account-filter-hosting-paused-count").textContent = String(hostingPaused);
6888
+ byId("account-filter-expiring-soon-count").textContent = String(expiringSoon);
6277
6889
  for (const [id, value] of [
6278
6890
  ["account-filter-all", "all"],
6279
6891
  ["account-filter-signed-in", "signedIn"],
6280
6892
  ["account-filter-signed-out", "signedOut"],
6893
+ ["account-filter-hosting-paused", "hostingPaused"],
6894
+ ["account-filter-expiring-soon", "expiringSoon"],
6281
6895
  ]) {
6282
6896
  const chip = byId(id);
6283
6897
  const active = accountFilter === value;
@@ -6296,6 +6910,7 @@ function renderAccounts() {
6296
6910
  query: accountQuery,
6297
6911
  filter: accountFilter,
6298
6912
  provider: accountProvider,
6913
+ nowMs,
6299
6914
  }),
6300
6915
  accountSort,
6301
6916
  );
@@ -6470,14 +7085,20 @@ function setDetailStatus(message) {
6470
7085
  function renderDetailFacts(view) {
6471
7086
  const facts = byId("account-detail-facts");
6472
7087
  facts.textContent = "";
6473
- for (const [label, value] of [
7088
+ const entries = [
6474
7089
  [text.accountDetailProvider, view.providerLabel],
6475
7090
  [text.accountDetailKey, view.key],
7091
+ ];
7092
+ if (view.email) entries.push([text.accountDetailEmail, view.email]);
7093
+ if (view.methodLabel) entries.push([text.accountDetailMethod, view.methodLabel]);
7094
+ entries.push(
6476
7095
  [text.accountDetailFingerprint, view.fingerprint.id || text.accountFingerprintNone],
6477
7096
  [text.accountDetailPinnedAt, formatTime(view.fingerprint.pinnedAt)],
6478
7097
  [text.accountDetailLastLoginExit, formatExit(view.lastLogin, text.accountExitDirect)],
6479
7098
  [text.accountDetailStatus, view.signedIn ? text.accountSignedIn : text.accountSignedOut],
6480
- ]) {
7099
+ );
7100
+ if (view.expiresAt) entries.push([text.accountDetailExpiresAt, formatTime(view.expiresAt)]);
7101
+ for (const [label, value] of entries) {
6481
7102
  const wrap = document.createElement("div");
6482
7103
  const dt = document.createElement("dt");
6483
7104
  dt.textContent = label;
@@ -7477,9 +8098,33 @@ for (const event of ["input", "search"]) {
7477
8098
  revealProviderMatches();
7478
8099
  });
7479
8100
  }
8101
+ byId("providers-category").addEventListener("change", () => {
8102
+ providerCategory = byId("providers-category").value || "all";
8103
+ renderProviders(providerCatalog);
8104
+ revealProviderMatches();
8105
+ });
8106
+ byId("providers-refresh").addEventListener("click", refreshProviders);
7480
8107
  byId("retry").addEventListener("click", () => location.reload());
7481
8108
  byId("add-proxy").addEventListener("click", () => openProxyDialog());
7482
8109
  byId("add-proxy-empty").addEventListener("click", () => openProxyDialog());
8110
+ byId("proxies-test-all").addEventListener("click", testAllVisibleProxies);
8111
+ byId("proxies-test-cancel").addEventListener("click", cancelBulkTests);
8112
+ byId("proxies-bulk-open").addEventListener("click", openProxyBulkDialog);
8113
+ byId("proxy-bulk-close").addEventListener("click", closeProxyBulkDialog);
8114
+ byId("proxy-bulk-cancel").addEventListener("click", closeProxyBulkDialog);
8115
+ byId("proxy-bulk-submit").addEventListener("click", submitProxyBulk);
8116
+ byId("proxy-bulk-input").addEventListener("input", () => {
8117
+ setProxyBulkError("");
8118
+ updateProxyBulkSummary();
8119
+ });
8120
+ byId("proxy-bulk-type").addEventListener("change", updateProxyBulkSummary);
8121
+ byId("proxy-bulk-prefix").addEventListener("input", updateProxyBulkSummary);
8122
+ byId("proxy-bulk-dialog").addEventListener("close", () => {
8123
+ setProxyBulkError("");
8124
+ });
8125
+ byId("proxy-bulk-dialog").addEventListener("cancel", (event) => {
8126
+ if (proxyBulkBusy) event.preventDefault();
8127
+ });
7483
8128
  // Save is wired to a plain click, not to form submission. magpie hosts page
7484
8129
  // plugins in <iframe sandbox="allow-scripts"> with no allow-forms, so the
7485
8130
  // browser blocks form submission before a submit event can fire and a
@@ -7519,6 +8164,25 @@ byId("proxy-form").addEventListener("input", () => {
7519
8164
  // field reads as if the new value were already wrong.
7520
8165
  setFormError("");
7521
8166
  });
8167
+ byId("proxy-clear-password").addEventListener("change", () => {
8168
+ const clear = byId("proxy-clear-password").checked;
8169
+ byId("proxy-password").disabled = clear;
8170
+ if (clear) byId("proxy-password").value = "";
8171
+ if (dialogContext) {
8172
+ dialogContext.lastTest = null;
8173
+ if (dialogContext.testing) {
8174
+ cancelDialogTest();
8175
+ setDialogBusy(false);
8176
+ }
8177
+ }
8178
+ clearTestResult();
8179
+ });
8180
+ byId("proxy-password").addEventListener("input", () => {
8181
+ if (byId("proxy-password").value) {
8182
+ byId("proxy-clear-password").checked = false;
8183
+ byId("proxy-password").disabled = false;
8184
+ }
8185
+ });
7522
8186
  byId("confirm-cancel").addEventListener("click", () => {
7523
8187
  confirmController.cancel();
7524
8188
  closeConfirmDialog();
@@ -7533,6 +8197,9 @@ byId("confirm-dialog").addEventListener("cancel", (event) => {
7533
8197
  if (deleting) event.preventDefault();
7534
8198
  });
7535
8199
  window.addEventListener("pagehide", () => {
8200
+ bulkTestController?.abort();
8201
+ bulkTestController = null;
8202
+ bulkTestActive = false;
7536
8203
  for (const id of [...rowTests.keys()]) cancelRowTest(id);
7537
8204
  cancelDialogTest();
7538
8205
  cancelSignInProxyTests();
@@ -7555,6 +8222,24 @@ byId("proxy-test-target").addEventListener("change", () => {
7555
8222
  renderTargetNote();
7556
8223
  renderProxies();
7557
8224
  });
8225
+ for (const event of ["input", "search"]) {
8226
+ byId("filter-search").addEventListener(event, (nativeEvent) => {
8227
+ proxyFilter.search = nativeEvent.target.value;
8228
+ renderProxies();
8229
+ });
8230
+ }
8231
+ byId("filter-status").addEventListener("change", () => {
8232
+ proxyFilter.status = byId("filter-status").value || "all";
8233
+ renderProxies();
8234
+ });
8235
+ byId("filter-usage").addEventListener("change", () => {
8236
+ proxyFilter.usage = byId("filter-usage").value || "all";
8237
+ renderProxies();
8238
+ });
8239
+ byId("proxy-sort").addEventListener("change", () => {
8240
+ proxySort = byId("proxy-sort").value || "default";
8241
+ renderProxies();
8242
+ });
7558
8243
  byId("filter-latency-min").addEventListener("input", () => {
7559
8244
  proxyFilter.minLatency = byId("filter-latency-min").value;
7560
8245
  renderProxies();
@@ -7612,6 +8297,8 @@ byId("account-sort").addEventListener("change", () => {
7612
8297
  byId("account-filter-all").addEventListener("click", () => setAccountFilter("all"));
7613
8298
  byId("account-filter-signed-in").addEventListener("click", () => setAccountFilter("signedIn"));
7614
8299
  byId("account-filter-signed-out").addEventListener("click", () => setAccountFilter("signedOut"));
8300
+ byId("account-filter-hosting-paused").addEventListener("click", () => setAccountFilter("hostingPaused"));
8301
+ byId("account-filter-expiring-soon").addEventListener("click", () => setAccountFilter("expiringSoon"));
7615
8302
  byId("account-provider-more-toggle").addEventListener("click", () => {
7616
8303
  setAccountProviderPanel(!accountProviderPanelOpen);
7617
8304
  });