@@ -177,7 +177,14 @@ async def enable_host(self, host_id: str, host_type: str) -> None:
177177 response = await self .api_wrapper ("post" , url , headers = self ._headers )
178178
179179 if response is True :
180- self .proxy_hosts_data [host_id ]["enabled" ] = 1
180+ if host_type is "proxy-hosts" :
181+ self .proxy_hosts_data [host_id ]["enabled" ] = 1
182+ if host_type is "redirection-hosts" :
183+ self .redir_hosts_data [host_id ]["enabled" ] = 1
184+ if host_type is "streams" :
185+ self .stream_hosts_data [host_id ]["enabled" ] = 1
186+ if host_type is "dead-hosts" :
187+ self .dead_hosts_data [host_id ]["enabled" ] = 1
181188 elif "error" in response .keys ():
182189 _LOGGER .error (
183190 "Error enabling host type %s host id %s. Error message: '%s'" ,
@@ -193,7 +200,14 @@ async def disable_host(self, host_id: str, host_type: str) -> None:
193200
194201 response = await self .api_wrapper ("post" , url , headers = self ._headers )
195202 if response is True :
196- self .proxy_hosts_data [host_id ]["enabled" ] = 0
203+ if host_type is "proxy-hosts" :
204+ self .proxy_hosts_data [host_id ]["enabled" ] = 0
205+ if host_type is "redirection-hosts" :
206+ self .redir_hosts_data [host_id ]["enabled" ] = 0
207+ if host_type is "streams" :
208+ self .stream_hosts_data [host_id ]["enabled" ] = 0
209+ if host_type is "dead-hosts" :
210+ self .dead_hosts_data [host_id ]["enabled" ] = 0
197211 elif "error" in response .keys ():
198212 _LOGGER .error (
199213 "Error enabling host type %s host id %s. Error message: '%s'" ,
@@ -215,16 +229,16 @@ def is_host_enabled(self, host_id: str, host_type: str) -> bool:
215229 return True
216230 else :
217231 return False
218- # elif host_type == "streams":
219- # if self.stream_hosts_data[host_id]["enabled"] == 1:
220- # return True
221- # else:
222- # return False
223- # elif host_type == "dead-hosts":
224- # if self.dead_hosts_data[host_id]["enabled"] == 1:
225- # return True
226- # else:
227- # return False
232+ elif host_type == "streams" :
233+ if self .stream_hosts_data [host_id ]["enabled" ] == 1 :
234+ return True
235+ else :
236+ return False
237+ elif host_type == "dead-hosts" :
238+ if self .dead_hosts_data [host_id ]["enabled" ] == 1 :
239+ return True
240+ else :
241+ return False
228242 else :
229243 return None
230244 @property
0 commit comments