type Cloudflare = {
token: string;
email: string;
key: string;
};
/**
* Get Browser Check setting
* Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will also challenge visitors that do not have a user agent or a non standard user agent (also commonly used by abuse bots, crawlers or visitors). (https://support.cloudflare.com/hc/en-us/articles/200170086).
*/
export async function main(auth: Cloudflare, zone_identifier: string) {
const url = new URL(
`https://api.cloudflare.com/client/v4/zones/${zone_identifier}/settings/browser_check`
);
const response = await fetch(url, {
method: "GET",
headers: {
"X-AUTH-EMAIL": auth.email,
"X-AUTH-KEY": auth.key,
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 3 days ago
type Cloudflare = {
token: string;
email: string;
key: string;
};
/**
* Get Browser Check setting
* Browser Integrity Check is similar to Bad Behavior and looks for common HTTP headers abused most commonly by spammers and denies access to your page. It will also challenge visitors that do not have a user agent or a non standard user agent (also commonly used by abuse bots, crawlers or visitors). (https://support.cloudflare.com/hc/en-us/articles/200170086).
*/
export async function main(auth: Cloudflare, zone_identifier: string) {
const url = new URL(
`https://api.cloudflare.com/client/v4/zones/${zone_identifier}/settings/browser_check`
);
const response = await fetch(url, {
method: "GET",
headers: {
"X-AUTH-EMAIL": auth.email,
"X-AUTH-KEY": auth.key,
Authorization: "Bearer " + auth.token,
},
body: undefined,
});
if (!response.ok) {
const text = await response.text();
throw new Error(`${response.status} ${text}`);
}
return await response.json();
}
Submitted by hugo697 541 days ago