v0.14.15
This commit is contained in:
@@ -1,7 +1,11 @@
|
||||
use crate::models::HomeAssistantSettings;
|
||||
use anyhow::{anyhow, bail, Context, Result};
|
||||
use serde_json::Value;
|
||||
use std::{env, time::Duration};
|
||||
use std::{
|
||||
env,
|
||||
net::{IpAddr, Ipv4Addr},
|
||||
time::Duration,
|
||||
};
|
||||
use url::Url;
|
||||
|
||||
const SUPERVISOR_AUTH_ENV: &str = "GREE_CONTROLLER_HA_AUTH";
|
||||
@@ -22,6 +26,10 @@ pub fn supervisor_token_detected() -> bool {
|
||||
.unwrap_or(false)
|
||||
}
|
||||
|
||||
pub fn is_supervisor_ingress_peer(peer: IpAddr) -> bool {
|
||||
supervisor_token_detected() && peer == IpAddr::V4(Ipv4Addr::new(172, 30, 32, 2))
|
||||
}
|
||||
|
||||
pub fn uses_supervisor_auth(settings: &HomeAssistantSettings) -> bool {
|
||||
supervisor_detected() && !settings.manual_auth_override
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user