mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-11-04 15:11:31 +08:00 
			
		
		
		
	moved instanceName to index.ejs
This commit is contained in:
		
							parent
							
								
									26e4ad9bf9
								
							
						
					
					
						commit
						429d3f518e
					
				@ -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();
 | 
			
		||||
 | 
			
		||||
@ -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
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@ -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()
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -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;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -488,7 +488,8 @@
 | 
			
		||||
      window.glob = {
 | 
			
		||||
          activeDialog: null,
 | 
			
		||||
          sourceId: '<%= sourceId %>',
 | 
			
		||||
          maxSyncIdAtLoad: <%= maxSyncIdAtLoad %>
 | 
			
		||||
          maxSyncIdAtLoad: <%= maxSyncIdAtLoad %>,
 | 
			
		||||
          instanceName: '<%= instanceName %>'
 | 
			
		||||
      };
 | 
			
		||||
    </script>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user