Implement plugin config validation

Refactor plugin management card
This commit is contained in:
grimsi
2024-12-19 13:23:19 +01:00
parent 774f904334
commit 5eb94180e7
12 changed files with 124 additions and 55 deletions
@@ -13,7 +13,6 @@ import me.xdrop.fuzzywuzzy.FuzzySearch
import org.pf4j.Extension
import org.pf4j.PluginWrapper
import java.time.Instant
import kotlin.collections.filter
class IgdbPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
@@ -22,6 +21,16 @@ class IgdbPlugin(wrapper: PluginWrapper) : GameyfinPlugin(wrapper) {
PluginConfigElement("clientSecret", "Twitch client secret", "Your Twitch Client Secret")
)
override fun validateConfig(config: Map<String, String?>): Boolean {
try {
authenticate()
return true
} catch (e: PluginConfigError) {
log.error(e.message)
return false
}
}
override fun start() {
try {
authenticate()