#To update swagger use: GO111MODULE=on go get -u github.com/go-swagger/go-swagger/cmd/swagger
SWAGGER := $(GO) run -mod=vendor github.com/go-swagger/go-swagger/cmd/swagger
SWAGGER_SPEC := templates/swagger/v1_json.tmpl
-SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl}}/api/v1"|g
-SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl}}/api/v1"|"basePath": "/api/v1"|g
+SWAGGER_SPEC_S_TMPL := s|"basePath": *"/api/v1"|"basePath": "{{AppSubUrl \| JSEscape \| Safe}}/api/v1"|g
+SWAGGER_SPEC_S_JSON := s|"basePath": *"{{AppSubUrl \| JSEscape \| Safe}}/api/v1"|"basePath": "/api/v1"|g
SWAGGER_EXCLUDE := code.gitea.io/sdk
SWAGGER_NEWLINE_COMMAND := -e '$$a\'
},
"Safe": Safe,
"SafeJS": SafeJS,
+ "JSEscape": JSEscape,
"Str2html": Str2html,
"TimeSince": timeutil.TimeSince,
"TimeSinceUnix": timeutil.TimeSinceUnix,
return html.EscapeString(raw)
}
+// JSEscape escapes a JS string
+func JSEscape(raw string) string {
+ return template.JSEscapeString(raw)
+}
+
// List traversings the list
func List(l *list.List) chan interface{} {
e := l.Front()
//
// Schemes: http, https
// BasePath: /api/v1
-// Version: {{AppVer}}
+// Version: {{AppVer | JSEscape | Safe}}
// License: MIT http://opensource.org/licenses/MIT
//
// Consumes:
"name": "MIT",
"url": "http://opensource.org/licenses/MIT"
},
- "version": "{{AppVer}}"
+ "version": "{{AppVer | JSEscape | Safe}}"
},
- "basePath": "{{AppSubUrl}}/api/v1",
+ "basePath": "{{AppSubUrl | JSEscape | Safe}}/api/v1",
"paths": {
"/admin/cron": {
"get": {