feat(v1.3.0): 图片编辑器(裁剪/旋转/图像大小/调色) + 批量水印 + AI生图 + 收藏体系 + 图片新窗口打开按钮 + 合拼拼图 + 返回顶部

This commit is contained in:
jinghui committed 2026-11-17 23:36:32 +08:00
1 parent e345456abf
commit 94ac94436c
46 files changed
+6521 -114

No files matched your search

+24 -3
View File
@@ -97,6 +97,13 @@ class LibraryDatabase {
// 列已存在,忽略错误
}
// 添加 ocr_done 列(如果不存在):1=已尝试过 OCR(含识别为空的结果),0=待补扫
try {
this.db.exec(`ALTER TABLE images ADD COLUMN ocr_done INTEGER DEFAULT 0`);
} catch (e) {
// 列已存在,忽略错误
}
// Folders table
this.db.exec(`
CREATE TABLE IF NOT EXISTS folders (
@@ -177,8 +184,8 @@ class LibraryDatabase {
insertImage(imageData) {
const stmt = this.db.prepare(`
INSERT OR REPLACE INTO images
(path, filename, folder, size, width, height, format, file_type, created_at, modified_at, file_hash, thumbnail_path, thumbnail_size, indexed_at, ocr_text)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
(path, filename, folder, size, width, height, format, file_type, created_at, modified_at, file_hash, thumbnail_path, thumbnail_size, indexed_at, ocr_text, ocr_done)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
`);
const result = stmt.run(
imageData.path,
@@ -195,13 +202,27 @@ class LibraryDatabase {
imageData.thumbnail_path,
imageData.thumbnail_size,
Date.now(),
imageData.ocr_text || ''
imageData.ocr_text || '',
imageData.ocr_done !== undefined ? imageData.ocr_done : 0
);
// 更新数据库修改时间
this.updateLastModified();
return result;
}
/**
* 更新单张图片的 OCR 结果并标记已识别(ocr_done=1)
* 供扫描时对"文件未变化但缺少文字索引"的旧记录补扫使用
*/
updateOcrResult(imagePath, text) {
const stmt = this.db.prepare(
'UPDATE images SET ocr_text = ?, ocr_done = 1 WHERE path = ?'
);
const result = stmt.run(text || '', imagePath);
this.updateLastModified();
return result;
}
getImageByPath(imagePath) {
const stmt = this.db.prepare('SELECT * FROM images WHERE path = ?');
return stmt.get(imagePath);