Additional notes on Webhook & fmt (#65)

This commit is contained in:
UUBulb 2024-04-27 17:03:47 +08:00 committed by GitHub
parent 8b6d128ab7
commit b4866847f8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 66 additions and 54 deletions

View File

@ -57,28 +57,55 @@ Boolean value indicating whether the DDNS function is enabled.
Name of the DDNS provider, currently support `webhook`, `cloudflare` and `tencentcloud`. Name of the DDNS provider, currently support `webhook`, `cloudflare` and `tencentcloud`.
##### AccessID ##### AccessID
Secret ID associated with DDNS provider. Secret ID associated with DDNS provider.
Only applied to `tencentcloud`. Only applied to `tencentcloud`.
##### AccessSecret ##### AccessSecret
Secret key associated with DDNS provider. Secret key associated with DDNS provider.
Only applied to `cloudflare` and `tencentcloud`. Only applied to `cloudflare` and `tencentcloud`.
##### WebhookMethod ##### WebhookMethod
Request method of Webhook. Request method of Webhook. For example, `GET` and `POST`.
For example, `GET` and `POST`.
Only applied to `webhook`. Only applied to `webhook`.
##### WebhookURL ##### WebhookURL
Request URL of Webhook. Request URL of Webhook.
Only applied to `webhook`. Only applied to `webhook`.
##### WebhookRequestBody ##### WebhookRequestBody
Request body of Webhook. Request body of Webhook.
Only applied to `webhook`. Only applied to `webhook`.
##### WebhookHeaders ##### WebhookHeaders
Request headers of Webhook. Request headers of Webhook.
Only applied to `webhook`. Only applied to `webhook`.
##### MaxRetries ##### MaxRetries
The number of retry attempts after an update request has failed. The number of retry attempts after an update request has failed.
##### Profiles ##### Profiles
Multiple configuration setting. Will be ignored in Single configuration setting. Multiple configuration setting. Will be ignored in Single configuration setting.
:::tip
`WebhookURL`, `WebhookRequestBody` and `WebhookHeaders` can use additional params
`{ip}` - Host IP
`{domain}` - DDNS domain
`{type}` - Your IP type, possibly "ipv4" or "ipv6"
`{access_id}` - Credential #1
`{access_secret}` - Credential #2
Example:
```
WebhookHeaders: |
a:{access_id}
b:{access_secret}
WebhookRequestBody: '{"domain": "{domain}", "ip": "{ip}", "type": "{type}"}'
```
:::
#### Multiple #### Multiple
Please leave `DDNS.Provider` field blank while using Multiple configuration. If not, the Multiple configuration will be ignored. Please leave `DDNS.Provider` field blank while using Multiple configuration. If not, the Multiple configuration will be ignored.
```yaml ```yaml
@ -95,35 +122,12 @@ DDNS:
WebhookRequestBody: "" WebhookRequestBody: ""
WebhookHeaders: "" WebhookHeaders: ""
``` ```
##### Enable
Boolean value indicating whether the DDNS function is enabled.
##### MaxRetries
The number of retry attempts after an update request has failed.
##### Profiles ##### Profiles
Multiple configuration setting. Multiple configuration setting.
##### Provider
Name of the DDNS provider, currently support `webhook`, `cloudflare` and `tencentcloud`.
##### example ##### example
Name of DDNS configuration, can be any string. Name of DDNS configuration, can be any string.
##### AccessID
Secret ID associated with DDNS provider. For other options, view [Single](#single).
Only applied to `tencentcloud`.
##### AccessSecret
Secret key associated with DDNS provider.
Only applied to `cloudflare` and `tencentcloud`.
##### WebhookMethod
Request method of Webhook.
For example, `GET` and `POST`.
Only applied to `webhook`.
##### WebhookURL
Request URL of Webhook.
Only applied to `webhook`.
##### WebhookRequestBody
Request body of Webhook.
Only applied to `webhook`.
##### WebhookHeaders
Request headers of Webhook.
Only applied to `webhook`.
### Dashboard configuration ### Dashboard configuration
After configuring `config.yaml`, you will need to modify server settings in Dashboard to make DDNS function effective. After configuring `config.yaml`, you will need to modify server settings in Dashboard to make DDNS function effective.
@ -142,7 +146,9 @@ The DDNS configuration to use in case of multiple configurations.
::: tip ::: tip
When modifying settings in the Dashboard and saving them, default configuration options will be filled into the `config.yaml` file. At this time, in the DDNS field, there will be both single configuration and multiple configurations options available. When modifying settings in the Dashboard and saving them, default configuration options will be filled into the `config.yaml` file. At this time, in the DDNS field, there will be both single configuration and multiple configurations options available.
If you need to use a single configuration, please ignore the content related to the Profiles option. If you need to use a single configuration, please ignore the content related to the Profiles option.
Please leave `DDNS.Provider` field blank while using Multiple configuration. If not, the Multiple configuration will be ignored. Please leave `DDNS.Provider` field blank while using Multiple configuration. If not, the Multiple configuration will be ignored.
::: :::

View File

@ -65,28 +65,55 @@ DDNS:
DDNS 供应商的名称。目前支持 `webhook``cloudflare` 以及 `tencentcloud` DDNS 供应商的名称。目前支持 `webhook``cloudflare` 以及 `tencentcloud`
##### AccessID ##### AccessID
DDNS 供应商的令牌 ID。 DDNS 供应商的令牌 ID。
仅适用于供应商 `tencentcloud` 仅适用于供应商 `tencentcloud`
##### AccessSecret ##### AccessSecret
DDNS 供应商的令牌 Secret。 DDNS 供应商的令牌 Secret。
仅适用于供应商 `cloudflare``tencentcloud` 仅适用于供应商 `cloudflare``tencentcloud`
##### WebhookMethod ##### WebhookMethod
Webhook 的请求方法。 Webhook 的请求方法。例如 `GET``POST`等。
例如 `GET``POST`等。
仅适用于供应商 `webhook` 仅适用于供应商 `webhook`
##### WebhookURL ##### WebhookURL
Webhook 的请求地址。 Webhook 的请求地址。
仅适用于供应商 `webhook` 仅适用于供应商 `webhook`
##### WebhookRequestBody ##### WebhookRequestBody
Webhook 的请求体。 Webhook 的请求体。
仅适用于供应商 `webhook` 仅适用于供应商 `webhook`
##### WebhookHeaders ##### WebhookHeaders
Webhook 的请求头。 Webhook 的请求头。
仅适用于供应商 `webhook` 仅适用于供应商 `webhook`
##### MaxRetries ##### MaxRetries
当请求失败时,重试请求的次数。 当请求失败时,重试请求的次数。
##### Profiles ##### Profiles
多配置设定。在单配置设定中,此项不进行处理。 多配置设定。在单配置设定中,此项不进行处理。
:::tip
`WebhookURL``WebhookRequestBody` 以及`WebhookHeaders`可以使用如下参数:
`{ip}` - 主机当前IP
`{domain}` - ddns域名
`{type}` - IP类型可能为"ipv4"和"ipv6"
`{access_id}` - 凭据1
`{access_secret}` - 凭据2
例如以下配置:
```
WebhookHeaders: |
a:{access_id}
b:{access_secret}
WebhookRequestBody: '{"domain": "{domain}", "ip": "{ip}", "type": "{type}"}'
```
:::
#### 多配置 #### 多配置
当使用多配置时,请将 `DDNS.Provider` 留空。如 `DDNS.Provider` 的值不为空,多配置设定将被无视。 当使用多配置时,请将 `DDNS.Provider` 留空。如 `DDNS.Provider` 的值不为空,多配置设定将被无视。
```yaml ```yaml
@ -103,35 +130,12 @@ DDNS:
WebhookRequestBody: "" WebhookRequestBody: ""
WebhookHeaders: "" WebhookHeaders: ""
``` ```
##### Enable
布尔值,选择是否开启 DDNS 功能。
##### MaxRetries
当请求失败时,重试请求的次数。
##### Profiles ##### Profiles
多配置设定。 多配置设定。
##### Provider
DDNS 供应商的名称。目前支持 `webhook``cloudflare` 以及 `tencentcloud`
##### example ##### example
你的 DDNS 配置名,可填任意字符串。 你的 DDNS 配置名,可填任意字符串。
##### AccessID
DDNS 供应商的令牌 ID。 其它选项请参考[单配置](#单配置)段。
仅适用于供应商 `tencentcloud`
##### AccessSecret
DDNS 供应商的令牌 Secret。
仅适用于供应商 `cloudflare``tencentcloud`
##### WebhookMethod
Webhook 的请求方法。
例如 `GET``POST`等。
仅适用于供应商 `webhook`
##### WebhookURL
Webhook 的请求地址。
仅适用于供应商 `webhook`
##### WebhookRequestBody
Webhook 的请求体。
仅适用于供应商 `webhook`
##### WebhookHeaders
Webhook 的请求头。
仅适用于供应商 `webhook`
### Dashboard 配置 ### Dashboard 配置
修改好配置文件后,还需要在 Dashboard 中修改服务器设置才能使 DDNS 生效。 修改好配置文件后,还需要在 Dashboard 中修改服务器设置才能使 DDNS 生效。
@ -149,7 +153,9 @@ DDNS 相关选项说明:
::: tip ::: tip
在 Dashboard 设置中修改配置并保存时,会在 `config.yaml` 中填入默认配置选项,此时 DDNS 段中会同时存在单配置和多配置的选项。 在 Dashboard 设置中修改配置并保存时,会在 `config.yaml` 中填入默认配置选项,此时 DDNS 段中会同时存在单配置和多配置的选项。
如需使用单配置,请无视 `Profiles` 选项相关内容。 如需使用单配置,请无视 `Profiles` 选项相关内容。
如需使用多配置,请将 `DDNS.Provider` 留空。如 `DDNS.Provider` 的值不为空,多配置设定将被无视。 如需使用多配置,请将 `DDNS.Provider` 留空。如 `DDNS.Provider` 的值不为空,多配置设定将被无视。
::: :::