dsh-tokenbank 0.1.64 → 0.1.66
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 +127 -80
- package/package.json +2 -2
package/lib/client.js
CHANGED
|
@@ -28,6 +28,7 @@ window.__ModuleLoader__.load({
|
|
|
28
28
|
openPortal: '打开完整门户',
|
|
29
29
|
openSite: '打开官网',
|
|
30
30
|
addFreeModels: '获取免费模型',
|
|
31
|
+
getModels: '获取模型',
|
|
31
32
|
freeModelsTip: '免费使用主流收费模型,点击后自动获取,模型列表 TokenBank 中的模型任意使用。',
|
|
32
33
|
modelLinked: '已接入 {n} 个模型',
|
|
33
34
|
reload: '刷新',
|
|
@@ -121,6 +122,7 @@ window.__ModuleLoader__.load({
|
|
|
121
122
|
openPortal: 'Open full portal',
|
|
122
123
|
openSite: 'Open website',
|
|
123
124
|
addFreeModels: 'Get free models',
|
|
125
|
+
getModels: 'Get models',
|
|
124
126
|
freeModelsTip: 'Use paid-tier models for free — one click links them, and every TokenBank model in the list is available.',
|
|
125
127
|
rechargeTip: 'Best price anywhere: $1 for ¥6.50 — 10%~25% cheaper than official APIs and relays. Pay with Alipay, credited instantly, credit never expires.',
|
|
126
128
|
modelLinked: '{n} models linked',
|
|
@@ -334,21 +336,60 @@ window.__ModuleLoader__.load({
|
|
|
334
336
|
}).catch(function () {})
|
|
335
337
|
return function () { stopped = true }
|
|
336
338
|
}, [])
|
|
337
|
-
var onClick = function () {
|
|
338
|
-
|
|
339
|
+
var onClick = function (e) {
|
|
340
|
+
var rect = e && e.currentTarget && e.currentTarget.getBoundingClientRect()
|
|
341
|
+
tbStore.set({
|
|
342
|
+
authOpen: true, authMode: 'register',
|
|
343
|
+
anchor: rect ? { right: rect.right, top: rect.top } : null,
|
|
344
|
+
})
|
|
339
345
|
}
|
|
346
|
+
var st = React.useState(null)
|
|
347
|
+
React.useEffect(function () {
|
|
348
|
+
var stopped = false
|
|
349
|
+
api('status').then(function (data) {
|
|
350
|
+
if (!stopped) { st[1](data); tbStore.set({ loggedIn: Boolean(data.loggedIn), portalUrl: data.portalUrl }) }
|
|
351
|
+
}).catch(function () {})
|
|
352
|
+
return function () { stopped = true }
|
|
353
|
+
}, [])
|
|
354
|
+
// 登录态变化(弹窗登录/退出)时刷新余额展示
|
|
355
|
+
React.useEffect(function () {
|
|
356
|
+
var stopped = false
|
|
357
|
+
if (!snap.loggedIn) return
|
|
358
|
+
api('status').then(function (data) {
|
|
359
|
+
if (!stopped) st[1](data)
|
|
360
|
+
}).catch(function () {})
|
|
361
|
+
return function () { stopped = true }
|
|
362
|
+
}, [snap.loggedIn, snap.authOpen])
|
|
363
|
+
var data = st[0]
|
|
340
364
|
return h('button', {
|
|
341
365
|
type: 'button',
|
|
366
|
+
id: 'tb-entry-btn',
|
|
367
|
+
className: snap.authOpen ? 'tb-entry-open' : '',
|
|
342
368
|
title: pageT('composerEntry'), 'aria-label': pageT('composerEntry'),
|
|
343
369
|
onClick: onClick,
|
|
344
|
-
style:
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
370
|
+
style: snap.loggedIn
|
|
371
|
+
? {
|
|
372
|
+
display: 'inline-flex', alignItems: 'center', justifyContent: 'center', gap: 4,
|
|
373
|
+
height: 29, padding: '0 8px', borderRadius: 7, boxSizing: 'border-box',
|
|
374
|
+
border: 'none', background: 'transparent',
|
|
375
|
+
cursor: 'pointer', position: 'relative',
|
|
376
|
+
}
|
|
377
|
+
: {
|
|
378
|
+
display: 'inline-flex', alignItems: 'center', cursor: 'pointer', position: 'relative',
|
|
379
|
+
border: 'none', background: 'transparent', padding: 0, boxSizing: 'border-box',
|
|
380
|
+
},
|
|
350
381
|
},
|
|
351
|
-
|
|
382
|
+
snap.loggedIn
|
|
383
|
+
? h('span', { style: { fontSize: 13, fontVariantNumeric: 'tabular-nums', color: 'var(--dsw-alias-label-secondary, #888)' } },
|
|
384
|
+
data && data.account && typeof data.account.balance_nano_usd === 'number'
|
|
385
|
+
? '$' + (data.account.balance_nano_usd / 1e9).toFixed(2) : '')
|
|
386
|
+
: h('span', {
|
|
387
|
+
style: { fontSize: 12, lineHeight: '25px', padding: '0 10px', borderRadius: 999, color: '#fff', background: '#ff4f1f', fontWeight: 600, letterSpacing: 0.3 },
|
|
388
|
+
}, pageT('freeToken')),
|
|
389
|
+
snap.loggedIn
|
|
390
|
+
? h('svg', { viewBox: '0 0 24 24', className: 'tb-entry-chevron', width: 14, height: 14, fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round', style: { color: 'var(--dsw-alias-label-tertiary, #a0a3a8)', flex: 'none' } },
|
|
391
|
+
h('path', { d: 'm6 9 6 6 6-6' }))
|
|
392
|
+
: null,
|
|
352
393
|
)
|
|
353
394
|
}
|
|
354
395
|
|
|
@@ -615,6 +656,14 @@ window.__ModuleLoader__.load({
|
|
|
615
656
|
var flash = React.useState(null)
|
|
616
657
|
var sLogoutArm = React.useState(false)
|
|
617
658
|
var sLogoutTimer = { ref: null }
|
|
659
|
+
var freeModelsUsed = React.useState(false)
|
|
660
|
+
// 登录态变化时同步一次性入口标记(退出已清 localStorage,重登后重新出现)
|
|
661
|
+
React.useEffect(function () {
|
|
662
|
+
if (!snap.loggedIn) return
|
|
663
|
+
try {
|
|
664
|
+
freeModelsUsed[1](window.localStorage.getItem('tb-free-models-used') === '1')
|
|
665
|
+
} catch (e) {}
|
|
666
|
+
}, [snap.loggedIn])
|
|
618
667
|
var boxRef = React.useRef(null)
|
|
619
668
|
React.useEffect(function () {
|
|
620
669
|
var stopped = false
|
|
@@ -666,74 +715,36 @@ window.__ModuleLoader__.load({
|
|
|
666
715
|
var loggedIn = snap.loggedIn
|
|
667
716
|
if (!runtimeCtx) return null
|
|
668
717
|
var smallBtn = Object.assign({}, buttonStyle, { height: 24, padding: '0 8px', fontSize: 12 })
|
|
718
|
+
// 弱化的文字链按钮:无框无底色,次级灰字,悬停才显主色
|
|
719
|
+
var quietLinkStyle = {
|
|
720
|
+
border: 'none', background: 'transparent', cursor: 'pointer', padding: '2px 4px',
|
|
721
|
+
fontSize: 12, lineHeight: '20px', borderRadius: 6,
|
|
722
|
+
color: 'var(--dsw-alias-label-secondary, #888)',
|
|
723
|
+
}
|
|
669
724
|
return h('div', {
|
|
670
725
|
ref: boxRef,
|
|
726
|
+
// 整个长驻板块作为可点击区域:点击任意位置打开账户弹窗(托管等子按钮单独 stopPropagation)
|
|
727
|
+
onClick: function () { openPanel('register') },
|
|
671
728
|
style: {
|
|
729
|
+
cursor: 'pointer',
|
|
672
730
|
margin: '4px 10px 8px', display: 'flex', flexDirection: 'column', gap: 6, width: 'calc(100% - 20px)', boxSizing: 'border-box', alignSelf: 'stretch'
|
|
673
731
|
},
|
|
674
732
|
},
|
|
675
733
|
h('div', { style: { display: 'flex', alignItems: 'center', gap: 4 } },
|
|
676
734
|
h('span', {
|
|
677
735
|
className: 'tb-wordmark',
|
|
678
|
-
style: { fontFamily: "'Frizon','FrizonLocal',sans-serif", fontSize: 14, letterSpacing: 0.5, color: '#
|
|
679
|
-
onClick: function () { window.open((data && data.portalUrl) || 'https://bank.skillpie.cn', '_blank', 'noopener') },
|
|
736
|
+
style: { fontFamily: "'Frizon','FrizonLocal',sans-serif", fontSize: 14, letterSpacing: 0.5, color: '#111111', position: 'relative', top: -1 },
|
|
680
737
|
}, 'TOKENBANK'),
|
|
681
|
-
h('
|
|
682
|
-
h('svg', { viewBox: '0 0 24 24', width: 12, height: 12, fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' },
|
|
683
|
-
h('path', { d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6' }),
|
|
684
|
-
h('path', { d: 'M15 3h6v6' }),
|
|
685
|
-
h('path', { d: 'M10 14L21 3' }))),
|
|
686
|
-
loggedIn ? h('button', {
|
|
687
|
-
type: 'button', title: pageT('logout'), 'aria-label': pageT('logout'),
|
|
688
|
-
style: sLogoutArm[0]
|
|
689
|
-
? Object.assign({}, buttonStyle, { height: 20, padding: '0 6px', fontSize: 11, color: '#d03050', borderColor: '#d03050', borderWidth: 1, borderStyle: 'solid', marginLeft: 'auto' })
|
|
690
|
-
: { border: 'none', background: 'transparent', cursor: 'pointer', padding: 2, display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: '#d03050', marginLeft: 'auto' },
|
|
691
|
-
onClick: async function () {
|
|
692
|
-
if (!sLogoutArm[0]) {
|
|
693
|
-
sLogoutArm[1](true)
|
|
694
|
-
// 10 秒不确认自动归位,避免按钮一直停在「退出登录?」态
|
|
695
|
-
clearTimeout(sLogoutTimer.ref)
|
|
696
|
-
sLogoutTimer.ref = setTimeout(function () { sLogoutArm[1](false) }, 5000)
|
|
697
|
-
return
|
|
698
|
-
}
|
|
699
|
-
clearTimeout(sLogoutTimer.ref)
|
|
700
|
-
await api('logout').catch(function () {})
|
|
701
|
-
sLogoutArm[1](false)
|
|
702
|
-
st[1](null)
|
|
703
|
-
tbStore.set({ loggedIn: false })
|
|
704
|
-
},
|
|
705
|
-
},
|
|
706
|
-
h('svg', { viewBox: '0 0 24 24', width: 13, height: 13, fill: 'none', stroke: 'currentColor', 'stroke-width': 2, 'stroke-linecap': 'round', 'stroke-linejoin': 'round' },
|
|
707
|
-
h('path', { d: 'M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4' }),
|
|
708
|
-
h('path', { d: 'M16 17l5-5-5-5' }),
|
|
709
|
-
h('path', { d: 'M21 12H9' })))
|
|
710
|
-
: h('button', {
|
|
738
|
+
loggedIn ? h('span', { style: { flex: 1 } }) : h('button', {
|
|
711
739
|
type: 'button',
|
|
712
740
|
style: { fontSize: 10, lineHeight: 1, padding: '3px 7px', borderRadius: 999, border: 'none', cursor: 'pointer', color: '#fff', background: '#ff4f1f', fontWeight: 600, letterSpacing: 0.3, marginLeft: 'auto' },
|
|
713
741
|
onClick: function () { openPanel('register') },
|
|
714
|
-
}, pageT('freeToken'))
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
loggedIn
|
|
721
|
-
? h('div', { style: { display: 'flex', alignItems: 'center', gap: 6 } },
|
|
722
|
-
h('span', { style: { fontSize: 14, fontWeight: 700, fontVariantNumeric: 'tabular-nums', flex: 1 } },
|
|
723
|
-
data && data.account && typeof data.account.balance_nano_usd === 'number'
|
|
724
|
-
? '$' + (data.account.balance_nano_usd / 1e9).toFixed(2) : '—'),
|
|
725
|
-
h('button', { type: 'button', style: Object.assign({}, smallBtn, { borderColor: 'var(--dsw-alias-border-l2, #c9ccd1)' }),
|
|
726
|
-
onClick: function () { openSettingsPage() } }, pageT('depositManage')),
|
|
727
|
-
h('button', { type: 'button', style: Object.assign({}, primaryButtonStyle, { height: 24, padding: '0 8px', fontSize: 12 }),
|
|
728
|
-
onClick: function () { openPanel('login', { startRecharge: true }) } }, pageT('recharge')))
|
|
729
|
-
: null,
|
|
730
|
-
loggedIn
|
|
731
|
-
? flash[0]
|
|
732
|
-
? h('button', { type: 'button', tabIndex: -1, disabled: true,
|
|
733
|
-
style: Object.assign({}, primaryButtonStyle, { height: 28, justifyContent: 'center', width: '100%', cursor: 'default', opacity: 0.9 }),
|
|
734
|
-
}, flash[0].text)
|
|
735
|
-
: h('button', { type: 'button', style: Object.assign({}, primaryButtonStyle, { height: 28, justifyContent: 'center', width: '100%' }),
|
|
736
|
-
onClick: addModels }, pageT('addFreeModels'))
|
|
742
|
+
}, pageT('freeToken')),
|
|
743
|
+
loggedIn ? h('span', { style: { fontSize: 13, fontWeight: 700, fontVariantNumeric: 'tabular-nums' } },
|
|
744
|
+
data && data.account && typeof data.account.balance_nano_usd === 'number'
|
|
745
|
+
? '$' + (data.account.balance_nano_usd / 1e9).toFixed(2) : '—') : null),
|
|
746
|
+
loggedIn && flash[0]
|
|
747
|
+
? h('div', { style: { fontSize: 11, color: 'var(--dsw-alias-label-secondary, #888)', textAlign: 'center' } }, flash[0].text)
|
|
737
748
|
: null,
|
|
738
749
|
)
|
|
739
750
|
}
|
|
@@ -766,6 +777,12 @@ window.__ModuleLoader__.load({
|
|
|
766
777
|
var checkinFlash = React.useState(null) // 签到成功闪现文案(复用获取免费模型按钮样式,2s 回原样)
|
|
767
778
|
var checkin = React.useState({ busy: false, done: false })
|
|
768
779
|
var depTip = React.useState(null) // 说明板块:hover 哪个按钮就显示哪段说明('deposit'|'recharge'|'models')
|
|
780
|
+
var tipSeen = React.useState({}) // 引导提示已看标记:每个按钮登录后仅第一次 hover 展示,后续不再弹
|
|
781
|
+
var showTipOnce = function (key) {
|
|
782
|
+
if (rechargeOpen[0] || tipSeen[0][key]) return
|
|
783
|
+
var next = Object.assign({}, tipSeen[0]); next[key] = true
|
|
784
|
+
tipSeen[1](next); depTip[1](key)
|
|
785
|
+
}
|
|
769
786
|
React.useEffect(function () {
|
|
770
787
|
if (!snap.authOpen) logoutArm[1](false)
|
|
771
788
|
}, [snap.authOpen])
|
|
@@ -796,12 +813,13 @@ window.__ModuleLoader__.load({
|
|
|
796
813
|
var anchor = snap.anchor || { right: window.innerWidth - 16, top: window.innerHeight - 80 }
|
|
797
814
|
var panelWidth = 256
|
|
798
815
|
return h('div', { style: { position: 'fixed', inset: 0, zIndex: 1999 } },
|
|
799
|
-
h('div', { style: { position: '
|
|
816
|
+
h('div', { style: { position: 'fixed', inset: 0, zIndex: -1 }, onClick: close }),
|
|
800
817
|
h('div', {
|
|
801
818
|
style: {
|
|
802
819
|
position: 'fixed', width: panelWidth, maxWidth: 'calc(100vw - 16px)',
|
|
803
|
-
|
|
804
|
-
|
|
820
|
+
right: Math.max(8, window.innerWidth - anchor.right),
|
|
821
|
+
bottom: Math.max(8, window.innerHeight - anchor.top + 8),
|
|
822
|
+
maxHeight: 420, overflow: 'auto',
|
|
805
823
|
/* 与模型选择器菜单(MenuSurface)完全一致的材质 */
|
|
806
824
|
background: 'var(--dsw-menu-surface-fill)',
|
|
807
825
|
backdropFilter: 'var(--dsw-menu-backdrop-filter)',
|
|
@@ -821,18 +839,29 @@ window.__ModuleLoader__.load({
|
|
|
821
839
|
href: portal, target: '_blank', rel: 'noopener noreferrer',
|
|
822
840
|
style: { display: 'inline-flex', alignItems: 'center', cursor: 'pointer', textDecoration: 'none' },
|
|
823
841
|
'aria-label': 'TokenBank',
|
|
824
|
-
}, h('span', { className: 'tb-wordmark', style: { fontFamily: "'Frizon','FrizonLocal',sans-serif", fontSize: 17, fontWeight: 400, letterSpacing: 0.5, lineHeight: 1, color: '#111111' } }, 'TOKENBANK')),
|
|
842
|
+
}, h('span', { className: 'tb-wordmark', style: { fontFamily: "'Frizon','FrizonLocal',sans-serif", fontSize: 17, fontWeight: 400, letterSpacing: 0.5, lineHeight: 1, color: '#111111', position: 'relative', top: -1, left: -1 } }, 'TOKENBANK')),
|
|
843
|
+
// 标题右侧紧贴的「打开外部」灰色小按钮:新开 TokenBank 官网
|
|
844
|
+
h('a', {
|
|
845
|
+
href: portal, target: '_blank', rel: 'noopener noreferrer',
|
|
846
|
+
title: pageT('openSite'), 'aria-label': pageT('openSite'),
|
|
847
|
+
style: { display: 'inline-flex', alignItems: 'center', justifyContent: 'center', width: 17, height: 17, borderRadius: 5, marginLeft: -4, position: 'relative', top: 1, color: 'var(--dsw-alias-label-secondary, #888)', background: 'transparent', border: 'none', outline: 'none', cursor: 'pointer', textDecoration: 'none' },
|
|
848
|
+
},
|
|
849
|
+
h('svg', { width: 13, height: 13, viewBox: '0 0 24 24', fill: 'none', stroke: 'currentColor', strokeWidth: 2.2, strokeLinecap: 'round', strokeLinejoin: 'round' },
|
|
850
|
+
h('path', { d: 'M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6' }),
|
|
851
|
+
h('polyline', { points: '15 3 21 3 21 9' }),
|
|
852
|
+
h('line', { x1: 10, y1: 14, x2: 21, y2: 3 }))),
|
|
825
853
|
h('span', { style: { flex: 1 } }),
|
|
826
854
|
data && data.loggedIn ? h('button', {
|
|
827
855
|
type: 'button', title: pageT('logout'), 'aria-label': pageT('logout'),
|
|
828
856
|
style: logoutArm[0]
|
|
829
857
|
? Object.assign({}, buttonStyle, { height: 24, padding: '0 8px', fontSize: 11, color: '#d03050', borderColor: '#d03050', borderWidth: 1, borderStyle: 'solid' })
|
|
830
|
-
: { height: 24, minWidth: 24, padding: 0, border: 'none', borderRadius: 6, background: 'transparent', cursor: 'pointer', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: '#
|
|
858
|
+
: { height: 24, minWidth: 24, padding: 0, border: 'none', borderRadius: 6, background: 'transparent', cursor: 'pointer', display: 'inline-flex', alignItems: 'center', justifyContent: 'center', color: 'var(--dsw-alias-label-secondary, #999)' },
|
|
831
859
|
onClick: async function () {
|
|
832
860
|
if (!logoutArm[0]) { logoutArm[1](true); return }
|
|
833
861
|
await api('logout').catch(function () {})
|
|
834
862
|
logoutArm[1](false)
|
|
835
863
|
st[1](null)
|
|
864
|
+
try { window.localStorage.removeItem('tb-free-models-used') } catch (e) {}
|
|
836
865
|
tbStore.set({ loggedIn: false })
|
|
837
866
|
},
|
|
838
867
|
},
|
|
@@ -866,8 +895,9 @@ window.__ModuleLoader__.load({
|
|
|
866
895
|
type: 'button', disabled: checkin[0].busy || checkin[0].done,
|
|
867
896
|
style: Object.assign({}, buttonStyle, {
|
|
868
897
|
height: 26, padding: '0 12px', fontSize: 12,
|
|
898
|
+
// 边框色与「托管」按钮同口径(border-l2 浅灰弱化),已签到转绿保留
|
|
869
899
|
color: checkin[0].done ? '#22a04a' : undefined,
|
|
870
|
-
borderColor: checkin[0].done ? '#22a04a' :
|
|
900
|
+
borderColor: checkin[0].done ? '#22a04a' : 'var(--dsw-alias-border-l2, #c9ccd1)',
|
|
871
901
|
}),
|
|
872
902
|
onClick: async function () {
|
|
873
903
|
if (checkin[0].done || checkin[0].busy) return
|
|
@@ -892,14 +922,14 @@ window.__ModuleLoader__.load({
|
|
|
892
922
|
data && data.loggedIn ? h('button', {
|
|
893
923
|
type: 'button', 'aria-label': pageT('depositManageTip'),
|
|
894
924
|
style: Object.assign({}, buttonStyle, { height: 26, padding: '0 12px', fontSize: 12, borderColor: 'var(--dsw-alias-border-l2, #c9ccd1)' }),
|
|
895
|
-
onMouseEnter: function () {
|
|
925
|
+
onMouseEnter: function () { showTipOnce('deposit') },
|
|
896
926
|
onClick: function () { depTip[1](null); tbStore.set({ authOpen: false }); openSettingsPage() },
|
|
897
927
|
}, pageT('depositManage')) : null,
|
|
898
928
|
(checkin[0].done || (data.account && typeof data.account.balance_nano_usd === 'number' && data.account.balance_nano_usd < 1e9))
|
|
899
929
|
? h('button', {
|
|
900
930
|
type: 'button',
|
|
901
931
|
style: Object.assign({}, primaryButtonStyle, { height: 26, padding: '0 12px', fontSize: 12 }),
|
|
902
|
-
onMouseEnter: function () {
|
|
932
|
+
onMouseEnter: function () { showTipOnce('recharge') },
|
|
903
933
|
onClick: function () { depTip[1](null); rechargeOpen[1](function (v) { return !v }) },
|
|
904
934
|
}, pageT('recharge'))
|
|
905
935
|
: null,
|
|
@@ -951,7 +981,7 @@ window.__ModuleLoader__.load({
|
|
|
951
981
|
} : undefined,
|
|
952
982
|
}, checkinFlash[0].text) : h('button', {
|
|
953
983
|
type: 'button', style: Object.assign({}, primaryButtonStyle, { justifyContent: 'center' }),
|
|
954
|
-
onMouseEnter: function () {
|
|
984
|
+
onMouseEnter: function () { showTipOnce('models') },
|
|
955
985
|
onClick: async function () {
|
|
956
986
|
try {
|
|
957
987
|
var models = await api('gateway-models', { accessKey: data.accessKey })
|
|
@@ -959,6 +989,15 @@ window.__ModuleLoader__.load({
|
|
|
959
989
|
await addProviderToModels(runtimeCtx, data.baseURL || portal, { accessKey: data.accessKey, list: list, protocol: models.protocol })
|
|
960
990
|
checkinFlash[1]({ text: pageT('modelLinked').replace('{n}', String(list.length)), models: true })
|
|
961
991
|
window.setTimeout(function () { checkinFlash[1](null) }, 3000)
|
|
992
|
+
// 模型接入成功即关弹窗,自动弹出宿主模型选择器(与签到闪现按钮同款时序)
|
|
993
|
+
tbStore.set({ authOpen: false })
|
|
994
|
+
window.setTimeout(function () {
|
|
995
|
+
var triggers = document.querySelectorAll('button[aria-haspopup="menu"]')
|
|
996
|
+
for (var q = 0; q < triggers.length; q++) {
|
|
997
|
+
var lb = triggers[q].getAttribute('aria-label') || ''
|
|
998
|
+
if (/选择模型|Select model/.test(lb)) { triggers[q].click(); return }
|
|
999
|
+
}
|
|
1000
|
+
}, 80)
|
|
962
1001
|
} catch (err) {
|
|
963
1002
|
tbStore.set({ notify: { kind: 'error', title: String(err.message || err), detail: '' } })
|
|
964
1003
|
}
|
|
@@ -971,6 +1010,8 @@ window.__ModuleLoader__.load({
|
|
|
971
1010
|
onAuthed: async function () {
|
|
972
1011
|
tbStore.set({ authOpen: false })
|
|
973
1012
|
try {
|
|
1013
|
+
var me = await api('status').catch(function () { return null })
|
|
1014
|
+
if (me) tbStore.set({ loggedIn: Boolean(me.loggedIn), portalUrl: me.portalUrl })
|
|
974
1015
|
if (!runtimeCtx.remote || !runtimeCtx.remote.settings) return
|
|
975
1016
|
var fresh = await api('status')
|
|
976
1017
|
if (fresh && fresh.accessKey) {
|
|
@@ -1481,6 +1522,14 @@ window.__ModuleLoader__.load({
|
|
|
1481
1522
|
var wmCss = document.createElement('style')
|
|
1482
1523
|
wmCss.textContent = "@font-face{font-family:'FrizonLocal';src:url(data:font/woff;base64," + FRIZON_WOFF + ") format('woff')}body[data-ds-dark-theme] .tb-wordmark{color:#ffffff!important}"
|
|
1483
1524
|
document.head.appendChild(wmCss)
|
|
1525
|
+
// 入口按钮 hover 形态:灰底 + 箭头反转(与模型选择器 hover 一致)
|
|
1526
|
+
var entryCss = document.createElement('style')
|
|
1527
|
+
entryCss.textContent = '#tb-entry-btn:hover{background:var(--dsw-alias-interactive-bg-hover, rgba(0,0,0,.05))!important;margin:1px 0;height:27px!important}.tb-entry-open .tb-entry-chevron{transition:transform .15s ease;transform:rotate(180deg)}'
|
|
1528
|
+
document.head.appendChild(entryCss)
|
|
1529
|
+
ctx.effect(function () {
|
|
1530
|
+
return function () { if (entryCss.parentNode) entryCss.parentNode.removeChild(entryCss) }
|
|
1531
|
+
}, 'dsh-tokenbank: entry hover style')
|
|
1532
|
+
|
|
1484
1533
|
}
|
|
1485
1534
|
ctx.effect(function () {
|
|
1486
1535
|
return ctx.locale.register(NS, { zh: zh, en: en })
|
|
@@ -1494,15 +1543,13 @@ window.__ModuleLoader__.load({
|
|
|
1494
1543
|
runtimeCtx = ctx
|
|
1495
1544
|
|
|
1496
1545
|
// 输入框工具行、模型选择器左侧的紧凑入口按钮(弹账户/注册窗)
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
// 侧栏底部长驻块(sidebar.footer.action 是 list 槽,渲染为追加项)
|
|
1500
|
-
ctx.slots.inject('sidebar.footer.action', function () {
|
|
1546
|
+
ctx.slots.inject('conversation.input.right', function () {
|
|
1501
1547
|
return ctx.slots.register({
|
|
1502
|
-
name: '
|
|
1503
|
-
id: 'dsh-tokenbank-
|
|
1548
|
+
name: 'conversation.input.right',
|
|
1549
|
+
id: 'dsh-tokenbank-entry',
|
|
1550
|
+
order: 0,
|
|
1504
1551
|
locale: NS,
|
|
1505
|
-
},
|
|
1552
|
+
}, ComposerEntry)
|
|
1506
1553
|
})
|
|
1507
1554
|
|
|
1508
1555
|
// 同一个槽只 inject 一次:多次 inject 会互相覆盖(之前 auth 注册被
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-tokenbank",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.66",
|
|
4
4
|
"description": "DSH 免费模型:一键注册 TokenBank 领免费 APIKey 送 $5 体验金,免费 GLM 模型直接进模型列表;自带余额查询、API Key 密钥托管(临时额度转永久)、每日签到、充值入口(支付宝),获取免费模型无需自建中转。致敬 dsh-our-free-model。官网 https://bank.skillpie.cn",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -48,4 +48,4 @@
|
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|
|
50
50
|
}
|
|
51
|
-
}
|
|
51
|
+
}
|