@goodandready/dsh-subscriptions 0.4.6 → 0.4.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/lib/client.js CHANGED
@@ -50,7 +50,8 @@ window.__ModuleLoader__.load({
50
50
  '.dsub-barWarn .dsub-barFill{background:var(--dsw-alias-state-warning-primary)}' +
51
51
  '.dsub-barFull .dsub-barFill{background:var(--dsw-alias-state-error-primary)}' +
52
52
  '.dsub-barRow{display:flex;align-items:center;gap:8px;font-size:12px;color:var(--dsw-alias-label-secondary)}' +
53
- '.dsub-verify{font-size:12px;color:var(--dsw-alias-state-warning-primary)}' + +
53
+ '.dsub-manual{display:flex;flex-direction:column;gap:6px;margin-top:4px;padding-top:10px;border-top:1px solid var(--dsw-alias-border-l2)}' +
54
+ '.dsub-verify{font-size:12px;color:var(--dsw-alias-state-warning-primary)}' +
54
55
  '.dsub-verify a{color:var(--dsw-alias-brand-primary)}'
55
56
 
56
57
  const cssId = 'dsh-subscriptions/settings.module.css'
@@ -102,10 +103,25 @@ const cssId = 'dsh-subscriptions/settings.module.css'
102
103
  'slashStatus': 'Subscription status',
103
104
  'none': 'none',
104
105
  'forecast': '≈',
105
- 'resetLabel': 'сброс',
106
106
  'resetLabel': 'reset',
107
+ 'check': 'Check',
108
+ 'checking': 'Checking…',
109
+ 'importToken': 'Import',
110
+ 'importTokenPlace': 'Paste an existing token',
111
+ 'reconnectRequired': 'Reconnect required',
112
+ 'manualTitle': 'If the browser did not come back',
113
+ 'windowPrimary': 'Primary window',
114
+ 'windowSecondary': 'Secondary window',
107
115
  }
108
116
  const ru = {
117
+ 'check': 'Проверить',
118
+ 'checking': 'Проверяю…',
119
+ 'importToken': 'Внести',
120
+ 'importTokenPlace': 'Вставить уже готовый токен',
121
+ 'reconnectRequired': 'Нужно переподключить',
122
+ 'manualTitle': 'Если браузер не вернулся сам',
123
+ 'windowPrimary': 'Основное окно',
124
+ 'windowSecondary': 'Дополнительное окно',
109
125
  'notConnected': 'Не подключено',
110
126
  'verifyAccount': 'Требуется проверка',
111
127
  'coolingDown': 'Пауза после лимита',
@@ -387,7 +403,7 @@ function PluginCard(props) {
387
403
  type: 'button', className: 'dsub-mini',
388
404
  disabled: checking[key],
389
405
  onClick: () => doCheck(row.slot.provider, row.slot.index).catch((e) => setErr(String(e.message || e))),
390
- }, checking[key] ? '...' : 'Check'),
406
+ }, checking[key] ? t('checking') : t('check')),
391
407
  React.createElement('button', {
392
408
  type: 'button', className: 'dsub-mini', title: t('removeSlot'),
393
409
  onClick: () => {
@@ -398,6 +414,8 @@ function PluginCard(props) {
398
414
  },
399
415
  }, '\u00d7'),
400
416
  ),
