From 3f6f13bb99deac7c0b5a5b5ddb43cea91fa40e13 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 30 Dec 2022 16:19:28 -0600 Subject: add controller 'downloads' option and docs --- config/slskd.example.yml | 3 ++- docs/config.md | 20 ++++++++++++-------- src/slskd/Core/Options.cs | 8 ++++++++ 3 files changed, 22 insertions(+), 9 deletions(-) diff --git a/config/slskd.example.yml b/config/slskd.example.yml index 02ccbe7f..7c1f3c36 100644 --- a/config/slskd.example.yml +++ b/config/slskd.example.yml @@ -17,10 +17,11 @@ # # controller config is required when running in 'agent' mode # # this specifies the relay controller that will be controlling this agent # controller: -# address: +# address: https://some.site.com:5000 # ignore_certificate_errors: false # api_key: # secret: +# downloads: false # # agent config is optional when running in 'controller' mode # # this specifies all of the agents capable of connecting # agents: diff --git a/docs/config.md b/docs/config.md index aed3a424..b3cf6aeb 100644 --- a/docs/config.md +++ b/docs/config.md @@ -226,14 +226,17 @@ Agents need to specify the HTTP or HTTPS address of their controller, the API ke If using HTTPS; most users won't have a valid certificate (the self-signed certificates that slskd generates at startup are not 'valid' because they are self-signed), and in those cases the `ignore_certificate_errors` option should be set to `true`. -| Command-Line | Environment Variable | Description | -| ---------------------------------------- | -------------------------------------------- | ------------------------------------------| -| `-r\|--relay` | `SLSKD_RELAY` | Enable the Relay feature | -| `-m\|--relay-mode` | `SLSKD_RELAY_MODE` | The Relay mode (Controller, Agent, Debug) | -| `--controller-address` | `SLSKD_CONTROLLER_ADDRESS` | The address of the controller | -| `--controller-ignore-certificate-errors` | `SLSKD_CONTROLLER_IGNORE_CERTIFICATE_ERRORS` | Ignore certificate errors | -| `--controller-api-key` | `SLSKD_CONTROLLER_API_KEY` | An API key for the controller | -| `--controller-secret` | `SLSKD_CONTROLLER_SECRET` | The shared secret for this agent | +Agents can optionally receive completed downloads from the controller by enabling the `downloads` option. With this option enabled, agents will automatically download new files from the controller and save them to the configured local downloads directory. + +| Command-Line | Environment Variable | Description | +| ---------------------------------------- | -------------------------------------------- | ------------------------------------------------| +| `-r\|--relay` | `SLSKD_RELAY` | Enable the Relay feature | +| `-m\|--relay-mode` | `SLSKD_RELAY_MODE` | The Relay mode (Controller, Agent, Debug) | +| `--controller-address` | `SLSKD_CONTROLLER_ADDRESS` | The address of the controller | +| `--controller-ignore-certificate-errors` | `SLSKD_CONTROLLER_IGNORE_CERTIFICATE_ERRORS` | Ignore certificate errors | +| `--controller-api-key` | `SLSKD_CONTROLLER_API_KEY` | An API key for the controller | +| `--controller-secret` | `SLSKD_CONTROLLER_SECRET` | The shared secret for this agent | +| `--controller-downloads` | `SLSKD_CONTROLLER_DOWNLOADS` | Receive completed downloads from the controller | ```yaml instance_name: some_instance @@ -245,6 +248,7 @@ relay: ignore_certificate_errors: true api_key: secret: + downloads: false ``` # Limits and User Groups diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index e23fd640..bc6f14a6 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -500,6 +500,14 @@ namespace slskd [NotNullOrWhiteSpace] [Secret] public string Secret { get; init; } + + /// + /// Gets a value indicating whether to receive completed downloads from the controller. + /// + [Argument(default, "controller-downloads")] + [EnvironmentVariable("CONTROLLER_DOWNLOADS")] + [Description("receive completed downloads from the controller")] + public bool Downloads { get; init; } = false; } /// -- cgit v1.2.3