1b8ff310eb
- Introduced a new API endpoint `GET /api/v1/video/proxy` to facilitate media resource downloads, allowing users to bypass domain restrictions imposed by WeChat. - Updated configuration to include proxy settings such as `SHORT_VIDEO_PROXY_ENABLED`, `SHORT_VIDEO_PROXY_ALLOWED_DOMAINS`, `SHORT_VIDEO_PROXY_MAX_SIZE_MB`, and `SHORT_VIDEO_PROXY_TIMEOUT_SECONDS`. - Enhanced the `ShortVideoConfig` struct to accommodate new proxy-related fields. - Improved error handling for proxy requests, including checks for allowed domains and file size limits. - Updated documentation to reflect the new proxy functionality and its configuration options, ensuring clarity for users and developers.
18 lines
743 B
Go
18 lines
743 B
Go
package routes
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
|
|
rmhandler "wx_service/internal/remove_watermark/handler"
|
|
)
|
|
|
|
func registerRemoveWatermarkRoutes(api *gin.RouterGroup, protected *gin.RouterGroup, videoHandler *rmhandler.VideoHandler) {
|
|
// 去水印解析与广告解锁:需要登录鉴权
|
|
protected.POST("/video/remove_watermark", videoHandler.RemoveWatermark)
|
|
protected.POST("/video/remove_watermark/unlock", videoHandler.UnlockQuota)
|
|
// 下载失败上报:供其他服务调用,无需鉴权
|
|
api.POST("/video/remove_watermark/report_failure", videoHandler.ReportDownloadFailure)
|
|
// 媒体代理:用于中转视频/图片等资源,绕过微信域名限制,无需鉴权
|
|
api.GET("/video/proxy", videoHandler.ProxyMedia)
|
|
}
|