pixivflow 2.37.0 → 2.38.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.
@@ -20,11 +20,20 @@ export interface RichNovelPublishOptions {
20
20
  * the caller can skip enrichment with zero behaviour change.
21
21
  */
22
22
  export declare function interpolateEnv(value: string): string;
23
- export declare function findRichNovelSources(artifact: DownloadedArtifact): {
23
+ export interface RichNovelManifestEntry {
24
+ /** Markdown-relative path, e.g. ``images/001.jpg``. */
25
+ local: string;
26
+ /** Original Pixiv CDN source URL (``https://i.pximg.net/...``). */
27
+ source: string;
28
+ }
29
+ export interface RichNovelSources {
24
30
  txtPath: string;
25
31
  mdPath: string;
26
32
  imagePaths: string[];
27
- } | undefined;
33
+ /** Optional Pixiv CDN source map derived from the novel metadata file. */
34
+ manifest: RichNovelManifestEntry[];
35
+ }
36
+ export declare function findRichNovelSources(artifact: DownloadedArtifact): RichNovelSources | undefined;
28
37
  /**
29
38
  * Publish a rich novel (markdown + inline images) to TelePress and return the
30
39
  * Telegraph URL. Client-side only — TelePress owns rendering/Catbox/Telegraph.
@@ -55,6 +55,31 @@ function interpolateEnv(value) {
55
55
  return resolved;
56
56
  });
57
57
  }
58
+ /** Read ``{local, source}`` entries from the novel's metadata sidecar. */
59
+ function readNovelManifest(artifact) {
60
+ const metadataFile = (artifact.cleanupFiles ?? []).find((f) => /\.json$/i.test(f));
61
+ if (!metadataFile || !fs.existsSync(metadataFile))
62
+ return [];
63
+ try {
64
+ const meta = JSON.parse(fs.readFileSync(metadataFile, 'utf8'));
65
+ if (!Array.isArray(meta.assets))
66
+ return [];
67
+ const entries = [];
68
+ for (const asset of meta.assets) {
69
+ if (!asset || asset.status !== 'downloaded' || !asset.url || !asset.localPath)
70
+ continue;
71
+ const source = String(asset.url);
72
+ const localPath = String(asset.localPath);
73
+ if (!source || !localPath)
74
+ continue;
75
+ entries.push({ local: `images/${path.basename(localPath)}`, source });
76
+ }
77
+ return entries;
78
+ }
79
+ catch {
80
+ return [];
81
+ }
82
+ }
58
83
  function findRichNovelSources(artifact) {
59
84
  if (artifact.type !== 'novel')
60
85
  return undefined;
@@ -73,7 +98,12 @@ function findRichNovelSources(artifact) {
73
98
  .map((name) => path.join(imagesDir, name))
74
99
  .sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
75
100
  }
76
- return { txtPath, mdPath, imagePaths };
101
+ return {
102
+ txtPath,
103
+ mdPath,
104
+ imagePaths,
105
+ manifest: readNovelManifest(artifact),
106
+ };
77
107
  }
78
108
  /**
79
109
  * Publish a rich novel (markdown + inline images) to TelePress and return the
@@ -98,6 +128,15 @@ async function publishRichNovelPreview(artifact, options) {
98
128
  `Content-Type: text/markdown\r\n\r\n`));
99
129
  fields.push(await fs.promises.readFile(sources.mdPath));
100
130
  fields.push(Buffer.from('\r\n'));
131
+ // Optional manifest: lets TelePress rewrite Pixiv CDN sources to the media
132
+ // proxy instead of uploading local files to an image host.
133
+ if (sources.manifest.length) {
134
+ fields.push(Buffer.from(`--${boundary}\r\n` +
135
+ `Content-Disposition: form-data; name="manifest"\r\n` +
136
+ `Content-Type: application/json\r\n\r\n`));
137
+ fields.push(Buffer.from(JSON.stringify(sources.manifest)));
138
+ fields.push(Buffer.from('\r\n'));
139
+ }
101
140
  // File parts for each inline image, named with the `images/` prefix so the
102
141
  // relative markdown refs resolve on the receiving side.
103
142
  for (const imagePath of sources.imagePaths) {
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "type": "commonjs",
3
3
  "name": "pixivflow",
4
- "version": "2.37.0",
4
+ "version": "2.38.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.37.0', commit: 'a17343519198' };
5
+ exports.BUILD = { version: '2.38.0', commit: '66e1379b588c' };
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.37.0",
4
+ "version": "2.38.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.37.0",
3
+ "version": "2.38.0",
4
4
  "description": "🎨 Pixiv 下载、筛选与自动收集工具 - 批量下载插画和小说、按标签/热度/日期筛选、定时任务与可靠 HTTP 交付 | Pixiv downloader and automation toolkit with filtering, scheduling and reliable HTTP delivery",
5
5
  "repository": {
6
6
  "type": "git",