diff --git a/server/settings/db.go b/server/settings/db.go index 01f0b5b..b2447b6 100644 --- a/server/settings/db.go +++ b/server/settings/db.go @@ -68,10 +68,6 @@ func (v *TDB) Get(xpath, name string) []byte { } func (v *TDB) Set(xpath, name string, value []byte) { - if ReadOnly { - return - } - spath := strings.Split(xpath, "/") if len(spath) == 0 { return @@ -139,10 +135,6 @@ func (v *TDB) List(xpath string) []string { } func (v *TDB) Rem(xpath, name string) { - if ReadOnly { - return - } - spath := strings.Split(xpath, "/") if len(spath) == 0 { return diff --git a/server/settings/dbreadcache.go b/server/settings/dbreadcache.go index 4158a4c..862faf2 100644 --- a/server/settings/dbreadcache.go +++ b/server/settings/dbreadcache.go @@ -1,5 +1,7 @@ package settings +import "server/log" + type DBReadCache struct { db TorrServerDB 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) { + if ReadOnly { + log.TLogln("DB.Set: Read-only DB mode!", name) + return + } cacheKey := v.makeDataCacheKey(xPath, name) v.dataCache[cacheKey] = value delete(v.listCache, xPath) @@ -49,6 +55,10 @@ func (v *DBReadCache) List(xPath string) []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) delete(v.dataCache, cacheKey) delete(v.listCache, xPath) diff --git a/server/torr/apihelper.go b/server/torr/apihelper.go index 1eba48a..ed169c5 100644 --- a/server/torr/apihelper.go +++ b/server/torr/apihelper.go @@ -140,6 +140,7 @@ func SetTorrent(hashHex, title, poster, data string) *Torrent { func RemTorrent(hashHex string) { if sets.ReadOnly { + log.TLogln("API RemTorrent: Read-only DB mode!", hashHex) return } hash := metainfo.NewHashFromHex(hashHex) @@ -192,6 +193,7 @@ func DropTorrent(hashHex string) { func SetSettings(set *sets.BTSets) { if sets.ReadOnly { + log.TLogln("API SetSettings: Read-only DB mode!") return } sets.SetBTSets(set) @@ -208,6 +210,7 @@ func SetSettings(set *sets.BTSets) { func SetDefSettings() { if sets.ReadOnly { + log.TLogln("API SetDefSettings: Read-only DB mode!") return } sets.SetDefaultConfig() diff --git a/server/version/version.go b/server/version/version.go index 4597419..ae97304 100644 --- a/server/version/version.go +++ b/server/version/version.go @@ -6,7 +6,7 @@ import ( // "github.com/anacrolix/torrent" ) -const Version = "MatriX.129.1" +const Version = "MatriX.129.JS" func GetTorrentVersion() string { bi, ok := debug.ReadBuildInfo()