add: check ip ban endpoint
This commit is contained in:
parent
8786cb4781
commit
e78c43ab62
8 changed files with 68 additions and 6 deletions
|
@ -72,6 +72,25 @@ export default function tetratto({
|
|||
);
|
||||
}
|
||||
|
||||
async function check_ip(ip) {
|
||||
if (!api_key) {
|
||||
throw Error("No API key provided.");
|
||||
}
|
||||
|
||||
return api_promise(
|
||||
json_parse(
|
||||
await (
|
||||
await fetch(`${host}/api/v1/bans/${ip}`, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"Atto-Secret-Key": api_key,
|
||||
},
|
||||
})
|
||||
).text(),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
async function query(body) {
|
||||
if (!api_key) {
|
||||
throw Error("No API key provided.");
|
||||
|
@ -285,6 +304,7 @@ export default function tetratto({
|
|||
api_key,
|
||||
// app data
|
||||
app,
|
||||
check_ip,
|
||||
query,
|
||||
insert,
|
||||
update,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue