From b4866847f85415b6e80e22d285938fccb88b82f8 Mon Sep 17 00:00:00 2001 From: UUBulb <35923940+uubulb@users.noreply.github.com> Date: Sat, 27 Apr 2024 17:03:47 +0800 Subject: [PATCH] Additional notes on Webhook & fmt (#65) --- docs/en_US/guide/servers.md | 60 ++++++++++++++++++++----------------- docs/guide/servers.md | 60 ++++++++++++++++++++----------------- 2 files changed, 66 insertions(+), 54 deletions(-) diff --git a/docs/en_US/guide/servers.md b/docs/en_US/guide/servers.md index 11c32e22..841e975c 100644 --- a/docs/en_US/guide/servers.md +++ b/docs/en_US/guide/servers.md @@ -57,28 +57,55 @@ Boolean value indicating whether the DDNS function is enabled. Name of the DDNS provider, currently support `webhook`, `cloudflare` and `tencentcloud`. ##### AccessID Secret ID associated with DDNS provider. + 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`. +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`. ##### MaxRetries The number of retry attempts after an update request has failed. ##### Profiles 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 Please leave `DDNS.Provider` field blank while using Multiple configuration. If not, the Multiple configuration will be ignored. ```yaml @@ -95,35 +122,12 @@ DDNS: WebhookRequestBody: "" WebhookHeaders: "" ``` -##### Enable -Boolean value indicating whether the DDNS function is enabled. -##### MaxRetries -The number of retry attempts after an update request has failed. ##### Profiles Multiple configuration setting. -##### Provider -Name of the DDNS provider, currently support `webhook`, `cloudflare` and `tencentcloud`. ##### example Name of DDNS configuration, can be any string. -##### AccessID -Secret ID associated with DDNS provider. -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`. + +For other options, view [Single](#single). ### Dashboard configuration 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 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. + Please leave `DDNS.Provider` field blank while using Multiple configuration. If not, the Multiple configuration will be ignored. ::: diff --git a/docs/guide/servers.md b/docs/guide/servers.md index af16e0c8..a1bd4944 100644 --- a/docs/guide/servers.md +++ b/docs/guide/servers.md @@ -65,28 +65,55 @@ DDNS: DDNS 供应商的名称。目前支持 `webhook`、`cloudflare` 以及 `tencentcloud`。 ##### AccessID DDNS 供应商的令牌 ID。 + 仅适用于供应商 `tencentcloud`。 ##### AccessSecret DDNS 供应商的令牌 Secret。 + 仅适用于供应商 `cloudflare` 及 `tencentcloud`。 ##### WebhookMethod -Webhook 的请求方法。 -例如 `GET`、`POST`等。 +Webhook 的请求方法。例如 `GET`、`POST`等。 + 仅适用于供应商 `webhook`。 ##### WebhookURL Webhook 的请求地址。 + 仅适用于供应商 `webhook`。 ##### WebhookRequestBody Webhook 的请求体。 + 仅适用于供应商 `webhook`。 ##### WebhookHeaders Webhook 的请求头。 + 仅适用于供应商 `webhook`。 ##### MaxRetries 当请求失败时,重试请求的次数。 ##### 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` 的值不为空,多配置设定将被无视。 ```yaml @@ -103,35 +130,12 @@ DDNS: WebhookRequestBody: "" WebhookHeaders: "" ``` -##### Enable -布尔值,选择是否开启 DDNS 功能。 -##### MaxRetries -当请求失败时,重试请求的次数。 ##### Profiles 多配置设定。 -##### Provider -DDNS 供应商的名称。目前支持 `webhook`、`cloudflare` 以及 `tencentcloud`。 ##### example 你的 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 中修改服务器设置才能使 DDNS 生效。 @@ -149,7 +153,9 @@ DDNS 相关选项说明: ::: tip 在 Dashboard 设置中修改配置并保存时,会在 `config.yaml` 中填入默认配置选项,此时 DDNS 段中会同时存在单配置和多配置的选项。 + 如需使用单配置,请无视 `Profiles` 选项相关内容。 + 如需使用多配置,请将 `DDNS.Provider` 留空。如 `DDNS.Provider` 的值不为空,多配置设定将被无视。 :::