pixivflow 2.24.0 → 2.25.0

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.
@@ -185,6 +185,18 @@ class NovelDownloader {
185
185
  logger_1.logger.info(`Novel ${detail.id} inline images: ${assets.filter((a) => a.status === 'downloaded').length}/${assets.length} downloaded`, { novelId: detail.id });
186
186
  }
187
187
  }
188
+ // Rich-media markdown sidecar (RFC 1 Phase 2): same path as the .txt
189
+ // (compat format stays), inline images become relative ![](images/x.jpg)
190
+ // refs so a later TelePress/TelePost phase can render the Telegraph page.
191
+ if (assets.some((a) => a.status === 'downloaded')) {
192
+ try {
193
+ const mdPath = await this.fileService.saveText(`${header}\n${(0, novelMarkers_1.renderNovelMarkdown)(text, assets)}`, fileName.replace(/\.txt$/, '.md'), metadata);
194
+ logger_1.logger.info(`Saved novel ${detail.id} rich-media markdown sidecar`, { filePath: mdPath });
195
+ }
196
+ catch (error) {
197
+ logger_1.logger.warn(`Failed to save rich-media markdown sidecar for novel ${detail.id}: ${error instanceof Error ? error.message : String(error)}`);
198
+ }
199
+ }
188
200
  const pixivMetadata = {
189
201
  pixiv_id: detail.id,
190
202
  title: detail.title,
@@ -51,4 +51,12 @@ export declare function scanNovelMarkers(source: string): NovelMarker[];
51
51
  export declare function extractNovelAssets(text: string, response?: Pick<PixivNovelTextResponse, 'images' | 'illusts'>): NovelAsset[];
52
52
  /** Minimal self-check for the scanner's double-bracket handling. */
53
53
  export declare function demo(): void;
54
+ /**
55
+ * Rich-media Markdown sidecar (RFC 1 Phase 2). Rebuilds the novel body with
56
+ * each downloaded inline resource as a relative `![](images/xxx.jpg)` reference
57
+ * (the `.txt` file remains the authoritative/compat format and its path is
58
+ * unchanged). Markers whose asset is `unavailable`/`failed` are left in the
59
+ * original text so nothing is silently dropped (partial success).
60
+ */
61
+ export declare function renderNovelMarkdown(source: string, assets: NovelAsset[]): string;
54
62
  //# sourceMappingURL=novelMarkers.d.ts.map
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.scanNovelMarkers = scanNovelMarkers;
4
4
  exports.extractNovelAssets = extractNovelAssets;
5
5
  exports.demo = demo;
6
+ exports.renderNovelMarkdown = renderNovelMarkdown;
7
+ const node_path_1 = require("node:path");
6
8
  const linkRegex = /https?:\/\/\S+/;
7
9
  function parseMarker(span) {
8
10
  if (span.startsWith('[newpage]'))
@@ -119,4 +121,24 @@ function demo() {
119
121
  assert(Array.isArray(scanNovelMarkers(s)) && scanNovelMarkers(s).length > 0, 'markers parsed');
120
122
  }
121
123
  }
124
+ /**
125
+ * Rich-media Markdown sidecar (RFC 1 Phase 2). Rebuilds the novel body with
126
+ * each downloaded inline resource as a relative `![](images/xxx.jpg)` reference
127
+ * (the `.txt` file remains the authoritative/compat format and its path is
128
+ * unchanged). Markers whose asset is `unavailable`/`failed` are left in the
129
+ * original text so nothing is silently dropped (partial success).
130
+ */
131
+ function renderNovelMarkdown(source, assets) {
132
+ const downloaded = new Map(assets
133
+ .filter((a) => a.status === 'downloaded' && Boolean(a.localPath))
134
+ .map((a) => [a.marker, a]));
135
+ return scanNovelMarkers(source)
136
+ .map((marker) => {
137
+ if (marker.type === 'text')
138
+ return marker.value;
139
+ const asset = downloaded.get(marker.raw);
140
+ return asset ? `![](images/${(0, node_path_1.basename)(asset.localPath)})` : marker.raw;
141
+ })
142
+ .join('');
143
+ }
122
144
  //# sourceMappingURL=novelMarkers.js.map
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "commonjs",
3
3
  "name": "pixivflow",
4
- "version": "2.24.0",
4
+ "version": "2.25.0",
5
5
  "private": true
6
6
  }
package/dist/version.js CHANGED
@@ -2,5 +2,5 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.BUILD = void 0;
4
4
  // GENERATED by scripts/write-version.js — do not edit manually.
5
- exports.BUILD = { version: '2.24.0', commit: '8c7fa0a4b74b' };
5
+ exports.BUILD = { version: '2.25.0', commit: '532ba3534889' };
6
6
  //# sourceMappingURL=version.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "commonjs",
3
3
  "name": "pixivflow-webui-backend",
4
- "version": "2.24.0",
4
+ "version": "2.25.0",
5
5
  "description": "PixivFlow WebUI Backend - CommonJS module"
6
6
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pixivflow",
3
- "version": "2.24.0",
3
+ "version": "2.25.0",
4
4
  "description": "\ud83c\udfa8 Pixiv \u4e0b\u8f7d\u3001\u7b5b\u9009\u4e0e\u81ea\u52a8\u6536\u96c6\u5de5\u5177 - \u6279\u91cf\u4e0b\u8f7d\u63d2\u753b\u548c\u5c0f\u8bf4\u3001\u6309\u6807\u7b7e/\u70ed\u5ea6/\u65e5\u671f\u7b5b\u9009\u3001\u5b9a\u65f6\u4efb\u52a1\u4e0e\u53ef\u9760 HTTP \u4ea4\u4ed8 | Pixiv downloader and automation toolkit with filtering, scheduling and reliable HTTP delivery",
5
5
  "repository": {
6
6
  "type": "git",