diff --git a/config.example.json b/config.example.json index 094df392..43d00c71 100644 --- a/config.example.json +++ b/config.example.json @@ -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 + } + } +} \ No newline at end of file diff --git a/internal/services/utilities/utilities.go b/internal/services/utilities/utilities.go index 913387b5..1bc730d1 100644 --- a/internal/services/utilities/utilities.go +++ b/internal/services/utilities/utilities.go @@ -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) diff --git a/internal/shared.go b/internal/shared.go index 9c0c30b4..0fa4b7bf 100644 --- a/internal/shared.go +++ b/internal/shared.go @@ -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 { diff --git a/web/src/locales/en.po b/web/src/locales/en.po index 5df0a2a9..148878a8 100644 --- a/web/src/locales/en.po +++ b/web/src/locales/en.po @@ -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 is required for Sylve to\n" +"finish initialization. Continue when ready." +msgstr "" +"A <0>full system reboot 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" diff --git a/web/src/locales/hi.po b/web/src/locales/hi.po index baf7cd38..7f9a0fd8 100644 --- a/web/src/locales/hi.po +++ b/web/src/locales/hi.po @@ -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 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 "" diff --git a/web/src/locales/mal.po b/web/src/locales/mal.po index aa341d36..37ed8bf6 100644 --- a/web/src/locales/mal.po +++ b/web/src/locales/mal.po @@ -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 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 ""