add: more settings options

This commit is contained in:
X4Lo committed 2024-06-23 17:01:18 +01:00
1 parent ef444f211d
commit 252f15ffd9
1 file changed
+9 -2
+9 -2
View File
@@ -10,6 +10,12 @@ const defaultSettings = {
frontPort: '', frontPort: '',
backPort: '', backPort: '',
portableMode: '', portableMode: '',
libraryViewMode: '',
favoritViewMode: '',
watchlistViewMode: '',
CollectionsViewMode: '',
CollectionItemsViewMode: '',
}; };
function getUserDataPath() { function getUserDataPath() {
@@ -50,8 +56,9 @@ function getSettings() {
function updateSettings(newSettings) { function updateSettings(newSettings) {
const settingsFilePath = getSettingsFilePath(); const settingsFilePath = getSettingsFilePath();
let updatedSettings = { ...userDataPath, ...newSettings }; const oldSettings = getSettings();
fs.mkdirSync(newSettings.userDataPath, { recursive: true }); // making sure the newly set data path is created before saving the new config let updatedSettings = { ...defaultSettings, ...oldSettings, ...newSettings };
fs.mkdirSync(updatedSettings.userDataPath, { recursive: true }); // making sure the newly set data path is created before saving the new config
fs.writeFileSync(settingsFilePath, JSON.stringify(updatedSettings, null, 2)); fs.writeFileSync(settingsFilePath, JSON.stringify(updatedSettings, null, 2));
} }