File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 1+ import gitbucket .core .service .SystemSettingsService
12import gitbucket .gist .controller .GistController
23import gitbucket .core .plugin .PluginRegistry
34import gitbucket .core .util .Version
45import java .io .File
56import javax .servlet .ServletContext
67import gitbucket .gist .util .Configurations ._
78
8- class Plugin extends gitbucket.core.plugin.Plugin {
9+ class Plugin extends gitbucket.core.plugin.Plugin with SystemSettingsService {
910 override val pluginId : String = " gist"
1011 override val pluginName : String = " Gist Plugin"
1112 override val description : String = " Provides Gist feature on GitBucket."
1213 override val versions : List [Version ] = List (Version (1 , 0 ))
1314
1415 override def initialize (registry : PluginRegistry , context : ServletContext ): Unit = {
1516 // Add Snippet link to the header
17+ val settings = loadSystemSettings()
18+ val path = settings.baseUrl.getOrElse(context.getContextPath)
1619 registry.addJavaScript(" .*" ,
1720 s """
1821 | $$ ('a.brand').after(
19- | $$ ('<span style="float: left; margin-top: 10px;">| <a href=" ${context.getContextPath }/gist" style="color: black;">Snippet</a></span>')
22+ | $$ ('<span style="float: left; margin-top: 10px;">| <a href=" ${path }/gist" style="color: black;">Snippet</a></span>')
2023 |);
2124 """ .stripMargin)
2225
You can’t perform that action at this time.
0 commit comments