release: v1.3.0 — 整站备份恢复、跨后端同步与任务中心
ci / ci (22, ubuntu-latest) (push) Canceled after 0s
GitHub Release / release (push) Canceled after 0s
Publish Docker image / build (linux/amd64, ubuntu-latest, amd64) (push) Canceled after 0s
Publish Docker image / build (linux/arm64, ubuntu-24.04-arm, arm64) (push) Canceled after 0s
Publish Docker image / merge (push) Canceled after 0s

This commit is contained in:
O96u committed 2026-09-07 17:05:12 +08:00
1 parent b05d572221
commit f17d79b236
72 files changed
+4312 -559

No files matched your search

+38
View File
@@ -0,0 +1,38 @@
import { stat } from 'node:fs/promises'
import { join } from 'node:path'
import { getDataDir } from '../data-dir'
import { getImageTotals } from '../image-index'
import { getBackupsDir } from './paths'
export async function getBackupExportEstimate(): Promise<{
imageCount: number
imageBytes: number
databaseBytes: number
totalBytes: number
}> {
const { count, bytes } = getImageTotals()
const databaseBytes = await (async () => {
try {
const dbStat = await stat(join(getDataDir(), 'pichost.db'))
return dbStat.size
} catch {
return 0
}
})()
return {
imageCount: count,
imageBytes: bytes,
databaseBytes,
totalBytes: bytes + databaseBytes
}
}
export async function getAvailableDiskBytes(): Promise<number | null> {
try {
const { statfs } = await import('node:fs/promises')
const stats = await statfs(getBackupsDir())
return Number(stats.bavail) * Number(stats.bsize)
} catch {
return null
}
}