pixivflow 3.0.2 → 3.1.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.
- package/dist/commands/TopicCommand.js +41 -9
- package/dist/config/types.d.ts +65 -1
- package/dist/config/types.js +3 -0
- package/dist/config/validation.js +47 -0
- package/dist/domain/media/NovelCoverPolicy.d.ts +28 -0
- package/dist/domain/media/NovelCoverPolicy.js +70 -0
- package/dist/download/DownloadManager.js +5 -1
- package/dist/download/NovelDownloader.d.ts +23 -1
- package/dist/download/NovelDownloader.js +69 -5
- package/dist/download/novelCover.d.ts +29 -5
- package/dist/download/novelCover.js +34 -5
- package/dist/package.json +1 -1
- package/dist/topic/TopicPipeline.d.ts +55 -1
- package/dist/topic/TopicPipeline.js +256 -41
- package/dist/topic/TopicResolver.js +4 -1
- package/dist/topic/TopicTagScorer.js +12 -1
- package/dist/topic/types.d.ts +62 -0
- package/dist/utils/imageDimensions.d.ts +19 -0
- package/dist/utils/imageDimensions.js +95 -0
- package/dist/version.js +1 -1
- package/dist/webui/package.json +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readImageDimensions = readImageDimensions;
|
|
4
|
+
/** JPEG frame markers that carry the sample dimensions (SOF0..SOF15 minus DHT/JPG/DAC). */
|
|
5
|
+
const JPEG_SOF_MARKERS = new Set([
|
|
6
|
+
0xc0, 0xc1, 0xc2, 0xc3, 0xc5, 0xc6, 0xc7, 0xc9, 0xca, 0xcb, 0xcd, 0xce, 0xcf,
|
|
7
|
+
]);
|
|
8
|
+
const PNG_SIGNATURE = [0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a];
|
|
9
|
+
function toBytes(input) {
|
|
10
|
+
if (!input)
|
|
11
|
+
return undefined;
|
|
12
|
+
if (input instanceof Uint8Array)
|
|
13
|
+
return input;
|
|
14
|
+
if (input instanceof ArrayBuffer)
|
|
15
|
+
return new Uint8Array(input);
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
function readPngDimensions(bytes) {
|
|
19
|
+
// signature (8) + chunk length (4) + "IHDR" (4) + width (4) + height (4)
|
|
20
|
+
if (bytes.length < 24)
|
|
21
|
+
return undefined;
|
|
22
|
+
for (let i = 0; i < PNG_SIGNATURE.length; i += 1) {
|
|
23
|
+
if (bytes[i] !== PNG_SIGNATURE[i])
|
|
24
|
+
return undefined;
|
|
25
|
+
}
|
|
26
|
+
if (!(bytes[12] === 0x49 && bytes[13] === 0x48 && bytes[14] === 0x44 && bytes[15] === 0x52)) {
|
|
27
|
+
return undefined;
|
|
28
|
+
}
|
|
29
|
+
const view = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
|
|
30
|
+
return { width: view.getUint32(16), height: view.getUint32(20) };
|
|
31
|
+
}
|
|
32
|
+
function readGifDimensions(bytes) {
|
|
33
|
+
if (bytes.length < 10)
|
|
34
|
+
return undefined;
|
|
35
|
+
const magic = String.fromCharCode(bytes[0], bytes[1], bytes[2]);
|
|
36
|
+
if (magic !== 'GIF')
|
|
37
|
+
return undefined;
|
|
38
|
+
const width = bytes[6] | (bytes[7] << 8);
|
|
39
|
+
const height = bytes[8] | (bytes[9] << 8);
|
|
40
|
+
if (!width || !height)
|
|
41
|
+
return undefined;
|
|
42
|
+
return { width, height };
|
|
43
|
+
}
|
|
44
|
+
function readJpegDimensions(bytes) {
|
|
45
|
+
if (bytes.length < 4 || bytes[0] !== 0xff || bytes[1] !== 0xd8)
|
|
46
|
+
return undefined;
|
|
47
|
+
let offset = 2;
|
|
48
|
+
while (offset + 9 < bytes.length) {
|
|
49
|
+
if (bytes[offset] !== 0xff) {
|
|
50
|
+
offset += 1;
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const marker = bytes[offset + 1];
|
|
54
|
+
// Fill bytes / standalone markers carry no payload.
|
|
55
|
+
if (marker === 0xff) {
|
|
56
|
+
offset += 1;
|
|
57
|
+
continue;
|
|
58
|
+
}
|
|
59
|
+
if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd8)) {
|
|
60
|
+
offset += 2;
|
|
61
|
+
continue;
|
|
62
|
+
}
|
|
63
|
+
if (marker === 0xda)
|
|
64
|
+
return undefined; // entropy-coded data: no frame header left
|
|
65
|
+
const length = (bytes[offset + 2] << 8) | bytes[offset + 3];
|
|
66
|
+
if (length < 2)
|
|
67
|
+
return undefined;
|
|
68
|
+
if (JPEG_SOF_MARKERS.has(marker)) {
|
|
69
|
+
const height = (bytes[offset + 5] << 8) | bytes[offset + 6];
|
|
70
|
+
const width = (bytes[offset + 7] << 8) | bytes[offset + 8];
|
|
71
|
+
if (!width || !height)
|
|
72
|
+
return undefined;
|
|
73
|
+
return { width, height };
|
|
74
|
+
}
|
|
75
|
+
offset += 2 + length;
|
|
76
|
+
}
|
|
77
|
+
return undefined;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Reads the intrinsic canvas of a JPEG, PNG or GIF payload.
|
|
81
|
+
* Returns `undefined` when the format is unknown or the header is incomplete.
|
|
82
|
+
*/
|
|
83
|
+
function readImageDimensions(input) {
|
|
84
|
+
const bytes = toBytes(input);
|
|
85
|
+
if (!bytes || bytes.length < 10)
|
|
86
|
+
return undefined;
|
|
87
|
+
if (bytes[0] === 0xff && bytes[1] === 0xd8)
|
|
88
|
+
return readJpegDimensions(bytes);
|
|
89
|
+
if (bytes[0] === 0x89 && bytes[1] === 0x50)
|
|
90
|
+
return readPngDimensions(bytes);
|
|
91
|
+
if (bytes[0] === 0x47 && bytes[1] === 0x49 && bytes[2] === 0x46)
|
|
92
|
+
return readGifDimensions(bytes);
|
|
93
|
+
return undefined;
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=imageDimensions.js.map
|
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: '3.0
|
|
5
|
+
exports.BUILD = { version: '3.1.0', commit: '583a74c98ef7' };
|
|
6
6
|
//# sourceMappingURL=version.js.map
|
package/dist/webui/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pixivflow",
|
|
3
|
-
"version": "3.0
|
|
3
|
+
"version": "3.1.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",
|