From 0dc5c0f4d706bc98d60d2a1b6c61097c94815714 Mon Sep 17 00:00:00 2001 From: Danijel Fischer Date: Sun, 4 Oct 2020 12:57:29 +0200 Subject: [PATCH 1/2] Add a white border around the QR Image --- src/api/api.go | 9 +++++---- src/docs/docs.go | 21 ++++++++++++++++++--- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/src/api/api.go b/src/api/api.go index 078a0d7..07ae0e4 100644 --- a/src/api/api.go +++ b/src/api/api.go @@ -6,15 +6,16 @@ import ( "encoding/base64" "encoding/json" "errors" + "os" + "os/exec" + "strings" + "time" + "github.com/gin-gonic/gin" uuid "github.com/gofrs/uuid" "github.com/h2non/filetype" log "github.com/sirupsen/logrus" qrcode "github.com/skip2/go-qrcode" - "os" - "os/exec" - "strings" - "time" ) const groupPrefix = "group." diff --git a/src/docs/docs.go b/src/docs/docs.go index cb80f03..0c33fe8 100644 --- a/src/docs/docs.go +++ b/src/docs/docs.go @@ -169,8 +169,18 @@ var doc = `{ }, "/v1/qrcodelink": { "get": { - "description": "test", + "parameters": [ + { + "in": "query", + "name": "device_name", + "type": "string", + "required": true, + "description": "The name of the device is being linked. This name will be shown in Signal as device." + } + ], + "description": "Returns a QR-Code image. In case of an error a JSON object will be returned. Due to security reason of Signal, the provided QR-Code will change with each request.", "produces": [ + "image/png". "application/json" ], "tags": [ @@ -179,9 +189,14 @@ var doc = `{ "summary": "Link device and generate QR code.", "responses": { "200": { - "description": "Image", + "description": "Ok", + "content": + "image" + }, + "400": { + "description": "Bad Request", "schema": { - "type": "string" + "$ref": "#/definitions/api.Error" } } } From dff503e31d883047089b32abdd30b31e92d823f9 Mon Sep 17 00:00:00 2001 From: Danijel Fischer Date: Sun, 4 Oct 2020 13:00:00 +0200 Subject: [PATCH 2/2] Forgot to add the main change --- src/api/api.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/api/api.go b/src/api/api.go index 07ae0e4..f0b2569 100644 --- a/src/api/api.go +++ b/src/api/api.go @@ -631,7 +631,7 @@ func (a *Api) GetQrCodeLink(c *gin.Context) { c.JSON(400, gin.H{"error": err.Error()}) } - q.DisableBorder = true + q.DisableBorder = false var png []byte png, err = q.PNG(256) if err != nil {