fix: corrige a tela de logs que ficava vazia ao abrir a tela de configuracao depois da primeira vez

This commit is contained in:
VPS 4 Builder
2026-05-28 03:55:12 +02:00
parent 347b96b1b0
commit 72acf0ebfc
4 changed files with 27 additions and 1 deletions
+17
View File
@@ -46,6 +46,23 @@ document.addEventListener('DOMContentLoaded', async () => {
if (badge) badge.innerText = `Client v${version}`; if (badge) badge.innerText = `Client v${version}`;
} }
if (window.api && window.api.getLogs) {
const logs = await window.api.getLogs();
if (logs && logs.length > 0) {
const terminalLogs = document.getElementById('terminal-logs');
if (terminalLogs) {
terminalLogs.innerHTML = ''; // clear wait message
logs.forEach(log => {
const div = document.createElement('div');
div.className = 'log-line';
div.textContent = log;
terminalLogs.appendChild(div);
});
terminalLogs.scrollTop = terminalLogs.scrollHeight;
}
}
}
loadedConfig = await window.api.getConfig(); loadedConfig = await window.api.getConfig();
// Populate settings form // Populate settings form
+8
View File
@@ -9,6 +9,7 @@ let configWindow = null;
let monitorProcess = null; let monitorProcess = null;
let currentStatus = { connected: false, identified: false }; let currentStatus = { connected: false, identified: false };
let downloadProgress = null; // Variável para controlar o progresso de download let downloadProgress = null; // Variável para controlar o progresso de download
const recentLogs = [];
// ================================================================ // ================================================================
// AUTO-UPDATER CONFIG // AUTO-UPDATER CONFIG
@@ -145,6 +146,9 @@ function startMonitorProcess() {
currentStatus.identified = message.identified; currentStatus.identified = message.identified;
updateTrayMenu(); updateTrayMenu();
} else if (message && message.event === 'log') { } else if (message && message.event === 'log') {
recentLogs.push(message.log);
if (recentLogs.length > 100) recentLogs.shift();
if (configWindow && !configWindow.isDestroyed()) { if (configWindow && !configWindow.isDestroyed()) {
configWindow.webContents.send('new-log', message.log); configWindow.webContents.send('new-log', message.log);
} }
@@ -326,6 +330,10 @@ ipcMain.handle('get-version', () => {
return app.getVersion(); return app.getVersion();
}); });
ipcMain.handle('get-logs', () => {
return recentLogs;
});
ipcMain.handle('save-config', (event, newConfig) => { ipcMain.handle('save-config', (event, newConfig) => {
const success = saveConfig(newConfig); const success = saveConfig(newConfig);
if (success) { if (success) {
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "rx.scoreodonto.com-client", "name": "rx.scoreodonto.com-client",
"version": "1.2.3", "version": "1.2.4",
"author": "ScoreOdonto", "author": "ScoreOdonto",
"description": "Cliente Windows para envio de imagens dentais da ScoreOdonto", "description": "Cliente Windows para envio de imagens dentais da ScoreOdonto",
"main": "index.js", "main": "index.js",
+1
View File
@@ -3,6 +3,7 @@ const { contextBridge, ipcRenderer } = require('electron');
contextBridge.exposeInMainWorld('api', { contextBridge.exposeInMainWorld('api', {
getConfig: () => ipcRenderer.invoke('get-config'), getConfig: () => ipcRenderer.invoke('get-config'),
getVersion: () => ipcRenderer.invoke('get-version'), getVersion: () => ipcRenderer.invoke('get-version'),
getLogs: () => ipcRenderer.invoke('get-logs'),
saveConfig: (config) => ipcRenderer.invoke('save-config', config), saveConfig: (config) => ipcRenderer.invoke('save-config', config),
testServer: (url) => ipcRenderer.invoke('test-server', url), testServer: (url) => ipcRenderer.invoke('test-server', url),
verifyCredentials: (url, email, password, token) => ipcRenderer.invoke('verify-credentials', url, email, password, token), verifyCredentials: (url, email, password, token) => ipcRenderer.invoke('verify-credentials', url, email, password, token),