dsh-tokenbank 0.1.43 → 0.1.45

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.
Files changed (2) hide show
  1. package/lib/client.js +23 -3
  2. package/package.json +1 -1
package/lib/client.js CHANGED
@@ -28,6 +28,7 @@ window.__ModuleLoader__.load({
28
28
  openPortal: '打开完整门户',
29
29
  openSite: '打开官网',
30
30
  addFreeModels: '获取免费模型',
31
+ modelLinked: '已接入 {n} 个模型,去切换',
31
32
  reload: '刷新',
32
33
  recharge: '充值',
33
34
  depositManage: '托管',
@@ -116,6 +117,7 @@ window.__ModuleLoader__.load({
116
117
  openPortal: 'Open full portal',
117
118
  openSite: 'Open website',
118
119
  addFreeModels: 'Get free models',
120
+ modelLinked: '{n} models linked, tap to switch',
119
121
  reload: 'Reload',
120
122
  recharge: 'Recharge',
121
123
  depositManage: 'Manage keys',
@@ -610,6 +612,7 @@ window.__ModuleLoader__.load({
610
612
  var rechargeOpen = React.useState(false)
611
613
  var logoutArm = React.useState(false)
612
614
  var innerToast = React.useState(null)
615
+ var checkinFlash = React.useState(null) // 签到成功闪现文案(复用获取免费模型按钮样式,2s 回原样)
613
616
  var checkin = React.useState({ busy: false, done: false })
614
617
  React.useEffect(function () {
615
618
  if (!snap.authOpen) logoutArm[1](false)
@@ -715,7 +718,8 @@ window.__ModuleLoader__.load({
715
718
  var fresh = await api('status').catch(function () { return null })
716
719
  if (fresh) { st[1](fresh); tbStore.set({ loggedIn: Boolean(fresh.loggedIn), portalUrl: fresh.portalUrl }) }
717
720
  var streakText = ci.streak > 1 ? '(' + pageT('checkinStreak').replace('{n}', String(ci.streak)) + ')' : ''
718
- innerToast[1]({ text: pageT('checkinOk') + streakText })
721
+ checkinFlash[1]({ text: pageT('checkinOk') + streakText })
722
+ window.setTimeout(function () { checkinFlash[1](null) }, 2000)
719
723
  }
720
724
  } catch (e9) {
721
725
  checkin[1]({ busy: false, done: false })
@@ -774,12 +778,28 @@ window.__ModuleLoader__.load({
774
778
  var models = await api('gateway-models', { accessKey: data.accessKey })
775
779
  var list = Array.isArray(models) ? models : (models.models || models.list || [])
776
780
  await addProviderToModels(runtimeCtx, data.baseURL || portal, { accessKey: data.accessKey, list: list, protocol: models.protocol })
777
- innerToast[1]({ kind: 'models', text: pageT('modelListCount').replace('{n}', String(list.length)) })
781
+ checkinFlash[1]({ text: pageT('modelLinked').replace('{n}', String(list.length)), models: true })
782
+ window.setTimeout(function () { checkinFlash[1](null) }, 2000)
778
783
  } catch (err) {
779
784
  tbStore.set({ notify: { kind: 'error', title: String(err.message || err), detail: '' } })
780
785
  }
781
786
  },
782
- }, pageT('addFreeModels')) : null,
787
+ }, pageT('addFreeModels'))
788
+ : checkinFlash[0] ? h('button', {
789
+ type: 'button', tabIndex: -1,
790
+ style: Object.assign({}, primaryButtonStyle, { justifyContent: 'center', cursor: checkinFlash[0].models ? 'pointer' : 'default', opacity: 0.9 }),
791
+ onClick: checkinFlash[0].models ? function () {
792
+ checkinFlash[1](null)
793
+ tbStore.set({ authOpen: false })
794
+ window.setTimeout(function () {
795
+ var triggers = document.querySelectorAll('button[aria-haspopup="menu"]')
796
+ for (var q = 0; q < triggers.length; q++) {
797
+ var lb = triggers[q].getAttribute('aria-label') || ''
798
+ if (/选择模型|Select model/.test(lb)) { triggers[q].click(); return }
799
+ }
800
+ }, 80)
801
+ } : undefined,
802
+ }, checkinFlash[0].text) : null,
783
803
  )
784
804
  : h(AuthCard, {
785
805
  mode: snap.authMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tokenbank",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
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",