417
+ React.createElement('div', { className: 'dsub-manual' },
418
+ React.createElement('span', { className: 'dsub-sub' }, t('manualTitle')),
401
419
  React.createElement('div', { className: 'dsub-row' },
402
420
  React.createElement('input', {
403
421
  className: 'dsub-grow',
@@ -422,8 +440,9 @@ function PluginCard(props) {
422
440
  onClick: () => importToken(row.slot.provider, row.slot.index).catch((e) => setErr(String(e.message || e))),
423
441
  }, t('importToken')),
424
442
  ),
443
+ ),
425
444
  account.accountNotice ? React.createElement('div', { className: 'dsub-verify' }, account.accountNotice) : null,
426
- account.refreshError ? React.createElement('div', { className: 'dsub-bad' }, 'reconnect required: ' + account.refreshError) : null,
445
+ account.refreshError ? React.createElement('div', { className: 'dsub-bad' }, t('reconnectRequired') + ': ' + account.refreshError) : null,
427
446
  (function(){ var r=checkRes[key]; if(!r) return null; var txt=r.ok ? ('ok ' + (r.email||'')) : ('fail ' + (r.error && r.error.message || '')); var cls=r.ok ? 'dsub-ok' : 'dsub-bad'; var q=r.quota; if(q && q.remaining!=null) txt += ' quota:'+q.remaining+(q.limit!=null?'/'+q.limit:''); return React.createElement('div', {className: cls}, txt) })(),
428
447
  account.validationUrl ? React.createElement('div', { className: 'dsub-verify' },
429
448
  t('verifyPrefix'),
@@ -443,9 +462,21 @@ function PluginCard(props) {
443
462
  React.createElement('span',null,Math.round(pct)+'%'),
444
463
  )
445
464
  }
465
+ // Имя окна приходит от провайдера внутренним: primary_window.
466
+ // Известные переводим, незнакомое хотя бы причёсываем, чтобы
467
+ // в карточке не оставалось подчёркиваний из чужого протокола.
468
+ function windowLabel(w){
469
+ var id=String((w&&w.id)||'')
470
+ var given=w&&(w.ru||w.en)
471
+ if(given&&given!==id)return given
472
+ if(id==='primary_window')return t('windowPrimary')
473
+ if(id==='secondary_window')return t('windowSecondary')
474
+ if(!id)return t('quota')
475
+ return id.replace(/_/g,' ')
476
+ }
446
477
  if(Array.isArray(wins)&&wins.length){
447
478
  wins.forEach(function(w){
448
- if(w&&w.usedPercent!=null)parts.push(bar((w.ru||w.id),w.usedPercent))
479
+ if(w&&w.usedPercent!=null)parts.push(bar(windowLabel(w),w.usedPercent))
449
480
  })
450
481
  }
451
482
  var q=account.quota
@@ -459,7 +490,7 @@ function PluginCard(props) {
459
490
  if(w0&&w0.usedPercent!=null&&w0.usedPercent<100){
460
491
  var remaining=100-w0.usedPercent
461
492
  var est=Math.floor(remaining/(w0.usedPercent/account.requests))
462
- if(est>0)parts.push(React.createElement('span',{className:'dsub-sub',key:'fc'},t('forecast')+' '+est+' ('+(w0.ru||w0.id)+')'))
493
+ if(est>0)parts.push(React.createElement('span',{className:'dsub-sub',key:'fc'},t('forecast')+' '+est+' ('+windowLabel(w0)+')'))
463
494
  }
464
495
  }
465
496
  if(!parts.length)return null
package/lib/usage.js CHANGED
@@ -58,6 +58,8 @@ const WINDOW_LABELS = {
58
58
  weekly_limit_7_days: { ru: "7д", en: "7d" },
59
59
  primary: { ru: "осн.", en: "primary" },
60
60
  secondary: { ru: "втор.", en: "secondary" },
61
+ primary_window: { ru: "осн.", en: "primary" },
62
+ secondary_window: { ru: "втор.", en: "secondary" },
61
63
  monthly: { ru: "месяц", en: "month" },
62
64
  credits: { ru: "кредиты", en: "credits" },
63
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goodandready/dsh-subscriptions",
3
- "version": "0.4.6",
3
+ "version": "0.4.8",
4
4
  "description": "Use ChatGPT Codex, Claude, Grok, and Antigravity subscriptions as DeepSeek Harness LLM providers via OAuth.",
5
5
  "license": "MIT",
6
6
  "type": "module",