Fixed the WIP sub object code
This commit is contained in:
parent
139cf8388c
commit
9bc3bea90d
2 changed files with 48 additions and 44 deletions
|
|
@ -20,7 +20,7 @@ export abstract class APIModel {
|
||||||
abstract getById(id: string): Promise<MediaTypeModel>;
|
abstract getById(id: string): Promise<MediaTypeModel>;
|
||||||
|
|
||||||
hasType(type: MediaType): boolean {
|
hasType(type: MediaType): boolean {
|
||||||
if (this.types.contains(type) && !(this.plugin.settings[((`${this.apiName}"."${type}`)) as keyof MediaDbPluginSettings] === false)) {
|
if (this.types.contains(type) && (Boolean((this.plugin.settings.apiToggle as any)?.[this.apiName]?.[type] as MediaDbPluginSettings) === true || (this.plugin.settings.apiToggle as any)?.[this.apiName]?.[type] as MediaDbPluginSettings === undefined)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,21 +19,23 @@ export interface MediaDbPluginSettings {
|
||||||
openNoteInNewTab: boolean;
|
openNoteInNewTab: boolean;
|
||||||
useDefaultFrontMatter: boolean;
|
useDefaultFrontMatter: boolean;
|
||||||
enableTemplaterIntegration: boolean;
|
enableTemplaterIntegration: boolean;
|
||||||
OMDbAPI: {
|
apiToggle: {
|
||||||
movie: boolean,
|
OMDbAPI: {
|
||||||
series: boolean,
|
movie: boolean;
|
||||||
game: boolean
|
series: boolean;
|
||||||
};
|
game: boolean;
|
||||||
MALAPI: {
|
},
|
||||||
movie: boolean,
|
MALAPI: {
|
||||||
series: boolean
|
movie: boolean;
|
||||||
};
|
series: boolean;
|
||||||
SteamAPI: {
|
},
|
||||||
game: boolean
|
SteamAPI: {
|
||||||
};
|
game: boolean;
|
||||||
MobyGamesAPI: {
|
},
|
||||||
game: boolean
|
MobyGamesAPI: {
|
||||||
};
|
game: boolean;
|
||||||
|
}
|
||||||
|
},
|
||||||
movieTemplate: string;
|
movieTemplate: string;
|
||||||
seriesTemplate: string;
|
seriesTemplate: string;
|
||||||
mangaTemplate: string;
|
mangaTemplate: string;
|
||||||
|
|
@ -83,20 +85,22 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
|
||||||
openNoteInNewTab: true,
|
openNoteInNewTab: true,
|
||||||
useDefaultFrontMatter: true,
|
useDefaultFrontMatter: true,
|
||||||
enableTemplaterIntegration: false,
|
enableTemplaterIntegration: false,
|
||||||
OMDbAPI: {
|
apiToggle: {
|
||||||
movie: true,
|
OMDbAPI: {
|
||||||
game: true,
|
movie: true,
|
||||||
series: true,
|
series: true,
|
||||||
},
|
game: true,
|
||||||
MALAPI: {
|
},
|
||||||
movie: true,
|
MALAPI: {
|
||||||
series: true,
|
movie: true,
|
||||||
},
|
series: true,
|
||||||
SteamAPI: {
|
},
|
||||||
game: true,
|
SteamAPI: {
|
||||||
},
|
game: true,
|
||||||
MobyGamesAPI: {
|
},
|
||||||
game: true,
|
MobyGamesAPI: {
|
||||||
|
game: true,
|
||||||
|
}
|
||||||
},
|
},
|
||||||
movieTemplate: '',
|
movieTemplate: '',
|
||||||
seriesTemplate: '',
|
seriesTemplate: '',
|
||||||
|
|
@ -295,8 +299,8 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
.setName('OMDb API')
|
.setName('OMDb API')
|
||||||
.setDesc('Use OMDb API for movies.')
|
.setDesc('Use OMDb API for movies.')
|
||||||
.addToggle(cb => {
|
.addToggle(cb => {
|
||||||
cb.setValue(this.plugin.settings.OMDbAPI.movie).onChange(data => {
|
cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.movie).onChange(data => {
|
||||||
this.plugin.settings.OMDbAPI.movie = data;
|
this.plugin.settings.apiToggle.OMDbAPI.movie = data;
|
||||||
this.plugin.saveSettings();
|
this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -304,8 +308,8 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
.setName('MAL API')
|
.setName('MAL API')
|
||||||
.setDesc('Use MAL API for movies.')
|
.setDesc('Use MAL API for movies.')
|
||||||
.addToggle(cb => {
|
.addToggle(cb => {
|
||||||
cb.setValue(this.plugin.settings.MALAPI.movie).onChange(data => {
|
cb.setValue(this.plugin.settings.apiToggle.MALAPI.movie).onChange(data => {
|
||||||
this.plugin.settings.MALAPI.movie = data;
|
this.plugin.settings.apiToggle.MALAPI.movie = data;
|
||||||
this.plugin.saveSettings();
|
this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -314,8 +318,8 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
.setName('OMDb API')
|
.setName('OMDb API')
|
||||||
.setDesc('Use OMDb API for series.')
|
.setDesc('Use OMDb API for series.')
|
||||||
.addToggle(cb => {
|
.addToggle(cb => {
|
||||||
cb.setValue(this.plugin.settings.OMDbAPI.series).onChange(data => {
|
cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.series).onChange(data => {
|
||||||
this.plugin.settings.OMDbAPI.series = data;
|
this.plugin.settings.apiToggle.OMDbAPI.series = data;
|
||||||
this.plugin.saveSettings();
|
this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -323,8 +327,8 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
.setName('MAL API')
|
.setName('MAL API')
|
||||||
.setDesc('Use MAL API for series.')
|
.setDesc('Use MAL API for series.')
|
||||||
.addToggle(cb => {
|
.addToggle(cb => {
|
||||||
cb.setValue(this.plugin.settings.MALAPI.series).onChange(data => {
|
cb.setValue(this.plugin.settings.apiToggle.MALAPI.series).onChange(data => {
|
||||||
this.plugin.settings.MALAPI.series = data;
|
this.plugin.settings.apiToggle.MALAPI.series = data;
|
||||||
this.plugin.saveSettings();
|
this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -333,8 +337,8 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
.setName('OMDb API')
|
.setName('OMDb API')
|
||||||
.setDesc('Use OMDb API for games.')
|
.setDesc('Use OMDb API for games.')
|
||||||
.addToggle(cb => {
|
.addToggle(cb => {
|
||||||
cb.setValue(this.plugin.settings.OMDbAPI.game).onChange(data => {
|
cb.setValue(this.plugin.settings.apiToggle.OMDbAPI.game).onChange(data => {
|
||||||
this.plugin.settings.OMDbAPI.game = data;
|
this.plugin.settings.apiToggle.OMDbAPI.game = data;
|
||||||
this.plugin.saveSettings();
|
this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -342,8 +346,8 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
.setName('Steam API')
|
.setName('Steam API')
|
||||||
.setDesc('Use OMDb API for games.')
|
.setDesc('Use OMDb API for games.')
|
||||||
.addToggle(cb => {
|
.addToggle(cb => {
|
||||||
cb.setValue(this.plugin.settings.SteamAPI.game).onChange(data => {
|
cb.setValue(this.plugin.settings.apiToggle.SteamAPI.game).onChange(data => {
|
||||||
this.plugin.settings.SteamAPI.game = data;
|
this.plugin.settings.apiToggle.SteamAPI.game = data;
|
||||||
this.plugin.saveSettings();
|
this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
@ -351,8 +355,8 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
||||||
.setName('MobyGames API')
|
.setName('MobyGames API')
|
||||||
.setDesc('Use MobyGames API for games.')
|
.setDesc('Use MobyGames API for games.')
|
||||||
.addToggle(cb => {
|
.addToggle(cb => {
|
||||||
cb.setValue(this.plugin.settings.MobyGamesAPI.game).onChange(data => {
|
cb.setValue(this.plugin.settings.apiToggle.MobyGamesAPI.game).onChange(data => {
|
||||||
this.plugin.settings.MobyGamesAPI.game = data;
|
this.plugin.settings.apiToggle.MobyGamesAPI.game = data;
|
||||||
this.plugin.saveSettings();
|
this.plugin.saveSettings();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue