From 50e84fc2d500c5e263abff7457bf3cc2b67f154e Mon Sep 17 00:00:00 2001 From: advplyr Date: Sun, 22 Dec 2024 15:15:56 -0600 Subject: [PATCH] Update PluginManager to singleton, update PluginContext, support prompt object in plugin extension --- client/components/prompt/Confirm.vue | 36 +++++++++++++++++-- client/pages/config/plugins/_id.vue | 12 +++++-- client/pages/config/plugins/index.vue | 12 ++++--- client/pages/item/_id/index.vue | 24 ++++++++++++- server/Auth.js | 12 ++++++- server/Server.js | 4 +-- server/controllers/LibraryController.js | 5 +-- server/controllers/LibraryItemController.js | 7 ++-- server/controllers/PodcastController.js | 21 +++++------ server/managers/CronManager.js | 9 +++-- server/managers/PluginManager.js | 11 +++++- server/managers/PodcastManager.js | 2 +- server/routers/ApiRouter.js | 2 -- .../managers/plugins/Example/manifest.json | 9 ++--- 14 files changed, 121 insertions(+), 45 deletions(-) diff --git a/client/components/prompt/Confirm.vue b/client/components/prompt/Confirm.vue index 032190cf..4e11ce45 100644 --- a/client/components/prompt/Confirm.vue +++ b/client/components/prompt/Confirm.vue @@ -7,6 +7,14 @@ +
+ +
+
{{ $strings.ButtonCancel }}
@@ -25,7 +33,8 @@ export default { return { el: null, content: null, - checkboxValue: false + checkboxValue: false, + formData: {} } }, watch: { @@ -61,6 +70,9 @@ export default { persistent() { return !!this.confirmPromptOptions.persistent }, + formFields() { + return this.confirmPromptOptions.formFields || [] + }, checkboxLabel() { return this.confirmPromptOptions.checkboxLabel }, @@ -100,11 +112,31 @@ export default { this.show = false }, confirm() { - if (this.callback) this.callback(true, this.checkboxValue) + if (this.callback) { + if (this.formFields.length) { + const formFieldData = { + ...this.formData + } + + this.callback(true, formFieldData) + } else { + this.callback(true, this.checkboxValue) + } + } this.show = false }, setShow() { this.checkboxValue = this.checkboxDefaultValue + + if (this.formFields.length) { + this.formFields.forEach((field) => { + let defaultValue = '' + if (field.type === 'boolean') defaultValue = false + if (field.type === 'select') defaultValue = field.options[0].value + this.$set(this.formData, field.name, defaultValue) + }) + } + this.$eventBus.$emit('showing-prompt', true) document.body.appendChild(this.el) setTimeout(() => { diff --git a/client/pages/config/plugins/_id.vue b/client/pages/config/plugins/_id.vue index dda1094f..e376abb0 100644 --- a/client/pages/config/plugins/_id.vue +++ b/client/pages/config/plugins/_id.vue @@ -12,10 +12,14 @@ help_outline + +
+ + Sourceopen_in_new
-

{{ configDescription }}

+

{{ configDescription }}