mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 04:16:17 +01:00 
			
		
		
		
	refactor(server): typed options
This commit is contained in:
		@@ -1,6 +1,6 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
import optionService from "../../services/options.js";
 | 
			
		||||
import optionService, { OptionNames } from "../../services/options.js";
 | 
			
		||||
import log from "../../services/log.js";
 | 
			
		||||
import searchService from "../../services/search/services/search.js";
 | 
			
		||||
import ValidationError from "../../errors/validation_error.js";
 | 
			
		||||
@@ -79,7 +79,7 @@ function getOptions() {
 | 
			
		||||
 | 
			
		||||
    for (const optionName in optionMap) {
 | 
			
		||||
        if (isAllowed(optionName)) {
 | 
			
		||||
            resultMap[optionName] = optionMap[optionName];
 | 
			
		||||
            resultMap[optionName] = optionMap[optionName as OptionNames];
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -115,7 +115,7 @@ function update(name: string, value: string) {
 | 
			
		||||
        log.info(`Updating option '${name}' to '${value}'`);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    optionService.setOption(name, value);
 | 
			
		||||
    optionService.setOption(name as OptionNames, value);
 | 
			
		||||
 | 
			
		||||
    if (name === "locale") {
 | 
			
		||||
        // This runs asynchronously, so it's not perfect, but it does the trick for now.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user