mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-13 16:40:01 +00:00
Refactor plugin config logic into Configurable
This commit is contained in:
@@ -0,0 +1,9 @@
|
||||
package de.grimsi.gameyfin.pluginapi.core
|
||||
|
||||
interface Configurable {
|
||||
val configMetadata: List<PluginConfigElement>
|
||||
var config: Map<String, String?>
|
||||
|
||||
fun validateConfig(): Boolean = validateConfig(config)
|
||||
fun validateConfig(config: Map<String, String?>): Boolean
|
||||
}
|
||||
@@ -10,23 +10,6 @@ abstract class GameyfinPlugin(wrapper: PluginWrapper) : Plugin(wrapper) {
|
||||
val SUPPORTED_LOGO_FORMATS: List<String> = listOf("png", "jpg", "jpeg", "gif", "svg", "webp")
|
||||
}
|
||||
|
||||
abstract val configMetadata: List<PluginConfigElement>
|
||||
protected open var config: Map<String, String?> = emptyMap()
|
||||
|
||||
open fun getCurrentConfig(): Map<String, String?> {
|
||||
return config
|
||||
}
|
||||
|
||||
open fun loadConfig(config: Map<String, String?>) {
|
||||
this.config = config
|
||||
}
|
||||
|
||||
open fun validateConfig(): Boolean {
|
||||
return validateConfig(config)
|
||||
}
|
||||
|
||||
abstract fun validateConfig(config: Map<String, String?>): Boolean
|
||||
|
||||
fun hasLogo(): Boolean {
|
||||
for (format in SUPPORTED_LOGO_FORMATS) {
|
||||
val resourcePath = "$LOGO_FILE_NAME.$format"
|
||||
|
||||
Reference in New Issue
Block a user