mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-02-11 04:39:40 +00:00
Update plugin to use uuid for id, update example plugin with taskmanager and socketauthority test
This commit is contained in:
parent
cfe3deff3b
commit
fc17a74865
11 changed files with 138 additions and 105 deletions
|
|
@ -42,7 +42,7 @@ export default {
|
|||
if (!store.getters['user/getIsAdminOrUp']) {
|
||||
redirect('/')
|
||||
}
|
||||
const plugin = store.state.plugins.find((plugin) => plugin.slug === params.slug)
|
||||
const plugin = store.state.plugins.find((plugin) => plugin.id === params.id)
|
||||
if (!plugin) {
|
||||
redirect('/config/plugins')
|
||||
}
|
||||
|
|
@ -95,14 +95,13 @@ export default {
|
|||
console.log('Form data', formData)
|
||||
|
||||
const payload = {
|
||||
pluginSlug: this.plugin.slug,
|
||||
config: formData
|
||||
}
|
||||
|
||||
this.processing = true
|
||||
|
||||
this.$axios
|
||||
.$post(`/api/plugins/config`, payload)
|
||||
.$post(`/api/plugins/${this.plugin.id}/config`, payload)
|
||||
.then(() => {
|
||||
console.log('Plugin configuration saved')
|
||||
})
|
||||
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<h2 class="text-xl font-medium">Installed Plugins</h2>
|
||||
<template v-for="plugin in plugins">
|
||||
<nuxt-link :key="plugin.slug" :to="`/config/plugins/${plugin.slug}`" class="flex items-center bg-primary rounded-md shadow-sm p-4 my-4 space-x-4">
|
||||
<nuxt-link :key="plugin.id" :to="`/config/plugins/${plugin.id}`" class="flex items-center bg-primary rounded-md shadow-sm p-4 my-4 space-x-4">
|
||||
<p class="text-lg">{{ plugin.name }}</p>
|
||||
<p class="text-sm text-gray-300">{{ plugin.description }}</p>
|
||||
<div class="flex-grow" />
|
||||
|
|
|
|||
|
|
@ -434,11 +434,10 @@ export default {
|
|||
|
||||
if (this.pluginExtensions.length) {
|
||||
this.pluginExtensions.forEach((plugin) => {
|
||||
const pluginSlug = plugin.slug
|
||||
plugin.extensions.forEach((pext) => {
|
||||
items.push({
|
||||
text: pext.label,
|
||||
action: `plugin-${pluginSlug}-action-${pext.name}`
|
||||
action: `plugin-${plugin.id}-action-${pext.name}`
|
||||
})
|
||||
})
|
||||
})
|
||||
|
|
@ -780,16 +779,15 @@ export default {
|
|||
this.$store.commit('globals/setShareModal', this.mediaItemShare)
|
||||
} else if (action.startsWith('plugin-')) {
|
||||
const actionStrSplit = action.replace('plugin-', '').split('-action-')
|
||||
const pluginSlug = actionStrSplit[0]
|
||||
const pluginId = actionStrSplit[0]
|
||||
const pluginAction = actionStrSplit[1]
|
||||
console.log('Plugin action for', pluginSlug, 'with action', pluginAction)
|
||||
this.onPluginAction(pluginSlug, pluginAction)
|
||||
console.log('Plugin action for', pluginId, 'with action', pluginAction)
|
||||
this.onPluginAction(pluginId, pluginAction)
|
||||
}
|
||||
},
|
||||
onPluginAction(pluginSlug, pluginAction) {
|
||||
onPluginAction(pluginId, pluginAction) {
|
||||
this.$axios
|
||||
.$post(`/api/plugins/action`, {
|
||||
pluginSlug,
|
||||
.$post(`/api/plugins/${pluginId}/action`, {
|
||||
pluginAction,
|
||||
target: 'item.detail.actions',
|
||||
data: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue