mirror of
https://github.com/gitbucket/gitbucket.git
synced 2026-02-18 04:27:08 +01:00
Merge pull request #1917 from kounoike/pr-list-plugins-api
Add plugin list API
This commit is contained in:
17
src/main/scala/gitbucket/core/api/ApiPlugin.scala
Normal file
17
src/main/scala/gitbucket/core/api/ApiPlugin.scala
Normal file
@@ -0,0 +1,17 @@
|
||||
package gitbucket.core.api
|
||||
|
||||
import gitbucket.core.plugin.{PluginRegistry, PluginInfo}
|
||||
|
||||
case class ApiPlugin(
|
||||
id: String,
|
||||
name: String,
|
||||
versino: String,
|
||||
description: String,
|
||||
jarFileName: String
|
||||
)
|
||||
|
||||
object ApiPlugin{
|
||||
def apply(plugin: PluginInfo): ApiPlugin = {
|
||||
ApiPlugin(plugin.pluginId, plugin.pluginName, plugin.pluginVersion, plugin.description, plugin.pluginJar.getName)
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import gitbucket.core.util.Implicits._
|
||||
import gitbucket.core.util.JGitUtil._
|
||||
import gitbucket.core.util.SyntaxSugars._
|
||||
import gitbucket.core.util._
|
||||
import gitbucket.core.plugin.PluginRegistry
|
||||
import gitbucket.core.view.helpers.{isRenderable, renderMarkup}
|
||||
import org.eclipse.jgit.api.Git
|
||||
import org.eclipse.jgit.revwalk.RevWalk
|
||||
@@ -717,5 +718,11 @@ trait ApiControllerBase extends ControllerBase {
|
||||
}
|
||||
})
|
||||
|
||||
/**
|
||||
* non-GitHub compatible API for listing plugins
|
||||
*/
|
||||
get("/api/v3/gitbucket/plugins"){
|
||||
PluginRegistry().getPlugins().map{ApiPlugin(_)}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user