Allow clearing DDNS url
This commit is contained in:
parent
32e67dc095
commit
497b3bb545
2 changed files with 5 additions and 4 deletions
|
@ -173,9 +173,9 @@ impl Manager {
|
|||
self.config.read().await.ddns_url.clone()
|
||||
}
|
||||
|
||||
pub async fn set_ddns_update_url(&self, url: http::Uri) -> Result<(), Error> {
|
||||
pub async fn set_ddns_update_url(&self, url: Option<http::Uri>) -> Result<(), Error> {
|
||||
self.mutate(|c| {
|
||||
c.ddns_url = Some(url);
|
||||
c.ddns_url = url;
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
|
|
@ -138,8 +138,9 @@ async fn put_settings(
|
|||
}
|
||||
|
||||
if let Some(url_string) = new_settings.ddns_update_url {
|
||||
let Ok(uri) = http::Uri::try_from(url_string) else {
|
||||
return Err(APIError::InvalidDDNSURL);
|
||||
let uri = match url_string.trim() {
|
||||
"" => None,
|
||||
u => Some(http::Uri::try_from(u).or(Err(APIError::InvalidDDNSURL))?),
|
||||
};
|
||||
config_manager.set_ddns_update_url(uri).await?;
|
||||
ddns_manager.update_ddns().await?;
|
||||
|
|
Loading…
Add table
Reference in a new issue