mirror of
https://github.com/hicccc77/WeFlow.git
synced 2026-03-25 07:16:51 +00:00
Revert "修复了图片解密失败的问题"
This commit is contained in:
@@ -744,8 +744,7 @@ export class KeyService {
|
||||
return (
|
||||
existsSync(join(dirPath, 'db_storage')) ||
|
||||
existsSync(join(dirPath, 'FileStorage', 'Image')) ||
|
||||
existsSync(join(dirPath, 'FileStorage', 'Image2')) ||
|
||||
existsSync(join(dirPath, 'msg', 'attach'))
|
||||
existsSync(join(dirPath, 'FileStorage', 'Image2'))
|
||||
)
|
||||
}
|
||||
|
||||
@@ -762,8 +761,8 @@ export class KeyService {
|
||||
private listAccountDirs(rootDir: string): string[] {
|
||||
try {
|
||||
const entries = readdirSync(rootDir)
|
||||
const candidates: { path: string; mtime: number; isAccount: boolean }[] = []
|
||||
|
||||
const high: string[] = []
|
||||
const low: string[] = []
|
||||
for (const entry of entries) {
|
||||
const fullPath = join(rootDir, entry)
|
||||
try {
|
||||
@@ -776,45 +775,15 @@ export class KeyService {
|
||||
continue
|
||||
}
|
||||
|
||||
const isAccount = this.isAccountDir(fullPath)
|
||||
candidates.push({
|
||||
path: fullPath,
|
||||
mtime: this.getDirMtime(fullPath),
|
||||
isAccount
|
||||
})
|
||||
}
|
||||
|
||||
// 优先选择有效账号目录,然后按修改时间从新到旧排序
|
||||
return candidates
|
||||
.sort((a, b) => {
|
||||
if (a.isAccount !== b.isAccount) return a.isAccount ? -1 : 1
|
||||
return b.mtime - a.mtime
|
||||
})
|
||||
.map(c => c.path)
|
||||
} catch {
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
private getDirMtime(dirPath: string): number {
|
||||
try {
|
||||
const stat = statSync(dirPath)
|
||||
let mtime = stat.mtimeMs
|
||||
|
||||
// 检查几个关键子目录的修改时间,以更准确地反映活动状态
|
||||
const subDirs = ['db_storage', 'msg/attach', 'FileStorage/Image']
|
||||
for (const sub of subDirs) {
|
||||
const fullPath = join(dirPath, sub)
|
||||
if (existsSync(fullPath)) {
|
||||
try {
|
||||
mtime = Math.max(mtime, statSync(fullPath).mtimeMs)
|
||||
} catch { }
|
||||
if (this.isAccountDir(fullPath)) {
|
||||
high.push(fullPath)
|
||||
} else {
|
||||
low.push(fullPath)
|
||||
}
|
||||
}
|
||||
|
||||
return mtime
|
||||
return high.length ? high.sort() : low.sort()
|
||||
} catch {
|
||||
return 0
|
||||
return []
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user