forked from mirrors/thatmattlove-hyperglass
parent
bfcae89bf0
commit
aab4ada723
2 changed files with 11 additions and 4 deletions
|
|
@ -15,9 +15,10 @@ hyperglass provides extensive customization options for the look and feel of the
|
|||
|
||||
[DNS over HTTPS](https://www.rfc-editor.org/rfc/rfc8484) is used to look up an FQDN query target from the perspective of the user's browser.
|
||||
|
||||
| Parameter | Type | Default Value | Description |
|
||||
| :------------------ | :----- | :------------ | :-------------------------------------- |
|
||||
| `dns_provider.name` | String | cloudflare | Cloudflare or Google DNS are supported. |
|
||||
| Parameter | Type | Default Value | Description |
|
||||
| :------------------ | :----- | :------------------------------------- | :-------------------------------------------------------------------------- |
|
||||
| `dns_provider.name` | String | cloudflare | If `cloudflare` or `google` are provided, no URL is necessary. |
|
||||
| `dns_provider.url` | String | `https://cloudflare-dns.com/dns-query` | Provide a custom DNS over HTTPS URL if you'd like to use your own resolver. |
|
||||
|
||||
### Logo
|
||||
|
||||
|
|
|
|||
|
|
@ -186,13 +186,19 @@ class Theme(HyperglassModel):
|
|||
class DnsOverHttps(HyperglassModel):
|
||||
"""Validation model for DNS over HTTPS resolution."""
|
||||
|
||||
name: str = Field(default="cloudflare", pattern=DOH_PROVIDERS_PATTERN)
|
||||
name: str = "cloudflare"
|
||||
url: str = ""
|
||||
|
||||
@model_validator(mode="before")
|
||||
def validate_dns(cls, data: "DnsOverHttps") -> t.Dict[str, str]:
|
||||
"""Assign url field to model based on selected provider."""
|
||||
name = data.get("name", "cloudflare")
|
||||
url = data.get("url", DNS_OVER_HTTPS["cloudflare"])
|
||||
if url not in DNS_OVER_HTTPS.values():
|
||||
return {
|
||||
"name": "custom",
|
||||
"url": url,
|
||||
}
|
||||
url = DNS_OVER_HTTPS[name]
|
||||
return {
|
||||
"name": name,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue