mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 19:36:12 +01:00
beginning of #98, new multistep wizard, db creation after user enters username and password
This commit is contained in:
@@ -1,10 +1,5 @@
|
||||
const repository = require('./repository');
|
||||
const utils = require('./utils');
|
||||
const dateUtils = require('./date_utils');
|
||||
const appInfo = require('./app_info');
|
||||
|
||||
async function getOption(name) {
|
||||
const option = await repository.getOption(name);
|
||||
const option = await require('./repository').getOption(name);
|
||||
|
||||
if (!option) {
|
||||
throw new Error("Option " + name + " doesn't exist");
|
||||
@@ -14,7 +9,7 @@ async function getOption(name) {
|
||||
}
|
||||
|
||||
async function setOption(name, value) {
|
||||
const option = await repository.getOption(name);
|
||||
const option = await require('./repository').getOption(name);
|
||||
|
||||
if (!option) {
|
||||
throw new Error(`Option ${name} doesn't exist`);
|
||||
@@ -36,32 +31,8 @@ async function createOption(name, value, isSynced) {
|
||||
}).save();
|
||||
}
|
||||
|
||||
async function initOptions(startNotePath) {
|
||||
await createOption('documentId', utils.randomSecureToken(16), false);
|
||||
await createOption('documentSecret', utils.randomSecureToken(16), false);
|
||||
|
||||
await createOption('username', '', true);
|
||||
await createOption('passwordVerificationHash', '', true);
|
||||
await createOption('passwordVerificationSalt', '', true);
|
||||
await createOption('passwordDerivedKeySalt', '', true);
|
||||
await createOption('encryptedDataKey', '', true);
|
||||
await createOption('encryptedDataKeyIv', '', true);
|
||||
|
||||
await createOption('startNotePath', startNotePath, false);
|
||||
await createOption('protectedSessionTimeout', 600, true);
|
||||
await createOption('noteRevisionSnapshotTimeInterval', 600, true);
|
||||
await createOption('lastBackupDate', dateUtils.nowDate(), false);
|
||||
await createOption('dbVersion', appInfo.dbVersion, false);
|
||||
|
||||
await createOption('lastSyncedPull', appInfo.dbVersion, false);
|
||||
await createOption('lastSyncedPush', 0, false);
|
||||
|
||||
await createOption('zoomFactor', 1.0, false);
|
||||
await createOption('theme', 'white', false);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
getOption,
|
||||
setOption,
|
||||
initOptions
|
||||
createOption
|
||||
};
|
||||
Reference in New Issue
Block a user