diff --git a/build-all.sh b/build-all.sh index 3312131..0a3b8cf 100755 --- a/build-all.sh +++ b/build-all.sh @@ -54,6 +54,12 @@ echo "Build web" export NODE_OPTIONS=--openssl-legacy-provider $GOBIN run gen_web.go +#### Update api docs +echo "Build docs" +$GOBIN install github.com/swaggo/swag/cmd/swag@latest +cd "${ROOT}/server" || exit 1 +swag init -g web/server.go + #### Build server echo "Build server" cd "${ROOT}/server" || exit 1 diff --git a/server/docs/docs.go b/server/docs/docs.go index b898681..61cfc26 100644 --- a/server/docs/docs.go +++ b/server/docs/docs.go @@ -62,7 +62,7 @@ const docTemplate = `{ "parameters": [ { "type": "string", - "description": "Test file size", + "description": "Test file size (in MB)", "name": "size", "in": "path", "required": true @@ -98,7 +98,7 @@ const docTemplate = `{ } } }, - "/ffp": { + "/ffp/{hash}/{id}": { "get": { "description": "Gather informations using ffprobe.", "produces": [ @@ -113,14 +113,14 @@ const docTemplate = `{ "type": "string", "description": "Torrent hash", "name": "hash", - "in": "query", + "in": "path", "required": true }, { "type": "string", "description": "File index in torrent", "name": "id", - "in": "query", + "in": "path", "required": true } ], @@ -217,7 +217,7 @@ const docTemplate = `{ } } }, - "/play": { + "/play/{hash}/{id}": { "get": { "description": "Play given torrent referenced by hash.", "produces": [ @@ -232,14 +232,14 @@ const docTemplate = `{ "type": "string", "description": "Torrent hash", "name": "hash", - "in": "query", + "in": "path", "required": true }, { "type": "string", "description": "File index in torrent", "name": "id", - "in": "query", + "in": "path", "required": true }, { diff --git a/server/docs/swagger.json b/server/docs/swagger.json index c5645a4..b653dec 100644 --- a/server/docs/swagger.json +++ b/server/docs/swagger.json @@ -55,7 +55,7 @@ "parameters": [ { "type": "string", - "description": "Test file size", + "description": "Test file size (in MB)", "name": "size", "in": "path", "required": true @@ -91,7 +91,7 @@ } } }, - "/ffp": { + "/ffp/{hash}/{id}": { "get": { "description": "Gather informations using ffprobe.", "produces": [ @@ -106,14 +106,14 @@ "type": "string", "description": "Torrent hash", "name": "hash", - "in": "query", + "in": "path", "required": true }, { "type": "string", "description": "File index in torrent", "name": "id", - "in": "query", + "in": "path", "required": true } ], @@ -210,7 +210,7 @@ } } }, - "/play": { + "/play/{hash}/{id}": { "get": { "description": "Play given torrent referenced by hash.", "produces": [ @@ -225,14 +225,14 @@ "type": "string", "description": "Torrent hash", "name": "hash", - "in": "query", + "in": "path", "required": true }, { "type": "string", "description": "File index in torrent", "name": "id", - "in": "query", + "in": "path", "required": true }, { diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index cd69f0f..a185378 100644 --- a/server/docs/swagger.yaml +++ b/server/docs/swagger.yaml @@ -332,7 +332,7 @@ paths: get: description: Download the test file of given size (for speed testing purpose). parameters: - - description: Test file size + - description: Test file size (in MB) in: path name: size required: true @@ -360,17 +360,17 @@ paths: summary: Tests server status tags: - API - /ffp: + /ffp/{hash}/{id}: get: description: Gather informations using ffprobe. parameters: - description: Torrent hash - in: query + in: path name: hash required: true type: string - description: File index in torrent - in: query + in: path name: id required: true type: string @@ -438,17 +438,17 @@ paths: summary: Get MSX IMDB informations tags: - MSX - /play: + /play/{hash}/{id}: get: description: Play given torrent referenced by hash. parameters: - description: Torrent hash - in: query + in: path name: hash required: true type: string - description: File index in torrent - in: query + in: path name: id required: true type: string