@wahaha216/koishi-plugin-jmcomic 0.2.3 → 0.2.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.
- package/lib/index.js +10 -2
- package/package.json +1 -1
- package/readme.md +19 -4
package/lib/index.js
CHANGED
|
@@ -140,10 +140,16 @@ function sanitizeFileName(fileName) {
|
|
|
140
140
|
sanitizedFileName = sanitizedFileName.replace(/\s+/g, "_");
|
|
141
141
|
sanitizedFileName = sanitizedFileName.replace(/_+/g, "_");
|
|
142
142
|
sanitizedFileName = sanitizedFileName.replace(/^[._]+|[._]+$/g, "");
|
|
143
|
+
let byteLength = Buffer.byteLength(sanitizedFileName, "utf-8");
|
|
144
|
+
while (byteLength > 200) {
|
|
145
|
+
const length = sanitizedFileName.length;
|
|
146
|
+
sanitizedFileName = sanitizedFileName.substring(0, length - 1);
|
|
147
|
+
byteLength = Buffer.byteLength(sanitizedFileName, "utf8");
|
|
148
|
+
}
|
|
143
149
|
if (sanitizedFileName.trim() === "") {
|
|
144
150
|
return "untitled_document";
|
|
145
151
|
}
|
|
146
|
-
return
|
|
152
|
+
return sanitizedFileName;
|
|
147
153
|
}
|
|
148
154
|
__name(sanitizeFileName, "sanitizeFileName");
|
|
149
155
|
async function limitPromiseAll(promises, limit) {
|
|
@@ -992,8 +998,8 @@ var JMAppClient = class _JMAppClient extends JMClientAbstract {
|
|
|
992
998
|
async photoToPdf(photo, pdfName, type = "photo", albumId = "", single = false, password) {
|
|
993
999
|
const images = photo.getImages();
|
|
994
1000
|
const id = photo.getId();
|
|
995
|
-
if (this.config.debug) this.logger.info(`开始生成PDF ${pdfName}.pdf`);
|
|
996
1001
|
pdfName = sanitizeFileName(pdfName);
|
|
1002
|
+
if (this.config.debug) this.logger.info(`开始生成PDF ${pdfName}.pdf`);
|
|
997
1003
|
let path = (0, import_path2.join)(this.root, type, `${id}`);
|
|
998
1004
|
if (type === "album") {
|
|
999
1005
|
path = (0, import_path2.join)(this.root, type, `${albumId}`);
|
|
@@ -1045,6 +1051,7 @@ var JMAppClient = class _JMAppClient extends JMClientAbstract {
|
|
|
1045
1051
|
const id = album.getId();
|
|
1046
1052
|
const series = album.getSeries();
|
|
1047
1053
|
const zipName = sanitizeFileName(album.getName());
|
|
1054
|
+
if (this.config.debug) this.logger.info(`开始生成ZIP ${zipName}.zip`);
|
|
1048
1055
|
const path = (0, import_path2.join)(this.root, "album", `${id}`);
|
|
1049
1056
|
const directorys = [];
|
|
1050
1057
|
if (series.length > 1) {
|
|
@@ -1065,6 +1072,7 @@ var JMAppClient = class _JMAppClient extends JMClientAbstract {
|
|
|
1065
1072
|
async photoToZip(photo, zipName, password, level = 6) {
|
|
1066
1073
|
const id = photo.getId();
|
|
1067
1074
|
zipName = sanitizeFileName(zipName);
|
|
1075
|
+
if (this.config.debug) this.logger.info(`开始生成ZIP ${zipName}.zip`);
|
|
1068
1076
|
const path = (0, import_path2.join)(this.root, "photo", `${id}`);
|
|
1069
1077
|
const zipPath = (0, import_path2.join)(path, `${zipName}.zip`);
|
|
1070
1078
|
await archiverImage(
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -17,10 +17,25 @@ jm queue
|
|
|
17
17
|
|
|
18
18
|
## 更新日志
|
|
19
19
|
|
|
20
|
+
<details>
|
|
21
|
+
<summary>0.2.5</summary>
|
|
22
|
+
|
|
23
|
+
文件名过长时截断至 200 字节
|
|
24
|
+
|
|
25
|
+
</details>
|
|
26
|
+
|
|
27
|
+
<details>
|
|
28
|
+
<summary>0.2.4</summary>
|
|
29
|
+
|
|
30
|
+
1. 调整 debug 日志
|
|
31
|
+
2. 修正文化名返回值
|
|
32
|
+
|
|
33
|
+
</details>
|
|
34
|
+
|
|
20
35
|
<details>
|
|
21
36
|
<summary>0.2.3</summary>
|
|
22
37
|
|
|
23
|
-
1. 将手动路径拼接替换为join
|
|
38
|
+
1. 将手动路径拼接替换为 join
|
|
24
39
|
2. 健壮文件名序列化,尝试修复部分文件名导致无法创建文件
|
|
25
40
|
|
|
26
41
|
</details>
|
|
@@ -28,7 +43,7 @@ jm queue
|
|
|
28
43
|
<details>
|
|
29
44
|
<summary>0.2.2</summary>
|
|
30
45
|
|
|
31
|
-
高度不足图片分割数时输出原图,尝试规避提取图片高度为0的情况
|
|
46
|
+
高度不足图片分割数时输出原图,尝试规避提取图片高度为 0 的情况
|
|
32
47
|
|
|
33
48
|
</details>
|
|
34
49
|
|
|
@@ -44,7 +59,7 @@ jm queue
|
|
|
44
59
|
<summary>0.2.0</summary>
|
|
45
60
|
|
|
46
61
|
1. 简易搜索功能
|
|
47
|
-
2. 修复队列丢失i18n key的问题
|
|
62
|
+
2. 修复队列丢失 i18n key 的问题
|
|
48
63
|
|
|
49
64
|
</details>
|
|
50
65
|
|
|
@@ -63,7 +78,7 @@ jm queue
|
|
|
63
78
|
2. 下载并发与解密并发限制
|
|
64
79
|
3. 修改配置页面顺序、分类
|
|
65
80
|
4. 不再直接暴露变量,改为逐级传递
|
|
66
|
-
5. 统一暴露Error类
|
|
81
|
+
5. 统一暴露 Error 类
|
|
67
82
|
6. 添加域名切换条件
|
|
68
83
|
|
|
69
84
|
</details>
|