Initial commit: docker compose config
Release Docker multi arch / docker (push) Has been cancelled
Test Install Script / Test Script Syntax (push) Has been cancelled
Test Install Script / Test on almalinux-10 (default) (push) Has been cancelled
Test Install Script / Test on almalinux-10 (root) (push) Has been cancelled
Test Install Script / Test on almalinux-8 (default) (push) Has been cancelled
Test Install Script / Test on almalinux-8 (root) (push) Has been cancelled
Test Install Script / Test on almalinux-9 (default) (push) Has been cancelled
Test Install Script / Test on almalinux-9 (root) (push) Has been cancelled
Test Install Script / Test on amazonlinux-2 (default) (push) Has been cancelled
Test Install Script / Test on amazonlinux-2 (root) (push) Has been cancelled
Test Install Script / Test on debian-11 (default) (push) Has been cancelled
Test Install Script / Test on debian-11 (root) (push) Has been cancelled
Test Install Script / Test on debian-12 (default) (push) Has been cancelled
Test Install Script / Test on debian-12 (root) (push) Has been cancelled
Test Install Script / Test on debian-13 (default) (push) Has been cancelled
Test Install Script / Test on debian-13 (root) (push) Has been cancelled
Test Install Script / Test on fedora-latest (default) (push) Has been cancelled
Test Install Script / Test on fedora-latest (root) (push) Has been cancelled
Test Install Script / Test on rocky-10 (default) (push) Has been cancelled
Test Install Script / Test on rocky-10 (root) (push) Has been cancelled
Test Install Script / Test on rocky-8 (default) (push) Has been cancelled
Test Install Script / Test on rocky-8 (root) (push) Has been cancelled
Test Install Script / Test on rocky-9 (default) (push) Has been cancelled
Test Install Script / Test on rocky-9 (root) (push) Has been cancelled
Test Install Script / Test on ubuntu-22.04 (default) (push) Has been cancelled
Test Install Script / Test on ubuntu-22.04 (root) (push) Has been cancelled
Test Install Script / Test on ubuntu-24.04 (default) (push) Has been cancelled
Test Install Script / Test on ubuntu-24.04 (root) (push) Has been cancelled

This commit is contained in:
2026-05-30 12:07:11 +00:00
commit 616c6b1c62
381 changed files with 55145 additions and 0 deletions
+212
View File
@@ -0,0 +1,212 @@
package settings
import (
"encoding/json"
"io"
"io/fs"
"path/filepath"
"strings"
"server/log"
)
type TorznabConfig struct {
Host string
Key string
Name string
}
type TMDBConfig struct {
APIKey string // TMDB API Key
APIURL string // Base API URL (default: https://api.themoviedb.org)
ImageURL string // Image URL (default: https://image.tmdb.org)
ImageURLRu string // Image URL for Russian users (default: https://imagetmdb.com)
}
type BTSets struct {
// Cache
CacheSize int64 // in byte, def 64 MB
ReaderReadAHead int // in percent, 5%-100%, [...S__X__E...] [S-E] not clean
PreloadCache int // in percent
// Disk
UseDisk bool
TorrentsSavePath string
RemoveCacheOnDrop bool
// Torrent
ForceEncrypt bool
RetrackersMode int // 0 - don`t add, 1 - add retrackers (def), 2 - remove retrackers 3 - replace retrackers
TorrentDisconnectTimeout int // in seconds
EnableDebug bool // debug logs
// DLNA
EnableDLNA bool
FriendlyName string
// Rutor
EnableRutorSearch bool
// Torznab
EnableTorznabSearch bool
TorznabUrls []TorznabConfig
// TMDB
TMDBSettings TMDBConfig
// BT Config
EnableIPv6 bool
DisableTCP bool
DisableUTP bool
DisableUPNP bool
DisableDHT bool
DisablePEX bool
DisableUpload bool
DownloadRateLimit int // in kb, 0 - inf
UploadRateLimit int // in kb, 0 - inf
ConnectionsLimit int
PeersListenPort int
// HTTPS
SslPort int
SslCert string
SslKey string
// Reader
ResponsiveMode bool // enable Responsive reader (don't wait pieceComplete)
// FS
ShowFSActiveTorr bool
// Storage preferences
StoreSettingsInJson bool
StoreViewedInJson bool
// P2P Proxy
EnableProxy bool
ProxyHosts []string
}
func (v *BTSets) String() string {
buf, _ := json.Marshal(v)
return string(buf)
}
var BTsets *BTSets
func SetBTSets(sets *BTSets) {
if ReadOnly {
return
}
// failsafe checks (use defaults)
if sets.CacheSize == 0 {
sets.CacheSize = 64 * 1024 * 1024
}
if sets.ConnectionsLimit == 0 {
sets.ConnectionsLimit = 25
}
if sets.TorrentDisconnectTimeout == 0 {
sets.TorrentDisconnectTimeout = 30
}
if sets.ReaderReadAHead < 5 {
sets.ReaderReadAHead = 5
}
if sets.ReaderReadAHead > 100 {
sets.ReaderReadAHead = 100
}
if sets.PreloadCache < 0 {
sets.PreloadCache = 0
}
if sets.PreloadCache > 100 {
sets.PreloadCache = 100
}
if sets.TorrentsSavePath == "" {
sets.UseDisk = false
} else if sets.UseDisk {
BTsets = sets
go filepath.WalkDir(sets.TorrentsSavePath, func(path string, d fs.DirEntry, err error) error {
if err != nil {
return err
}
if d.IsDir() && strings.ToLower(d.Name()) == ".tsc" {
BTsets.TorrentsSavePath = path
log.TLogln("Find directory \"" + BTsets.TorrentsSavePath + "\", use as cache dir")
return io.EOF
}
if d.IsDir() && strings.HasPrefix(d.Name(), ".") {
return filepath.SkipDir
}
return nil
})
}
BTsets = sets
buf, err := json.Marshal(BTsets)
if err != nil {
log.TLogln("Error marshal btsets", err)
return
}
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%
sets.ResponsiveMode = true
sets.ShowFSActiveTorr = true
sets.StoreSettingsInJson = true
// Set default TMDB settings
sets.TMDBSettings = TMDBConfig{
APIKey: "",
APIURL: "https://api.themoviedb.org",
ImageURL: "https://image.tmdb.org",
ImageURLRu: "https://imagetmdb.com",
}
BTsets = sets
if !ReadOnly {
buf, err := json.Marshal(BTsets)
if err != nil {
log.TLogln("Error marshal btsets", err)
return
}
tdb.Set("Settings", "BitTorr", buf)
}
//Proxy
sets.EnableProxy = false
sets.ProxyHosts = []string{"*themoviedb.org", "*tmdb.org", "rutor.info"}
}
func loadBTSets() {
buf := tdb.Get("Settings", "BitTorr")
if len(buf) > 0 {
err := json.Unmarshal(buf, &BTsets)
if err == nil {
if BTsets.ReaderReadAHead < 5 {
BTsets.ReaderReadAHead = 5
}
// Set default TMDB settings if missing (for existing configs)
if BTsets.TMDBSettings.APIURL == "" {
BTsets.TMDBSettings = TMDBConfig{
APIKey: "",
APIURL: "https://api.themoviedb.org",
ImageURL: "https://image.tmdb.org",
ImageURLRu: "https://imagetmdb.com",
}
}
return
}
log.TLogln("Error unmarshal btsets", err)
}
// initialize defaults on error
SetDefaultConfig()
}