1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-11-26 22:41:17 +02:00

Plugins: Fixed saving secure settings to the keychain, and added way to store plugin settings to settings.json

This commit is contained in:
Laurent Cozic
2021-06-19 15:56:37 +01:00
parent b7b12f9369
commit ab9bbcbff2
5 changed files with 66 additions and 22 deletions

View File

@@ -1363,10 +1363,18 @@ class Setting extends BaseModel {
}
// Low-level method to load a setting directly from the database. Should not be used in most cases.
public static async loadOne(key: string) {
public static async loadOne(key: string): Promise<CacheItem> {
if (this.keyStorage(key) === SettingStorage.File) {
const fromFile = await this.fileHandler.load();
return fromFile[key];
return {
key,
value: fromFile[key],
};
} else if (this.settingMetadata(key).secure) {
return {
key,
value: await this.keychainService().password(`setting.${key}`),
};
} else {
return this.modelSelectOne('SELECT * FROM settings WHERE key = ?', [key]);
}