Merge branch 'master' into new-torrent

This commit is contained in:
nikk gitanes
2021-12-14 05:57:57 +03:00
9 changed files with 58 additions and 26 deletions

View File

@@ -8,6 +8,11 @@ After open browser link http://127.0.0.1:8090 \
On linux systems you need to set the environment variable before run \
***export GODEBUG=madvdontneed=1***
#### Unofficial TorrServer iocage plugin
On FreeBSD (TrueNAS/FreeNAS) you can use this plugin
https://github.com/filka96/iocage-plugin-TorrServer
### Build
Install golang 1.16+ by instruction: https://golang.org/doc/install \
Goto dir to source\

View File

@@ -41,6 +41,8 @@ func (args) Version() string {
var params args
func main() {
runtime.GOMAXPROCS(runtime.NumCPU())
arg.MustParse(&params)
if params.Path == "" {
@@ -56,6 +58,7 @@ func main() {
log.Init(params.LogPath, params.WebLogPath)
fmt.Println("=========== START ===========")
fmt.Println("TorrServer", version.Version+",", runtime.Version())
fmt.Println("CPU Num:", runtime.NumCPU())
if params.HttpAuth {
log.TLogln("Use HTTP Auth file", settings.Path+"/accs.db")
}

View File

@@ -8,6 +8,7 @@ import (
"os/user"
"path/filepath"
"runtime"
"strconv"
"time"
"github.com/anacrolix/dms/dlna/dms"
@@ -37,7 +38,20 @@ func Start() {
return
}(),
HTTPConn: func() net.Listener {
conn, err := net.Listen("tcp", ":9080")
port := 9080
for {
log.TLogln("Check dlna port", port)
m, err := net.Listen("tcp", ":"+strconv.Itoa(port))
if m != nil {
m.Close()
}
if err == nil {
break
}
port++
}
log.TLogln("Set dlna port", port)
conn, err := net.Listen("tcp", ":"+strconv.Itoa(port))
if err != nil {
log.TLogln(err)
os.Exit(1)

View File

@@ -121,9 +121,8 @@ func loadBTSets() {
func SetDefault() {
sets := new(BTSets)
sets.EnableDebug = false
sets.DisableUTP = true
sets.CacheSize = 96 * 1024 * 1024 // 96 MB
sets.PreloadCache = 0
sets.CacheSize = 64 * 1024 * 1024 // 64 MB
sets.PreloadCache = 50
sets.ConnectionsLimit = 23
sets.RetrackersMode = 1
sets.TorrentDisconnectTimeout = 30

View File

@@ -1,3 +1,4 @@
package version
const Version = "MatriX.109.NE1.38"
const Version = "MatriX.110.NE1.39"

View File

@@ -4,7 +4,9 @@ import (
"net/http"
"strings"
"server/dlna"
"server/log"
set "server/settings"
"server/torr"
"server/torr/state"
"server/web/api/utils"
@@ -103,7 +105,11 @@ func addTorrent(req torrReqJS, c *gin.Context) {
torr.SaveTorrentToDB(tor)
}
}()
// TODO: remove
if set.BTsets.EnableDLNA {
dlna.Stop()
dlna.Start()
}
c.JSON(200, tor.Status())
}
@@ -137,6 +143,11 @@ func remTorrent(req torrReqJS, c *gin.Context) {
return
}
torr.RemTorrent(req.Hash)
// TODO: remove
if set.BTsets.EnableDLNA {
dlna.Stop()
dlna.Start()
}
c.Status(200)
}

19
web/package-lock.json generated
View File

@@ -11,7 +11,7 @@
"dependencies": {
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"axios": "^0.21.1",
"axios": "^0.21.2",
"clsx": "^1.1.1",
"i18next": "^20.3.1",
"i18next-browser-languagedetector": "^6.1.1",
@@ -4432,12 +4432,11 @@
}
},
"node_modules/axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"license": "MIT",
"version": "0.21.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz",
"integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==",
"dependencies": {
"follow-redirects": "^1.10.0"
"follow-redirects": "^1.14.0"
}
},
"node_modules/axobject-query": {
@@ -27263,11 +27262,11 @@
"integrity": "sha512-evY7DN8qSIbsW2H/TWQ1bX3sXN1d4MNb5Vb4n7BzPuCwRHdkZ1H2eNLuSh73EoQqkGKUtju2G2HCcjCfhvZIAA=="
},
"axios": {
"version": "0.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.1.tgz",
"integrity": "sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==",
"version": "0.21.2",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.21.2.tgz",
"integrity": "sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==",
"requires": {
"follow-redirects": "^1.10.0"
"follow-redirects": "^1.14.0"
}
},
"axobject-query": {

View File

@@ -5,7 +5,7 @@
"dependencies": {
"@material-ui/core": "^4.11.4",
"@material-ui/icons": "^4.11.2",
"axios": "^0.21.1",
"axios": "^0.21.2",
"clsx": "^1.1.1",
"i18next": "^20.3.1",
"i18next-browser-languagedetector": "^6.1.1",

View File

@@ -2773,12 +2773,12 @@ axe-core@^4.0.2:
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.3.3.tgz#b55cd8e8ddf659fe89b064680e1c6a4dceab0325"
integrity sha512-/lqqLAmuIPi79WYfRpy2i8z+x+vxU3zX2uAm0gs1q52qTuKwolOj1P8XbufpXcsydrpKx2yGn2wzAnxCMV86QA==
axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
integrity sha512-dKQiRHxGD9PPRIUNIWvZhPTPpl1rf/OxTYKsqKUDjBwYylTvV7SjSHJb9ratfyzM6wCdLCOYLzs73qpg5c4iGA==
axios@^0.21.2:
version "0.21.2"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.2.tgz#21297d5084b2aeeb422f5d38e7be4fbb82239017"
integrity sha512-87otirqUw3e8CzHTMO+/9kh/FSgXt/eVDvipijwDtEuwbkySWZ9SBm6VEubmJ/kLKEoLQV/POhxXFb66bfekfg==
dependencies:
follow-redirects "^1.10.0"
follow-redirects "^1.14.0"
axobject-query@^2.2.0:
version "2.2.0"
@@ -5870,10 +5870,10 @@ flush-write-stream@^1.0.0, flush-write-stream@^1.0.2:
inherits "^2.0.3"
readable-stream "^2.3.6"
follow-redirects@^1.0.0, follow-redirects@^1.10.0:
version "1.14.2"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.2.tgz#cecb825047c00f5e66b142f90fed4f515dec789b"
integrity sha512-yLR6WaE2lbF0x4K2qE2p9PEXKLDjUjnR/xmjS3wHAYxtlsI9MLLBJUZirAHKzUZDGLxje7w/cXR49WOUo4rbsA==
follow-redirects@^1.0.0, follow-redirects@^1.14.0:
version "1.14.5"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.5.tgz#f09a5848981d3c772b5392309778523f8d85c381"
integrity sha512-wtphSXy7d4/OR+MvIFbCVBDzZ5520qV8XfPklSN5QtxuMUJZ+b0Wnst1e1lCDocfzuCkHqj8k0FpZqO+UIaKNA==
for-each@^0.3.3:
version "0.3.3"