dsh-tokenbank 0.1.44 → 0.1.46

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 +21 -8
  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',
@@ -716,7 +718,7 @@ window.__ModuleLoader__.load({
716
718
  var fresh = await api('status').catch(function () { return null })
717
719
  if (fresh) { st[1](fresh); tbStore.set({ loggedIn: Boolean(fresh.loggedIn), portalUrl: fresh.portalUrl }) }
718
720
  var streakText = ci.streak > 1 ? '(' + pageT('checkinStreak').replace('{n}', String(ci.streak)) + ')' : ''
719
- checkinFlash[1](pageT('checkinOk') + streakText)
721
+ checkinFlash[1]({ text: pageT('checkinOk') + streakText })
720
722
  window.setTimeout(function () { checkinFlash[1](null) }, 2000)
721
723
  }
722
724
  } catch (e9) {
@@ -769,23 +771,34 @@ window.__ModuleLoader__.load({
769
771
  }, 80)
770
772
  },
771
773
  }, pageT('goSwitch')) : null,
772
- ) : !rechargeOpen[0] ? h('button', {
774
+ ) : !rechargeOpen[0] ? (checkinFlash[0] ? h('button', {
775
+ type: 'button', tabIndex: -1,
776
+ style: Object.assign({}, primaryButtonStyle, { justifyContent: 'center', cursor: checkinFlash[0].models ? 'pointer' : 'default', opacity: 0.9 }),
777
+ onClick: checkinFlash[0].models ? function () {
778
+ checkinFlash[1](null)
779
+ tbStore.set({ authOpen: false })
780
+ window.setTimeout(function () {
781
+ var triggers = document.querySelectorAll('button[aria-haspopup="menu"]')
782
+ for (var q = 0; q < triggers.length; q++) {
783
+ var lb = triggers[q].getAttribute('aria-label') || ''
784
+ if (/选择模型|Select model/.test(lb)) { triggers[q].click(); return }
785
+ }
786
+ }, 80)
787
+ } : undefined,
788
+ }, checkinFlash[0].text) : h('button', {
773
789
  type: 'button', style: Object.assign({}, primaryButtonStyle, { justifyContent: 'center' }),
774
790
  onClick: async function () {
775
791
  try {
776
792
  var models = await api('gateway-models', { accessKey: data.accessKey })
777
793
  var list = Array.isArray(models) ? models : (models.models || models.list || [])
778
794
  await addProviderToModels(runtimeCtx, data.baseURL || portal, { accessKey: data.accessKey, list: list, protocol: models.protocol })
779
- innerToast[1]({ kind: 'models', text: pageT('modelListCount').replace('{n}', String(list.length)) })
795
+ checkinFlash[1]({ text: pageT('modelLinked').replace('{n}', String(list.length)), models: true })
796
+ window.setTimeout(function () { checkinFlash[1](null) }, 2000)
780
797
  } catch (err) {
781
798
  tbStore.set({ notify: { kind: 'error', title: String(err.message || err), detail: '' } })
782
799
  }
783
800
  },
784
- }, pageT('addFreeModels'))
785
- : checkinFlash[0] ? h('button', {
786
- type: 'button', tabIndex: -1,
787
- style: Object.assign({}, primaryButtonStyle, { justifyContent: 'center', cursor: 'default', opacity: 0.85 }),
788
- }, checkinFlash[0]) : null,
801
+ }, pageT('addFreeModels'))) : null,
789
802
  )
790
803
  : h(AuthCard, {
791
804
  mode: snap.authMode,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-tokenbank",
3
- "version": "0.1.44",
3
+ "version": "0.1.46",
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",