mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: neutered file system
docs: add filter params to api docs
This commit is contained in:
parent
cbcdd938eb
commit
6f9015d3d8
19
main.go
19
main.go
@ -247,18 +247,19 @@ func main() {
|
||||
// https://github.com/golang/go/issues/43431
|
||||
embeddedStatic, _ := fs.Sub(staticFiles, "static")
|
||||
static := conf.ChooseFS("static", embeddedStatic)
|
||||
fileServer := gzipped.FileServer(fsutils.NewExistsHttpFS(
|
||||
fsutils.NewExistsFS(
|
||||
fsutils.NeuteredFileSystem{
|
||||
FS: static,
|
||||
}).WithCache(!config.IsDev()),
|
||||
|
||||
assetsFileServer := gzipped.FileServer(fsutils.NewExistsHttpFS(
|
||||
fsutils.NewExistsFS(static).WithCache(!config.IsDev()),
|
||||
))
|
||||
staticFileServer := http.FileServer(http.FS(
|
||||
fsutils.NeuteredFileSystem{FS: static},
|
||||
))
|
||||
|
||||
router.PathPrefix("/contribute.json").Handler(fileServer)
|
||||
router.PathPrefix("/assets").Handler(fileServer)
|
||||
router.PathPrefix("/swagger-ui").Handler(fileServer)
|
||||
router.PathPrefix("/contribute.json").Handler(staticFileServer)
|
||||
router.PathPrefix("/assets").Handler(assetsFileServer)
|
||||
router.PathPrefix("/swagger-ui").Handler(staticFileServer)
|
||||
router.PathPrefix("/docs").Handler(
|
||||
middlewares.NewFileTypeFilterMiddleware([]string{".go"})(fileServer),
|
||||
middlewares.NewFileTypeFilterMiddleware([]string{".go"})(staticFileServer),
|
||||
)
|
||||
|
||||
// Miscellaneous
|
||||
|
@ -41,6 +41,12 @@ func (h *SummaryApiHandler) RegisterRoutes(router *mux.Router) {
|
||||
// @Param from query string false "Start date (e.g. '2021-02-07')"
|
||||
// @Param to query string false "End date (e.g. '2021-02-08')"
|
||||
// @Param recompute query bool false "Whether to recompute the summary from raw heartbeat or use cache"
|
||||
// @Param project query string false "Project to filter by"
|
||||
// @Param language query string false "Language to filter by"
|
||||
// @Param editor query string false "Editor to filter by"
|
||||
// @Param operating_system query string false "OS to filter by"
|
||||
// @Param machine query string false "Machine to filter by"
|
||||
// @Param label query string false "Project label to filter by"
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} models.Summary
|
||||
// @Router /summary [get]
|
||||
|
@ -50,6 +50,12 @@ func (h *StatsHandler) RegisterRoutes(router *mux.Router) {
|
||||
// @Produce json
|
||||
// @Param user path string true "User ID to fetch data for (or 'current')"
|
||||
// @Param range path string false "Range interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any)
|
||||
// @Param project query string false "Project to filter by"
|
||||
// @Param language query string false "Language to filter by"
|
||||
// @Param editor query string false "Editor to filter by"
|
||||
// @Param operating_system query string false "OS to filter by"
|
||||
// @Param machine query string false "Machine to filter by"
|
||||
// @Param label query string false "Project label to filter by"
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} v1.StatsViewModel
|
||||
// @Router /compat/wakatime/v1/users/{user}/stats/{range} [get]
|
||||
|
@ -52,6 +52,12 @@ func (h *SummariesHandler) RegisterRoutes(router *mux.Router) {
|
||||
// @Param range query string false "Range interval identifier" Enums(today, yesterday, week, month, year, 7_days, last_7_days, 30_days, last_30_days, 12_months, last_12_months, any)
|
||||
// @Param start query string false "Start date (e.g. '2021-02-07')"
|
||||
// @Param end query string false "End date (e.g. '2021-02-08')"
|
||||
// @Param project query string false "Project to filter by"
|
||||
// @Param language query string false "Language to filter by"
|
||||
// @Param editor query string false "Editor to filter by"
|
||||
// @Param operating_system query string false "OS to filter by"
|
||||
// @Param machine query string false "Machine to filter by"
|
||||
// @Param label query string false "Project label to filter by"
|
||||
// @Security ApiKeyAuth
|
||||
// @Success 200 {object} v1.SummariesViewModel
|
||||
// @Router /compat/wakatime/v1/users/{user}/summaries [get]
|
||||
|
@ -313,6 +313,42 @@ var doc = `{
|
||||
"description": "Range interval identifier",
|
||||
"name": "range",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project to filter by",
|
||||
"name": "project",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Language to filter by",
|
||||
"name": "language",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Editor to filter by",
|
||||
"name": "editor",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "OS to filter by",
|
||||
"name": "operating_system",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Machine to filter by",
|
||||
"name": "machine",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project label to filter by",
|
||||
"name": "label",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -380,6 +416,42 @@ var doc = `{
|
||||
"description": "End date (e.g. '2021-02-08')",
|
||||
"name": "end",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project to filter by",
|
||||
"name": "project",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Language to filter by",
|
||||
"name": "language",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Editor to filter by",
|
||||
"name": "editor",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "OS to filter by",
|
||||
"name": "operating_system",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Machine to filter by",
|
||||
"name": "machine",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project label to filter by",
|
||||
"name": "label",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -719,6 +791,42 @@ var doc = `{
|
||||
"description": "Whether to recompute the summary from raw heartbeat or use cache",
|
||||
"name": "recompute",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project to filter by",
|
||||
"name": "project",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Language to filter by",
|
||||
"name": "language",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Editor to filter by",
|
||||
"name": "editor",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "OS to filter by",
|
||||
"name": "operating_system",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Machine to filter by",
|
||||
"name": "machine",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project label to filter by",
|
||||
"name": "label",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
@ -298,6 +298,42 @@
|
||||
"description": "Range interval identifier",
|
||||
"name": "range",
|
||||
"in": "path"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project to filter by",
|
||||
"name": "project",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Language to filter by",
|
||||
"name": "language",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Editor to filter by",
|
||||
"name": "editor",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "OS to filter by",
|
||||
"name": "operating_system",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Machine to filter by",
|
||||
"name": "machine",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project label to filter by",
|
||||
"name": "label",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -365,6 +401,42 @@
|
||||
"description": "End date (e.g. '2021-02-08')",
|
||||
"name": "end",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project to filter by",
|
||||
"name": "project",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Language to filter by",
|
||||
"name": "language",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Editor to filter by",
|
||||
"name": "editor",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "OS to filter by",
|
||||
"name": "operating_system",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Machine to filter by",
|
||||
"name": "machine",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project label to filter by",
|
||||
"name": "label",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
@ -704,6 +776,42 @@
|
||||
"description": "Whether to recompute the summary from raw heartbeat or use cache",
|
||||
"name": "recompute",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project to filter by",
|
||||
"name": "project",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Language to filter by",
|
||||
"name": "language",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Editor to filter by",
|
||||
"name": "editor",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "OS to filter by",
|
||||
"name": "operating_system",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Machine to filter by",
|
||||
"name": "machine",
|
||||
"in": "query"
|
||||
},
|
||||
{
|
||||
"type": "string",
|
||||
"description": "Project label to filter by",
|
||||
"name": "label",
|
||||
"in": "query"
|
||||
}
|
||||
],
|
||||
"responses": {
|
||||
|
@ -536,6 +536,30 @@ paths:
|
||||
in: path
|
||||
name: range
|
||||
type: string
|
||||
- description: Project to filter by
|
||||
in: query
|
||||
name: project
|
||||
type: string
|
||||
- description: Language to filter by
|
||||
in: query
|
||||
name: language
|
||||
type: string
|
||||
- description: Editor to filter by
|
||||
in: query
|
||||
name: editor
|
||||
type: string
|
||||
- description: OS to filter by
|
||||
in: query
|
||||
name: operating_system
|
||||
type: string
|
||||
- description: Machine to filter by
|
||||
in: query
|
||||
name: machine
|
||||
type: string
|
||||
- description: Project label to filter by
|
||||
in: query
|
||||
name: label
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -583,6 +607,30 @@ paths:
|
||||
in: query
|
||||
name: end
|
||||
type: string
|
||||
- description: Project to filter by
|
||||
in: query
|
||||
name: project
|
||||
type: string
|
||||
- description: Language to filter by
|
||||
in: query
|
||||
name: language
|
||||
type: string
|
||||
- description: Editor to filter by
|
||||
in: query
|
||||
name: editor
|
||||
type: string
|
||||
- description: OS to filter by
|
||||
in: query
|
||||
name: operating_system
|
||||
type: string
|
||||
- description: Machine to filter by
|
||||
in: query
|
||||
name: machine
|
||||
type: string
|
||||
- description: Project label to filter by
|
||||
in: query
|
||||
name: label
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
@ -804,6 +852,30 @@ paths:
|
||||
in: query
|
||||
name: recompute
|
||||
type: boolean
|
||||
- description: Project to filter by
|
||||
in: query
|
||||
name: project
|
||||
type: string
|
||||
- description: Language to filter by
|
||||
in: query
|
||||
name: language
|
||||
type: string
|
||||
- description: Editor to filter by
|
||||
in: query
|
||||
name: editor
|
||||
type: string
|
||||
- description: OS to filter by
|
||||
in: query
|
||||
name: operating_system
|
||||
type: string
|
||||
- description: Machine to filter by
|
||||
in: query
|
||||
name: machine
|
||||
type: string
|
||||
- description: Project label to filter by
|
||||
in: query
|
||||
name: label
|
||||
type: string
|
||||
produces:
|
||||
- application/json
|
||||
responses:
|
||||
|
Loading…
Reference in New Issue
Block a user