mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 21:46:11 +05:00
Merge branch 'master' into old-engine
This commit is contained in:
24
.gitlab-ci.yml
Normal file
24
.gitlab-ci.yml
Normal file
@@ -0,0 +1,24 @@
|
||||
stages:
|
||||
- build_go
|
||||
|
||||
build_go:
|
||||
image: golang:latest
|
||||
stage: build_go
|
||||
when: manual
|
||||
tags:
|
||||
- amd64
|
||||
artifacts:
|
||||
name: "TorrServer"
|
||||
paths:
|
||||
- dist
|
||||
script:
|
||||
- apt update
|
||||
- apt install -y npm zip
|
||||
- rm -rf /var/lib/apt/lists/*
|
||||
- npm install -g yarn
|
||||
- wget -q "https://dl.google.com/android/repository/android-ndk-r25c-linux.zip"
|
||||
- unzip ./android-ndk-r25c-linux.zip
|
||||
- rm ./android-ndk-r25c-linux.zip
|
||||
- pwd
|
||||
- ls -l
|
||||
- ./build-all.sh
|
||||
@@ -8,7 +8,7 @@ RUN yarn install && yarn run build
|
||||
|
||||
|
||||
### BUILD TORRSERVER MULTIARCH START ###
|
||||
FROM --platform=$BUILDPLATFORM golang:1.19-alpine as builder
|
||||
FROM --platform=$BUILDPLATFORM golang:1.20-alpine as builder
|
||||
|
||||
COPY . /opt/src
|
||||
COPY --from=front /app/build /opt/src/web/build
|
||||
|
||||
10
build-all.sh
10
build-all.sh
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
PLATFORMS=(
|
||||
'linux/amd64'
|
||||
'linux/arm64'
|
||||
'linux/arm7'
|
||||
'linux/amd64'
|
||||
'linux/arm5'
|
||||
'linux/386'
|
||||
'windows/amd64'
|
||||
@@ -90,9 +90,9 @@ declare -a COMPILERS=(
|
||||
"amd64:x86_64-linux-android21-clang"
|
||||
)
|
||||
|
||||
export NDK_VERSION="23.1.7779620" # 25.1.8937393
|
||||
export NDK_TOOLCHAIN=${ANDROID_HOME}/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/darwin-x86_64
|
||||
|
||||
export NDK_VERSION="25.2.9519653" # 25.1.8937393
|
||||
#export NDK_TOOLCHAIN=${ANDROID_HOME}/ndk/${NDK_VERSION}/toolchains/llvm/prebuilt/darwin-x86_64
|
||||
export NDK_TOOLCHAIN="${PWD}/../android-ndk-r25c/toolchains/llvm/prebuilt/linux-x86_64"
|
||||
GOOS=android
|
||||
|
||||
for V in "${COMPILERS[@]}"; do
|
||||
@@ -115,4 +115,4 @@ if [[ "${FAILURES}" != "" ]]; then
|
||||
echo ""
|
||||
echo "failed on: ${FAILURES}"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
@@ -4,6 +4,7 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"runtime"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
@@ -12,31 +13,57 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
EsSystemRequired = 0x00000001
|
||||
EsContinuous = 0x80000000
|
||||
EsSystemRequired = 0x00000001
|
||||
EsAwaymodeRequired = 0x00000040 // Added for future improvements
|
||||
EsContinuous = 0x80000000
|
||||
)
|
||||
|
||||
var pulseTime = 1 * time.Minute
|
||||
var pulseTime = 60 * time.Second
|
||||
var clearFlagTimeout = 3 * 60 * time.Second
|
||||
|
||||
func Preconfig(kill bool) {
|
||||
go func() {
|
||||
// need work on one thread because SetThreadExecutionState sets flag to thread. We need set and clear flag for same thread.
|
||||
runtime.LockOSThread()
|
||||
// don't sleep/hibernate windows
|
||||
kernel32 := syscall.NewLazyDLL("kernel32.dll")
|
||||
setThreadExecStateProc := kernel32.NewProc("SetThreadExecutionState")
|
||||
currentExecState := uintptr(EsContinuous)
|
||||
normalExecutionState := uintptr(EsContinuous)
|
||||
systemRequireState := uintptr(EsSystemRequired | EsContinuous)
|
||||
pulse := time.NewTicker(pulseTime)
|
||||
var clearFlagTime int64 = -1
|
||||
for {
|
||||
select {
|
||||
case <-pulse.C:
|
||||
{
|
||||
send := false
|
||||
systemRequired := false
|
||||
for _, torrent := range torr.ListTorrent() {
|
||||
if torrent.Stat != state.TorrentInDB {
|
||||
send = true
|
||||
systemRequired = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if send {
|
||||
setThreadExecStateProc.Call(uintptr(EsSystemRequired))
|
||||
if systemRequired && currentExecState != systemRequireState {
|
||||
// Looks like sending just EsSystemRequired to clear timer is broken in Win11.
|
||||
// Enable system required to avoid the system to idle to sleep.
|
||||
currentExecState = systemRequireState
|
||||
setThreadExecStateProc.Call(systemRequireState)
|
||||
}
|
||||
|
||||
if !systemRequired && currentExecState != normalExecutionState {
|
||||
// Clear EXECUTION_STATE flags to disable away mode and allow the system to idle to sleep normally.
|
||||
|
||||
// Avoid clear flag immediately to add time to start next episode
|
||||
if clearFlagTime == -1 {
|
||||
clearFlagTime = time.Now().Unix() + int64(clearFlagTimeout.Seconds())
|
||||
}
|
||||
|
||||
if clearFlagTime >= time.Now().Unix() {
|
||||
clearFlagTime = -1
|
||||
currentExecState = normalExecutionState
|
||||
setThreadExecStateProc.Call(normalExecutionState)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,7 +29,8 @@ func Start() {
|
||||
ifaces, err := net.Interfaces()
|
||||
if err != nil {
|
||||
logger.Levelf(log.Error, "%v", err)
|
||||
os.Exit(1)
|
||||
return
|
||||
// os.Exit(1) // avoid start on Android 13+
|
||||
}
|
||||
for _, i := range ifaces {
|
||||
// interface flags seem to always be 0 on Windows
|
||||
|
||||
@@ -2,7 +2,7 @@ module server
|
||||
|
||||
go 1.18
|
||||
|
||||
replace github.com/anacrolix/torrent v1.49.0 => github.com/tsynik/torrent v1.2.8
|
||||
replace github.com/anacrolix/torrent v1.50.0 => github.com/tsynik/torrent v1.2.8
|
||||
|
||||
require (
|
||||
github.com/agnivade/levenshtein v1.1.1
|
||||
@@ -11,7 +11,7 @@ require (
|
||||
github.com/anacrolix/log v0.13.2-0.20221123232138-02e2764801c3
|
||||
github.com/anacrolix/missinggo v1.3.0
|
||||
github.com/anacrolix/publicip v0.3.0
|
||||
github.com/anacrolix/torrent v1.49.0
|
||||
github.com/anacrolix/torrent v1.50.0
|
||||
github.com/gin-contrib/cors v1.4.0
|
||||
github.com/gin-contrib/location v0.0.2
|
||||
github.com/gin-gonic/gin v1.9.0
|
||||
@@ -19,6 +19,7 @@ require (
|
||||
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8
|
||||
github.com/pkg/errors v0.9.1
|
||||
go.etcd.io/bbolt v1.3.7
|
||||
golang.org/x/image v0.7.0
|
||||
golang.org/x/time v0.3.0
|
||||
gopkg.in/vansante/go-ffprobe.v2 v2.1.1
|
||||
)
|
||||
@@ -28,10 +29,10 @@ require (
|
||||
github.com/alecthomas/atomic v0.1.0-alpha2 // indirect
|
||||
github.com/alexflint/go-scalar v1.2.0 // indirect
|
||||
github.com/anacrolix/chansync v0.3.0 // indirect
|
||||
github.com/anacrolix/dht/v2 v2.19.3-0.20230103143054-92b36a3fa7a3 // indirect
|
||||
github.com/anacrolix/dht/v2 v2.20.0 // indirect
|
||||
github.com/anacrolix/envpprof v1.3.0 // indirect
|
||||
github.com/anacrolix/ffprobe v1.0.1 // indirect
|
||||
github.com/anacrolix/generics v0.0.0-20221221005542-ac1d5b02b8a3 // indirect
|
||||
github.com/anacrolix/generics v0.0.0-20230428105757-683593396d68 // indirect
|
||||
github.com/anacrolix/missinggo/perf v1.0.0 // indirect
|
||||
github.com/anacrolix/missinggo/v2 v2.7.1 // indirect
|
||||
github.com/anacrolix/multiless v0.3.1-0.20221221005021-2d12701f83f7 // indirect
|
||||
@@ -40,7 +41,7 @@ require (
|
||||
github.com/anacrolix/upnp v0.1.3-0.20220123035249-922794e51c96 // indirect
|
||||
github.com/anacrolix/utp v0.1.0 // indirect
|
||||
github.com/benbjohnson/immutable v0.4.3 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.5.0 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.7.0 // indirect
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 // indirect
|
||||
github.com/bytedance/sonic v1.8.6 // indirect
|
||||
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
|
||||
@@ -67,12 +68,12 @@ require (
|
||||
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
|
||||
github.com/ugorji/go/codec v1.2.11 // indirect
|
||||
golang.org/x/arch v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.7.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 // indirect
|
||||
golang.org/x/net v0.8.0 // indirect
|
||||
golang.org/x/crypto v0.8.0 // indirect
|
||||
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 // indirect
|
||||
golang.org/x/net v0.9.0 // indirect
|
||||
golang.org/x/sync v0.1.0 // indirect
|
||||
golang.org/x/sys v0.6.0 // indirect
|
||||
golang.org/x/text v0.8.0 // indirect
|
||||
golang.org/x/sys v0.7.0 // indirect
|
||||
golang.org/x/text v0.9.0 // indirect
|
||||
google.golang.org/protobuf v1.30.0 // indirect
|
||||
gopkg.in/yaml.v3 v3.0.1 // indirect
|
||||
)
|
||||
|
||||
@@ -28,8 +28,8 @@ github.com/alexflint/go-scalar v1.2.0 h1:WR7JPKkeNpnYIOfHRa7ivM21aWAdHD0gEWHCx+W
|
||||
github.com/alexflint/go-scalar v1.2.0/go.mod h1:LoFvNMqS1CPrMVltza4LvnGKhaSpc3oyLEBUZVhhS2o=
|
||||
github.com/anacrolix/chansync v0.3.0 h1:lRu9tbeuw3wl+PhMu/r+JJCRu5ArFXIluOgdF0ao6/U=
|
||||
github.com/anacrolix/chansync v0.3.0/go.mod h1:DZsatdsdXxD0WiwcGl0nJVwyjCKMDv+knl1q2iBjA2k=
|
||||
github.com/anacrolix/dht/v2 v2.19.3-0.20230103143054-92b36a3fa7a3 h1:2l6QIQo3om9VckhjhL6KcXELJLe9TqTwHyuGJUyoaUc=
|
||||
github.com/anacrolix/dht/v2 v2.19.3-0.20230103143054-92b36a3fa7a3/go.mod h1:SDGC+sEs1pnO2sJGYuhvIis7T8749dDHNfcjtdH4e3g=
|
||||
github.com/anacrolix/dht/v2 v2.20.0 h1:eDx9lfE9iCSf5sPK0290GToHURNhEFuUGN8iyvhvJDk=
|
||||
github.com/anacrolix/dht/v2 v2.20.0/go.mod h1:SDGC+sEs1pnO2sJGYuhvIis7T8749dDHNfcjtdH4e3g=
|
||||
github.com/anacrolix/dms v1.5.1-0.20230317005814-6af26ec4c733 h1:M0gzRW5+d7r2v+Fs743n/Ri267qgf1JVgT/OFOHuyTE=
|
||||
github.com/anacrolix/dms v1.5.1-0.20230317005814-6af26ec4c733/go.mod h1:5fAMpBcPFG4WQFh91zhf2E7/KYZ3/WmmRAf/WMoL0Q0=
|
||||
github.com/anacrolix/envpprof v0.0.0-20180404065416-323002cec2fa/go.mod h1:KgHhUaQMc8cC0+cEflSgCFNFbKwi5h54gqtVn8yhP7c=
|
||||
@@ -40,8 +40,8 @@ github.com/anacrolix/envpprof v1.3.0/go.mod h1:7QIG4CaX1uexQ3tqd5+BRa/9e2D02Wcer
|
||||
github.com/anacrolix/ffprobe v1.0.0/go.mod h1:BIw+Bjol6CWjm/CRWrVLk2Vy+UYlkgmBZ05vpSYqZPw=
|
||||
github.com/anacrolix/ffprobe v1.0.1 h1:S/MfCrUNZvbkkykX/1mmLVRf8//M7mvlY3BcwHaK3bQ=
|
||||
github.com/anacrolix/ffprobe v1.0.1/go.mod h1:MXe+zG/RRa5OdIf5+VYYfS/CfsSqOH7RrvGIqJBzqhI=
|
||||
github.com/anacrolix/generics v0.0.0-20221221005542-ac1d5b02b8a3 h1:gXyo39DTLD3j6cNKvt8wRAqQs/jeOmbX5CR0djEK8SE=
|
||||
github.com/anacrolix/generics v0.0.0-20221221005542-ac1d5b02b8a3/go.mod h1:ff2rHB/joTV03aMSSn/AZNnaIpUw0h3njetGsaXcMy8=
|
||||
github.com/anacrolix/generics v0.0.0-20230428105757-683593396d68 h1:fyXlBfnlFzZSFckJ8QLb2lfmWfY++4RiUnae7ZMuv0A=
|
||||
github.com/anacrolix/generics v0.0.0-20230428105757-683593396d68/go.mod h1:ff2rHB/joTV03aMSSn/AZNnaIpUw0h3njetGsaXcMy8=
|
||||
github.com/anacrolix/log v0.3.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
|
||||
github.com/anacrolix/log v0.6.0/go.mod h1:lWvLTqzAnCWPJA08T2HCstZi0L1y2Wyvm3FJgwU9jwU=
|
||||
github.com/anacrolix/log v0.10.1-0.20220123034749-3920702c17f8/go.mod h1:GmnE2c0nvz8pOIPUSC9Rawgefy1sDXqposC2wgtBZE4=
|
||||
@@ -87,8 +87,8 @@ github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24
|
||||
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
|
||||
github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw=
|
||||
github.com/bits-and-blooms/bitset v1.2.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
|
||||
github.com/bits-and-blooms/bitset v1.5.0 h1:NpE8frKRLGHIcEzkR+gZhiioW1+WbYV6fKwD6ZIpQT8=
|
||||
github.com/bits-and-blooms/bitset v1.5.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
|
||||
github.com/bits-and-blooms/bitset v1.7.0 h1:YjAGVd3XmtK9ktAbX8Zg2g2PwLIMjGREZJHlV4j7NEo=
|
||||
github.com/bits-and-blooms/bitset v1.7.0/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edYb8uY+O0FJTyyDA=
|
||||
github.com/bradfitz/iter v0.0.0-20140124041915-454541ec3da2/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo=
|
||||
github.com/bradfitz/iter v0.0.0-20190303215204-33e6a9893b0c/go.mod h1:PyRFw1Lt2wKX4ZVSQ2mk+PeDa1rxyObEDlApuIsUKuo=
|
||||
github.com/bradfitz/iter v0.0.0-20191230175014-e8f45d346db8 h1:GKTyiRCL6zVf5wWaqKnf+7Qs6GbEPfd4iMOitWzXJx8=
|
||||
@@ -328,6 +328,7 @@ github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4d
|
||||
github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg=
|
||||
github.com/willf/bitset v1.1.9/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||
github.com/willf/bitset v1.1.10/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4=
|
||||
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
|
||||
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
|
||||
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
|
||||
go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk=
|
||||
@@ -339,15 +340,20 @@ golang.org/x/arch v0.3.0/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8=
|
||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.7.0 h1:AvwMYaRytfdeVt3u6mLaxYtErKYjxA2OXjJ1HHq6t3A=
|
||||
golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU=
|
||||
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
|
||||
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
|
||||
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
|
||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29 h1:ooxPy7fPvB4kwsA2h+iBNHkAbp/4JxTSwCmvdjEYmug=
|
||||
golang.org/x/exp v0.0.0-20230321023759-10a507213a29/go.mod h1:CxIveKay+FTh1D0yPZemJVgC/95VzuuOLq5Qi4xnoYc=
|
||||
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53 h1:5llv2sWeaMSnA3w2kS57ouQQ4pudlXrR0dCgw51QK9o=
|
||||
golang.org/x/exp v0.0.0-20230425010034-47ecfdc1ba53/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
|
||||
golang.org/x/image v0.7.0 h1:gzS29xtG1J5ybQlv0PuyfE3nmc6R4qB73m6LUUmvFuw=
|
||||
golang.org/x/image v0.7.0/go.mod h1:nd/q4ef1AKKYl/4kft7g+6UyGbdiqWqTP1ZAbRoV7Rg=
|
||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
||||
golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
||||
golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4=
|
||||
golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs=
|
||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
||||
@@ -360,8 +366,10 @@ golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLL
|
||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
||||
golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg=
|
||||
golang.org/x/net v0.0.0-20220524220425-1d687d428aca/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
|
||||
golang.org/x/net v0.8.0 h1:Zrh2ngAOFYneWTAIAPethzeaQLuHwhuBkuV6ZiRnUaQ=
|
||||
golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc=
|
||||
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
|
||||
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
|
||||
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
|
||||
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
|
||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
||||
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
|
||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
@@ -370,6 +378,7 @@ golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
|
||||
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@@ -392,17 +401,22 @@ golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0 h1:MVltZSvRTcU2ljQOhs94SXPftV6DCNnZViHeQps87pQ=
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
|
||||
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/text v0.8.0 h1:57P1ETyNKtuIjB4SRd15iJxuhj8Gc416Y78H3qgMh68=
|
||||
golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8=
|
||||
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
|
||||
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
|
||||
golang.org/x/time v0.3.0 h1:rg5rLMjNzMS1RkNLzCG38eapWhnYLFYXDXj2gOlr8j4=
|
||||
golang.org/x/time v0.3.0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
|
||||
golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
@@ -411,6 +425,10 @@ golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGm
|
||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
||||
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
|
||||
golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU=
|
||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
||||
google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk=
|
||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
||||
|
||||
@@ -131,8 +131,6 @@ func loadDB() {
|
||||
err = dec.Decode(&torr)
|
||||
if err == nil {
|
||||
ftorrs = append(ftorrs, torr)
|
||||
} else {
|
||||
log.TLogln("Error read rutor db:", err)
|
||||
}
|
||||
}
|
||||
torrs = ftorrs
|
||||
|
||||
@@ -25,7 +25,7 @@ type BTSets struct {
|
||||
ForceEncrypt bool
|
||||
RetrackersMode int // 0 - don`t add, 1 - add retrackers (def), 2 - remove retrackers 3 - replace retrackers
|
||||
TorrentDisconnectTimeout int // in seconds
|
||||
EnableDebug bool // print logs
|
||||
EnableDebug bool // debug logs
|
||||
|
||||
// DLNA
|
||||
EnableDLNA bool
|
||||
@@ -59,7 +59,7 @@ func SetBTSets(sets *BTSets) {
|
||||
if ReadOnly {
|
||||
return
|
||||
}
|
||||
// failsafe (load defaults)
|
||||
// failsafe checks (use defaults)
|
||||
if sets.CacheSize == 0 {
|
||||
sets.CacheSize = 64 * 1024 * 1024
|
||||
}
|
||||
@@ -114,6 +114,25 @@ func SetBTSets(sets *BTSets) {
|
||||
tdb.Set("Settings", "BitTorr", buf)
|
||||
}
|
||||
|
||||
func SetDefaultConfig() {
|
||||
sets := new(BTSets)
|
||||
sets.CacheSize = 64 * 1024 * 1024 // 64 MB
|
||||
sets.PreloadCache = 50
|
||||
sets.ConnectionsLimit = 25
|
||||
sets.RetrackersMode = 1
|
||||
sets.TorrentDisconnectTimeout = 30
|
||||
sets.ReaderReadAHead = 95 // 95%
|
||||
BTsets = sets
|
||||
if !ReadOnly {
|
||||
buf, err := json.Marshal(BTsets)
|
||||
if err != nil {
|
||||
log.TLogln("Error marshal btsets", err)
|
||||
return
|
||||
}
|
||||
tdb.Set("Settings", "BitTorr", buf)
|
||||
}
|
||||
}
|
||||
|
||||
func loadBTSets() {
|
||||
buf := tdb.Get("Settings", "BitTorr")
|
||||
if len(buf) > 0 {
|
||||
@@ -127,17 +146,5 @@ func loadBTSets() {
|
||||
log.TLogln("Error unmarshal btsets", err)
|
||||
}
|
||||
|
||||
SetDefault()
|
||||
}
|
||||
|
||||
func SetDefault() {
|
||||
sets := new(BTSets)
|
||||
sets.EnableDebug = false
|
||||
sets.CacheSize = 64 * 1024 * 1024 // 64 MB
|
||||
sets.PreloadCache = 50
|
||||
sets.ConnectionsLimit = 25
|
||||
sets.RetrackersMode = 1
|
||||
sets.TorrentDisconnectTimeout = 30
|
||||
sets.ReaderReadAHead = 95 // 95%
|
||||
BTsets = sets
|
||||
SetDefaultConfig()
|
||||
}
|
||||
|
||||
@@ -207,7 +207,7 @@ func SetDefSettings() {
|
||||
if sets.ReadOnly {
|
||||
return
|
||||
}
|
||||
sets.SetDefault()
|
||||
sets.SetDefaultConfig()
|
||||
log.TLogln("drop all torrents")
|
||||
dropAllTorrent()
|
||||
time.Sleep(time.Second * 1)
|
||||
|
||||
@@ -2,9 +2,13 @@ package utils
|
||||
|
||||
import (
|
||||
"image"
|
||||
_ "image/gif"
|
||||
_ "image/jpeg"
|
||||
_ "image/png"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"golang.org/x/image/webp"
|
||||
|
||||
"server/log"
|
||||
)
|
||||
@@ -19,7 +23,11 @@ func CheckImgUrl(link string) bool {
|
||||
return false
|
||||
}
|
||||
defer resp.Body.Close()
|
||||
_, _, err = image.Decode(resp.Body)
|
||||
if strings.HasSuffix(link, ".webp") {
|
||||
_, err = webp.Decode(resp.Body)
|
||||
} else {
|
||||
_, _, err = image.Decode(resp.Body)
|
||||
}
|
||||
if err != nil {
|
||||
log.TLogln("Error decode image:", err)
|
||||
return false
|
||||
|
||||
@@ -6,7 +6,7 @@ import (
|
||||
// "github.com/anacrolix/torrent"
|
||||
)
|
||||
|
||||
const Version = "MatriX.121.OE"
|
||||
const Version = "MatriX.123.OE"
|
||||
|
||||
func GetTorrentVersion() string {
|
||||
// _ = torrent.NewDefaultClientConfig()
|
||||
|
||||
@@ -118,20 +118,20 @@ var Mstile150x150png []byte
|
||||
//go:embed pages/site.webmanifest
|
||||
var Sitewebmanifest []byte
|
||||
|
||||
//go:embed pages/static/js/2.9dd71e52.chunk.js
|
||||
var Staticjs29dd71e52chunkjs []byte
|
||||
//go:embed pages/static/js/2.4ba5e0d3.chunk.js
|
||||
var Staticjs24ba5e0d3chunkjs []byte
|
||||
|
||||
//go:embed pages/static/js/2.9dd71e52.chunk.js.LICENSE.txt
|
||||
var Staticjs29dd71e52chunkjsLICENSEtxt []byte
|
||||
//go:embed pages/static/js/2.4ba5e0d3.chunk.js.LICENSE.txt
|
||||
var Staticjs24ba5e0d3chunkjsLICENSEtxt []byte
|
||||
|
||||
//go:embed pages/static/js/2.9dd71e52.chunk.js.map
|
||||
var Staticjs29dd71e52chunkjsmap []byte
|
||||
//go:embed pages/static/js/2.4ba5e0d3.chunk.js.map
|
||||
var Staticjs24ba5e0d3chunkjsmap []byte
|
||||
|
||||
//go:embed pages/static/js/main.0dd1792c.chunk.js
|
||||
var Staticjsmain0dd1792cchunkjs []byte
|
||||
//go:embed pages/static/js/main.0410f8f3.chunk.js
|
||||
var Staticjsmain0410f8f3chunkjs []byte
|
||||
|
||||
//go:embed pages/static/js/main.0dd1792c.chunk.js.map
|
||||
var Staticjsmain0dd1792cchunkjsmap []byte
|
||||
//go:embed pages/static/js/main.0410f8f3.chunk.js.map
|
||||
var Staticjsmain0410f8f3chunkjsmap []byte
|
||||
|
||||
//go:embed pages/static/js/runtime-main.64d07802.js
|
||||
var Staticjsruntimemain64d07802js []byte
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
{
|
||||
"files": {
|
||||
"main.js": "/static/js/main.0dd1792c.chunk.js",
|
||||
"main.js.map": "/static/js/main.0dd1792c.chunk.js.map",
|
||||
"main.js": "/static/js/main.0410f8f3.chunk.js",
|
||||
"main.js.map": "/static/js/main.0410f8f3.chunk.js.map",
|
||||
"runtime-main.js": "/static/js/runtime-main.64d07802.js",
|
||||
"runtime-main.js.map": "/static/js/runtime-main.64d07802.js.map",
|
||||
"static/js/2.9dd71e52.chunk.js": "/static/js/2.9dd71e52.chunk.js",
|
||||
"static/js/2.9dd71e52.chunk.js.map": "/static/js/2.9dd71e52.chunk.js.map",
|
||||
"static/js/2.4ba5e0d3.chunk.js": "/static/js/2.4ba5e0d3.chunk.js",
|
||||
"static/js/2.4ba5e0d3.chunk.js.map": "/static/js/2.4ba5e0d3.chunk.js.map",
|
||||
"index.html": "/index.html",
|
||||
"static/js/2.9dd71e52.chunk.js.LICENSE.txt": "/static/js/2.9dd71e52.chunk.js.LICENSE.txt"
|
||||
"static/js/2.4ba5e0d3.chunk.js.LICENSE.txt": "/static/js/2.4ba5e0d3.chunk.js.LICENSE.txt"
|
||||
},
|
||||
"entrypoints": [
|
||||
"static/js/runtime-main.64d07802.js",
|
||||
"static/js/2.9dd71e52.chunk.js",
|
||||
"static/js/main.0dd1792c.chunk.js"
|
||||
"static/js/2.4ba5e0d3.chunk.js",
|
||||
"static/js/main.0410f8f3.chunk.js"
|
||||
]
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -161,24 +161,24 @@ func RouteWebPages(route *gin.RouterGroup) {
|
||||
c.Data(200, "application/manifest+json", Sitewebmanifest)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.9dd71e52.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjs29dd71e52chunkjs)
|
||||
route.GET("/static/js/2.4ba5e0d3.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjs24ba5e0d3chunkjs)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.9dd71e52.chunk.js.LICENSE.txt", func(c *gin.Context) {
|
||||
c.Data(200, "text/plain; charset=utf-8", Staticjs29dd71e52chunkjsLICENSEtxt)
|
||||
route.GET("/static/js/2.4ba5e0d3.chunk.js.LICENSE.txt", func(c *gin.Context) {
|
||||
c.Data(200, "text/plain; charset=utf-8", Staticjs24ba5e0d3chunkjsLICENSEtxt)
|
||||
})
|
||||
|
||||
route.GET("/static/js/2.9dd71e52.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjs29dd71e52chunkjsmap)
|
||||
route.GET("/static/js/2.4ba5e0d3.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjs24ba5e0d3chunkjsmap)
|
||||
})
|
||||
|
||||
route.GET("/static/js/main.0dd1792c.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjsmain0dd1792cchunkjs)
|
||||
route.GET("/static/js/main.0410f8f3.chunk.js", func(c *gin.Context) {
|
||||
c.Data(200, "application/javascript; charset=utf-8", Staticjsmain0410f8f3chunkjs)
|
||||
})
|
||||
|
||||
route.GET("/static/js/main.0dd1792c.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjsmain0dd1792cchunkjsmap)
|
||||
route.GET("/static/js/main.0410f8f3.chunk.js.map", func(c *gin.Context) {
|
||||
c.Data(200, "application/json", Staticjsmain0410f8f3chunkjsmap)
|
||||
})
|
||||
|
||||
route.GET("/static/js/runtime-main.64d07802.js", func(c *gin.Context) {
|
||||
|
||||
@@ -1,25 +1,26 @@
|
||||
export default {
|
||||
CacheSize: 64,
|
||||
ReaderReadAHead: 95,
|
||||
UseDisk: false,
|
||||
UploadRateLimit: 0,
|
||||
TorrentsSavePath: '',
|
||||
ConnectionsLimit: 25,
|
||||
DisableDHT: false,
|
||||
DisablePEX: false,
|
||||
DisableTCP: false,
|
||||
DisableUPNP: false,
|
||||
DisableUTP: false,
|
||||
DisableUpload: false,
|
||||
DownloadRateLimit: 0,
|
||||
EnableDebug: false,
|
||||
EnableIPv6: false,
|
||||
FriendlyName: '',
|
||||
EnableRutorSearch: false,
|
||||
ForceEncrypt: false,
|
||||
PeersListenPort: 0,
|
||||
PreloadCache: 50,
|
||||
UseDisk: false,
|
||||
TorrentsSavePath: '',
|
||||
RemoveCacheOnDrop: false,
|
||||
ForceEncrypt: false,
|
||||
RetrackersMode: 1,
|
||||
TorrentDisconnectTimeout: 30,
|
||||
EnableDebug: false,
|
||||
EnableDLNA: false,
|
||||
FriendlyName: '',
|
||||
EnableRutorSearch: false,
|
||||
EnableIPv6: false,
|
||||
DisableTCP: false,
|
||||
DisableUTP: false,
|
||||
DisableUPNP: false,
|
||||
DisableDHT: false,
|
||||
DisablePEX: false,
|
||||
DisableUpload: false,
|
||||
DownloadRateLimit: 0,
|
||||
UploadRateLimit: 0,
|
||||
ConnectionsLimit: 25,
|
||||
PeersListenPort: 0,
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ export const useMaterialUITheme = () => {
|
||||
overrides: {
|
||||
MuiTypography: {
|
||||
h6: {
|
||||
fontSize: '1.2rem',
|
||||
fontSize: '1.0rem',
|
||||
},
|
||||
},
|
||||
MuiPaper: {
|
||||
|
||||
Reference in New Issue
Block a user