Added Https service. Fix for #188 How enable https? (#312)

* https service added on port 8091 default

* https port check

* format

* readme

* readme

* readme

* readme

---------

Co-authored-by: evfedoto <evfedoto@cisco.com>
Co-authored-by: nikk <tsynik@gmail.com>
This commit is contained in:
Evgeni
2023-11-13 00:50:11 +01:00
committed by GitHub
parent 792f87380d
commit a91e6eb11b
23 changed files with 46811 additions and 2120 deletions

View File

@@ -236,13 +236,23 @@ func loadTorrent(path, host string) (ret []interface{}) {
func getLink(host, path string) string {
if !strings.HasPrefix(host, "http") {
host = "http://" + host
if settings.Ssl {
host = "https://" + host
} else {
host = "http://" + host
}
}
pos := strings.LastIndex(host, ":")
if pos > 7 {
host = host[:pos]
}
return host + ":" + settings.Port + "/" + path
if settings.Ssl {
return host + ":" + settings.SslPort + "/" + path
} else {
return host + ":" + settings.Port + "/" + path
}
}
func getObjFromTorrent(path, parent, host string, torr *torr.Torrent, file *state.TorrentFileStat) (ret interface{}) {