mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2024-12-17 17:20:21 +01:00
core: api to save/get app settings to migrate them as part of the database (#3824)
* rfc: migrate app settings as part of export/import/migration * export/import app settings * test, fix * chat: store app settings in db (#3834) * chat: store app settings in db * add combining with app-defaults * commit schema * test with tweaked settings * remove unused error --------- Co-authored-by: Evgeny Poberezkin <evgeny@poberezkin.com> * remove app settings from export/import * test, more settings --------- Co-authored-by: Alexander Bondarenko <486682+dpwiz@users.noreply.github.com>
This commit is contained in:
committed by
GitHub
parent
b7709c59d3
commit
e37654772f
@@ -68,6 +68,7 @@ import Simplex.Chat.Protocol
|
||||
import Simplex.Chat.Remote
|
||||
import Simplex.Chat.Remote.Types
|
||||
import Simplex.Chat.Store
|
||||
import Simplex.Chat.Store.AppSettings
|
||||
import Simplex.Chat.Store.Connections
|
||||
import Simplex.Chat.Store.Direct
|
||||
import Simplex.Chat.Store.Files
|
||||
@@ -597,6 +598,8 @@ processChatCommand' vr = \case
|
||||
fileErrs <- importArchive cfg
|
||||
setStoreChanged
|
||||
pure $ CRArchiveImported fileErrs
|
||||
APISaveAppSettings as -> withStore' (`saveAppSettings` as) >> ok_
|
||||
APIGetAppSettings platformDefaults -> CRAppSettings <$> withStore' (`getAppSettings` platformDefaults)
|
||||
APIDeleteStorage -> withStoreChanged deleteStorage
|
||||
APIStorageEncryption cfg -> withStoreChanged $ sqlCipherExport cfg
|
||||
TestStorageEncryption key -> sqlCipherTestKey key >> ok_
|
||||
@@ -6469,6 +6472,8 @@ chatCommandP =
|
||||
"/db key " *> (APIStorageEncryption <$> (dbEncryptionConfig <$> dbKeyP <* A.space <*> dbKeyP)),
|
||||
"/db decrypt " *> (APIStorageEncryption . (`dbEncryptionConfig` "") <$> dbKeyP),
|
||||
"/db test key " *> (TestStorageEncryption <$> dbKeyP),
|
||||
"/_save app settings" *> (APISaveAppSettings <$> jsonP),
|
||||
"/_get app settings" *> (APIGetAppSettings <$> optional (A.space *> jsonP)),
|
||||
"/sql chat " *> (ExecChatStoreSQL <$> textP),
|
||||
"/sql agent " *> (ExecAgentStoreSQL <$> textP),
|
||||
"/sql slow" $> SlowSQLQueries,
|
||||
|
||||
Reference in New Issue
Block a user