Normalize to double quotes across all files with Prettier

This commit is contained in:
X4Lo committed 2026-06-21 22:28:08 +01:00
1 parent 73bff72cec
commit a5659cf4c8
190 files changed
+9523 -8859

No files matched your search

+66 -32
View File
@@ -1,20 +1,20 @@
const fs = require('fs');
const path = require('path');
const fs = require("fs");
const path = require("path");
const defaultSettings = {
userDataPath: '',
tmdbApiUrl: '',
tmdbApiKey: '',
frontPort: '',
backPort: '',
portableMode: '',
userDataPath: "",
tmdbApiUrl: "",
tmdbApiKey: "",
frontPort: "",
backPort: "",
portableMode: "",
libraryViewMode: 'grid',
favoritViewMode: 'grid',
watchlistViewMode: 'grid',
CollectionsViewMode: 'grid',
CollectionItemsViewMode: 'grid',
episodesViewMode: 'grid'
libraryViewMode: "grid",
favoritViewMode: "grid",
watchlistViewMode: "grid",
CollectionsViewMode: "grid",
CollectionItemsViewMode: "grid",
episodesViewMode: "grid",
};
class ConfigService {
@@ -31,7 +31,7 @@ class ConfigService {
}
getSettingsFilePath() {
return path.join(this.getUserDataPath(), 'settings.json');
return path.join(this.getUserDataPath(), "settings.json");
}
getSettings() {
@@ -43,19 +43,22 @@ class ConfigService {
const parsedSettings = JSON.parse(settingsData);
return { ...defaultSettings, ...parsedSettings };
} catch (err) {
console.error('Error reading settings file:', err);
console.log('Creating default settings file...');
console.error("Error reading settings file:", err);
console.log("Creating default settings file...");
let newSettingsFile = { ...defaultSettings };
let defaultDataPath = path.join(this.getUserDataPath(), 'data')
let defaultDataPath = path.join(this.getUserDataPath(), "data");
newSettingsFile.userDataPath = defaultDataPath;
newSettingsFile.backPort = 4000;
fs.mkdirSync(defaultDataPath, { recursive: true });
fs.writeFileSync(settingsFilePath, JSON.stringify(newSettingsFile, null, 2));
console.log('Default settings file created.');
fs.writeFileSync(
settingsFilePath,
JSON.stringify(newSettingsFile, null, 2),
);
console.log("Default settings file created.");
return defaultSettings;
}
@@ -65,9 +68,16 @@ class ConfigService {
const settingsFilePath = this.getSettingsFilePath();
const oldSettings = this.getSettings();
let updatedSettings = { ...defaultSettings, ...oldSettings, ...newSettings };
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),
);
}
getMediaFolder() {
@@ -77,14 +87,39 @@ class ConfigService {
const settings = this.getSettings();
const dataPath = settings.userDataPath;
const posterDir = path.join(dataPath, 'images', 'entries', 'posters');
const backdropDir = path.join(dataPath, 'images', 'entries', 'backdrops');
const logoDir = path.join(dataPath, 'images', 'entries', 'logos');
const collectionsPostersDir = path.join(dataPath, 'images', 'collections', 'posters');
const collectionsBackdropsDir = path.join(dataPath, 'images', 'collections', 'backdrops');
const seasonsPostersDir = path.join(dataPath, 'images', 'seasons', 'posters');
const episodesStillsDir = path.join(dataPath, 'images', 'episodes', 'stills');
const peopleProfilesDir = path.join(dataPath, 'images', 'peoples', 'profiles');
const posterDir = path.join(dataPath, "images", "entries", "posters");
const backdropDir = path.join(dataPath, "images", "entries", "backdrops");
const logoDir = path.join(dataPath, "images", "entries", "logos");
const collectionsPostersDir = path.join(
dataPath,
"images",
"collections",
"posters",
);
const collectionsBackdropsDir = path.join(
dataPath,
"images",
"collections",
"backdrops",
);
const seasonsPostersDir = path.join(
dataPath,
"images",
"seasons",
"posters",
);
const episodesStillsDir = path.join(
dataPath,
"images",
"episodes",
"stills",
);
const peopleProfilesDir = path.join(
dataPath,
"images",
"peoples",
"profiles",
);
fs.mkdirSync(posterDir, { recursive: true });
fs.mkdirSync(backdropDir, { recursive: true });
@@ -103,10 +138,9 @@ class ConfigService {
getTmdbApiKey() {
return this.settings.tmdbApiKey;
}
}
// const instance = new ConfigService();
// Object.freeze(instance);
module.exports = new ConfigService();
module.exports = new ConfigService();