Sync production source including routing, billing, Astra detection and public uptime. Update custom build instructions and license packaging.
28 lines
736 B
Go
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()
|
|
}
|