diff --git a/env.sh b/env.sh index 13c860f..6b8bd22 100644 --- a/env.sh +++ b/env.sh @@ -1,2 +1,2 @@ #!/bin/sh -export GITBUCKET_VERSION=3.4.0 +export GITBUCKET_VERSION=3.4.1-SNAPSHOT diff --git a/src/main/scala/gitbucket/core/plugin/Plugin.scala b/src/main/scala/gitbucket/core/plugin/Plugin.scala index 2d3535c..3624d4e 100644 --- a/src/main/scala/gitbucket/core/plugin/Plugin.scala +++ b/src/main/scala/gitbucket/core/plugin/Plugin.scala @@ -23,35 +23,55 @@ val images: Seq[(String, Array[Byte])] = Nil /** + * Override to declare this plug-in provides images. + */ + def images(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(String, Array[Byte])] = Nil + + /** * Override to declare this plug-in provides controllers. */ val controllers: Seq[(String, ControllerBase)] = Nil /** + * Override to declare this plug-in provides controllers. + */ + def controllers(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(String, ControllerBase)] = Nil + + /** * Override to declare this plug-in provides JavaScript. */ val javaScripts: Seq[(String, String)] = Nil /** + * Override to declare this plug-in provides JavaScript. + */ + def javaScripts(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(String, String)] = Nil + + /** * Override to declare this plug-in provides renderers. */ val renderers: Seq[(String, Renderer)] = Nil /** + * Override to declare this plug-in provides renderers. + */ + def renderers(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Seq[(String, Renderer)] = Nil + + /** * This method is invoked in initialization of plugin system. * Register plugin functionality to PluginRegistry. */ def initialize(registry: PluginRegistry, context: ServletContext, settings: SystemSettings): Unit = { - images.foreach { case (id, in) => + (images ++ images(registry, context, settings)).foreach { case (id, in) => registry.addImage(id, in) } - controllers.foreach { case (path, controller) => + (controllers ++ controllers(registry, context, settings)).foreach { case (path, controller) => registry.addController(path, controller) } - javaScripts.foreach { case (path, script) => + (javaScripts ++ javaScripts(registry, context, settings)).foreach { case (path, script) => registry.addJavaScript(path, script) } - renderers.foreach { case (extension, renderer) => + (renderers ++ renderers(registry, context, settings)).foreach { case (extension, renderer) => registry.addRenderer(extension, renderer) } }