@gruu6y/page-clean-login 0.2.7 → 0.2.9

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.
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -16,34 +16,68 @@
16
16
  // longer writes a reason about it.
17
17
 
18
18
  export const PROVIDER_CAPABILITY_STATES = Object.freeze(["pending", "ready", "blocked"]);
19
+ export const PROVIDER_NOTICE_TONES = Object.freeze(["warn", "danger"]);
19
20
 
20
- // Antigravity risk notice: free-tier / unpaid accounts get disabled by Google's ToS enforcement.
21
- const ANTIGRAVITY_NOTICE = Object.freeze({
22
- en: "Heads-up: A subscription account that hasn't paid Google a single cent is bound to get banned, no matter what.",
23
- "zh-Hans": "提醒:一块钱都没给 Google 付的订阅账号,神仙来了也得封了。",
24
- "zh-Hant": "提醒:一塊錢都沒給 Google 付的訂閱帳號,神仙來了也得封。",
25
- ja: "注意:Google に 1 円も支払っていないサブスクアカウントは、どうあがいても BAN されます。",
21
+ // Google AGY family risk notice: unpaid accounts cannot avoid Google's ToS
22
+ // bans through this plugin, and using AGY providers through magpie is not
23
+ // recommended for now.
24
+ export const AGY_FAMILY_NOTICE = Object.freeze({
25
+ en: "Heads-up: This plugin cannot ease ban risk on accounts without real paid billing, and using Google AGY providers through magpie is not recommended for now.",
26
+ "zh-Hans": "提醒:未实付的账号无法通过本插件缓解你的封禁焦虑,且暂时不建议通过 magpie 使用 agy 供应商。",
27
+ "zh-Hant": "提醒:未實付的帳號無法透過本外掛緩解你的封禁焦慮,且暫時不建議透過 magpie 使用 agy 供應商。",
28
+ ja: "注意:実際に課金していないアカウントの BAN 不安はこのプラグインでは解消できず、当面は magpie 経由での agy プロバイダー利用もおすすめしません。",
26
29
  });
27
30
 
28
- // Codex and Claude are magpie built-ins: this plugin has no plugin to scan for
29
- // them and reaches the sign-in through magpie's own command line, which ends in
30
- // a browser this plugin cannot seal off yet. Until the sandbox service exists,
31
- // both cards say plainly that they are not the way to sign in for now.
32
- const NO_SANDBOX_NOTICE = Object.freeze({
33
- en: "Not recommended for now: do not sign in through this plugin yet, because the sandbox service is not ready.",
34
- "zh-Hans": "暂时不建议使用本插件登录:沙箱服务暂未准备提供。",
35
- "zh-Hant": "暫時不建議使用此外掛登入:沙箱服務暫未準備提供。",
36
- ja: "当面はこのプラグインでのログインはおすすめしません。サンドボックスサービスをまだ用意していないためです。",
31
+ // Claude family risk notice: users should use claude-cage instead of this plugin.
32
+ export const CLAUDE_NOTICE = Object.freeze({
33
+ en: "Notice: Do not use Claude through this plugin. Please use claude-cage instead.",
34
+ "zh-Hans": "提醒:请不要通过本插件来使用 Claude,请使用 claude-cage。",
35
+ "zh-Hant": "提醒:請不要透過本外掛來使用 Claude,請使用 claude-cage。",
36
+ ja: "注意:このプラグイン経由で Claude を使わないでください。代わりに claude-cage をご利用ください。",
37
37
  });
38
38
 
39
- // What magpie itself does for Claude. Kept next to the sandbox line so the
40
- // Claude card states both facts in one notice.
41
- const CLAUDE_TOKEN_NOTICE = Object.freeze({
42
- en: "magpie signs in to Claude by importing a token (POST /api/signin/claude-token), not through a web account page.",
43
- "zh-Hans": "magpie 通过导入 token(POST /api/signin/claude-token)来登录 Claude,而不是通过网页账号页面。",
44
- "zh-Hant": "magpie 透過匯入 token(POST /api/signin/claude-token)來登入 Claude,而不是透過網頁帳號頁面。",
45
- ja: "magpie は Web のアカウントページではなく、token のインポート(POST /api/signin/claude-token)で Claude にサインインします。",
46
- });
39
+ function providerSlug(value) {
40
+ return String(value || "")
41
+ .trim()
42
+ .toLowerCase()
43
+ .replace(/[^a-z0-9]+/g, "-")
44
+ .replace(/^-+|-+$/g, "");
45
+ }
46
+
47
+ const AGY_ID_PATTERN = /^(?:google-)?(?:antigravity|agy)(?:-|$)/;
48
+ const AGY_TOKEN_PATTERN = /(?:^|-)(?:antigravity|agy)(?:-|$)/;
49
+ const CLAUDE_ID_PATTERN = /^(?:anthropic-)?claude(?:code)?(?:-|$)/;
50
+ const CLAUDE_TOKEN_PATTERN = /(?:^|-)claude(?:code)?(?:-|$)/;
51
+
52
+ // Curated family-level notices so plugin-derived and market cards (such as
53
+ // `agy-cli` or `claude-code`) inherit the same specialized warning as the
54
+ // built-in registry entries.
55
+ export function providerSpecialNotice(provider = {}) {
56
+ if (!provider || typeof provider !== "object") return null;
57
+ const ids = [provider.id, provider.agentId, provider.signInProvider]
58
+ .map(providerSlug)
59
+ .filter(Boolean);
60
+ const name = providerSlug(provider.name);
61
+ const pkg = providerSlug(provider.pluginPackage || provider.package);
62
+
63
+ if (
64
+ ids.some((id) => AGY_ID_PATTERN.test(id)) ||
65
+ (name && AGY_TOKEN_PATTERN.test(name)) ||
66
+ (pkg && AGY_TOKEN_PATTERN.test(pkg))
67
+ ) {
68
+ return { notice: { ...AGY_FAMILY_NOTICE }, noticeTone: "warn" };
69
+ }
70
+
71
+ if (
72
+ ids.some((id) => CLAUDE_ID_PATTERN.test(id)) ||
73
+ (name && CLAUDE_TOKEN_PATTERN.test(name)) ||
74
+ (pkg && CLAUDE_TOKEN_PATTERN.test(pkg))
75
+ ) {
76
+ return { notice: { ...CLAUDE_NOTICE }, noticeTone: "danger" };
77
+ }
78
+
79
+ return null;
80
+ }
47
81
 
48
82
  const definitions = [
49
83
  {
@@ -64,7 +98,8 @@ const definitions = [
64
98
  linkOnly: true,
65
99
  authHosts: ["accounts.google.com"],
66
100
  callbackPort: 45171,
67
- notice: { ...ANTIGRAVITY_NOTICE },
101
+ notice: { ...AGY_FAMILY_NOTICE },
102
+ noticeTone: "warn",
68
103
  capability: { state: "pending", reason: {} },
69
104
  },
70
105
  {
@@ -82,7 +117,8 @@ const definitions = [
82
117
  linkOnly: true,
83
118
  authHosts: ["auth.openai.com"],
84
119
  callbackPort: 45172,
85
- notice: { ...NO_SANDBOX_NOTICE },
120
+ notice: {},
121
+ noticeTone: null,
86
122
  capability: { state: "pending", reason: {} },
87
123
  },
88
124
  {
@@ -90,26 +126,21 @@ const definitions = [
90
126
  name: "Claude",
91
127
  mark: { kind: "letter", text: "Cl", tone: "clay" },
92
128
  description: {
93
- en: "Anthropic's Claude. magpie links it by importing a token; this plugin has not implemented token import yet.",
94
- "zh-Hans": "Anthropic 的 Claude。magpie 通过导入 token 来关联;本插件尚未实现 token 导入。",
95
- "zh-Hant": "Anthropic 的 Claude。magpie 透過匯入 token 來關聯;本外掛尚未實作 token 匯入。",
96
- ja: "Anthropic の Claude。magpie は token のインポートで連携します。このプラグインでは token インポートをまだ実装していません。",
129
+ en: "Anthropic's Claude.",
130
+ "zh-Hans": "Anthropic 的 Claude。",
131
+ "zh-Hant": "Anthropic 的 Claude。",
132
+ ja: "Anthropic の Claude。",
97
133
  },
98
134
  agentId: "claude",
99
135
  // magpie signs in to Claude with `POST /api/signin/claude-token`, which
100
136
  // imports a token. It is not a browser OAuth flow, so there is no web auth
101
- // host and no callback port to claim. The URL in this description was read
102
- // from the magpie binary; the import itself is not implemented here yet.
137
+ // host and no callback port to claim.
103
138
  signInMode: "token-import",
104
139
  linkOnly: true,
105
140
  authHosts: [],
106
141
  callbackPort: null,
107
- notice: {
108
- en: `${NO_SANDBOX_NOTICE.en} ${CLAUDE_TOKEN_NOTICE.en}`,
109
- "zh-Hans": `${NO_SANDBOX_NOTICE["zh-Hans"]}${CLAUDE_TOKEN_NOTICE["zh-Hans"]}`,
110
- "zh-Hant": `${NO_SANDBOX_NOTICE["zh-Hant"]}${CLAUDE_TOKEN_NOTICE["zh-Hant"]}`,
111
- ja: `${NO_SANDBOX_NOTICE.ja}${CLAUDE_TOKEN_NOTICE.ja}`,
112
- },
142
+ notice: { ...CLAUDE_NOTICE },
143
+ noticeTone: "danger",
113
144
  capability: { state: "pending", reason: {} },
114
145
  },
115
146
  ];
@@ -130,6 +161,7 @@ export const PROVIDER_PUBLIC_FIELDS = Object.freeze([
130
161
  "authHosts",
131
162
  "callbackPort",
132
163
  "notice",
164
+ "noticeTone",
133
165
  "capability",
134
166
  ]);
135
167
 
@@ -145,6 +177,7 @@ export function publicProvider(provider) {
145
177
  authHosts: [...provider.authHosts],
146
178
  callbackPort: provider.callbackPort,
147
179
  notice: { ...provider.notice },
180
+ noticeTone: PROVIDER_NOTICE_TONES.includes(provider.noticeTone) ? provider.noticeTone : null,
148
181
  capability: {
149
182
  state: provider.capability.state,
150
183
  reason: { ...provider.capability.reason },
@@ -23,6 +23,7 @@ export const MAGPIE_PROVIDERS_READ = "providers:list";
23
23
 
24
24
  import { projectPrompts, requiresFormInput, requiresSecretInput } from "./magpie-plugins.mjs";
25
25
  import { methodInputFields } from "./method-inputs.mjs";
26
+ import { providerSpecialNotice } from "./provider-registry.mjs";
26
27
 
27
28
  // Five presences. The first four only compare the local registry with
28
29
  // magpie's own list. The fifth exists because an installed plugin can expose a
@@ -52,9 +53,9 @@ export const PROVIDER_PRESENCES = Object.freeze([
52
53
  // `accounts add`), so it explains nothing and prints no note at all.
53
54
  // A registry-only card sits in the "other providers" list, next to cards that
54
55
  // print no prose at all, so it gets one line and no more: the curated notice,
55
- // when the registry has one ("do not sign in through this plugin yet", plus the
56
- // token import note for Claude). Its own description and the generic "magpie
57
- // does not list it" note were two further paragraphs around that one sentence.
56
+ // when the registry has one (such as the AGY family or Claude warnings). Its
57
+ // own description and the generic "magpie does not list it" note were two
58
+ // further paragraphs around that one sentence.
58
59
  const PROSE_FREE_PRESENCES = Object.freeze(["local-only"]);
59
60
 
60
61
  // A scan that BROKE is not a flow that was never implemented. When the
@@ -371,6 +372,12 @@ function magpieOnlyProvider(item, pluginItem, scanFailure) {
371
372
  // plugin has no browser login" sentence used to sit here and contradicted
372
373
  // cards that listed a browser method while claiming there was no add entry.)
373
374
  const reason = scanFailure ? { ...scanFailure } : {};
375
+ const special = providerSpecialNotice({
376
+ id: item.id,
377
+ name: item.name,
378
+ signInProvider: pluginItem ? pluginItem.id : null,
379
+ pluginPackage: pluginItem ? pluginItem.package : null,
380
+ });
374
381
  return {
375
382
  id: item.id,
376
383
  name: item.name,
@@ -381,7 +388,8 @@ function magpieOnlyProvider(item, pluginItem, scanFailure) {
381
388
  linkOnly: true,
382
389
  authHosts: [],
383
390
  callbackPort: null,
384
- notice: null,
391
+ notice: special ? special.notice : null,
392
+ noticeTone: special ? special.noticeTone : null,
385
393
  capability: { state: "pending", reason },
386
394
  presence: "magpie-only",
387
395
  presenceNote: null,
@@ -418,6 +426,12 @@ function pluginOnlyProvider(item) {
418
426
  // One plugin can expose several providers, so the card is named after the
419
427
  // provider the plugin declared, never after the package it came from.
420
428
  const name = item.name || item.id;
429
+ const special = providerSpecialNotice({
430
+ id: item.id,
431
+ name,
432
+ signInProvider: item.id,
433
+ pluginPackage: item.package,
434
+ });
421
435
  return {
422
436
  id: item.id,
423
437
  name,
@@ -428,7 +442,8 @@ function pluginOnlyProvider(item) {
428
442
  linkOnly: true,
429
443
  authHosts: [],
430
444
  callbackPort: null,
431
- notice: null,
445
+ notice: special ? special.notice : null,
446
+ noticeTone: special ? special.noticeTone : null,
432
447
  capability: { state: "pending", reason: {} },
433
448
  presence: "plugin-only",
434
449
  presenceNote: null,
@@ -647,6 +662,7 @@ export function mergeProviderSources({ local = [], magpie, plugins, catalog } =
647
662
  // line and the registry's own notice say everything the description and
648
663
  // the presence note used to repeat.
649
664
  description: PROSE_FREE_PRESENCES.includes(presence) ? {} : provider.description,
665
+ noticeTone: provider.noticeTone ?? null,
650
666
  capability,
651
667
  presence,
652
668
  presenceNote,
@@ -718,6 +734,11 @@ export function mergeProviderSources({ local = [], magpie, plugins, catalog } =
718
734
  if (keys.some((key) => covered.has(key))) continue;
719
735
  for (const key of keys) covered.add(key);
720
736
  const flags = methodFlags([]);
737
+ const special = providerSpecialNotice({
738
+ id: item.id,
739
+ name: item.name,
740
+ pluginPackage: item.package || null,
741
+ });
721
742
  providers.push({
722
743
  id: item.id,
723
744
  name: item.name,
@@ -728,7 +749,8 @@ export function mergeProviderSources({ local = [], magpie, plugins, catalog } =
728
749
  linkOnly: true,
729
750
  authHosts: [],
730
751
  callbackPort: null,
731
- notice: null,
752
+ notice: special ? special.notice : null,
753
+ noticeTone: special ? special.noticeTone : null,
732
754
  capability: { state: "pending", reason: {} },
733
755
  presence: "catalog",
734
756
  presenceNote: null,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@gruu6y/page-clean-login",
3
- "version": "0.2.7",
4
- "description": "在 magpie 中管理代理 IP 与供应商登录,每个账号通过独立浏览器身份登录;一个带仅回环主机服务的页面插件。",
3
+ "version": "0.2.9",
4
+ "description": "干净登录:通过领先的指纹浏览器,在插件页面接管magpie的凭据登录与续期,缓解封号焦虑",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
7
7
  "access": "public",
package/ui/app.js CHANGED
@@ -4016,6 +4016,15 @@ function providerCard(provider) {
4016
4016
  const notice = document.createElement("p");
4017
4017
  notice.className = "provider-notice";
4018
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
+ }
4019
4028
 
4020
4029
  // A card appends only the lines it actually carries. Some presences
4021
4030
  // deliberately have no description or no reason — a `magpie-only` card, for
@@ -5212,6 +5221,7 @@ function openSignInDialog(provider, options = {}) {
5212
5221
  busy: false,
5213
5222
  };
5214
5223
  byId("signin-provider").textContent = signInContext.name;
5224
+ renderSignInProviderNotice(provider);
5215
5225
  renderSignInMethods(provider);
5216
5226
  renderSignInInputs(provider);
5217
5227
  renderSignInAccounts(provider);
@@ -5234,6 +5244,35 @@ function openSignInDialog(provider, options = {}) {
5234
5244
  });
5235
5245
  }
5236
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
+
5237
5276
  // The account row's "sign in again" action preselects the kept identity, so
5238
5277
  // the next sign-in reuses that fingerprint instead of drawing a new one.
5239
5278
  function renderSignInPreselection() {
@@ -5453,6 +5492,7 @@ function cleanupSignInDialog() {
5453
5492
  stopSignInPolling();
5454
5493
  cancelSignInProxyTests();
5455
5494
  signInContext = null;
5495
+ renderSignInProviderNotice(null);
5456
5496
  setSignInNotice("");
5457
5497
  setSignInError("");
5458
5498
  byId("signin-inputs").textContent = "";
package/ui/index.html CHANGED
@@ -584,6 +584,7 @@
584
584
  </div>
585
585
  <div class="dialog-body">
586
586
  <p class="signin-provider" id="signin-provider"></p>
587
+ <p class="provider-notice signin-provider-notice" id="signin-provider-notice" hidden></p>
587
588
  <div class="field" id="signin-method-field" hidden>
588
589
  <label for="signin-method" id="signin-method-label">Sign-in method</label>
589
590
  <select id="signin-method" name="method"></select>
package/ui/style.css CHANGED
@@ -609,6 +609,13 @@ main { flex: 1; }
609
609
  }
610
610
  .provider-card:hover { border-color: var(--line-strong); }
611
611
  .provider-card:hover::before { transform: scaleY(1); }
612
+ .provider-card[data-notice-tone="warn"] {
613
+ border-color: color-mix(in srgb, var(--amber) 48%, var(--line));
614
+ }
615
+ .provider-card[data-notice-tone="warn"]::before { background: var(--amber); }
616
+ .provider-card[data-notice-tone="danger"] {
617
+ border-color: color-mix(in srgb, var(--red) 55%, var(--line));
618
+ }
612
619
  .provider-head { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
613
620
  .provider-mark {
614
621
  width: 34px;
@@ -671,6 +678,46 @@ main { flex: 1; }
671
678
  font-size: 12px;
672
679
  }
673
680
  .provider-notice { margin: 0; color: var(--faint); font-size: 11.5px; }
681
+ .provider-notice[data-tone="warn"],
682
+ .provider-notice[data-tone="danger"] {
683
+ display: flex;
684
+ gap: 8px;
685
+ align-items: flex-start;
686
+ padding: 8px 10px;
687
+ border: 1px solid var(--amber);
688
+ border-left: 3px solid var(--amber);
689
+ border-radius: var(--radius);
690
+ background: color-mix(in srgb, var(--amber) 10%, var(--paper-2));
691
+ color: var(--ink);
692
+ font-size: 12px;
693
+ font-weight: 560;
694
+ line-height: 1.5;
695
+ overflow-wrap: anywhere;
696
+ }
697
+ .provider-notice[data-tone="warn"]::before,
698
+ .provider-notice[data-tone="danger"]::before {
699
+ content: "!";
700
+ flex: none;
701
+ width: 16px;
702
+ height: 16px;
703
+ margin-top: 1px;
704
+ display: inline-grid;
705
+ place-items: center;
706
+ border-radius: 50%;
707
+ background: var(--amber);
708
+ color: #fff;
709
+ font: 700 10.5px/1 var(--mono);
710
+ }
711
+ .provider-notice[data-tone="danger"] {
712
+ border-color: var(--red);
713
+ border-left-color: var(--red);
714
+ background: color-mix(in srgb, var(--red) 9%, var(--paper-2));
715
+ color: var(--red-deep);
716
+ }
717
+ :root[data-theme="dark"] .provider-notice[data-tone="danger"] { color: #f3b199; }
718
+ .provider-notice[data-tone="danger"]::before { background: var(--red); }
719
+ :root[data-theme="dark"] .provider-notice[data-tone="warn"]::before,
720
+ :root[data-theme="dark"] .provider-notice[data-tone="danger"]::before { color: var(--paper-3); }
674
721
  .provider-presence {
675
722
  margin: 0;
676
723
  padding: 8px 10px;
@@ -753,6 +800,7 @@ main { flex: 1; }
753
800
  /* --- sign-in dialog bits ------------------------------------------------ */
754
801
 
755
802
  .signin-provider { margin: 0 0 4px; font-size: 13px; font-weight: 650; }
803
+ .signin-provider-notice { margin: 8px 0 12px; }
756
804
  .signin-notice { margin: 12px 0 0; color: var(--ink); font-size: 12.5px; }
757
805
  .signin-status {
758
806
  display: flex;