|
|
@ -42,11 +42,16 @@ interface MainSettings {
|
|
|
|
apiKey: string;
|
|
|
|
apiKey: string;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
interface PublicSettings {
|
|
|
|
|
|
|
|
initialized: boolean;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
interface AllSettings {
|
|
|
|
interface AllSettings {
|
|
|
|
main: MainSettings;
|
|
|
|
main: MainSettings;
|
|
|
|
plex: PlexSettings;
|
|
|
|
plex: PlexSettings;
|
|
|
|
radarr: RadarrSettings[];
|
|
|
|
radarr: RadarrSettings[];
|
|
|
|
sonarr: SonarrSettings[];
|
|
|
|
sonarr: SonarrSettings[];
|
|
|
|
|
|
|
|
public: PublicSettings;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
const SETTINGS_PATH = path.join(__dirname, '../../config/settings.json');
|
|
|
|
const SETTINGS_PATH = path.join(__dirname, '../../config/settings.json');
|
|
|
@ -68,6 +73,9 @@ class Settings {
|
|
|
|
},
|
|
|
|
},
|
|
|
|
radarr: [],
|
|
|
|
radarr: [],
|
|
|
|
sonarr: [],
|
|
|
|
sonarr: [],
|
|
|
|
|
|
|
|
public: {
|
|
|
|
|
|
|
|
initialized: false,
|
|
|
|
|
|
|
|
},
|
|
|
|
};
|
|
|
|
};
|
|
|
|
if (initialSettings) {
|
|
|
|
if (initialSettings) {
|
|
|
|
Object.assign<AllSettings, AllSettings>(this.data, initialSettings);
|
|
|
|
Object.assign<AllSettings, AllSettings>(this.data, initialSettings);
|
|
|
@ -106,6 +114,14 @@ class Settings {
|
|
|
|
this.data.sonarr = data;
|
|
|
|
this.data.sonarr = data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
get public(): PublicSettings {
|
|
|
|
|
|
|
|
return this.data.public;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
set public(data: PublicSettings) {
|
|
|
|
|
|
|
|
this.data.public = data;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
/**
|
|
|
|
* Settings Load
|
|
|
|
* Settings Load
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -126,7 +142,7 @@ class Settings {
|
|
|
|
const data = fs.readFileSync(SETTINGS_PATH, 'utf-8');
|
|
|
|
const data = fs.readFileSync(SETTINGS_PATH, 'utf-8');
|
|
|
|
|
|
|
|
|
|
|
|
if (data) {
|
|
|
|
if (data) {
|
|
|
|
this.data = JSON.parse(data);
|
|
|
|
this.data = Object.assign(this.data, JSON.parse(data));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return this.data;
|
|
|
|
return this.data;
|
|
|
|
}
|
|
|
|
}
|
|
|
|