utils: btt client (rain): make dht and rpc opt-in

This commit is contained in:
hayzamjs
2026-01-15 23:33:21 +00:00
parent f85a3620d4
commit b9d46f9efa
6 changed files with 119 additions and 41 deletions
+27 -14
View File
@@ -1,15 +1,28 @@
{
"environment": "development",
"proxyToVite": false,
"wanInterfaces": ["em0"],
"admin": {
"email": "admin@sylve.local",
"password": "admin"
},
"logLevel": 0,
"port": 8181,
"httpPort": 8182,
"raft": {
"reset": false
}
}
"environment": "development",
"proxyToVite": false,
"wanInterfaces": [
"em0"
],
"admin": {
"email": "admin@sylve.local",
"password": "admin"
},
"logLevel": 0,
"port": 8181,
"httpPort": 8182,
"raft": {
"reset": false
},
"btt": {
"rpc": {
"enabled": false,
"host": "127.0.0.1",
"port": 6890
},
"dht": {
"enabled": false,
"port": 7246
}
}
}
+13
View File
@@ -51,6 +51,19 @@ func NewUtilitiesService(db *gorm.DB) utilitiesServiceInterfaces.UtilitiesServic
cfg.Database = config.GetDownloadsPath("torrent.db")
cfg.DataDir = config.GetDownloadsPath("torrents")
cfg.RPCEnabled = config.ParsedConfig.BTT.RPC.Enabled
if config.ParsedConfig.BTT.RPC.Enabled {
cfg.RPCHost = config.ParsedConfig.BTT.RPC.Address
cfg.RPCPort = config.ParsedConfig.BTT.RPC.Port
}
cfg.DHTEnabled = config.ParsedConfig.BTT.DHT.Enabled
if config.ParsedConfig.BTT.DHT.Enabled {
cfg.DHTPort = uint16(config.ParsedConfig.BTT.DHT.Port)
}
session, err := torrent.NewSession(cfg)
if err != nil {
logger.L.Fatal().Msgf("Failed to create torrent downloader %v", err)
+17
View File
@@ -22,6 +22,22 @@ type Raft struct {
Reset bool `json:"reset"`
}
type DHTConfig struct {
Port int `json:"port"`
Enabled bool `json:"enabled"`
}
type BTTRPC struct {
Enabled bool `json:"enabled"`
Address string `json:"address"`
Port int `json:"port"`
}
type BTT struct {
RPC BTTRPC `json:"rpc"`
DHT DHTConfig `json:"dht"`
}
type SylveConfig struct {
Environment string `json:"environment"`
ProxyToVite bool `json:"proxyToVite"`
@@ -34,6 +50,7 @@ type SylveConfig struct {
DataPath string `json:"dataPath"`
TLS TLSConfig `json:"tlsConfig"`
Raft Raft `json:"raft"`
BTT BTT `json:"btt"`
}
type APIResponse[T any] struct {
+22 -9
View File
@@ -6562,9 +6562,8 @@ msgstr "Setup Complete"
#~ msgid "System needs to restart to apply changes"
#~ msgstr "System needs to restart to apply changes"
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Restart"
msgstr "<0/> Restart"
#~ msgid "<0/> Restart"
#~ msgstr "<0/> Restart"
#~ msgid "Initialized"
#~ msgstr "Initialized"
@@ -6575,9 +6574,8 @@ msgstr "<0/> Restart"
#~ msgid "Failed to restart system: {0}"
#~ msgstr "Failed to restart system: {0}"
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Restarting..."
msgstr "<0/> Restarting..."
#~ msgid "<0/> Restarting..."
#~ msgstr "<0/> Restarting..."
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "System is restarting…"
@@ -6600,9 +6598,8 @@ msgstr "System did not come back online in time"
#~ msgid "Test123"
#~ msgstr "Test123"
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "We need to restart the system to apply changes"
msgstr "We need to restart the system to apply changes"
#~ msgid "We need to restart the system to apply changes"
#~ msgstr "We need to restart the system to apply changes"
#~ msgid "You are about to {0} the WOL Server"
#~ msgstr "You are about to {0} the WOL Server"
@@ -6794,3 +6791,19 @@ msgstr "Modify Users"
#: src/routes/[node]/settings/authentication/groups/+page.svelte
msgid "Default Sylve Group (sylve_g)"
msgstr "Default Sylve Group (sylve_g)"
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid ""
"A <0>full system reboot</0> is required for Sylve to\n"
"finish initialization. Continue when ready."
msgstr ""
"A <0>full system reboot</0> is required for Sylve to\n"
"finish initialization. Continue when ready."
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Rebooting..."
msgstr "<0/> Rebooting..."
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Reboot"
msgstr "<0/> Reboot"
+20 -9
View File
@@ -6522,9 +6522,8 @@ msgstr ""
#~ msgid "System needs to restart to apply changes"
#~ msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Restart"
msgstr ""
#~ msgid "<0/> Restart"
#~ msgstr ""
#~ msgid "Initialized"
#~ msgstr ""
@@ -6535,9 +6534,8 @@ msgstr ""
#~ msgid "Failed to restart system: {0}"
#~ msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Restarting..."
msgstr ""
#~ msgid "<0/> Restarting..."
#~ msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "System is restarting…"
@@ -6560,9 +6558,8 @@ msgstr ""
#~ msgid "Test123"
#~ msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "We need to restart the system to apply changes"
msgstr ""
#~ msgid "We need to restart the system to apply changes"
#~ msgstr ""
#~ msgid "You are about to {0} the WOL Server"
#~ msgstr ""
@@ -6754,3 +6751,17 @@ msgstr ""
#: src/routes/[node]/settings/authentication/groups/+page.svelte
msgid "Default Sylve Group (sylve_g)"
msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid ""
"A <0>full system reboot</0> is required for Sylve to\n"
"finish initialization. Continue when ready."
msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Rebooting..."
msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Reboot"
msgstr ""
+20 -9
View File
@@ -6516,9 +6516,8 @@ msgstr ""
#~ msgid "System needs to restart to apply changes"
#~ msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Restart"
msgstr ""
#~ msgid "<0/> Restart"
#~ msgstr ""
#~ msgid "Initialized"
#~ msgstr ""
@@ -6529,9 +6528,8 @@ msgstr ""
#~ msgid "Failed to restart system: {0}"
#~ msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Restarting..."
msgstr ""
#~ msgid "<0/> Restarting..."
#~ msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "System is restarting…"
@@ -6554,9 +6552,8 @@ msgstr ""
#~ msgid "Test123"
#~ msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "We need to restart the system to apply changes"
msgstr ""
#~ msgid "We need to restart the system to apply changes"
#~ msgstr ""
#~ msgid "You are about to {0} the WOL Server"
#~ msgstr ""
@@ -6748,3 +6745,17 @@ msgstr ""
#: src/routes/[node]/settings/authentication/groups/+page.svelte
msgid "Default Sylve Group (sylve_g)"
msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid ""
"A <0>full system reboot</0> is required for Sylve to\n"
"finish initialization. Continue when ready."
msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Rebooting..."
msgstr ""
#: src/lib/components/custom/Initialization/Reboot.svelte
msgid "<0/> Reboot"
msgstr ""