feat(api): validate plex when settings are saved

This commit is contained in:
sct
2020-09-19 22:13:48 +09:00
parent e0c39aeca1
commit 8f6247d821
7 changed files with 182 additions and 8 deletions

View File

@@ -1,5 +1,6 @@
import fs from 'fs';
import path from 'path';
import { v4 as uuidv4 } from 'uuid';
interface Library {
id: string;
@@ -47,6 +48,7 @@ interface PublicSettings {
}
interface AllSettings {
clientId?: string;
main: MainSettings;
plex: PlexSettings;
radarr: RadarrSettings[];
@@ -122,6 +124,15 @@ class Settings {
this.data.public = data;
}
get clientId(): string {
if (!this.data.clientId) {
this.data.clientId = uuidv4();
this.save();
}
return this.data.clientId;
}
/**
* Settings Load
*