feat: Docker 独立部署版 v1.1.0 + OCR 图片文字搜索
上游 ZangXincz/FlyPic 已归档停更、飞牛应用商店下架,本提交使其脱离 飞牛应用框架,以普通 Docker 容器继续运行。 - ✨ Docker 独立部署:多阶段 Dockerfile + docker-compose.yml,一键构建 - ✨ OCR 图片内文字搜索:扫描时 tesseract(chi_sim+eng) 提取文字入 ocr_text 列, 搜索同时匹配文件名与图片内容 - 🐛 修复 LibraryService 缺少 logger 引用导致添加素材库 500 - 🐛 移除写权限校验,支持只读挂载素材目录 - 📝 容器内路径与宿主机一致(中文路径直接可用) - 🎨 保持原交互:单击选中、Ctrl/Shift 多选、双击放大 - 🔒 config/(JWT 密钥)加入 gitignore
This commit is contained in:
1 parent
7359937892
commit
d96986ec79
11 files changed
+254
-118
No files matched your search
@@ -10,6 +10,7 @@ const {
|
||||
clearSharpCache
|
||||
} = require('./thumbnail');
|
||||
const scanManager = require('./scanManager');
|
||||
const { extractText } = require('./ocr');
|
||||
const { constants } = require('../src/config');
|
||||
const logger = require('../src/utils/logger');
|
||||
|
||||
@@ -304,6 +305,11 @@ async function processImage(imagePath, libraryPath, db, dryRun = false) {
|
||||
const actualWidth = thumbnails.width || metadata.width;
|
||||
const actualHeight = thumbnails.height || metadata.height;
|
||||
|
||||
// OCR 文字识别(可选:tesseract 失败时返回空字符串,不影响主流程)
|
||||
stepStart = Date.now();
|
||||
const ocrText = await extractText(imagePath);
|
||||
stepTimes.ocr = Date.now() - stepStart;
|
||||
|
||||
const imageData = {
|
||||
path: relativePath.replace(/\\/g, '/'),
|
||||
filename: filename,
|
||||
@@ -317,7 +323,8 @@ async function processImage(imagePath, libraryPath, db, dryRun = false) {
|
||||
modified_at: Math.floor(metadata.modified_at),
|
||||
file_hash: currentHash,
|
||||
thumbnail_path: thumbnails.thumbnail_path,
|
||||
thumbnail_size: thumbnails.thumbnail_size
|
||||
thumbnail_size: thumbnails.thumbnail_size,
|
||||
ocr_text: ocrText
|
||||
};
|
||||
|
||||
if (dryRun) {
|
||||
@@ -336,7 +343,8 @@ async function processImage(imagePath, libraryPath, db, dryRun = false) {
|
||||
`总计${totalTime}ms`,
|
||||
`哈希${stepTimes.hashCalc}ms`,
|
||||
`元数据${stepTimes.metadata}ms`,
|
||||
`缩略图${stepTimes.thumbnail}ms`
|
||||
`缩略图${stepTimes.thumbnail}ms`,
|
||||
`OCR${stepTimes.ocr}ms`
|
||||
];
|
||||
|
||||
// 只有当总耗时超过 500ms 时才输出警告
|
||||
|
||||
Reference in new issue
Block a user