Support custom channel now

This commit is contained in:
JustSong
2023-04-23 20:35:49 +08:00
parent 57379d8e92
commit b3be4d8f85
8 changed files with 55 additions and 8 deletions

View File

@@ -11,6 +11,9 @@ import (
func Relay(c *gin.Context) {
channelType := c.GetInt("channel")
baseURL := common.ChannelBaseURLs[channelType]
if channelType == common.ChannelTypeCustom {
baseURL = c.GetString("base_url")
}
req, err := http.NewRequest(c.Request.Method, fmt.Sprintf("%s%s", baseURL, c.Request.URL.String()), c.Request.Body)
if err != nil {
c.JSON(http.StatusOK, gin.H{