mirror of
https://github.com/pi-hole/FTL.git
synced 2024-10-26 16:52:18 +02:00
Searchterm should simply be called domain
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
@@ -170,9 +170,9 @@ components:
|
||||
type: integer
|
||||
description: Maximum number of results to be returned (per type)
|
||||
example: 20
|
||||
searchterm:
|
||||
domain:
|
||||
type: string
|
||||
description: Search term
|
||||
description: (Part of) domain to be searched for
|
||||
example: "doubleclick.net"
|
||||
debug:
|
||||
type: boolean
|
||||
|
||||
+1
-1
@@ -223,7 +223,7 @@ int api_search(struct ftl_conn *api)
|
||||
cJSON *parameters = JSON_NEW_OBJECT();
|
||||
JSON_ADD_NUMBER_TO_OBJECT(parameters, "N", N);
|
||||
JSON_ADD_BOOL_TO_OBJECT(parameters, "partial", partial);
|
||||
JSON_REF_STR_IN_OBJECT(parameters, "searchterm", api->item);
|
||||
JSON_REF_STR_IN_OBJECT(parameters, "domain", api->item);
|
||||
JSON_ADD_BOOL_TO_OBJECT(parameters, "debug", debug);
|
||||
JSON_ADD_ITEM_TO_OBJECT(search, "parameters", parameters);
|
||||
if(debug)
|
||||
|
||||
@@ -1252,15 +1252,15 @@
|
||||
}
|
||||
|
||||
@test "API domain search: Non-existing domain returns expected JSON" {
|
||||
run bash -c 'curl -s 127.0.0.1/api/search/non.existant'
|
||||
run bash -c 'curl -s 127.0.0.1/api/search/non.existent'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == '{"search":{"domains":[],"gravity":[],"total":0,"parameters":{"N":20,"partial":false,"searchterm":"non.existant","debug":false}},"took":'*'}' ]]
|
||||
[[ ${lines[0]} == '{"search":{"domains":[],"gravity":[],"total":0,"parameters":{"N":20,"partial":false,"domain":"non.existent","debug":false}},"took":'*'}' ]]
|
||||
}
|
||||
|
||||
@test "API domain search: antigravity.ftl returns expected JSON" {
|
||||
run bash -c 'curl -s 127.0.0.1/api/search/antigravity.ftl'
|
||||
printf "%s\n" "${lines[@]}"
|
||||
[[ ${lines[0]} == '{"search":{"domains":[],"gravity":[{"domain":"antigravity.ftl","type":"block","address":"https://pi-hole.net/block.txt","comment":"Fake block-list","enabled":true,"id":1,"date_added":'*',"date_modified":'*',"type":"block","date_updated":'*',"number":2000,"invalid_domains":2,"abp_entries":0,"status":1,"groups":[0,2]},{"domain":"antigravity.ftl","type":"allow","address":"https://pi-hole.net/allow.txt","comment":"Fake allow-list","enabled":true,"id":2,"date_added":'*',"date_modified":'*',"type":"allow","date_updated":'*',"number":2000,"invalid_domains":2,"abp_entries":0,"status":1,"groups":[0]},{"domain":"@@||antigravity.ftl^","type":"allow","address":"https://pi-hole.net/allow.txt","comment":"Fake allow-list","enabled":true,"id":2,"date_added":'*',"date_modified":'*',"type":"allow","date_updated":'*',"number":2000,"invalid_domains":2,"abp_entries":0,"status":1,"groups":[0]}],"total":3,"parameters":{"N":20,"partial":false,"searchterm":"antigravity.ftl","debug":false}},"took":'*'}' ]]
|
||||
[[ ${lines[0]} == '{"search":{"domains":[],"gravity":[{"domain":"antigravity.ftl","type":"block","address":"https://pi-hole.net/block.txt","comment":"Fake block-list","enabled":true,"id":1,"date_added":'*',"date_modified":'*',"type":"block","date_updated":'*',"number":2000,"invalid_domains":2,"abp_entries":0,"status":1,"groups":[0,2]},{"domain":"antigravity.ftl","type":"allow","address":"https://pi-hole.net/allow.txt","comment":"Fake allow-list","enabled":true,"id":2,"date_added":'*',"date_modified":'*',"type":"allow","date_updated":'*',"number":2000,"invalid_domains":2,"abp_entries":0,"status":1,"groups":[0]},{"domain":"@@||antigravity.ftl^","type":"allow","address":"https://pi-hole.net/allow.txt","comment":"Fake allow-list","enabled":true,"id":2,"date_added":'*',"date_modified":'*',"type":"allow","date_updated":'*',"number":2000,"invalid_domains":2,"abp_entries":0,"status":1,"groups":[0]}],"total":3,"parameters":{"N":20,"partial":false,"domain":"antigravity.ftl","debug":false}},"took":'*'}' ]]
|
||||
}
|
||||
|
||||
@test "API authorization (without password): No login required" {
|
||||
|
||||
Reference in New Issue
Block a user