mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-06-24 18:10:52 +00:00
Swagger.v1.json template (#3572)
* Turn swagger.v1.json into template * Rename ENABLE_SWAGGER_ENDPOINT option to ENABLE_SWAGGER
This commit is contained in:
parent
412583a3f2
commit
a74426d631
14 changed files with 74 additions and 21 deletions
|
@ -22,8 +22,8 @@ var (
|
|||
templates = template.New("")
|
||||
)
|
||||
|
||||
// Renderer implements the macaron handler for serving the templates.
|
||||
func Renderer() macaron.Handler {
|
||||
// HTMLRenderer implements the macaron handler for serving HTML templates.
|
||||
func HTMLRenderer() macaron.Handler {
|
||||
return macaron.Renderer(macaron.RenderOptions{
|
||||
Funcs: NewFuncMap(),
|
||||
Directory: path.Join(setting.StaticRootPath, "templates"),
|
||||
|
@ -33,6 +33,18 @@ func Renderer() macaron.Handler {
|
|||
})
|
||||
}
|
||||
|
||||
// JSONRenderer implements the macaron handler for serving JSON templates.
|
||||
func JSONRenderer() macaron.Handler {
|
||||
return macaron.Renderer(macaron.RenderOptions{
|
||||
Funcs: NewFuncMap(),
|
||||
Directory: path.Join(setting.StaticRootPath, "templates"),
|
||||
AppendDirectories: []string{
|
||||
path.Join(setting.CustomPath, "templates"),
|
||||
},
|
||||
HTMLContentType: "application/json",
|
||||
})
|
||||
}
|
||||
|
||||
// Mailer provides the templates required for sending notification mails.
|
||||
func Mailer() *template.Template {
|
||||
for _, funcs := range NewFuncMap() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue