moved instanceName to index.ejs

This commit is contained in:
azivner 2018-04-02 21:34:28 -04:00
parent 26e4ad9bf9
commit 429d3f518e
5 changed files with 10 additions and 9 deletions

View file

@ -370,7 +370,6 @@ function getNotePathFromAddress() {
async function loadTree() {
const resp = await server.get('tree');
startNotePath = resp.start_note_path;
window.glob.instanceName = resp.instanceName;
if (document.location.hash) {
startNotePath = getNotePathFromAddress();

View file

@ -51,10 +51,9 @@ async function getTree() {
});
return {
instanceName: config.General ? config.General.instanceName : null,
start_note_path: await optionService.getOption('start_note_path'),
branches: branches,
notes: notes,
start_note_path: await optionService.getOption('start_note_path')
notes: notes
};
}

View file

@ -3,11 +3,13 @@
const sourceIdService = require('../services/source_id');
const sql = require('../services/sql');
const labelService = require('../services/labels');
const config = require('../services/config');
async function index(req, res) {
res.render('index', {
sourceId: await sourceIdService.generateSourceId(),
maxSyncIdAtLoad: await sql.getValue("SELECT MAX(id) FROM sync"),
instanceName: config.General ? config.General.instanceName : null,
appCss: await getAppCss()
});
}

View file

@ -31,15 +31,15 @@ async function replace(table_name, rec) {
}
async function beginTransaction() {
return await wrap(async db => db.run("BEGIN"));
return await execute("BEGIN");
}
async function commit() {
return await wrap(async db => db.run("COMMIT"));
return await execute("COMMIT");
}
async function rollback() {
return await wrap(async db => db.run("ROLLBACK"));
return await execute("ROLLBACK");
}
async function getRow(query, params = []) {
@ -47,7 +47,7 @@ async function getRow(query, params = []) {
}
async function getRowOrNull(query, params = []) {
const all = await wrap(async db => db.all(query, ...params));
const all = await getRows(query, params);
return all.length > 0 ? all[0] : null;
}

View file

@ -488,7 +488,8 @@
window.glob = {
activeDialog: null,
sourceId: '<%= sourceId %>',
maxSyncIdAtLoad: <%= maxSyncIdAtLoad %>
maxSyncIdAtLoad: <%= maxSyncIdAtLoad %>,
instanceName: '<%= instanceName %>'
};
</script>