dsh-line-bot 0.5.3 → 0.5.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.5.4
4
+
5
+ - LINE 不會播放 APNG 動畫(只顯示第一幀),所以 GIF 預設改成靜態 PNG,檔案更小、載入更穩。
6
+ - 面板「表情包」卡新增「GIF 保留 APNG 動畫」開關(預設關閉);打開才會送 APNG。
7
+
3
8
  ## 0.5.3
4
9
 
5
10
  - 表情包改用 Flex Message(hero 圖片+文字),GIF 轉成 APNG 保留動畫;APNG 過大或轉檔失敗才退回靜態 PNG。
package/client.js CHANGED
@@ -298,6 +298,8 @@ window.__ModuleLoader__.load({
298
298
  }
299
299
 
300
300
  // ── 主面板 ─────────────────────────────────────────────────────────────
301
+ const memoCfgApng = (cfgValue) => cfgValue?.apng === true
302
+
301
303
  const ACTION_LABELS = {
302
304
  'meme-stats': '讀取表情包圖庫',
303
305
  start: '啟動',
@@ -1151,6 +1153,7 @@ window.__ModuleLoader__.load({
1151
1153
  ),
1152
1154
  h(Toggle, { checked: memeCfg.enabled !== false, onChange: (value) => update({ stickers: { enabled: value } }), label: '允許角色使用表情包', hint: '關掉後只回文字' }),
1153
1155
  h(Field, { label: '一次最多幾張', hint: 'LINE 一次回覆最多 5 則訊息,圖片也算在內' }, h(Num, { value: memeCfg.maxPerReply, min: 1, max: 3, step: 1, onChange: (value) => update({ stickers: { maxPerReply: value } }) })),
1156
+ h(Toggle, { checked: memoCfgApng(memeCfg), onChange: (value) => update({ stickers: { apng: value } }), label: 'GIF 保留 APNG 動畫', hint: 'LINE 目前不會播放 APNG,只會顯示第一幀;開啟會讓檔案變大' }),
1154
1157
  h('div', { style: S.row },
1155
1158
  h(Btn, { onClick: () => act('meme-stats'), disabled: !!busy }, busy === 'meme-stats' ? '讀取中…' : '重新讀取圖庫'),
1156
1159
  ),
package/lib/config.mjs CHANGED
@@ -115,6 +115,8 @@ export const DEFAULT_CONFIG = {
115
115
  // 角色可以用圖片/表情包回話;圖片由面板上傳,存在 <dataDir>/stickers。
116
116
  enabled: true,
117
117
  maxPerReply: 1,
118
+ // LINE 的圖片訊息不會播放 APNG 動畫,預設只送第一幀(靜態 PNG);要保留 APNG 檔可打開。
119
+ apng: false,
118
120
  },
119
121
  log: {
120
122
  maxLines: 400,
@@ -240,6 +242,7 @@ export function sanitizePatch(current, patch) {
240
242
  const stickers = next.stickers || (next.stickers = {})
241
243
  stickers.enabled = Boolean(stickers.enabled)
242
244
  stickers.maxPerReply = clampInt(stickers.maxPerReply, 1, 3, 1)
245
+ stickers.apng = Boolean(stickers.apng)
243
246
 
244
247
  const nudge = next.nudge
245
248
  nudge.enabled = Boolean(nudge.enabled)
package/lib/host.mjs CHANGED
@@ -39,7 +39,7 @@ const { createStickerStore } = stickersMod
39
39
  const { createMemeSource } = memeSourceMod
40
40
  const { chunkText, clip, inQuietWindow, jsonFail, jsonOk, maskSecret, readJsonBody, safeArray, sleep } = utilMod
41
41
 
42
- export const VERSION = '0.5.3'
42
+ export const VERSION = '0.5.4'
43
43
 
44
44
  // 環境變數提供的 Cloudflare API Token(方便用 shell 注入、不用把 token 寫進設定檔)。
45
45
  // 設定檔裡的 token 優先;兩者都沒有時才用環境變數。
@@ -956,7 +956,9 @@ export async function create({ ctx, config: pluginConfig, logger: upstream }) {
956
956
  else if (ext === '.png') mime = 'image/png'
957
957
  else if (ext === '.gif') {
958
958
  mime = 'image/png'
959
- serve = convertGifToApng(filePath) || convertToPng(filePath)
959
+ serve = store.get().stickers?.apng === true
960
+ ? (convertGifToApng(filePath) || convertToPng(filePath))
961
+ : convertToPng(filePath)
960
962
  }
961
963
  else if (ext === '.webp') {
962
964
  mime = 'image/png'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-line-bot",
3
- "version": "0.5.3",
3
+ "version": "0.5.4",
4
4
  "description": "把 LINE 官方帳號(Messaging API)接進 DeepSeek Harness 的插件:內建 Cloudflare Tunnel、人設選擇(大肥魚或插件自訂)、主動傳訊與完整設定面板。",
5
5
  "type": "module",
6
6
  "main": "index.js",