mirror of
https://github.com/Dvorinka/MyClubServer.git
synced 2026-06-04 02:32:57 +00:00
dev day #75
This commit is contained in:
@@ -159,8 +159,9 @@ func (ctrl *ImageProcessingController) ProcessImage(c *gin.Context) {
|
||||
}
|
||||
absolute := scheme + "://" + host + outputPath
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"url": absolute,
|
||||
"format": format,
|
||||
"url": outputPath,
|
||||
"absolute_url": absolute,
|
||||
"format": format,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -346,7 +347,8 @@ func (ctrl *ImageProcessingController) CropAndUpload(c *gin.Context) {
|
||||
}
|
||||
absolute := scheme + "://" + host + outputPath
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"url": absolute,
|
||||
"url": outputPath,
|
||||
"absolute_url": absolute,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -431,7 +433,28 @@ func (ctrl *ImageProcessingController) QuickEdit(c *gin.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
scheme := "http"
|
||||
if c.Request.TLS != nil || strings.EqualFold(c.Request.Header.Get("X-Forwarded-Proto"), "https") {
|
||||
scheme = "https"
|
||||
}
|
||||
host := c.Request.Host
|
||||
if xf := strings.TrimSpace(c.Request.Header.Get("X-Forwarded-Host")); xf != "" {
|
||||
parts := strings.Split(xf, ",")
|
||||
if len(parts) > 0 {
|
||||
h := strings.TrimSpace(parts[0])
|
||||
if h != "" { host = h }
|
||||
}
|
||||
}
|
||||
if !strings.Contains(host, ":") {
|
||||
if xfp := strings.TrimSpace(c.Request.Header.Get("X-Forwarded-Port")); xfp != "" {
|
||||
if (scheme == "http" && xfp != "80") || (scheme == "https" && xfp != "443") {
|
||||
host = host + ":" + xfp
|
||||
}
|
||||
}
|
||||
}
|
||||
absolute := scheme + "://" + host + outputPath
|
||||
c.JSON(http.StatusOK, gin.H{
|
||||
"url": outputPath,
|
||||
"url": outputPath,
|
||||
"absolute_url": absolute,
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user