feat: restrict templater integration behind a setting

This commit is contained in:
Kelvin John Falk Szolnoky 2024-01-24 21:49:14 +01:00
parent 3369a4c6cc
commit 65540b5169
No known key found for this signature in database
GPG key ID: 02BA666D8C0E7E1B
2 changed files with 18 additions and 2 deletions

View file

@ -17,6 +17,7 @@ export interface MediaDbPluginSettings {
customDateFormat: string;
openNoteInNewTab: boolean;
useDefaultFrontMatter: boolean;
enableTemplaterIntegration: boolean;
movieTemplate: string;
seriesTemplate: string;
@ -65,6 +66,7 @@ const DEFAULT_SETTINGS: MediaDbPluginSettings = {
customDateFormat: 'L',
openNoteInNewTab: true,
useDefaultFrontMatter: true,
enableTemplaterIntegration: false,
movieTemplate: '',
seriesTemplate: '',
@ -232,6 +234,18 @@ export class MediaDbSettingTab extends PluginSettingTab {
});
});
new Setting(containerEl)
.setName('Enable Templater integration')
.setDesc(
'Enable integration with the templater plugin, this also needs templater to be installed. Warning: Templater allows you to execute arbitrary JavaScript code and system commands.',
)
.addToggle(cb => {
cb.setValue(this.plugin.settings.enableTemplaterIntegration).onChange(data => {
this.plugin.settings.enableTemplaterIntegration = data;
this.plugin.saveSettings();
});
});
containerEl.createEl('h3', { text: 'New File Location' });
// region new file location
new Setting(containerEl)