mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
electron fixes
This commit is contained in:
parent
98f80998b9
commit
e827ddffb9
@ -1,20 +1,19 @@
|
|||||||
import server from './services/server.js';
|
import server from './services/server.js';
|
||||||
|
|
||||||
$(document).ready(() => {
|
$(document).ready(async () => {
|
||||||
server.get('migration').then(result => {
|
const {appDbVersion, dbVersion} = await server.get('migration');
|
||||||
const appDbVersion = result.app_dbVersion;
|
|
||||||
const dbVersion = result.dbVersion;
|
|
||||||
|
|
||||||
if (appDbVersion === dbVersion) {
|
console.log("HI", {appDbVersion, dbVersion});
|
||||||
$("#up-to-date").show();
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$("#need-to-migrate").show();
|
|
||||||
|
|
||||||
$("#app-db-version").html(appDbVersion);
|
if (appDbVersion === dbVersion) {
|
||||||
$("#db-version").html(dbVersion);
|
$("#up-to-date").show();
|
||||||
}
|
}
|
||||||
});
|
else {
|
||||||
|
$("#need-to-migrate").show();
|
||||||
|
|
||||||
|
$("#app-db-version").html(appDbVersion);
|
||||||
|
$("#db-version").html(dbVersion);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#run-migration").click(async () => {
|
$("#run-migration").click(async () => {
|
||||||
@ -37,4 +36,11 @@ $("#run-migration").click(async () => {
|
|||||||
|
|
||||||
$("#migration-table").append(row);
|
$("#migration-table").append(row);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
// copy of this shortcut to be able to debug migration problems
|
||||||
|
$(document).bind('keydown', 'ctrl+shift+i', () => {
|
||||||
|
require('electron').remote.getCurrentWindow().toggleDevTools();
|
||||||
|
|
||||||
|
return false;
|
||||||
});
|
});
|
@ -100,7 +100,7 @@ setTimeout(() => {
|
|||||||
lastSyncId: lastSyncId
|
lastSyncId: lastSyncId
|
||||||
}));
|
}));
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}, 1000);
|
}, 0);
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
logError,
|
logError,
|
||||||
|
@ -85,19 +85,17 @@ async function ajax(url, method, data) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(() => {
|
if (utils.isElectron()) {
|
||||||
if (utils.isElectron()) {
|
const ipc = require('electron').ipcRenderer;
|
||||||
const ipc = require('electron').ipcRenderer;
|
|
||||||
|
|
||||||
ipc.on('server-response', (event, arg) => {
|
ipc.on('server-response', (event, arg) => {
|
||||||
console.log(utils.now(), "Response #" + arg.requestId + ": " + arg.statusCode);
|
console.log(utils.now(), "Response #" + arg.requestId + ": " + arg.statusCode);
|
||||||
|
|
||||||
reqResolves[arg.requestId](arg.body);
|
reqResolves[arg.requestId](arg.body);
|
||||||
|
|
||||||
delete reqResolves[arg.requestId];
|
delete reqResolves[arg.requestId];
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, 100);
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
get,
|
get,
|
||||||
|
@ -7,7 +7,7 @@ const appInfo = require('../../services/app_info');
|
|||||||
async function getMigrationInfo() {
|
async function getMigrationInfo() {
|
||||||
return {
|
return {
|
||||||
dbVersion: parseInt(await optionService.getOption('dbVersion')),
|
dbVersion: parseInt(await optionService.getOption('dbVersion')),
|
||||||
app_dbVersion: appInfo.dbVersion
|
appDbVersion: appInfo.dbVersion
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ function init(app) {
|
|||||||
|
|
||||||
res.status = function(statusCode) {
|
res.status = function(statusCode) {
|
||||||
res.statusCode = statusCode;
|
res.statusCode = statusCode;
|
||||||
|
return res;
|
||||||
};
|
};
|
||||||
|
|
||||||
res.send = function(obj) {
|
res.send = function(obj) {
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
const scriptService = require('./script');
|
const scriptService = require('./script');
|
||||||
const repository = require('./repository');
|
const repository = require('./repository');
|
||||||
const cls = require('./cls');
|
const cls = require('./cls');
|
||||||
|
const sqlInit = require('./sql_init');
|
||||||
|
|
||||||
async function runNotesWithLabel(runAttrValue) {
|
async function runNotesWithLabel(runAttrValue) {
|
||||||
const notes = await repository.getEntities(`
|
const notes = await repository.getEntities(`
|
||||||
@ -19,8 +20,10 @@ async function runNotesWithLabel(runAttrValue) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000);
|
sqlInit.dbReady.then(() => {
|
||||||
|
setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000);
|
||||||
|
|
||||||
setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000);
|
setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000);
|
||||||
|
|
||||||
setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000);
|
setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000);
|
||||||
|
});
|
4
src/www
4
src/www
@ -18,8 +18,6 @@ const log = require('./services/log');
|
|||||||
const appInfo = require('./services/app_info');
|
const appInfo = require('./services/app_info');
|
||||||
const messagingService = require('./services/messaging');
|
const messagingService = require('./services/messaging');
|
||||||
const utils = require('./services/utils');
|
const utils = require('./services/utils');
|
||||||
const sql = require('./services/sql');
|
|
||||||
const sqlInit = require('./services/sql_init');
|
|
||||||
|
|
||||||
const port = normalizePort(config['Network']['port'] || '3000');
|
const port = normalizePort(config['Network']['port'] || '3000');
|
||||||
app.set('port', port);
|
app.set('port', port);
|
||||||
@ -56,7 +54,7 @@ httpServer.listen(port);
|
|||||||
httpServer.on('error', onError);
|
httpServer.on('error', onError);
|
||||||
httpServer.on('listening', onListening);
|
httpServer.on('listening', onListening);
|
||||||
|
|
||||||
sqlInit.dbReady.then(() => messagingService.init(httpServer, sessionParser));
|
messagingService.init(httpServer, sessionParser);
|
||||||
|
|
||||||
if (utils.isElectron()) {
|
if (utils.isElectron()) {
|
||||||
const electronRouting = require('./routes/electron');
|
const electronRouting = require('./routes/electron');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user