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:
parent
990b0dea4d
commit
971293cacf
|
|
@ -22,7 +22,13 @@ Versão atual: **0.0.2**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## <20> Changelog
|
## <20> Changelog### [0.0.4] — Correções de bugs
|
||||||
|
|
||||||
|
#### Corrigido
|
||||||
|
- **Progresso do backup:** contador de arquivos processados ultrapassava o total porque `find -type f` contava apenas arquivos regulares, enquanto o `tar -v` emite uma linha por entrada (incluindo diretórios e symlinks). Corrigido removendo `-type f` do comando `find`.
|
||||||
|
- **Aba Sobre — última versão:** a verificação da versão mais recente era feita no browser, falhando dentro do Docker por restrições de rede/CORS. A requisição foi movida para o backend, que lê o `package.json` diretamente do repositório via `raw.githubusercontent.com`.
|
||||||
|
|
||||||
|
---
|
||||||
### [0.0.3] — Settings, About, i18n e autenticação
|
### [0.0.3] — Settings, About, i18n e autenticação
|
||||||
|
|
||||||
#### Adicionado
|
#### Adicionado
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "dockerbackup-app",
|
"name": "dockerbackup-app",
|
||||||
"version": "0.0.3",
|
"version": "0.0.4",
|
||||||
"description": "Aplicacao web para backup e restauracao de volumes Docker",
|
"description": "Aplicacao web para backup e restauracao de volumes Docker",
|
||||||
"main": "src/server.js",
|
"main": "src/server.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|
|
||||||
|
|
@ -1416,42 +1416,30 @@ async function loadAboutView() {
|
||||||
const updateStatus = document.querySelector('#aboutUpdateStatus');
|
const updateStatus = document.querySelector('#aboutUpdateStatus');
|
||||||
const updateBtn = document.querySelector('#aboutUpdateBtn');
|
const updateBtn = document.querySelector('#aboutUpdateBtn');
|
||||||
|
|
||||||
|
if (latestVerEl) latestVerEl.textContent = t('about.checking');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const about = await api('/api/about');
|
const about = await api('/api/about');
|
||||||
const current = about.currentVersion || '—';
|
const current = about.currentVersion || '—';
|
||||||
if (currentVerEl) currentVerEl.textContent = current;
|
const latest = about.latestVersion || null;
|
||||||
|
|
||||||
// Fetch latest from GitHub
|
if (currentVerEl) currentVerEl.textContent = current;
|
||||||
if (latestVerEl) latestVerEl.textContent = t('about.checking');
|
if (latestVerEl) latestVerEl.textContent = latest || '—';
|
||||||
try {
|
|
||||||
const ghRes = await fetch('https://api.github.com/repos/asabino2/dockerbackup/tags', {
|
|
||||||
headers: { Accept: 'application/vnd.github.v3+json' },
|
|
||||||
});
|
|
||||||
if (ghRes.ok) {
|
|
||||||
const tags = await ghRes.json();
|
|
||||||
const latestTag = tags[0]?.name?.replace(/^v/, '') || null;
|
|
||||||
if (latestVerEl) latestVerEl.textContent = latestTag || '—';
|
|
||||||
|
|
||||||
if (updateWrap) updateWrap.classList.remove('hidden');
|
if (updateWrap) updateWrap.classList.remove('hidden');
|
||||||
if (latestTag && current !== latestTag) {
|
if (latest && current !== latest) {
|
||||||
if (updateStatus) updateStatus.textContent = t('about.updateAvailable');
|
if (updateStatus) updateStatus.textContent = t('about.updateAvailable');
|
||||||
if (updateBtn) updateBtn.classList.remove('hidden');
|
if (updateBtn) updateBtn.classList.remove('hidden');
|
||||||
} else {
|
} else if (latest) {
|
||||||
if (updateStatus) updateStatus.textContent = t('about.upToDate');
|
if (updateStatus) updateStatus.textContent = t('about.upToDate');
|
||||||
if (updateBtn) updateBtn.classList.add('hidden');
|
if (updateBtn) updateBtn.classList.add('hidden');
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (latestVerEl) latestVerEl.textContent = '—';
|
|
||||||
if (updateStatus) updateStatus.textContent = t('about.checkError');
|
if (updateStatus) updateStatus.textContent = t('about.checkError');
|
||||||
if (updateWrap) updateWrap.classList.remove('hidden');
|
if (updateBtn) updateBtn.classList.add('hidden');
|
||||||
}
|
|
||||||
} catch {
|
|
||||||
if (latestVerEl) latestVerEl.textContent = '—';
|
|
||||||
if (updateStatus) updateStatus.textContent = t('about.checkError');
|
|
||||||
if (updateWrap) updateWrap.classList.remove('hidden');
|
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (currentVerEl) currentVerEl.textContent = '—';
|
if (currentVerEl) currentVerEl.textContent = '—';
|
||||||
|
if (latestVerEl) latestVerEl.textContent = '—';
|
||||||
showToast(error.message, true);
|
showToast(error.message, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -282,6 +282,11 @@
|
||||||
<div class="about-changelog">
|
<div class="about-changelog">
|
||||||
<h3 data-i18n="about.changelog">Últimas alterações</h3>
|
<h3 data-i18n="about.changelog">Últimas alterações</h3>
|
||||||
<div id="aboutChangelog" class="changelog-content">
|
<div id="aboutChangelog" class="changelog-content">
|
||||||
|
<h4>0.0.4</h4>
|
||||||
|
<ul>
|
||||||
|
<li>Correção: contador de arquivos no progresso do backup ultrapassava o total</li>
|
||||||
|
<li>Correção: aba Sobre não exibia a última versão disponível</li>
|
||||||
|
</ul>
|
||||||
<h4>0.0.3</h4>
|
<h4>0.0.3</h4>
|
||||||
<ul>
|
<ul>
|
||||||
<li>Suporte a múltiplos idiomas (10 idiomas)</li>
|
<li>Suporte a múltiplos idiomas (10 idiomas)</li>
|
||||||
|
|
|
||||||
|
|
@ -408,7 +408,7 @@ class BackupService {
|
||||||
|
|
||||||
if (backupScope === 'volumes') {
|
if (backupScope === 'volumes') {
|
||||||
pushLog('Contando arquivos para barra de progresso.', 'contando');
|
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 output = await this.dockerService.runContainerCommand(containerId, countCmd);
|
||||||
const parsed = Number(output.split(/\r?\n/).pop());
|
const parsed = Number(output.split(/\r?\n/).pop());
|
||||||
fileTotal = Number.isFinite(parsed) ? parsed : 0;
|
fileTotal = Number.isFinite(parsed) ? parsed : 0;
|
||||||
|
|
|
||||||
|
|
@ -138,7 +138,23 @@ async function main() {
|
||||||
const pkgPath = path.join(process.cwd(), 'package.json');
|
const pkgPath = path.join(process.cwd(), 'package.json');
|
||||||
const pkgRaw = await fs.readFile(pkgPath, 'utf8');
|
const pkgRaw = await fs.readFile(pkgPath, 'utf8');
|
||||||
const pkg = JSON.parse(pkgRaw);
|
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) {
|
} catch (error) {
|
||||||
response.status(500).json({ error: error.message });
|
response.status(500).json({ error: error.message });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue