@gruu6y/page-clean-login 0.2.6 → 0.2.8

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";
@@ -3605,6 +4016,15 @@ function providerCard(provider) {
3605
4016
  const notice = document.createElement("p");
3606
4017
  notice.className = "provider-notice";
3607
4018
  notice.textContent = localizedText(provider.notice, langKey);
4019
+ const noticeTone =
4020
+ provider.noticeTone === "danger" || provider.noticeTone === "warn"
4021
+ ? provider.noticeTone
4022
+ : "";
4023
+ if (noticeTone && notice.textContent) {
4024
+ notice.dataset.tone = noticeTone;
4025
+ notice.setAttribute("role", noticeTone === "danger" ? "alert" : "note");
4026
+ card.dataset.noticeTone = noticeTone;
4027
+ }
3608
4028
 
3609
4029
  // A card appends only the lines it actually carries. Some presences
3610
4030
  // deliberately have no description or no reason — a `magpie-only` card, for
@@ -3711,6 +4131,19 @@ function providerCard(provider) {
3711
4131
  });
3712
4132
  actions.append(install);
3713
4133
  }
4134
+ if (acctCount > 0) {
4135
+ const viewAccounts = document.createElement("button");
4136
+ viewAccounts.type = "button";
4137
+ viewAccounts.className = "button provider-view-accounts";
4138
+ viewAccounts.dataset.providerId = countKey;
4139
+ viewAccounts.textContent = text.providerViewAccounts.replace("{count}", String(acctCount));
4140
+ viewAccounts.addEventListener("click", () => {
4141
+ selectTab("accounts");
4142
+ setAccountProvider(countKey);
4143
+ loadAccountIdentities();
4144
+ });
4145
+ actions.append(viewAccounts);
4146
+ }
3714
4147
  // Reporting is offered on every card, including the ones that offer no way in
3715
4148
  // at all: a card with nothing to click is exactly the one worth reporting.
3716
4149
  const report = document.createElement("button");
@@ -4074,6 +4507,7 @@ async function loadAccountIdentities() {
4074
4507
  // identities arrive. The split does not depend on them: no card moves
4075
4508
  // between the main list and the collapsed catalog.
4076
4509
  renderProviders(providerCatalog);
4510
+ renderProxies();
4077
4511
  }
4078
4512
  }
4079
4513
 
@@ -4448,6 +4882,9 @@ function renderSignIn() {
4448
4882
  for (const input of inputs.querySelectorAll("[data-input-key]")) {
4449
4883
  input.disabled = active || context.busy;
4450
4884
  }
4885
+ if (flow?.egressWarning) {
4886
+ setSignInNotice(text.signInEgressWarning.replace("{detail}", String(flow.egressWarning)));
4887
+ }
4451
4888
  }
4452
4889
 
4453
4890
  function renderSignInProxies() {
@@ -4784,6 +5221,7 @@ function openSignInDialog(provider, options = {}) {
4784
5221
  busy: false,
4785
5222
  };
4786
5223
  byId("signin-provider").textContent = signInContext.name;
5224
+ renderSignInProviderNotice(provider);
4787
5225
  renderSignInMethods(provider);
4788
5226
  renderSignInInputs(provider);
4789
5227
  renderSignInAccounts(provider);
@@ -4806,6 +5244,35 @@ function openSignInDialog(provider, options = {}) {
4806
5244
  });
4807
5245
  }
4808
5246
 
5247
+ // Mirrors a card's specialized risk notice inside the sign-in dialog so users
5248
+ // opening sign-in directly (including from the Accounts tab) still see it while
5249
+ // keeping the sign-in entry open.
5250
+ function renderSignInProviderNotice(provider) {
5251
+ const node = byId("signin-provider-notice");
5252
+ if (!node) return;
5253
+ const message = localizedText(provider?.notice, langKey);
5254
+ const tone =
5255
+ provider?.noticeTone === "danger" || provider?.noticeTone === "warn"
5256
+ ? provider.noticeTone
5257
+ : "";
5258
+ if (!message) {
5259
+ node.textContent = "";
5260
+ delete node.dataset.tone;
5261
+ node.removeAttribute("role");
5262
+ node.hidden = true;
5263
+ return;
5264
+ }
5265
+ node.textContent = message;
5266
+ if (tone) {
5267
+ node.dataset.tone = tone;
5268
+ node.setAttribute("role", tone === "danger" ? "alert" : "note");
5269
+ } else {
5270
+ delete node.dataset.tone;
5271
+ node.setAttribute("role", "note");
5272
+ }
5273
+ node.hidden = false;
5274
+ }
5275
+
4809
5276
  // The account row's "sign in again" action preselects the kept identity, so
