mirror of
https://github.com/kopia/kopia.git
synced 2026-03-16 05:09:21 -04:00
* app: added desktop app shell based on Electron that runs in the tray, starts a background kopia server and allows access to the UI * icons: updated icons for the app * htmlui: flexible containers
28 lines
611 B
JavaScript
28 lines
611 B
JavaScript
const { ipcMain } = require('electron');
|
|
|
|
const maxLogLines = 100;
|
|
let serverLog = [];
|
|
|
|
function sendLogsUpdate(sender) {
|
|
sender.send('logs-updated', serverLog.join(''));
|
|
}
|
|
|
|
ipcMain.on('subscribe-to-logs', (event, arg) => {
|
|
sendLogsUpdate(event.sender);
|
|
|
|
ipcMain.addListener('logs-updated-event', () => {
|
|
sendLogsUpdate(event.sender);
|
|
})
|
|
});
|
|
|
|
module.exports = {
|
|
appendToLog(data) {
|
|
const l = serverLog.push(data);
|
|
if (l > maxLogLines) {
|
|
serverLog.splice(0, 1);
|
|
}
|
|
|
|
ipcMain.emit('logs-updated-event');
|
|
console.log(`${data}`);
|
|
}
|
|
} |