Fix http mount issues
This commit is contained in:
@@ -100,7 +100,13 @@ func ServeDownloadsListForInfuse(torMgr *torrent.TorrentManager) ([]byte, error)
|
|||||||
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:\">")
|
||||||
for _, download := range torMgr.DownloadCache.Items() {
|
filenames := torMgr.DownloadMap.Keys()
|
||||||
|
sort.Strings(filenames)
|
||||||
|
for _, filename := range filenames {
|
||||||
|
download, ok := torMgr.DownloadMap.Get(filename)
|
||||||
|
if !ok || !strings.HasPrefix(download.Link, "http") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
buf.WriteString(dav.File(download.Filename, download.Filesize, download.Generated))
|
buf.WriteString(dav.File(download.Filename, download.Filesize, download.Generated))
|
||||||
}
|
}
|
||||||
buf.WriteString("</d:multistatus>")
|
buf.WriteString("</d:multistatus>")
|
||||||
|
|||||||
@@ -127,7 +127,13 @@ func ServeDownloadsList(torMgr *torrent.TorrentManager) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
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:\">")
|
||||||
buf.WriteString(dav.BaseDirectory(config.DOWNLOADS, ""))
|
buf.WriteString(dav.BaseDirectory(config.DOWNLOADS, ""))
|
||||||
for _, download := range torMgr.DownloadCache.Items() {
|
filenames := torMgr.DownloadMap.Keys()
|
||||||
|
sort.Strings(filenames)
|
||||||
|
for _, filename := range filenames {
|
||||||
|
download, ok := torMgr.DownloadMap.Get(filename)
|
||||||
|
if !ok || !strings.HasPrefix(download.Link, "http") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
buf.WriteString(dav.File(download.Filename, download.Filesize, download.Generated))
|
buf.WriteString(dav.File(download.Filename, download.Filesize, download.Generated))
|
||||||
}
|
}
|
||||||
buf.WriteString("</d:multistatus>")
|
buf.WriteString("</d:multistatus>")
|
||||||
|
|||||||
@@ -21,8 +21,9 @@ type RootResponse struct {
|
|||||||
Version string `json:"version"`
|
Version string `json:"version"`
|
||||||
BuiltAt string `json:"built_at"`
|
BuiltAt string `json:"built_at"`
|
||||||
GitCommit string `json:"git_commit"`
|
GitCommit string `json:"git_commit"`
|
||||||
Dav string `json:"dav"`
|
|
||||||
Html string `json:"html"`
|
Html string `json:"html"`
|
||||||
|
Dav string `json:"dav"`
|
||||||
|
Infuse string `json:"infuse"`
|
||||||
Logs string `json:"logs"`
|
Logs string `json:"logs"`
|
||||||
UserInfo *realdebrid.User `json:"user_info"` // Replace UserInfoType with the actual type
|
UserInfo *realdebrid.User `json:"user_info"` // Replace UserInfoType with the actual type
|
||||||
MemAlloc uint64 `json:"mem_alloc"` // Memory allocation in MB
|
MemAlloc uint64 `json:"mem_alloc"` // Memory allocation in MB
|
||||||
@@ -48,8 +49,9 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
Version: version.GetVersion(),
|
Version: version.GetVersion(),
|
||||||
BuiltAt: version.GetBuiltAt(),
|
BuiltAt: version.GetBuiltAt(),
|
||||||
GitCommit: version.GetGitCommit(),
|
GitCommit: version.GetGitCommit(),
|
||||||
Dav: fmt.Sprintf("//%s/dav/", req.Host),
|
|
||||||
Html: fmt.Sprintf("//%s/http/", req.Host),
|
Html: fmt.Sprintf("//%s/http/", req.Host),
|
||||||
|
Dav: fmt.Sprintf("//%s/dav/", req.Host),
|
||||||
|
Infuse: fmt.Sprintf("//%s/infuse/", req.Host),
|
||||||
Logs: fmt.Sprintf("//%s/logs/", req.Host),
|
Logs: fmt.Sprintf("//%s/logs/", req.Host),
|
||||||
UserInfo: userInfo,
|
UserInfo: userInfo,
|
||||||
MemAlloc: bToMb(mem.Alloc),
|
MemAlloc: bToMb(mem.Alloc),
|
||||||
@@ -81,12 +83,16 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
<td>Git Commit</td>
|
<td>Git Commit</td>
|
||||||
<td colspan="2">%s</td>
|
<td colspan="2">%s</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>HTML</td>
|
||||||
|
<td colspan="2"><a href="%s">%s</a></td>
|
||||||
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>DAV</td>
|
<td>DAV</td>
|
||||||
<td colspan="2"><a href="%s">%s</a></td>
|
<td colspan="2"><a href="%s">%s</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>HTML</td>
|
<td>Infuse</td>
|
||||||
<td colspan="2"><a href="%s">%s</a></td>
|
<td colspan="2"><a href="%s">%s</a></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@@ -238,10 +244,12 @@ func (zr *Handlers) handleHome(resp http.ResponseWriter, req *http.Request) {
|
|||||||
response.Version,
|
response.Version,
|
||||||
response.BuiltAt,
|
response.BuiltAt,
|
||||||
response.GitCommit,
|
response.GitCommit,
|
||||||
response.Dav,
|
|
||||||
response.Dav,
|
|
||||||
response.Html,
|
response.Html,
|
||||||
response.Html,
|
response.Html,
|
||||||
|
response.Dav,
|
||||||
|
response.Dav,
|
||||||
|
response.Infuse,
|
||||||
|
response.Infuse,
|
||||||
response.Logs,
|
response.Logs,
|
||||||
response.Logs,
|
response.Logs,
|
||||||
response.MemAlloc,
|
response.MemAlloc,
|
||||||
|
|||||||
@@ -100,8 +100,15 @@ func ServeDownloadsList(torMgr *torrent.TorrentManager) ([]byte, error) {
|
|||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
}
|
}
|
||||||
buf.WriteString("<ol>")
|
buf.WriteString("<ol>")
|
||||||
for _, download := range torMgr.DownloadCache.Items() {
|
filenames := torMgr.DownloadMap.Keys()
|
||||||
buf.WriteString(fmt.Sprintf("<li><a href=\"%s\">%s</a></li>", download.Download, download.Filename))
|
sort.Strings(filenames)
|
||||||
|
for _, filename := range filenames {
|
||||||
|
download, ok := torMgr.DownloadMap.Get(filename)
|
||||||
|
if !ok || !strings.HasPrefix(download.Link, "http") {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
filePath := filepath.Join(config.DOWNLOADS, url.PathEscape(filename))
|
||||||
|
buf.WriteString(fmt.Sprintf("<li><a href=\"/http/%s\">%s</a></li>", filePath, download.Filename))
|
||||||
}
|
}
|
||||||
return buf.Bytes(), nil
|
return buf.Bytes(), nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user