4810
5277
  // the next sign-in reuses that fingerprint instead of drawing a new one.
4811
5278
  function renderSignInPreselection() {
@@ -4919,7 +5386,12 @@ async function startSignIn() {
4919
5386
  // the code and is waiting for the user to type it back. Asking the service
4920
5387
  // for the real state keeps this honest instead of assuming a browser.
4921
5388
  const state = typeof result?.flow?.state === "string" ? result.flow.state : "waiting-login";
4922
- context.flow = { state, accountKey: null, instructions: result?.instructions || "" };
5389
+ context.flow = {
5390
+ state,
5391
+ accountKey: null,
5392
+ instructions: result?.instructions || "",
5393
+ egressWarning: typeof result?.flow?.egressWarning === "string" ? result.flow.egressWarning : "",
5394
+ };
4923
5395
  setSignInNotice(state === "waiting-code" ? text.signInCodePrompt : text.signInOpened);
4924
5396
  renderSignIn();
4925
5397
  startSignInPolling();
@@ -5020,6 +5492,7 @@ function cleanupSignInDialog() {
5020
5492
  stopSignInPolling();
5021
5493
  cancelSignInProxyTests();
5022
5494
  signInContext = null;
5495
+ renderSignInProviderNotice(null);
5023
5496
  setSignInNotice("");
5024
5497
  setSignInError("");
5025
5498
  byId("signin-inputs").textContent = "";
@@ -5231,14 +5704,25 @@ function renderProviders(items) {
5231
5704
  const moreList = byId("providers-more-list");
5232
5705
  const empty = byId("providers-empty");
5233
5706
  byId("provider-count").textContent = String(providerCatalog.length);
5234
- const { primary, other } = partitionProviders(providerCatalog, accountCounts());
5707
+ const counts = countAccountsByProvider(accountIdentities);
5708
+ renderedProviderCounts = counts;
5709
+ const { primary, other } = partitionProviders(providerCatalog, counts);
5235
5710
  // The query narrows both grids, the collapsed one included: a provider the
5236
5711
  // user cannot find is the same to them as a provider that is not there.
5237
5712
  const searching = providerQuery.trim().length > 0;
5238
- const shownPrimary = filterProviders(primary, providerQuery, langKey);
5239
- const shownOther = filterProviders(other, providerQuery, langKey);
5713
+ const categoryActive = providerCategory !== "all";
5714
+ const shownPrimary = filterProvidersByCategory(
5715
+ filterProviders(primary, providerQuery, langKey),
5716
+ providerCategory,
5717
+ counts,
5718
+ );
5719
+ const shownOther = filterProvidersByCategory(
5720
+ filterProviders(other, providerQuery, langKey),
5721
+ providerCategory,
5722
+ counts,
5723
+ );
5240
5724
  const shown = shownPrimary.length + shownOther.length;
5241
- byId("providers-search-status").textContent = searching
5725
+ byId("providers-search-status").textContent = (searching || categoryActive)
5242
5726
  ? text.providersSearchCount
5243
5727
  .replace("{shown}", String(shown))
5244
5728
  .replace("{total}", String(providerCatalog.length))
@@ -5248,6 +5732,10 @@ function renderProviders(items) {
5248
5732
  const noMatch = searching && providerCatalog.length > 0;
5249
5733
  byId("providers-empty-title").textContent = noMatch ? text.providersNoMatchTitle : text.providersEmptyTitle;
5250
5734
  byId("providers-empty-copy").textContent = noMatch ? text.providersNoMatchCopy : text.providersEmptyCopy;
5735
+ if (!noMatch && categoryActive && providerCatalog.length > 0) {
5736
+ byId("providers-empty-title").textContent = text.providersNoMatchTitle;
5737
+ byId("providers-empty-copy").textContent = text.providersNoMatchCopy;
5738
+ }
5251
5739
  empty.hidden = shown > 0;
5252
5740
  list.hidden = shownPrimary.length === 0;
5253
5741
  list.textContent = "";
@@ -5268,6 +5756,29 @@ function revealProviderMatches() {
5268
5756
  if (byId("providers-more-list").children.length > 0) more.open = true;
5269
5757
  }
5270
5758
 
5759
+ async function refreshProviders() {
5760
+ if (providersRefreshing) return;
5761
+ providersRefreshing = true;
5762
+ byId("providers-refresh").disabled = true;
5763
+ try {
5764
+ const merged = await api("api/provider-sources", {
5765
+ method: "POST",
5766
+ body: { magpie: magpiePayloadFromHash(), refresh: true },
5767
+ });
5768
+ if (merged?.providerSources) {
5769
+ applyProviderSources(merged.providerSources);
5770
+ startPluginScanPolling();
5771
+ }
5772
+ await Promise.all([loadProxyTargets(), loadAccountIdentities()]);
5773
+ toast(text.providersRefreshed);
5774
+ } catch (error) {
5775
+ toast(apiErrorText(error));
5776
+ } finally {
5777
+ providersRefreshing = false;
5778
+ byId("providers-refresh").disabled = false;
5779
+ }
5780
+ }
5781
+
5271
5782
  function render(data) {
5272
5783
  const view = data?.providerSources;
5273
5784
  providerSourcesView = view || null;
@@ -5670,6 +6181,9 @@ function cleanupProxyDialog() {
5670
6181
  context.testGuard.cancel();
5671
6182
  context.testAbort?.abort();
5672
6183
  }
6184
+ byId("proxy-clear-password").checked = false;
6185
+ byId("proxy-clear-password-field").hidden = true;
6186
+ byId("proxy-password").disabled = false;
5673
6187
  setFormError("");
5674
6188
  clearTestResult();
5675
6189
  setDialogBusy(false);
@@ -5697,6 +6211,9 @@ function openProxyDialog(proxy = null) {
5697
6211
  byId("proxy-port").value = proxy?.port != null ? String(proxy.port) : "";
5698
6212
  byId("proxy-username").value = proxy?.username || "";
5699
6213
  byId("proxy-password").value = "";
6214
+ byId("proxy-password").disabled = false;
6215
+ byId("proxy-clear-password").checked = false;
6216
+ byId("proxy-clear-password-field").hidden = !proxy?.hasPassword;
5700
6217
  const hint = byId("proxy-password-hint");
5701
6218
  if (proxy?.hasPassword) {
5702
6219
  hint.textContent = text.passwordKeepHint;
@@ -5803,6 +6320,9 @@ async function saveProxy() {
5803
6320
  setDialogBusy(true);
5804
6321
  try {
5805
6322
  const payload = payloadFor(values);
6323
+ if (context.mode === "edit" && !values.password && byId("proxy-clear-password").checked) {
6324
+ payload.clearPassword = true;
6325
+ }
5806
6326
  const data = context.mode === "edit"
5807
6327
  ? await api(`api/proxies/${encodeURIComponent(context.id)}`, { method: "PATCH", body: payload })
5808
6328
  : await api("api/proxies", { method: "POST", body: payload });
@@ -5830,6 +6350,107 @@ async function saveProxy() {
5830
6350
  }
5831
6351
  }
5832
6352
 
6353
+ function setProxyBulkError(message) {
6354
+ const node = byId("proxy-bulk-error");
6355
+ node.textContent = message || "";
6356
+ node.hidden = !message;
6357
+ }
6358
+
6359
+ function parseProxyBulkInput() {
6360
+ const raw = byId("proxy-bulk-input").value;
6361
+ const defaultType = byId("proxy-bulk-type").value || "http";
6362
+ const prefix = byId("proxy-bulk-prefix").value || "";
6363
+ const parsed = parseBulkProxies(raw, {
6364
+ defaultType,
6365
+ prefix,
6366
+ existingNames: proxies.map((item) => item.name),
6367
+ existingKeys: proxies.map(proxyConnectionKey).filter(Boolean),
6368
+ limit: PROXY_BULK_LIMIT,
6369
+ });
6370
+ return { raw, defaultType, prefix, parsed };
6371
+ }
6372
+
6373
+ function updateProxyBulkSummary() {
6374
+ const summary = byId("proxy-bulk-summary");
6375
+ const { raw, parsed } = parseProxyBulkInput();
6376
+ if (!raw.trim()) {
6377
+ summary.textContent = "";
6378
+ return;
6379
+ }
6380
+ const template = parsed.truncated > 0
6381
+ ? text.proxyBulkSummaryTruncated
6382
+ : text.proxyBulkSummary;
6383
+ summary.textContent = template
6384
+ .replace("{ready}", String(parsed.items.length))
6385
+ .replace("{duplicates}", String(parsed.duplicates.length))
6386
+ .replace("{invalid}", String(parsed.invalid.length))
6387
+ .replace("{limit}", String(PROXY_BULK_LIMIT))
6388
+ .replace("{truncated}", String(parsed.truncated));
6389
+ }
6390
+
6391
+ function openProxyBulkDialog() {
6392
+ const dialog = byId("proxy-bulk-dialog");
6393
+ if (dialog.open || proxyBulkBusy) return;
6394
+ byId("proxy-bulk-type").value = "http";
6395
+ byId("proxy-bulk-prefix").value = "";
6396
+ byId("proxy-bulk-input").value = "";
6397
+ byId("proxy-bulk-summary").textContent = "";
6398
+ byId("proxy-bulk-submit").disabled = false;
6399
+ byId("proxy-bulk-cancel").disabled = false;
6400
+ byId("proxy-bulk-submit").textContent = text.proxyBulkSubmit;
6401
+ setProxyBulkError("");
6402
+ dialog.showModal();
6403
+ byId("proxy-bulk-input").focus();
6404
+ }
6405
+
6406
+ function closeProxyBulkDialog() {
6407
+ if (proxyBulkBusy) return;
6408
+ const dialog = byId("proxy-bulk-dialog");
6409
+ if (dialog.open) dialog.close();
6410
+ setProxyBulkError("");
6411
+ }
6412
+
6413
+ async function submitProxyBulk() {
6414
+ if (proxyBulkBusy) return;
6415
+ const { raw, defaultType, prefix, parsed } = parseProxyBulkInput();
6416
+ if (parsed.items.length === 0) {
6417
+ setProxyBulkError(text.proxyBulkEmpty);
6418
+ byId("proxy-bulk-input").focus();
6419
+ return;
6420
+ }
6421
+ proxyBulkBusy = true;
6422
+ byId("proxy-bulk-submit").disabled = true;
6423
+ byId("proxy-bulk-cancel").disabled = true;
6424
+ byId("proxy-bulk-submit").textContent = text.proxyBulkSubmitting;
6425
+ setProxyBulkError("");
6426
+ try {
6427
+ const data = await api("api/proxies/bulk", {
6428
+ method: "POST",
6429
+ body: { text: raw, defaultType, prefix },
6430
+ });
6431
+ const created = Array.isArray(data?.created) ? data.created : [];
6432
+ const skipped = Array.isArray(data?.skipped) ? data.skipped : [];
6433
+ const errors = Array.isArray(data?.errors) ? data.errors : [];
6434
+ for (const item of created) replaceProxy(item);
6435
+ proxyBulkBusy = false;
6436
+ closeProxyBulkDialog();
6437
+ renderProxies();
6438
+ toast(
6439
+ text.proxyBulkDone
6440
+ .replace("{created}", String(created.length))
6441
+ .replace("{skipped}", String(skipped.length))
6442
+ .replace("{errors}", String(errors.length)),
6443
+ );
6444
+ } catch (error) {
6445
+ setProxyBulkError(apiErrorText(error));
6446
+ } finally {
6447
+ proxyBulkBusy = false;
6448
+ byId("proxy-bulk-submit").disabled = false;
6449
+ byId("proxy-bulk-cancel").disabled = false;
6450
+ byId("proxy-bulk-submit").textContent = text.proxyBulkSubmit;
6451
+ }
6452
+ }
6453
+
5833
6454
  function askDelete(proxy) {
5834
6455
  const dialog = byId("confirm-dialog");
5835
6456
  if (dialog.open) return;
@@ -5976,6 +6597,16 @@ function accountRow(account) {
5976
6597
  const small = document.createElement("small");
5977
6598
  small.textContent = `${view.providerLabel} · ${view.key}`;
5978
6599
  name.append(line, small);
6600
+ const metaParts = [
6601
+ view.methodLabel,
6602
+ view.email && view.email !== view.name ? view.email : "",
6603
+ ].filter(Boolean);
6604
+ if (metaParts.length) {
6605
+ const metaLine = document.createElement("small");
6606
+ metaLine.className = "account-meta-line";
6607
+ metaLine.textContent = metaParts.join(" · ");
6608
+ name.append(metaLine);
6609
+ }
5979
6610
 
5980
6611
  const fingerprint = accountCell(
5981
6612
  "proxy-address account-fingerprint account-cell-fingerprint",
@@ -6032,6 +6663,17 @@ function accountRow(account) {
6032
6663
  paused: text.accountHostingPaused,
6033
6664
  });
6034
6665
  statusCell.append(hostingLine);
6666
+ const expiry = formatExpiryBadge(view.expiresAt, Date.now(), {
6667
+ expired: text.accountExpiryExpired,
6668
+ soon: text.accountExpirySoon,
6669
+ ok: text.accountExpiryDays,
6670
+ });
6671
+ if (expiry.state !== "none") {
6672
+ const expiryNode = document.createElement("small");
6673
+ expiryNode.className = `account-expiry-badge${expiry.state === "expired" ? " is-expired" : expiry.state === "soon" ? " is-soon" : ""}`;
6674
+ expiryNode.textContent = expiry.label;
6675
+ statusCell.append(expiryNode);
6676
+ }
6035
6677
 
6036
6678
  const actions = accountCell("proxy-actions account-cell-actions", text.accountColActions);
6037
6679
  const busy = Boolean(accountCheckContext?.active);
@@ -6235,6 +6877,8 @@ function renderAccountFilterSummary() {
6235
6877
  statusLabels: {
6236
6878
  signedIn: text.accountFilterSignedIn,
6237
6879
  signedOut: text.accountFilterSignedOut,
6880
+ hostingPaused: text.accountFilterHostingPaused,
6881
+ expiringSoon: text.accountFilterExpiringSoon,
6238
6882
  },
6239
6883
  });
6240
6884
  const summary = byId("account-active-filters");
@@ -6268,16 +6912,26 @@ function renderAccounts() {
6268
6912
  const empty = byId("accounts-empty");
6269
6913
  const notice = byId("accounts-notice");
6270
6914
  renderHostingAlert();
6915
+ const nowMs = Date.now();
6271
6916
  const total = accountIdentities.length;
6272
6917
  const signedIn = accountIdentities.filter((item) => item?.signedIn === true).length;
6918
+ const hostingPaused = accountIdentities.filter((item) => isHostingPaused(item)).length;
6919
+ const expiringSoon = accountIdentities.filter((item) => {
6920
+ const state = formatExpiryBadge(accountView(item).expiresAt, nowMs).state;
6921
+ return state === "soon" || state === "expired";
6922
+ }).length;
6273
6923
  byId("account-count").textContent = String(total);
6274
6924
  byId("account-filter-all-count").textContent = String(total);
6275
6925
  byId("account-filter-signed-in-count").textContent = String(signedIn);
6276
6926
  byId("account-filter-signed-out-count").textContent = String(total - signedIn);
6927
+ byId("account-filter-hosting-paused-count").textContent = String(hostingPaused);
6928
+ byId("account-filter-expiring-soon-count").textContent = String(expiringSoon);
6277
6929
  for (const [id, value] of [
6278
6930
  ["account-filter-all", "all"],
6279
6931
  ["account-filter-signed-in", "signedIn"],
6280
6932
  ["account-filter-signed-out", "signedOut"],
6933
+ ["account-filter-hosting-paused", "hostingPaused"],
6934
+ ["account-filter-expiring-soon", "expiringSoon"],
6281
6935
  ]) {
6282
6936
  const chip = byId(id);
6283
6937
  const active = accountFilter === value;
@@ -6296,6 +6950,7 @@ function renderAccounts() {
6296
6950
  query: accountQuery,
6297
6951
  filter: accountFilter,
6298
6952
  provider: accountProvider,
6953
+ nowMs,
6299
6954
  }),
6300
6955
  accountSort,
6301
6956
  );
@@ -6470,14 +7125,20 @@ function setDetailStatus(message) {
6470
7125
  function renderDetailFacts(view) {
6471
7126
  const facts = byId("account-detail-facts");
6472
7127
  facts.textContent = "";
6473
- for (const [label, value] of [
7128
+ const entries = [
6474
7129
  [text.accountDetailProvider, view.providerLabel],
6475
7130
  [text.accountDetailKey, view.key],
7131
+ ];
7132
+ if (view.email) entries.push([text.accountDetailEmail, view.email]);
7133
+ if (view.methodLabel) entries.push([text.accountDetailMethod, view.methodLabel]);
7134
+ entries.push(
6476
7135
  [text.accountDetailFingerprint, view.fingerprint.id || text.accountFingerprintNone],
6477
7136
  [text.accountDetailPinnedAt, formatTime(view.fingerprint.pinnedAt)],
6478
7137
  [text.accountDetailLastLoginExit, formatExit(view.lastLogin, text.accountExitDirect)],
6479
7138
  [text.accountDetailStatus, view.signedIn ? text.accountSignedIn : text.accountSignedOut],
6480
- ]) {
7139
+ );
7140
+ if (view.expiresAt) entries.push([text.accountDetailExpiresAt, formatTime(view.expiresAt)]);
7141
+ for (const [label, value] of entries) {
6481
7142
  const wrap = document.createElement("div");
6482
7143
  const dt = document.createElement("dt");
6483
7144
  dt.textContent = label;
@@ -7477,9 +8138,33 @@ for (const event of ["input", "search"]) {
7477
8138
  revealProviderMatches();
7478
8139
  });
7479
8140
  }
8141
+ byId("providers-category").addEventListener("change", () => {
8142
+ providerCategory = byId("providers-category").value || "all";
8143
+ renderProviders(providerCatalog);
8144
+ revealProviderMatches();
8145
+ });
8146
+ byId("providers-refresh").addEventListener("click", refreshProviders);
7480
8147
  byId("retry").addEventListener("click", () => location.reload());
7481
8148
  byId("add-proxy").addEventListener("click", () => openProxyDialog());
7482
8149
  byId("add-proxy-empty").addEventListener("click", () => openProxyDialog());
8150
+ byId("proxies-test-all").addEventListener("click", testAllVisibleProxies);
8151
+ byId("proxies-test-cancel").addEventListener("click", cancelBulkTests);
8152
+ byId("proxies-bulk-open").addEventListener("click", openProxyBulkDialog);
8153
+ byId("proxy-bulk-close").addEventListener("click", closeProxyBulkDialog);
8154
+ byId("proxy-bulk-cancel").addEventListener("click", closeProxyBulkDialog);
8155
+ byId("proxy-bulk-submit").addEventListener("click", submitProxyBulk);
8156
+ byId("proxy-bulk-input").addEventListener("input", () => {
8157
+ setProxyBulkError("");
8158
+ updateProxyBulkSummary();
8159
+ });
8160
+ byId("proxy-bulk-type").addEventListener("change", updateProxyBulkSummary);
8161
+ byId("proxy-bulk-prefix").addEventListener("input", updateProxyBulkSummary);
8162
+ byId("proxy-bulk-dialog").addEventListener("close", () => {
8163
+ setProxyBulkError("");
8164
+ });
8165
+ byId("proxy-bulk-dialog").addEventListener("cancel", (event) => {
8166
+ if (proxyBulkBusy) event.preventDefault();
8167
+ });
7483
8168
  // Save is wired to a plain click, not to form submission. magpie hosts page
7484
8169
  // plugins in <iframe sandbox="allow-scripts"> with no allow-forms, so the
7485
8170
  // browser blocks form submission before a submit event can fire and a
@@ -7519,6 +8204,25 @@ byId("proxy-form").addEventListener("input", () => {
7519
8204
  // field reads as if the new value were already wrong.
7520
8205
  setFormError("");
7521
8206
  });
8207
+ byId("proxy-clear-password").addEventListener("change", () => {
8208
+ const clear = byId("proxy-clear-password").checked;
8209
+ byId("proxy-password").disabled = clear;
8210
+ if (clear) byId("proxy-password").value = "";
8211
+ if (dialogContext) {
8212
+ dialogContext.lastTest = null;
8213
+ if (dialogContext.testing) {
8214
+ cancelDialogTest();
8215
+ setDialogBusy(false);
8216
+ }
8217
+ }
8218
+ clearTestResult();
8219
+ });
8220
+ byId("proxy-password").addEventListener("input", () => {
8221
+ if (byId("proxy-password").value) {
8222
+ byId("proxy-clear-password").checked = false;
8223
+ byId("proxy-password").disabled = false;
8224
+ }
8225
+ });
7522
8226
  byId("confirm-cancel").addEventListener("click", () => {
7523
8227
  confirmController.cancel();
7524
8228
  closeConfirmDialog();
@@ -7533,6 +8237,9 @@ byId("confirm-dialog").addEventListener("cancel", (event) => {
7533
8237
  if (deleting) event.preventDefault();
7534
8238
  });
7535
8239
  window.addEventListener("pagehide", () => {
8240
+ bulkTestController?.abort();
8241
+ bulkTestController = null;
8242
+ bulkTestActive = false;
7536
8243
  for (const id of [...rowTests.keys()]) cancelRowTest(id);
7537
8244
  cancelDialogTest();
7538
8245
  cancelSignInProxyTests();
@@ -7555,6 +8262,24 @@ byId("proxy-test-target").addEventListener("change", () => {
7555
8262
  renderTargetNote();
7556
8263
  renderProxies();
7557
8264
  });
8265
+ for (const event of ["input", "search"]) {
8266
+ byId("filter-search").addEventListener(event, (nativeEvent) => {
8267
+ proxyFilter.search = nativeEvent.target.value;
8268
+ renderProxies();
8269
+ });
8270
+ }
8271
+ byId("filter-status").addEventListener("change", () => {
8272
+ proxyFilter.status = byId("filter-status").value || "all";
8273
+ renderProxies();
8274
+ });
8275
+ byId("filter-usage").addEventListener("change", () => {
8276
+ proxyFilter.usage = byId("filter-usage").value || "all";
8277
+ renderProxies();
8278
+ });
8279
+ byId("proxy-sort").addEventListener("change", () => {
8280
+ proxySort = byId("proxy-sort").value || "default";
8281
+ renderProxies();
8282
+ });
7558
8283
  byId("filter-latency-min").addEventListener("input", () => {
7559
8284
  proxyFilter.minLatency = byId("filter-latency-min").value;
7560
8285
  renderProxies();
@@ -7612,6 +8337,8 @@ byId("account-sort").addEventListener("change", () => {
7612
8337
  byId("account-filter-all").addEventListener("click", () => setAccountFilter("all"));
7613
8338
  byId("account-filter-signed-in").addEventListener("click", () => setAccountFilter("signedIn"));
7614
8339
  byId("account-filter-signed-out").addEventListener("click", () => setAccountFilter("signedOut"));
8340
+ byId("account-filter-hosting-paused").addEventListener("click", () => setAccountFilter("hostingPaused"));
8341
+ byId("account-filter-expiring-soon").addEventListener("click", () => setAccountFilter("expiringSoon"));
7615
8342
  byId("account-provider-more-toggle").addEventListener("click", () => {
7616
8343
  setAccountProviderPanel(!accountProviderPanelOpen);
7617
8344
  });