update at 2025-10-09 12:39:24

This commit is contained in:
douboer
2025-10-09 12:39:24 +08:00
parent a891153be0
commit 6f51916b50
44 changed files with 332 additions and 226 deletions

View File

@@ -51,6 +51,7 @@ export class NMPSettings {
sliceImageSavePath: string; // 切图保存路径
sliceImageWidth: number; // 切图宽度(像素)
sliceImageAspectRatio: string; // 横竖比例,格式 "3:4"
xhsPreviewWidth: number; // 小红书预览宽度(像素)
private static instance: NMPSettings;
@@ -100,6 +101,7 @@ export class NMPSettings {
this.sliceImageSavePath = '/Users/gavin/note2mp/images/xhs';
this.sliceImageWidth = 1080;
this.sliceImageAspectRatio = '3:4';
this.xhsPreviewWidth = 540;
}
resetStyelAndHighlight() {
@@ -136,7 +138,8 @@ export class NMPSettings {
batchPublishPresets = [],
sliceImageSavePath,
sliceImageWidth,
sliceImageAspectRatio
sliceImageAspectRatio,
xhsPreviewWidth
} = data;
const settings = NMPSettings.getInstance();
@@ -166,6 +169,9 @@ export class NMPSettings {
if (sliceImageSavePath) settings.sliceImageSavePath = sliceImageSavePath;
if (sliceImageWidth !== undefined && Number.isFinite(sliceImageWidth)) settings.sliceImageWidth = Math.max(100, parseInt(sliceImageWidth));
if (sliceImageAspectRatio) settings.sliceImageAspectRatio = sliceImageAspectRatio;
if (xhsPreviewWidth !== undefined && Number.isFinite(xhsPreviewWidth)) {
settings.xhsPreviewWidth = Math.max(100, parseInt(xhsPreviewWidth));
}
settings.getExpiredDate();
settings.isLoaded = true;
@@ -200,6 +206,7 @@ export class NMPSettings {
'sliceImageSavePath': settings.sliceImageSavePath,
'sliceImageWidth': settings.sliceImageWidth,
'sliceImageAspectRatio': settings.sliceImageAspectRatio,
'xhsPreviewWidth': settings.xhsPreviewWidth,
}
}
@@ -221,4 +228,4 @@ export class NMPSettings {
if (this.expireat == null) return false;
return this.expireat > new Date();
}
}
}