ソースを参照

对接下载接口

Signed-off-by: allan716 <[email protected]>
allan716 2 年 前
コミット
7399961638

+ 7 - 0
internal/backend/controllers/base/proxy.go

@@ -1,6 +1,7 @@
 package base
 
 import (
+	"github.com/ChineseSubFinder/ChineseSubFinder/pkg/logic/sub_supplier/subtitle_best"
 	"net/http"
 
 	"github.com/ChineseSubFinder/ChineseSubFinder/pkg/local_http_proxy_server"
@@ -78,6 +79,12 @@ func (cb *ControllerBase) CheckProxyHandler(c *gin.Context) {
 		subSupplierHub.AddSubSupplier(assrt.NewSupplier(cb.fileDownloader))
 	}
 
+	if settings.Get().SubtitleSources.SubtitleBestSettings.Enabled == true &&
+		settings.Get().SubtitleSources.SubtitleBestSettings.ApiKey != "" {
+		// 如果开启了 SubtitleBest 字幕源,则需要测试 ASSRt 的代理
+		subSupplierHub.AddSubSupplier(subtitle_best.NewSupplier(cb.fileDownloader))
+	}
+
 	outStatus := subSupplierHub.CheckSubSiteStatus()
 
 	c.JSON(http.StatusOK, outStatus)

+ 7 - 0
pkg/logic/pre_download_process/pre_download_proces.go

@@ -4,6 +4,7 @@ import (
 	"errors"
 	"fmt"
 	"github.com/ChineseSubFinder/ChineseSubFinder/pkg/local_http_proxy_server"
+	"github.com/ChineseSubFinder/ChineseSubFinder/pkg/logic/sub_supplier/subtitle_best"
 	"time"
 
 	"github.com/ChineseSubFinder/ChineseSubFinder/pkg"
@@ -116,6 +117,12 @@ func (p *PreDownloadProcess) Init() *PreDownloadProcess {
 			p.SubSupplierHub.AddSubSupplier(assrt.NewSupplier(p.fileDownloader))
 		}
 
+		if settings.Get().SubtitleSources.SubtitleBestSettings.Enabled == true &&
+			settings.Get().SubtitleSources.SubtitleBestSettings.ApiKey != "" {
+			// 如果开启了 SubtitleBest 字幕源,则需要新增
+			p.SubSupplierHub.AddSubSupplier(subtitle_best.NewSupplier(p.fileDownloader))
+		}
+
 		if pkg.LiteMode() == false {
 			// 如果不是 Lite 模式,那么就可以开启这个功能
 			if common2.SubhdCode != "" {