mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	creating new starting page when creating database
This commit is contained in:
		
							parent
							
								
									6546548848
								
							
						
					
					
						commit
						3789ead2da
					
				@ -28,7 +28,7 @@ async function setOption(optName, optValue) {
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
async function initOptions() {
 | 
			
		||||
async function initOptions(startNoteTreeId) {
 | 
			
		||||
    await setOption('document_id', utils.randomSecureToken(16));
 | 
			
		||||
    await setOption('document_secret', utils.randomSecureToken(16));
 | 
			
		||||
 | 
			
		||||
@ -39,7 +39,7 @@ async function initOptions() {
 | 
			
		||||
    await setOption('encrypted_data_key', '');
 | 
			
		||||
    await setOption('encrypted_data_key_iv', '');
 | 
			
		||||
 | 
			
		||||
    await setOption('start_note_tree_id', '');
 | 
			
		||||
    await setOption('start_note_tree_id', startNoteTreeId);
 | 
			
		||||
    await setOption('protected_session_timeout', 600);
 | 
			
		||||
    await setOption('history_snapshot_time_interval', 600);
 | 
			
		||||
    await setOption('last_backup_date', utils.nowTimestamp());
 | 
			
		||||
 | 
			
		||||
@ -4,6 +4,7 @@ const log = require('./log');
 | 
			
		||||
const dataDir = require('./data_dir');
 | 
			
		||||
const fs = require('fs');
 | 
			
		||||
const sqlite = require('sqlite');
 | 
			
		||||
const utils = require('./utils');
 | 
			
		||||
 | 
			
		||||
async function createConnection() {
 | 
			
		||||
    return await sqlite.open(dataDir.DOCUMENT_PATH, {Promise});
 | 
			
		||||
@ -25,7 +26,28 @@ const dbReady = new Promise((resolve, reject) => {
 | 
			
		||||
            await doInTransaction(async () => {
 | 
			
		||||
                await executeScript(schema);
 | 
			
		||||
 | 
			
		||||
                await require('./options').initOptions();
 | 
			
		||||
                const noteId = utils.newNoteId();
 | 
			
		||||
 | 
			
		||||
                await insert('notes_tree', {
 | 
			
		||||
                    note_tree_id: utils.newNoteTreeId(),
 | 
			
		||||
                    note_id: noteId,
 | 
			
		||||
                    note_pid: 'root',
 | 
			
		||||
                    note_pos: 1,
 | 
			
		||||
                    is_deleted: 0,
 | 
			
		||||
                    date_modified: utils.nowTimestamp()
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                await insert('notes', {
 | 
			
		||||
                    note_id: noteId,
 | 
			
		||||
                    note_title: 'Welcome to Trilium!',
 | 
			
		||||
                    note_text: 'Text',
 | 
			
		||||
                    is_protected: 0,
 | 
			
		||||
                    is_deleted: 0,
 | 
			
		||||
                    date_created: utils.nowTimestamp(),
 | 
			
		||||
                    date_modified: utils.nowTimestamp()
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                await require('./options').initOptions(noteId);
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            // we don't resolve dbReady promise because user needs to setup the username and password to initialize
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user