@goodandready/dsh-subscriptions 0.4.5 → 0.4.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/lib/client.js +36 -6
- package/lib/index.js +2 -2
- package/package.json +1 -1
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-
|
|
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] ? '
|
|
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' }, '
|
|
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,20 @@ 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
|
+
if(w&&w.ru)return w.ru
|
|
471
|
+
if(id==='primary_window')return t('windowPrimary')
|
|
472
|
+
if(id==='secondary_window')return t('windowSecondary')
|
|
473
|
+
if(!id)return t('quota')
|
|
474
|
+
return id.replace(/_/g,' ')
|
|
475
|
+
}
|
|
446
476
|
if(Array.isArray(wins)&&wins.length){
|
|
447
477
|
wins.forEach(function(w){
|
|
448
|
-
if(w&&w.usedPercent!=null)parts.push(bar((w
|
|
478
|
+
if(w&&w.usedPercent!=null)parts.push(bar(windowLabel(w),w.usedPercent))
|
|
449
479
|
})
|
|
450
480
|
}
|
|
451
481
|
var q=account.quota
|
|
@@ -459,7 +489,7 @@ function PluginCard(props) {
|
|
|
459
489
|
if(w0&&w0.usedPercent!=null&&w0.usedPercent<100){
|
|
460
490
|
var remaining=100-w0.usedPercent
|
|
461
491
|
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
|
|
492
|
+
if(est>0)parts.push(React.createElement('span',{className:'dsub-sub',key:'fc'},t('forecast')+' '+est+' ('+windowLabel(w0)+')'))
|
|
463
493
|
}
|
|
464
494
|
}
|
|
465
495
|
if(!parts.length)return null
|
package/lib/index.js
CHANGED
|
@@ -898,10 +898,10 @@ export function apply(ctx, config) {
|
|
|
898
898
|
const reset = a.quota && a.quota.resetAt ? new Date(a.quota.resetAt).toLocaleString() : ''
|
|
899
899
|
const status = a.validationUrl ? 'verify' : (a.cooldownUntil && a.cooldownUntil > Date.now() ? 'cooldown' : (a.configured ? 'ok' : 'none'))
|
|
900
900
|
return '<tr><td>' + escapeHtml(a.provider) + '</td><td>' + (a.index||1) + '</td>' +
|
|
901
|
-
'<td>' +
|
|
901
|
+
'<td>' + escapeHtml(a.label || a.email || '') + '</td><td>' + status + '</td>' +
|
|
902
902
|
'<td>' + (pct != null ? Math.round(pct) + '%' : '—') + '</td>' +
|
|
903
903
|
'<td>' + (rem != null ? (rem + (lim != null ? '/' + lim : '')) : '—') + '</td>' +
|
|
904
|
-
'<td>' +
|
|
904
|
+
'<td>' + escapeHtml(reset) + '</td><td>' + escapeHtml(a.refreshError || '') + '</td></tr>'
|
|
905
905
|
})
|
|
906
906
|
const body = rows.length
|
|
907
907
|
? '<div class="grid">' + rows.join('') + '</div>'
|
package/package.json
CHANGED