mirror of
https://github.com/JGeek00/adguard-home-manager.git
synced 2025-05-04 20:30:35 +00:00
Added check host
This commit is contained in:
parent
5803998d73
commit
cca12d5664
5 changed files with 283 additions and 2 deletions
|
@ -960,4 +960,40 @@ Future updateLists({
|
|||
else {
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Future checkHostFiltered({
|
||||
required Server server,
|
||||
required String host,
|
||||
}) async {
|
||||
final result = await apiRequest(
|
||||
urlPath: '/filtering/check_host?name=$host',
|
||||
method: 'get',
|
||||
server: server,
|
||||
type: 'check_host_filtered'
|
||||
);
|
||||
|
||||
if (result['hasResponse'] == true) {
|
||||
if (result['statusCode'] == 200) {
|
||||
return {
|
||||
'result': 'success',
|
||||
'data': jsonDecode(result['body'])
|
||||
};
|
||||
}
|
||||
else {
|
||||
return {
|
||||
'result': 'error',
|
||||
'log': AppLog(
|
||||
type: 'update_lists',
|
||||
dateTime: DateTime.now(),
|
||||
message: 'error_code_not_expected',
|
||||
statusCode: result['statusCode'],
|
||||
resBody: result['body'],
|
||||
)
|
||||
};
|
||||
}
|
||||
}
|
||||
else {
|
||||
return result;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue