atualiza versão para 0.0.4; corrige contador de arquivos no progresso do backup e exibição da última versão na aba Sobre

This commit is contained in:
Alexander Sabino
2026-05-09 11:04:42 +01:00
parent 990b0dea4d
commit 971293cacf
6 changed files with 46 additions and 31 deletions
+1 -1
View File
@@ -408,7 +408,7 @@ class BackupService {
if (backupScope === 'volumes') {
pushLog('Contando arquivos para barra de progresso.', 'contando');
const countCmd = `set -eu; TOTAL=0; for p in ${relSourcePaths.map((item) => shellQuote(item)).join(' ')}; do if [ -e \"/$p\" ]; then C=$(find \"/$p\" -type f 2>/dev/null | wc -l | tr -d \" \" ); TOTAL=$((TOTAL + C)); fi; done; echo \"$TOTAL\"`;
const countCmd = `set -eu; TOTAL=0; for p in ${relSourcePaths.map((item) => shellQuote(item)).join(' ')}; do if [ -e \"/$p\" ]; then C=$(find \"/$p\" 2>/dev/null | wc -l | tr -d \" \" ); TOTAL=$((TOTAL + C)); fi; done; echo \"$TOTAL\"`;
const output = await this.dockerService.runContainerCommand(containerId, countCmd);
const parsed = Number(output.split(/\r?\n/).pop());
fileTotal = Number.isFinite(parsed) ? parsed : 0;
+17 -1
View File
@@ -138,7 +138,23 @@ async function main() {
const pkgPath = path.join(process.cwd(), 'package.json');
const pkgRaw = await fs.readFile(pkgPath, 'utf8');
const pkg = JSON.parse(pkgRaw);
response.json({ currentVersion: pkg.version, name: pkg.name || 'dockerbackup' });
const currentVersion = pkg.version;
let latestVersion = null;
try {
const ghRes = await fetch('https://raw.githubusercontent.com/asabino2/dockerbackup/main/package.json', {
headers: { 'User-Agent': 'dockerbackup-app' },
signal: AbortSignal.timeout(8000),
});
if (ghRes.ok) {
const remotePkg = await ghRes.json();
if (remotePkg.version) latestVersion = String(remotePkg.version);
}
} catch {
// Non-fatal: latestVersion stays null
}
response.json({ currentVersion, latestVersion, name: pkg.name || 'dockerbackup' });
} catch (error) {
response.status(500).json({ error: error.message });
}