fix: chunk nextdns

This commit is contained in:
Saahil 2024-11-11 20:14:41 -05:00
parent 5e7ee068f1
commit de0957e71c
No known key found for this signature in database
GPG key ID: 8A8B64515254CFC6
4 changed files with 12 additions and 3 deletions

2
.gitignore vendored
View file

@ -132,3 +132,5 @@ dist
data.json
t.ts
ctf/unenc
*.bin
*.txt

1
.wakaignore Normal file
View file

@ -0,0 +1 @@
.git

View file

@ -20,7 +20,7 @@ export interface Device {
id: string;
name: string;
}
export const chunks:string[] = []
export function PrivateDNS(app: ModifiedApp, id: string, channel: string) {
const client = new EventSource(
`https://api.nextdns.io/profiles/${id}/logs/stream`,
@ -34,10 +34,15 @@ export function PrivateDNS(app: ModifiedApp, id: string, channel: string) {
//@ts-ignore
delete realData.clientIp;
// console.log(`${realData.status == 'blocked' ? ':x:' : ":white_check_mark:"} ${realData.encrypted ? ":lock: " : ""} - ${realData.domain} `)
if(chunks.length < 10) {
chunks.push(`${realData.status == "blocked" ? ":x:" : ":white_check_mark:"} ${realData.encrypted ? ":lock: " : ""} - ${realData.domain} `)
} else {
app.client.chat.postMessage({
channel,
text: `${realData.status == "blocked" ? ":x:" : ":white_check_mark:"} ${realData.encrypted ? ":lock: " : ""} - ${realData.domain} `,
text: chunks.join("\n"),
});
}
};
// fetch(`https://api.nextdns.io/profiles/${id}/logs/stream`, {
// headers: { "X-Api-Key": process.env.NEXTDNS_API_KEY },

View file

@ -5,9 +5,10 @@ version = 1
[files]
include = ["*"] # files to include in tracking
exclude = ["/node_modules"] # files to exclude in tracking
exclude = ["/node_modules", ".gits"] # files to exclude in tracking
exclude_files = [
".gitignore",
".wakaignore"
] # files whose contents will be used to exclude other files from tracking
exclude_binary_files = true # whether to ignore binary files