mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge pull request #22 from tsynik/debug
add debug switch and mute excessive logging
This commit is contained in:
@@ -16,6 +16,7 @@ var (
|
|||||||
func init() {
|
func init() {
|
||||||
sets = new(Settings)
|
sets = new(Settings)
|
||||||
sets.CacheSize = 200 * 1024 * 1024
|
sets.CacheSize = 200 * 1024 * 1024
|
||||||
|
sets.EnableDebug = false
|
||||||
sets.PreloadBufferSize = 20 * 1024 * 1024
|
sets.PreloadBufferSize = 20 * 1024 * 1024
|
||||||
sets.ConnectionsLimit = 20
|
sets.ConnectionsLimit = 20
|
||||||
sets.DhtConnectionLimit = 500
|
sets.DhtConnectionLimit = 500
|
||||||
@@ -32,6 +33,7 @@ type Settings struct {
|
|||||||
|
|
||||||
//BT Config
|
//BT Config
|
||||||
EnableIPv6 bool
|
EnableIPv6 bool
|
||||||
|
EnableDebug bool
|
||||||
DisableTCP bool
|
DisableTCP bool
|
||||||
DisableUTP bool
|
DisableUTP bool
|
||||||
DisableUPNP bool
|
DisableUPNP bool
|
||||||
|
|||||||
@@ -73,6 +73,7 @@ func (bt *BTServer) configure() {
|
|||||||
|
|
||||||
bt.config = torrent.NewDefaultClientConfig()
|
bt.config = torrent.NewDefaultClientConfig()
|
||||||
|
|
||||||
|
bt.config.Debug = settings.Get().EnableDebug
|
||||||
bt.config.DisableIPv6 = settings.Get().EnableIPv6 == false
|
bt.config.DisableIPv6 = settings.Get().EnableIPv6 == false
|
||||||
bt.config.DisableTCP = settings.Get().DisableTCP
|
bt.config.DisableTCP = settings.Get().DisableTCP
|
||||||
bt.config.DisableUTP = settings.Get().DisableUTP
|
bt.config.DisableUTP = settings.Get().DisableUTP
|
||||||
@@ -93,7 +94,6 @@ func (bt *BTServer) configure() {
|
|||||||
if settings.Get().DhtConnectionLimit > 0 {
|
if settings.Get().DhtConnectionLimit > 0 {
|
||||||
bt.config.ConnTracker.SetMaxEntries(settings.Get().DhtConnectionLimit)
|
bt.config.ConnTracker.SetMaxEntries(settings.Get().DhtConnectionLimit)
|
||||||
}
|
}
|
||||||
|
|
||||||
if settings.Get().DownloadRateLimit > 0 {
|
if settings.Get().DownloadRateLimit > 0 {
|
||||||
bt.config.DownloadRateLimiter = utils.Limit(settings.Get().DownloadRateLimit * 1024)
|
bt.config.DownloadRateLimiter = utils.Limit(settings.Get().DownloadRateLimit * 1024)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -514,8 +514,9 @@ func torrentPlay(c echo.Context) error {
|
|||||||
if link == "" {
|
if link == "" {
|
||||||
return echo.NewHTTPError(http.StatusBadRequest, "link should not be empty")
|
return echo.NewHTTPError(http.StatusBadRequest, "link should not be empty")
|
||||||
}
|
}
|
||||||
fmt.Println("Play:", c.QueryParams())
|
if (settings.Get().EnableDebug) {
|
||||||
|
fmt.Println("Play:", c.QueryParams()) // mute log flood on play
|
||||||
|
}
|
||||||
qsave := c.QueryParam("save")
|
qsave := c.QueryParam("save")
|
||||||
qpreload := c.QueryParam("preload")
|
qpreload := c.QueryParam("preload")
|
||||||
qfile := c.QueryParam("file")
|
qfile := c.QueryParam("file")
|
||||||
|
|||||||
@@ -85,6 +85,10 @@ var settingsPage = `
|
|||||||
<div class="form-check">
|
<div class="form-check">
|
||||||
<input id="DisableUpload" class="form-check-input" type="checkbox" autocomplete="off">
|
<input id="DisableUpload" class="form-check-input" type="checkbox" autocomplete="off">
|
||||||
<label for="DisableUpload">Отключить Отдачу</label>
|
<label for="DisableUpload">Отключить Отдачу</label>
|
||||||
|
</div>
|
||||||
|
<div class="form-check">
|
||||||
|
<input id="EnableDebug" class="form-check-input" type="checkbox" autocomplete="off">
|
||||||
|
<label for="EnableDebug">Режим отладки (только для разработчиков)</label>
|
||||||
</div>
|
</div>
|
||||||
<br>
|
<br>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
@@ -171,6 +175,7 @@ var settingsPage = `
|
|||||||
data.DisableUPNP = $('#DisableUPNP').prop('checked');
|
data.DisableUPNP = $('#DisableUPNP').prop('checked');
|
||||||
data.DisableDHT = $('#DisableDHT').prop('checked');
|
data.DisableDHT = $('#DisableDHT').prop('checked');
|
||||||
data.DisableUpload = $('#DisableUpload').prop('checked');
|
data.DisableUpload = $('#DisableUpload').prop('checked');
|
||||||
|
data.EnableDebug = $('#EnableDebug').prop('checked');
|
||||||
data.Encryption = Number($('#Encryption').val());
|
data.Encryption = Number($('#Encryption').val());
|
||||||
|
|
||||||
data.ConnectionsLimit = Number($('#ConnectionsLimit').val());
|
data.ConnectionsLimit = Number($('#ConnectionsLimit').val());
|
||||||
|
|||||||
Reference in New Issue
Block a user