fix: 明确图片评论限制 v1.7.7

- 小红书网页版评论框不支持图片(仅App支持),发送失败时页面弹提示(只弹一次)
- 侧边栏图片模式显示橙色警告,引导改用自定义文字/AI模式
This commit is contained in:
88531 committed 2026-10-10 16:01:14 +08:00
1 parent 2e97e62210
commit 85b7d6f762
6 files changed
+28 -13

No files matched your search

+15 -4
View File
@@ -21,6 +21,7 @@ class XHSNoteSaver {
this.customComments = []; // 固定评论池
this.currentCommentIndex = 0; // 当前评论索引
this.currentImageIndex = 0; // 当前图片索引(图片回复模式)
this.imageCommentWarned = false; // 图片失败提示只弹一次
this.init();
}
@@ -1603,9 +1604,19 @@ class XHSNoteSaver {
let sentComment = '';
let sentImage = null;
if (this.commentMode === 'image') {
sentImage = await this.uploadCommentImage();
sentComment = '[图片]';
console.log('评论图片已添加');
try {
sentImage = await this.uploadCommentImage();
sentComment = '[图片]';
console.log('评论图片已添加');
} catch (error) {
console.error('图片评论失败:', error);
// 只提示一次,避免每篇笔记都弹
if (!this.imageCommentWarned) {
this.imageCommentWarned = true;
this.showToast('⚠️ 图片评论发送失败:' + error.message + ';建议切换「自定义文字」或「AI」模式');
}
return; // 跳过本篇
}
} else {
sentComment = await this.inputComment();
console.log('评论已输入');
@@ -1880,7 +1891,7 @@ class XHSNoteSaver {
fileInput = await this.revealCommentFileInput();
}
if (!fileInput) {
throw new Error('未找到评论图片上传入口(小红书页面可能已改版)');
throw new Error('网页版评论框没有图片上传入口(小红书仅手机App支持图片评论)');
}
// 注入文件并触发 change 事件