@deepwhale-cn/dsh-douyin-desk 0.2.2 → 0.2.4

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 CHANGED
@@ -22,6 +22,7 @@ window.__ModuleLoader__.load({
22
22
  .dwh-dy-card{border:.5px solid var(--dsw-alias-border-l1);border-radius:14px;background:var(--dsw-alias-bg-base);overflow:hidden;flex:1;min-height:0;display:flex;flex-direction:column}
23
23
  .dwh-dy-hd{display:flex;align-items:center;gap:10px;padding:14px 18px;border-bottom:.5px solid var(--dsw-alias-border-l1);flex-wrap:wrap}
24
24
  .dwh-dy-hd b{font-size:14px;letter-spacing:.2px}
25
+ .dwh-dy-hd .ver{font-size:11.5px;color:var(--dsw-alias-label-secondary);border:.5px solid var(--dsw-alias-border-l2);border-radius:6px;padding:0 6px}
25
26
  .dwh-dy-hd small{color:var(--dsw-alias-label-secondary);font-weight:400;font-size:12px}
26
27
  .dwh-dy-hd .sp{flex:1}
27
28
  .dwh-dy-btn{height:30px;padding:0 13px;border:.5px solid var(--dsw-alias-border-l2);border-radius:9px;background:transparent;color:inherit;font:inherit;font-size:12.5px;cursor:pointer;white-space:nowrap}
@@ -146,7 +147,7 @@ window.__ModuleLoader__.load({
146
147
  root.innerHTML = `
147
148
  <div class="dwh-dy-card">
148
149
  <div class="dwh-dy-hd">
149
- <b>深鲸抖音复盘</b><small class="st">正在读取…</small><span class="sp"></span>
150
+ <b>深鲸抖音复盘</b><small class="ver">v—</small><small class="st">正在读取…</small><span class="sp"></span>
150
151
  <button class="dwh-dy-btn primary" data-act="login" style="display:none">扫码授权</button>
151
152
  <button class="dwh-dy-btn" data-act="csv">导出 CSV</button>
152
153
  <button class="dwh-dy-btn" data-act="report">生成周报</button>
@@ -599,6 +600,16 @@ window.__ModuleLoader__.load({
599
600
  }
600
601
  }
601
602
 
603
+ async function loadVersion() {
604
+ try {
605
+ const meta = await getJson('/douyin-desk/meta');
606
+ const el = root.querySelector('.ver');
607
+ if (el && meta.version) el.textContent = `v${String(meta.version)}`;
608
+ } catch {
609
+ // 版本读不到不影响主流程
610
+ }
611
+ }
612
+
602
613
  async function loadState() {
603
614
  try {
604
615
  const data = await getJson('/douyin-desk/state');
@@ -640,7 +651,7 @@ window.__ModuleLoader__.load({
640
651
  }
641
652
 
642
653
  async function refreshAll() {
643
- await Promise.all([loadState(), loadRows(), loadAnalysis(), loadIdeas(), loadFavorites()]);
654
+ await Promise.all([loadState(), loadRows(), loadAnalysis(), loadIdeas(), loadFavorites(), loadVersion()]);
644
655
  render();
645
656
  }
646
657
 
package/lib/index.js CHANGED
@@ -26,10 +26,20 @@ import {
26
26
  import path from 'node:path';
27
27
  import { readFileSync } from 'node:fs';
28
28
  import { execFile } from 'node:child_process';
29
+ import { fileURLToPath } from 'node:url';
29
30
 
30
31
  export const name = 'douyin-desk';
31
32
  export const inject = ['tools', 'webServer', 'llm'];
32
33
 
34
+ const VERSION = (() => {
35
+ try {
36
+ const pkg = JSON.parse(readFileSync(new URL('../package.json', import.meta.url), 'utf8'));
37
+ return String(pkg.version ?? '');
38
+ } catch {
39
+ return '';
40
+ }
41
+ })();
42
+
33
43
  const TEXT_OUTPUT = {
34
44
  schema: { type: 'string' },
35
45
  render: (_args, value) => [{ type: 'text', text: value }],
@@ -348,6 +358,14 @@ export function apply(ctx, config) {
348
358
  }));
349
359
 
350
360
  // ── 面板路由(同源,只读 + 同步) ──
361
+ ctx.effect(() => ctx.webServer.register({
362
+ kind: 'exact',
363
+ path: '/douyin-desk/meta',
364
+ handler: async (_req, res) => {
365
+ sendJson(res, 200, { ok: true, version: VERSION, name: '深鲸抖音复盘' });
366
+ },
367
+ }));
368
+
351
369
  ctx.effect(() => ctx.webServer.register({
352
370
  kind: 'exact',
353
371
  path: '/douyin-desk/state',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@deepwhale-cn/dsh-douyin-desk",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "深鲸抖音复盘:同步账号作品、文案与收藏到本地,做互动复盘、发布节奏分析、文案库与周报;只读,不发布、不互动。",
5
5
  "license": "MIT",
6
6
  "type": "module",