| 874 | } |
| 875 | |
| 876 | func parseProxyMediaInfoContentPath(r *http.Request) (string, error) { |
| 877 | queryContentPath := strings.TrimSpace(r.URL.Query().Get("contentPath")) |
| 878 | if queryContentPath == "" { |
| 879 | queryContentPath = strings.TrimSpace(r.URL.Query().Get("content_path")) |
| 880 | } |
| 881 | if queryContentPath != "" { |
| 882 | return normalizeContentPathRelativeInput(queryContentPath) |
| 883 | } |
| 884 | |
| 885 | contentType := strings.TrimSpace(strings.ToLower(r.Header.Get("Content-Type"))) |
| 886 | if strings.HasPrefix(contentType, "application/json") { |
| 887 | var req proxyContentPathMediaInfoRequest |
| 888 | if err := json.NewDecoder(r.Body).Decode(&req); err != nil { |
| 889 | return "", errors.New("invalid request body") |
| 890 | } |
| 891 | return normalizeContentPathRelativeInput(req.ContentPath) |
| 892 | } |
| 893 | |
| 894 | if err := r.ParseForm(); err != nil { |
| 895 | return "", errors.New("invalid form data") |
| 896 | } |
| 897 | |
| 898 | contentPath := r.FormValue("contentPath") |
| 899 | if strings.TrimSpace(contentPath) == "" { |
| 900 | contentPath = r.FormValue("content_path") |
| 901 | } |
| 902 | |
| 903 | return normalizeContentPathRelativeInput(contentPath) |
| 904 | } |
| 905 | |
| 906 | func generateLoginCookieValue() (string, error) { |
| 907 | buf := make([]byte, 16) |