Fix ipv6 replacement

This commit is contained in:
Ben Sarmiento
2024-01-26 22:33:13 +01:00
parent 1e1ec9d767
commit 979151d2de
5 changed files with 5 additions and 5 deletions

View File

@@ -96,7 +96,7 @@ func ServeFilesListForInfuse(directory, torrentName string, torMgr *torrent.Torr
func ServeDownloadsListForInfuse(torMgr *torrent.TorrentManager) ([]byte, error) { func ServeDownloadsListForInfuse(torMgr *torrent.TorrentManager) ([]byte, error) {
var buf bytes.Buffer var buf bytes.Buffer
if !torMgr.Config.EnableDownloadMount() { if !torMgr.Config.EnableDownloadMount() {
buf.WriteString("Enable download cache in config to use this feature") buf.WriteString("Enable download mount in config to use this feature")
return buf.Bytes(), nil return buf.Bytes(), nil
} }
buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">") buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")

View File

@@ -122,7 +122,7 @@ func HandleSingleFile(directory, torrentName, fileName string, torMgr *torrent.T
func ServeDownloadsList(torMgr *torrent.TorrentManager) ([]byte, error) { func ServeDownloadsList(torMgr *torrent.TorrentManager) ([]byte, error) {
var buf bytes.Buffer var buf bytes.Buffer
if !torMgr.Config.EnableDownloadMount() { if !torMgr.Config.EnableDownloadMount() {
buf.WriteString("Enable download cache in config to use this feature") buf.WriteString("Enable download mount in config to use this feature")
return buf.Bytes(), nil return buf.Bytes(), nil
} }
buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">") buf.WriteString("<?xml version=\"1.0\" encoding=\"utf-8\"?><d:multistatus xmlns:d=\"DAV:\">")

View File

@@ -203,7 +203,7 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
<td>%d</td> <td>%d</td>
</tr> </tr>
<tr> <tr>
<td>Use Download Cache</td> <td>Use Download Mount</td>
<td>%t</td> <td>%t</td>
</tr> </tr>
<tr> <tr>

View File

@@ -96,7 +96,7 @@ func ServeFilesList(directory, torrentName string, torMgr *torrent.TorrentManage
func ServeDownloadsList(torMgr *torrent.TorrentManager) ([]byte, error) { func ServeDownloadsList(torMgr *torrent.TorrentManager) ([]byte, error) {
var buf bytes.Buffer var buf bytes.Buffer
if !torMgr.Config.EnableDownloadMount() { if !torMgr.Config.EnableDownloadMount() {
buf.WriteString("Enable download cache in config to use this feature") buf.WriteString("Enable download mount in config to use this feature")
return buf.Bytes(), nil return buf.Bytes(), nil
} }
buf.WriteString("<ol>") buf.WriteString("<ol>")

View File

@@ -178,7 +178,7 @@ func (r *HTTPClient) Do(req *http.Request) (*http.Response, error) {
} }
func (r *HTTPClient) replaceHostIfNeeded(req *http.Request) { func (r *HTTPClient) replaceHostIfNeeded(req *http.Request) {
if !r.ensureIPv6Host && !r.cfg.ShouldForceIPv6() || !strings.HasSuffix(req.Host, "download.real-debrid.com") { if strings.HasSuffix(req.Host, "download.real-debrid.cloud") || !r.ensureIPv6Host || !r.cfg.ShouldForceIPv6() {
return return
} }
// get subdomain of req.Host // get subdomain of req.Host