mirror of
https://git.selfprivacy.org/SelfPrivacy/selfprivacy-rest-api.git
synced 2024-11-28 06:51:28 +00:00
feat: Provide display names in DNS records
This commit is contained in:
parent
77c267b9c8
commit
e648a3b8ef
|
@ -11,3 +11,4 @@ class DnsRecord:
|
||||||
content: str
|
content: str
|
||||||
ttl: int
|
ttl: int
|
||||||
priority: typing.Optional[int]
|
priority: typing.Optional[int]
|
||||||
|
display_name: str
|
||||||
|
|
|
@ -139,6 +139,7 @@ def service_to_graphql_service(service: ServiceInterface) -> Service:
|
||||||
content=record.content,
|
content=record.content,
|
||||||
ttl=record.ttl,
|
ttl=record.ttl,
|
||||||
priority=record.priority,
|
priority=record.priority,
|
||||||
|
display_name=record.display_name,
|
||||||
)
|
)
|
||||||
for record in service.get_dns_records()
|
for record in service.get_dns_records()
|
||||||
],
|
],
|
||||||
|
|
|
@ -33,6 +33,7 @@ class SystemDomainInfo:
|
||||||
content=record.content,
|
content=record.content,
|
||||||
ttl=record.ttl,
|
ttl=record.ttl,
|
||||||
priority=record.priority,
|
priority=record.priority,
|
||||||
|
display_name=record.display_name,
|
||||||
)
|
)
|
||||||
for record in get_all_required_dns_records()
|
for record in get_all_required_dns_records()
|
||||||
]
|
]
|
||||||
|
|
|
@ -54,12 +54,14 @@ def get_all_required_dns_records() -> list[ServiceDnsRecord]:
|
||||||
name="api",
|
name="api",
|
||||||
content=ip4,
|
content=ip4,
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="SelfPrivacy API",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name="api",
|
name="api",
|
||||||
content=ip6,
|
content=ip6,
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="SelfPrivacy API (IPv6)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
for service in get_enabled_services():
|
for service in get_enabled_services():
|
||||||
|
|
|
@ -135,12 +135,14 @@ class Bitwarden(Service):
|
||||||
name="password",
|
name="password",
|
||||||
content=network_utils.get_ip4(),
|
content=network_utils.get_ip4(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Bitwarden",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name="password",
|
name="password",
|
||||||
content=network_utils.get_ip6(),
|
content=network_utils.get_ip6(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Bitwarden (IPv6)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -127,12 +127,14 @@ class Gitea(Service):
|
||||||
name="git",
|
name="git",
|
||||||
content=network_utils.get_ip4(),
|
content=network_utils.get_ip4(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Gitea",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name="git",
|
name="git",
|
||||||
content=network_utils.get_ip6(),
|
content=network_utils.get_ip6(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Gitea (IPv6)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -136,12 +136,14 @@ class JitsiMeet(Service):
|
||||||
name="meet",
|
name="meet",
|
||||||
content=ip4,
|
content=ip4,
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Jitsi",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name="meet",
|
name="meet",
|
||||||
content=ip6,
|
content=ip6,
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Jitsi (IPv6)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -121,27 +121,43 @@ class MailServer(Service):
|
||||||
name=domain,
|
name=domain,
|
||||||
content=ip4,
|
content=ip4,
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Root Domain",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name=domain,
|
name=domain,
|
||||||
content=ip6,
|
content=ip6,
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Root Domain (IPv6)",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="MX", name=domain, content=domain, ttl=3600, priority=10
|
type="MX",
|
||||||
|
name=domain,
|
||||||
|
content=domain,
|
||||||
|
ttl=3600,
|
||||||
|
priority=10,
|
||||||
|
display_name="Mail server record",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="TXT", name="_dmarc", content="v=DMARC1; p=none", ttl=18000
|
type="TXT",
|
||||||
|
name="_dmarc",
|
||||||
|
content="v=DMARC1; p=none",
|
||||||
|
ttl=18000,
|
||||||
|
display_name="DMARC record",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="TXT",
|
type="TXT",
|
||||||
name=domain,
|
name=domain,
|
||||||
content=f"v=spf1 a mx ip4:{ip4} -all",
|
content=f"v=spf1 a mx ip4:{ip4} -all",
|
||||||
ttl=18000,
|
ttl=18000,
|
||||||
|
display_name="SPF record",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="TXT", name="selector._domainkey", content=dkim_record, ttl=18000
|
type="TXT",
|
||||||
|
name="selector._domainkey",
|
||||||
|
content=dkim_record,
|
||||||
|
ttl=18000,
|
||||||
|
display_name="DKIM key",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -134,12 +134,14 @@ class Nextcloud(Service):
|
||||||
name="cloud",
|
name="cloud",
|
||||||
content=network_utils.get_ip4(),
|
content=network_utils.get_ip4(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Nextcloud",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name="cloud",
|
name="cloud",
|
||||||
content=network_utils.get_ip6(),
|
content=network_utils.get_ip6(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Nextcloud (IPv6)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -110,12 +110,14 @@ class Ocserv(Service):
|
||||||
name="vpn",
|
name="vpn",
|
||||||
content=network_utils.get_ip4(),
|
content=network_utils.get_ip4(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="OpenConnect VPN",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name="vpn",
|
name="vpn",
|
||||||
content=network_utils.get_ip6(),
|
content=network_utils.get_ip6(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="OpenConnect VPN (IPv6)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -131,12 +131,14 @@ class Pleroma(Service):
|
||||||
name="social",
|
name="social",
|
||||||
content=network_utils.get_ip4(),
|
content=network_utils.get_ip4(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Pleroma",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name="social",
|
name="social",
|
||||||
content=network_utils.get_ip6(),
|
content=network_utils.get_ip6(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Pleroma (IPv6)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ class ServiceDnsRecord(BaseModel):
|
||||||
name: str
|
name: str
|
||||||
content: str
|
content: str
|
||||||
ttl: int
|
ttl: int
|
||||||
|
display_name: str
|
||||||
priority: typing.Optional[int] = None
|
priority: typing.Optional[int] = None
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -186,12 +186,14 @@ class DummyService(Service):
|
||||||
name="password",
|
name="password",
|
||||||
content=network_utils.get_ip4(),
|
content=network_utils.get_ip4(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Test Service",
|
||||||
),
|
),
|
||||||
ServiceDnsRecord(
|
ServiceDnsRecord(
|
||||||
type="AAAA",
|
type="AAAA",
|
||||||
name="password",
|
name="password",
|
||||||
content=network_utils.get_ip6(),
|
content=network_utils.get_ip6(),
|
||||||
ttl=3600,
|
ttl=3600,
|
||||||
|
display_name="Test Service (IPv6)",
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue