dsh-pighub 0.9.70 → 0.9.71

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
@@ -834,7 +834,11 @@ window.__ModuleLoader__.load({
834
834
  function Meadow(props) {
835
835
  const theme = (props && props.theme) || CLASSIC_THEME_FALLBACK;
836
836
  const geo = theme.geometry || {};
837
- const G = themeRect(geo.grass, PEN_GRASS);
837
+ /* 草坪**强制使用标准尺寸**(用户口径 2026-11-14:「草坪要强制拉伸到标准尺寸」):
838
+ * 主题只应该换「草地长什么样」,不该改草坪的占地范围——否则换了主题草坪会缩进/错位,
839
+ * 与围栏对不上。所以这里忽略 theme.geometry.grass,一律用 classic 的 PEN_GRASS;
840
+ * 主题若要自带草地贴图,就拉伸铺满这个标准矩形(见下面的 grassImage)。 */
841
+ const G = PEN_GRASS;
838
842
  const I = themeRect(geo.inner, PEN_INNER);
839
843
  const gw = G.x1 - G.x0;
840
844
  const gh = G.y1 - G.y0;
package/lib/index.js CHANGED
@@ -44,7 +44,7 @@ export const inject = ['tools'];
44
44
  import { startDesktopPet, stopDesktopPet, syncDesktopPet, desktopPetState, sayOnDesktop, reclaimStaleSessions } from './desktop-pet.js';
45
45
 
46
46
  const here = dirname(fileURLToPath(import.meta.url));
47
- const VERSION = '0.9.70';
47
+ const VERSION = '0.9.71';
48
48
  /** 桌面桌宠的精灵边长(CSS px 基准,= manifest 里 sizeRatio 的中位数)。 */
49
49
  const DESKTOP_PET_SIZE = 96;
50
50
  /** 全局尺寸系数(用户口径 2026-11-13:「整体猪猪缩小到 75% 大小」)。三层一起乘。 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-pighub",
3
- "version": "0.9.70",
3
+ "version": "0.9.71",
4
4
  "description": "猪猪库 PigHub 的 DeepSeek Harness 插件:侧边栏猪圈面板、每日一只猪猪、重复获得升星、可拖出的置顶桌宠,数据落在 ~/.PigHub。不内嵌任何上游图片。",
5
5
  "type": "module",
6
6
  "main": "./lib/index.js",
@@ -31,5 +31,30 @@ check('normaliseTheme 对坏 geometry 逐字段回落 classic', () => {
31
31
  assert.deepEqual(t2.geometry.inner, [1, 2, 3, 4]);
32
32
  });
33
33
 
34
+ // ---- 目录版准入(用户口径 2026-11-14:非法主题不进列表)----
35
+ import { mkdtempSync, mkdirSync, writeFileSync, rmSync } from 'node:fs';
36
+ import { tmpdir } from 'node:os';
37
+ import { join as pjoin } from 'node:path';
38
+ import { validateThemeDir } from '../lib/themes.js';
39
+
40
+ check('坏 JSON 的主题目录 → 判为非法(不进列表)', () => {
41
+ const dir = mkdtempSync(pjoin(tmpdir(), 'pgtheme-'));
42
+ writeFileSync(pjoin(dir, 'theme.json'), '{ not json');
43
+ const r = validateThemeDir(dir, 'x');
44
+ rmSync(dir, { recursive: true, force: true });
45
+ assert.equal(r.ok, false);
46
+ assert.equal(r.reason, 'theme_json_invalid');
47
+ });
48
+
49
+ check('合法主题目录 → 通过', () => {
50
+ const dir = mkdtempSync(pjoin(tmpdir(), 'pgtheme-'));
51
+ writeFileSync(pjoin(dir, 'theme.json'), JSON.stringify({ name: 'ok', geometry: { grass: [10, 20, 90, 95] } }));
52
+ writeFileSync(pjoin(dir, 'fence.png'), Buffer.from([137, 80, 78, 71]));
53
+ const r = validateThemeDir(dir, 'ok');
54
+ rmSync(dir, { recursive: true, force: true });
55
+ assert.equal(r.ok, true);
56
+ assert.equal(r.name, 'ok');
57
+ });
58
+
34
59
  console.log('\n' + pass + ' PASS / ' + fail + ' FAIL — themes');
35
60
  process.exit(fail === 0 ? 0 : 1);