0
0
mirror of https://github.com/vx3r/wg-gen-web.git synced 2025-09-11 12:24:27 +00:00

go fmt / badges

This commit is contained in:
vx3r
2020-01-30 16:12:26 +09:00
parent 024d2b4ebb
commit 9b6d610a9c
9 changed files with 85 additions and 53 deletions

View File

@ -29,7 +29,6 @@ func ApplyRoutes(r *gin.Engine) {
}
}
func createClient(c *gin.Context) {
var data model.Client
@ -136,19 +135,18 @@ func configClient(c *gin.Context) {
c.Header("Content-Disposition", "attachment; filename=wg0.conf")
c.Data(http.StatusOK, "application/config", configData)
return
} else {
// return config as png qrcode
png, err := qrcode.Encode(string(configData), qrcode.Medium, 220)
if err != nil {
log.WithFields(log.Fields{
"err": err,
}).Error("failed to create qrcode")
c.AbortWithStatus(http.StatusInternalServerError)
return
}
c.Data(http.StatusOK, "image/png", png)
}
// return config as png qrcode
png, err := qrcode.Encode(string(configData), qrcode.Medium, 220)
if err != nil {
log.WithFields(log.Fields{
"err": err,
}).Error("failed to create qrcode")
c.AbortWithStatus(http.StatusInternalServerError)
return
}
c.Data(http.StatusOK, "image/png", png)
return
}
func readServer(c *gin.Context) {
@ -185,4 +183,4 @@ func updateServer(c *gin.Context) {
}
c.JSON(http.StatusOK, client)
}
}