mirror of
https://github.com/BrenBroZAYT/gameyfin.git
synced 2026-06-16 08:15:48 +00:00
Automatically assign priority at first plugin load
This commit is contained in:
+7
-1
@@ -14,7 +14,13 @@ class DatabasePluginStatusProvider(
|
|||||||
|
|
||||||
// If the plugin is unknown, persist it as enabled
|
// If the plugin is unknown, persist it as enabled
|
||||||
if (pluginManagement == null) {
|
if (pluginManagement == null) {
|
||||||
pluginManagement = pluginManagementRepository.save(PluginManagementEntry(pluginId = pluginId, enabled = true))
|
|
||||||
|
// Set priority to the max value of the current plugins + 1 (which is the lowest priority) or 1 if there are no entries
|
||||||
|
val currentMaxPriority = pluginManagementRepository.findMaxPriority() ?: 0
|
||||||
|
|
||||||
|
pluginManagement = pluginManagementRepository.save(
|
||||||
|
PluginManagementEntry(pluginId = pluginId, enabled = true, priority = currentMaxPriority + 1)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
return pluginManagement.enabled != true
|
return pluginManagement.enabled != true
|
||||||
|
|||||||
+5
-1
@@ -1,5 +1,9 @@
|
|||||||
package de.grimsi.gameyfin.core.plugins.management
|
package de.grimsi.gameyfin.core.plugins.management
|
||||||
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository
|
import org.springframework.data.jpa.repository.JpaRepository
|
||||||
|
import org.springframework.data.jpa.repository.Query
|
||||||
|
|
||||||
interface PluginManagementRepository : JpaRepository<PluginManagementEntry, String>
|
interface PluginManagementRepository : JpaRepository<PluginManagementEntry, String> {
|
||||||
|
@Query("SELECT MAX(p.priority) FROM PluginManagementEntry p")
|
||||||
|
fun findMaxPriority(): Int?
|
||||||
|
}
|
||||||
-5
@@ -87,11 +87,6 @@ class PluginManagementService(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasLogo(pluginId: String): Boolean {
|
|
||||||
val plugin = pluginManager.getPlugin(pluginId).plugin as GameyfinPlugin
|
|
||||||
return plugin.hasLogo()
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getLogo(pluginId: String): InputStream? {
|
fun getLogo(pluginId: String): InputStream? {
|
||||||
val plugin = pluginManager.getPlugin(pluginId).plugin as GameyfinPlugin
|
val plugin = pluginManager.getPlugin(pluginId).plugin as GameyfinPlugin
|
||||||
return plugin.getLogo()
|
return plugin.getLogo()
|
||||||
|
|||||||
Reference in New Issue
Block a user