─── 用户自助门户 API ───────────────────────────────────────────────────────── subURL 根据请求上下文构造完整的订阅链接。
(r *http.Request, token string)
| 637 | |
| 638 | // subURL 根据请求上下文构造完整的订阅链接。 |
| 639 | func subURL(r *http.Request, token string) string { |
| 640 | scheme := "https" |
| 641 | if r.TLS == nil && r.Header.Get("X-Forwarded-Proto") != "https" { |
| 642 | scheme = "http" |
| 643 | } |
| 644 | host := r.Host |
| 645 | if fwdHost := r.Header.Get("X-Forwarded-Host"); fwdHost != "" { |
| 646 | host = fwdHost |
| 647 | } |
| 648 | return scheme + "://" + host + "/sub/" + token |
| 649 | } |
| 650 | |
| 651 | |
| 652 | func (h *Handler) apiResetToken(w http.ResponseWriter, r *http.Request) { |