|
|
|
@ -10,6 +10,7 @@ import (
|
|
|
|
"image/png"
|
|
|
|
"image/png"
|
|
|
|
"math/rand/v2"
|
|
|
|
"math/rand/v2"
|
|
|
|
"net/http"
|
|
|
|
"net/http"
|
|
|
|
|
|
|
|
"net/url"
|
|
|
|
"path/filepath"
|
|
|
|
"path/filepath"
|
|
|
|
"slices"
|
|
|
|
"slices"
|
|
|
|
"strings"
|
|
|
|
"strings"
|
|
|
|
@ -403,7 +404,13 @@ func NewPublishKey(ctx *gin.Context) {
|
|
|
|
|
|
|
|
|
|
|
|
host := settings.CustomPublishHost.Get()
|
|
|
|
host := settings.CustomPublishHost.Get()
|
|
|
|
if host == "" {
|
|
|
|
if host == "" {
|
|
|
|
host = settings.HOST.Get()
|
|
|
|
u, err := url.Parse(settings.HOST.Get())
|
|
|
|
|
|
|
|
if err != nil {
|
|
|
|
|
|
|
|
log.Errorf("new publish key error: %v", err)
|
|
|
|
|
|
|
|
ctx.AbortWithStatusJSON(http.StatusInternalServerError, model.NewAPIErrorResp(err))
|
|
|
|
|
|
|
|
return
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
host = u.Host
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if host == "" {
|
|
|
|
if host == "" {
|
|
|
|
host = ctx.Request.Host
|
|
|
|
host = ctx.Request.Host
|
|
|
|
|