dsh-project-deck 0.1.4 → 0.1.5

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.
@@ -621,8 +621,7 @@ async function refreshWechat(){
621
621
  const needQr = WX.mode === 'ilink' && !WX.logged && WX.qrUrl;
622
622
  $('wxQrWrap').style.display = needQr ? 'block' : 'none';
623
623
  if (needQr) $('wxQr').src = '/api/wechat/qr.png?t=' + Date.now();
624
- $('wxLoginBtn').style.display = (WX.mode === 'ilink' && !WX.logged) ? '' : 'none';
625
- $('wxLogoutBtn').style.display = (WX.mode === 'ilink' && WX.logged) ? '' : 'none';
624
+ updateWxButtons();
626
625
  if (WX.mode === 'ilink' && !WX.ok) {
627
626
  if (!wxTimer) wxTimer = setInterval(refreshWechat, 2500);
628
627
  } else if (wxTimer) { clearInterval(wxTimer); wxTimer = null; }
@@ -641,6 +640,13 @@ const WX_FIELD = {
641
640
  ilink: null,
642
641
  };
643
642
 
643
+ function updateWxButtons(){
644
+ const type = $('wxType') ? $('wxType').value : 'wxpush';
645
+ const logged = !!(WX && WX.logged);
646
+ $('wxLoginBtn').style.display = (type === 'ilink' && !logged) ? '' : 'none';
647
+ $('wxLogoutBtn').style.display = (type === 'ilink' && logged) ? '' : 'none';
648
+ }
649
+
644
650
  function onWxTypeChange(){
645
651
  const type = $('wxType').value;
646
652
  const f = WX_FIELD[type];
@@ -651,20 +657,23 @@ function onWxTypeChange(){
651
657
  $('wxField').placeholder = f[1];
652
658
  $('wxField').value = cur[f[0]] || '';
653
659
  }
654
- const isIlink = type === 'ilink';
655
- $('wxLoginBtn').style.display = isIlink ? '' : 'none';
656
- $('wxLogoutBtn').style.display = 'none';
660
+ // 内置微信没有额外参数:下拉即切换并落盘,随后出现「连接微信」
661
+ if (!f) applyDelivery({ type });
662
+ }
663
+
664
+ async function applyDelivery(delivery){
665
+ try{
666
+ const r = await api('/api/config', { delivery });
667
+ S = r.state; render(); refreshWechat();
668
+ toast('通知渠道 → ' + delivery.type);
669
+ }catch(e){ toast('切换失败:' + e.message, true); }
657
670
  }
658
671
 
659
672
  async function saveWx(){
660
673
  const type = $('wxType').value;
661
674
  const f = WX_FIELD[type];
662
675
  if (!f) return;
663
- const delivery = { type, [f[0]]: $('wxField').value.trim() };
664
- try{
665
- const r = await api('/api/config', { delivery });
666
- S = r.state; render(); refreshWechat(); toast('通知渠道已更新');
667
- }catch(e){ toast('保存失败:' + e.message, true); }
676
+ await applyDelivery({ type, [f[0]]: $('wxField').value.trim() });
668
677
  }
669
678
 
670
679
  function setFabPos(pos){
@@ -932,6 +941,7 @@ refresh().then(() => {
932
941
  const h = location.hash;
933
942
  if (h.startsWith('#p=')) openDetail(decodeURIComponent(h.slice(3)));
934
943
  });
944
+ refreshWechat();
935
945
  loadScan();
936
946
  loadImages();
937
947
  setInterval(tick, 1000);
package/lib/client.js CHANGED
@@ -135,7 +135,15 @@ window.__ModuleLoader__.load({
135
135
 
136
136
  // 悬浮按钮可拖到页面任意位置(位置持久化)
137
137
  const [pos, setPos] = React.useState(() => {
138
- try { const v = JSON.parse(localStorage.getItem('deck-fab-pos') || 'null'); return v && typeof v.x === 'number' ? v : null } catch { return null }
138
+ try {
139
+ const v = JSON.parse(localStorage.getItem('deck-fab-pos') || 'null')
140
+ if (!v || typeof v.x !== 'number' || typeof v.y !== 'number') return null
141
+ // 旧版本可能存过越界坐标,载入时先夹到可视区域内
142
+ return {
143
+ x: Math.max(6, Math.min(v.x, window.innerWidth - 54)),
144
+ y: Math.max(6, Math.min(v.y, window.innerHeight - 54)),
145
+ }
146
+ } catch { return null }
139
147
  })
140
148
  const [summary, setSummary] = React.useState({ auto: 0, assist: 0, pending: 0 })
141
149
  React.useEffect(() => {
@@ -167,6 +175,12 @@ window.__ModuleLoader__.load({
167
175
  y: Math.max(6, Math.min(y, window.innerHeight - 54)),
168
176
  })
169
177
 
178
+ React.useEffect(() => {
179
+ const onResize = () => setPos((cur) => (cur ? clamp(cur.x, cur.y) : cur))
180
+ window.addEventListener('resize', onResize)
181
+ return () => window.removeEventListener('resize', onResize)
182
+ }, [])
183
+
170
184
  // 用 window 级监听,避免指针移出按钮就丢事件(之前只能按住按钮原地挪)
171
185
  React.useEffect(() => {
172
186
  const onMove = (e) => {
package/lib/index.js CHANGED
@@ -9,7 +9,7 @@ import { join } from 'node:path'
9
9
  export const name = 'dsh-project-deck'
10
10
  export const inject = ['tools']
11
11
 
12
- const PAGENT = join(homedir(), '.person-agent', 'bin', 'deck')
12
+ const PAGENT = join(process.env.DECK_HOME || join(homedir(), '.project-deck'), 'bin', 'deck')
13
13
 
14
14
  function run(args, timeout = 60000) {
15
15
  return new Promise((resolve) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-project-deck",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "DeepSeek Harness plugin: a project deck for your repos — registry, dashboard, scheduled WeChat reports, auto-discovery, multi-node scanning.",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",