koishi-plugin-fimtale-api 1.0.4 → 1.0.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.
Files changed (2) hide show
  1. package/lib/index.js +10 -31
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -47,7 +47,6 @@ var Config = import_koishi.Schema.object({
47
47
  cookies: import_koishi.Schema.string().role("secret").description("浏览器 Cookie (用于解除安全模式,必填)"),
48
48
  pollInterval: import_koishi.Schema.number().default(60 * 1e3).description("追更轮询间隔(ms)"),
49
49
  autoParseLink: import_koishi.Schema.boolean().default(true).description("自动解析链接为预览卡片"),
50
- // 渲染配置 (标准手机比例)
51
50
  deviceWidth: import_koishi.Schema.number().default(390).description("阅读器渲染宽度(px)"),
52
51
  deviceHeight: import_koishi.Schema.number().default(844).description("阅读器渲染高度(px)"),
53
52
  fontSize: import_koishi.Schema.number().default(20).description("正文字号(px)")
@@ -212,22 +211,23 @@ function apply(ctx, config) {
212
211
  const likes = isChapter && parent ? parent.Upvotes || 0 : info.Upvotes || 0;
213
212
  const html = `<!DOCTYPE html><html><head><style>
214
213
  body { margin: 0; padding: 0; font-family: ${fontStack}; background: transparent; }
215
- .card { width: 620px; height: 360px; background: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); display: flex; overflow: hidden; }
214
+ /* 增加卡片高度到 400px 以容纳副标题,防止内容挤压 */
215
+ .card { width: 620px; height: 400px; background: #fff; border-radius: 16px; box-shadow: 0 10px 30px rgba(0,0,0,0.15); display: flex; overflow: hidden; }
216
216
  .cover { width: 220px; height: 100%; ${bgStyle} background-size: cover; background-position: center; position: relative; flex-shrink: 0; }
217
- .id-tag { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,0.6); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: bold; backdrop-filter: blur(4px); font-family: monospace; }
217
+ /* 更改 ID 字体 */
218
+ .id-tag { position: absolute; top: 12px; left: 12px; background: rgba(0,0,0,0.6); color: #fff; padding: 4px 10px; border-radius: 6px; font-size: 13px; font-weight: bold; backdrop-filter: blur(4px); font-family: "Impact", "Arial Black", sans-serif; letter-spacing: 1px; }
218
219
  .info { flex: 1; padding: 24px; display: flex; flex-direction: column; overflow: hidden; position: relative; }
219
220
 
220
- /* 头部区域优化:增加下划线和间距 */
221
221
  .header-group { flex-shrink: 0; margin-bottom: 16px; border-bottom: 1px dashed #f0f0f0; padding-bottom: 12px; }
222
222
  .title { font-size: 22px; font-weight: 700; color: #333; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; margin-bottom: 4px; }
223
223
  .subtitle { font-size: 15px; color: #555; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; padding-left: 10px; border-left: 3px solid #e91e63; margin-top: 4px; }
224
-
225
- /* 作者栏优化:增加顶部间距,避免紧贴标签 */
226
224
  .author { font-size: 14px; color: #777; margin-top: 10px; font-weight: 400; display:flex; align-items:center; }
227
225
 
228
226
  .tags { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; flex-shrink: 0; }
229
227
  .tag { background: #eff2f5; color: #5c6b7f; padding: 3px 9px; border-radius: 4px; font-size: 11px; font-weight: 500; }
230
- .summary-box { flex: 1; position: relative; overflow: hidden; min-height: 0; }
228
+
229
+ /* 增加底部边距,防止贴到底部线条 */
230
+ .summary-box { flex: 1; position: relative; overflow: hidden; min-height: 0; margin-bottom: 12px; }
231
231
  .summary { font-size: 13px; color: #666; line-height: 1.6; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; padding-bottom: 3px; }
232
232
  .footer { border-top: 1px solid #eee; padding-top: 14px; display: flex; justify-content: space-between; font-size: 12px; color: #888; margin-top: auto; flex-shrink: 0; }
233
233
  .stat b { color: #555; font-weight: bold; margin-right: 2px;}
@@ -245,7 +245,7 @@ function apply(ctx, config) {
245
245
  try {
246
246
  await injectCookies(page);
247
247
  await page.setContent(html);
248
- await page.setViewport({ width: 660, height: 480, deviceScaleFactor: 3 });
248
+ await page.setViewport({ width: 660, height: 400, deviceScaleFactor: 3 });
249
249
  const img = await page.$(".card").then((e) => e.screenshot({ type: "jpeg", quality: 100 }));
250
250
  return img;
251
251
  } finally {
@@ -311,53 +311,32 @@ function apply(ctx, config) {
311
311
  .fixed-header { position: absolute; top: 0; left: 0; width: 100%; height: ${headerHeight}px; border-bottom: 1px solid #d7ccc8; box-sizing: border-box; padding: 0 20px; display: flex; align-items: center; justify-content: space-between; font-size: 12px; color: #8d6e63; background: #f6f4ec; z-index: 5; font-weight: bold; }
312
312
  .fixed-footer { position: absolute; bottom: 0; left: 0; width: 100%; height: ${footerHeight}px; display: flex; align-items: center; justify-content: center; font-size: 12px; color: #aaa; background: #f6f4ec; z-index: 5; }
313
313
  #viewport { position: absolute; top: ${marginTop}px; left: ${paddingX}px; width: ${contentWidth}px; height: ${optimalContentHeight}px; overflow: hidden; }
314
-
315
- #content-scroller {
316
- height: 100%; width: 100%;
317
- column-width: ${contentWidth}px; column-gap: ${columnGap}px; column-fill: auto;
318
- padding: ${paddingY}px 0; box-sizing: border-box;
319
- font-size: ${config.fontSize}px; line-height: ${lineHeightRatio};
320
- text-align: left; /* 关键:左对齐,解决长空格 */
321
- transform: translateX(0); transition: none;
322
- }
323
-
314
+ #content-scroller { height: 100%; width: 100%; column-width: ${contentWidth}px; column-gap: ${columnGap}px; column-fill: auto; padding: ${paddingY}px 0; box-sizing: border-box; font-size: ${config.fontSize}px; line-height: ${lineHeightRatio}; text-align: left; transform: translateX(0); transition: none; }
324
315
  p, div { margin: 0 0 0.2em 0; text-indent: 2em; word-wrap: break-word; overflow-wrap: break-word; }
325
-
326
316
  .align-center { text-align: center !important; text-align-last: center !important; text-indent: 0 !important; margin: 0.8em 0; font-weight: bold; color: #5d4037; }
327
317
  .align-right { text-align: right !important; text-indent: 0 !important; margin-top: 0.5em; color: #666; font-style: italic; }
328
318
  .no-indent { text-indent: 0 !important; }
329
-
330
319
  blockquote { margin: 1em 0.5em; padding-left: 1em; border-left: 4px solid #d7ccc8; color: #666; }
331
320
  blockquote p { text-indent: 0; margin: 0.3em 0; }
332
-
333
321
  ul, ol { margin: 0.5em 0; padding-left: 1.5em; }
334
322
  li { margin-bottom: 0.2em; }
335
-
336
323
  hr { border: 0; height: 1px; background: #d7ccc8; margin: 1.5em 0; }
337
-
338
324
  table { width: 100%; border-collapse: collapse; margin: 1em 0; font-size: 0.9em; }
339
325
  th, td { border: 1px solid #ccc; padding: 4px; text-align: left; }
340
326
  th { background: #eee; font-weight: bold; }
341
-
342
327
  pre { background: #eee; padding: 0.5em; overflow-x: auto; border-radius: 4px; margin: 0.5em 0; }
343
328
  code { font-family: monospace; background: #f0f0f0; padding: 2px 4px; border-radius: 3px; }
344
-
345
329
  s, strike, del { text-decoration: line-through; color: #888; }
346
330
  u { text-decoration: underline; }
347
331
  sup, sub { font-size: 0.75em; line-height: 0; position: relative; vertical-align: baseline; }
348
332
  sup { top: -0.5em; }
349
333
  sub { bottom: -0.25em; }
350
-
351
334
  a { color: #0277bd; text-decoration: none; }
352
-
353
335
  figure.img-box { display: flex; justify-content: center; align-items: center; margin: 0.5em 0; width: 100%; }
354
336
  img { max-width: 100%; height: auto; display: block; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,0.1); }
355
-
356
337
  h1, h2, h3 { font-size: 1.1em; margin: 0.8em 0; color: #5d4037; text-indent: 0; font-weight: bold; text-align: center; text-align-last: center; break-after: avoid; }
357
-
358
338
  strong, b { font-weight: 900; color: #3e2723; }
359
339
  em, i { font-style: italic; }
360
-
361
340
  p:last-child { margin-bottom: 0; }
362
341
  </style></head><body>
363
342
  <div class="fixed-header"><span>${info.Title.substring(0, 12) + (info.Title.length > 12 ? "..." : "")}</span><span>${info.UserName}</span></div>
@@ -424,7 +403,7 @@ function apply(ctx, config) {
424
403
  const nodes = pages.map((buf) => (0, import_koishi.h)("message", import_koishi.h.image(buf, "image/jpeg")));
425
404
  const navs = [];
426
405
  const mainId = res.parent ? res.parent.ID : res.data.ID;
427
- navs.push(`[目录] /ft.info ${mainId}`);
406
+ navs.push(`[首页] /ft.read ${mainId}`);
428
407
  if (res.menu?.length) {
429
408
  const idx = res.menu.findIndex((m) => m.ID.toString() === threadId);
430
409
  if (idx > 0) navs.push(`[上一章] /ft.read ${res.menu[idx - 1].ID}`);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-fimtale-api",
3
3
  "description": "Koishi插件,从fimtale搜索/订阅/随机获取小说/解析链接等",
4
- "version": "1.0.4",
4
+ "version": "1.0.5",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [