Files
new-api-custom/controller/manxue_artwork_url.go
T
cneicy ceddfd3d6b feat: sync deployed v1.0.0-rc.38-custom.42
Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
2026-09-26 04:49:11 +08:00

28 lines
736 B
Go

package controller
import (
"github.com/tidwall/gjson"
"net/url"
)
func manxueArtworkURL(result gjson.Result) string {
for _, key := range []string{"share_url", "public_url", "result_url", "result.share_url", "result.public_url"} {
raw := result.Get(key).String()
u, err := url.Parse(raw)
if err == nil && u.Scheme == "https" && u.Host == "manxue.ai" && u.User == nil && u.Query().Get("result") != "" {
return u.String()
}
}
id := result.Get("public_id").String()
if id == "" {
id = result.Get("result.public_id").String()
}
if id == "" && result.Get("public").Bool() {
id = result.Get("result.id").String()
}
if id == "" {
return ""
}
return "https://manxue.ai/?" + url.Values{"result": {id}}.Encode()
}