mirror of
https://github.com/Ernous/TorrServerJellyfin.git
synced 2025-12-19 13:36:09 +05:00
Squashed commit of the following:
commit 218d84b7905d23dce3c8f842ed78b8eac8ea9580 Author: nikk gitanes <tsynik@gmail.com> Date: Mon Feb 5 01:10:19 2024 +0300 add read-only DB logging commit 826fde8e8444a9169afeb7f777e1803fcf6bd435 Author: nikk gitanes <tsynik@gmail.com> Date: Sat Feb 3 22:50:19 2024 +0300 update msx doc commit 98b7d61bd98269b0e456cb71a5d50a8f98203aba Merge: 490ee26963c7daAuthor: nikk gitanes <tsynik@gmail.com> Date: Sat Feb 3 11:21:45 2024 +0300 Merge branch 'master' into jsondb commit 490ee26d3f14316cb1ad3b872ebe408a5aa2a91b Merge:83c7ed1efb17eeAuthor: nikk gitanes <tsynik@gmail.com> Date: Sat Feb 3 10:50:41 2024 +0300 Merge branch 'master' into jsondb
This commit is contained in:
@@ -68,10 +68,6 @@ func (v *TDB) Get(xpath, name string) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *TDB) Set(xpath, name string, value []byte) {
|
func (v *TDB) Set(xpath, name string, value []byte) {
|
||||||
if ReadOnly {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
spath := strings.Split(xpath, "/")
|
spath := strings.Split(xpath, "/")
|
||||||
if len(spath) == 0 {
|
if len(spath) == 0 {
|
||||||
return
|
return
|
||||||
@@ -139,10 +135,6 @@ func (v *TDB) List(xpath string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *TDB) Rem(xpath, name string) {
|
func (v *TDB) Rem(xpath, name string) {
|
||||||
if ReadOnly {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
spath := strings.Split(xpath, "/")
|
spath := strings.Split(xpath, "/")
|
||||||
if len(spath) == 0 {
|
if len(spath) == 0 {
|
||||||
return
|
return
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
package settings
|
package settings
|
||||||
|
|
||||||
|
import "server/log"
|
||||||
|
|
||||||
type DBReadCache struct {
|
type DBReadCache struct {
|
||||||
db TorrServerDB
|
db TorrServerDB
|
||||||
listCache map[string][]string
|
listCache map[string][]string
|
||||||
@@ -33,6 +35,10 @@ func (v *DBReadCache) Get(xPath, name string) []byte {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *DBReadCache) Set(xPath, name string, value []byte) {
|
func (v *DBReadCache) Set(xPath, name string, value []byte) {
|
||||||
|
if ReadOnly {
|
||||||
|
log.TLogln("DB.Set: Read-only DB mode!", name)
|
||||||
|
return
|
||||||
|
}
|
||||||
cacheKey := v.makeDataCacheKey(xPath, name)
|
cacheKey := v.makeDataCacheKey(xPath, name)
|
||||||
v.dataCache[cacheKey] = value
|
v.dataCache[cacheKey] = value
|
||||||
delete(v.listCache, xPath)
|
delete(v.listCache, xPath)
|
||||||
@@ -49,6 +55,10 @@ func (v *DBReadCache) List(xPath string) []string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (v *DBReadCache) Rem(xPath, name string) {
|
func (v *DBReadCache) Rem(xPath, name string) {
|
||||||
|
if ReadOnly {
|
||||||
|
log.TLogln("DB.Rem: Read-only DB mode!", name)
|
||||||
|
return
|
||||||
|
}
|
||||||
cacheKey := v.makeDataCacheKey(xPath, name)
|
cacheKey := v.makeDataCacheKey(xPath, name)
|
||||||
delete(v.dataCache, cacheKey)
|
delete(v.dataCache, cacheKey)
|
||||||
delete(v.listCache, xPath)
|
delete(v.listCache, xPath)
|
||||||
|
|||||||
@@ -140,6 +140,7 @@ func SetTorrent(hashHex, title, poster, data string) *Torrent {
|
|||||||
|
|
||||||
func RemTorrent(hashHex string) {
|
func RemTorrent(hashHex string) {
|
||||||
if sets.ReadOnly {
|
if sets.ReadOnly {
|
||||||
|
log.TLogln("API RemTorrent: Read-only DB mode!", hashHex)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
hash := metainfo.NewHashFromHex(hashHex)
|
hash := metainfo.NewHashFromHex(hashHex)
|
||||||
@@ -192,6 +193,7 @@ func DropTorrent(hashHex string) {
|
|||||||
|
|
||||||
func SetSettings(set *sets.BTSets) {
|
func SetSettings(set *sets.BTSets) {
|
||||||
if sets.ReadOnly {
|
if sets.ReadOnly {
|
||||||
|
log.TLogln("API SetSettings: Read-only DB mode!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sets.SetBTSets(set)
|
sets.SetBTSets(set)
|
||||||
@@ -208,6 +210,7 @@ func SetSettings(set *sets.BTSets) {
|
|||||||
|
|
||||||
func SetDefSettings() {
|
func SetDefSettings() {
|
||||||
if sets.ReadOnly {
|
if sets.ReadOnly {
|
||||||
|
log.TLogln("API SetDefSettings: Read-only DB mode!")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
sets.SetDefaultConfig()
|
sets.SetDefaultConfig()
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import (
|
|||||||
// "github.com/anacrolix/torrent"
|
// "github.com/anacrolix/torrent"
|
||||||
)
|
)
|
||||||
|
|
||||||
const Version = "MatriX.129.1"
|
const Version = "MatriX.129.JS"
|
||||||
|
|
||||||
func GetTorrentVersion() string {
|
func GetTorrentVersion() string {
|
||||||
bi, ok := debug.ReadBuildInfo()
|
bi, ok := debug.ReadBuildInfo()
|
||||||
|
|||||||
Reference in New Issue
Block a user