mirror of
https://github.com/asabino2/dockerbackup.git
synced 2026-09-24 06:36:59 +00:00
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:
@@ -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
@@ -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 });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user