chore: update public repo

This commit is contained in:
desu-bot 2025-01-14 02:38:00 +00:00
parent e0109980c0
commit e7c9507247
No known key found for this signature in database
25 changed files with 5364 additions and 0 deletions

View file

@ -0,0 +1,39 @@
import { filesize } from 'filesize'
import { z } from 'zod'
import { ffetch } from '../../utils/fetch.ts'
import { getEnv } from '../../utils/misc.ts'
const res = await ffetch('/api/v0/transfers/uploads', {
baseUrl: getEnv('SLSKD_ENDPOINT'),
headers: {
cookie: getEnv('SLSKD_COOKIE'),
},
}).parsedJson(z.array(
z.object({
username: z.string(),
directories: z.array(z.object({
directory: z.string(),
fileCount: z.number(),
files: z.array(z.object({
id: z.string(),
filename: z.string(),
state: z.string(),
bytesTransferred: z.number(),
})),
})),
}),
))
let total = 0
for (const user of res) {
for (const dir of user.directories) {
for (const file of dir.files) {
if (file.state !== 'Completed, Succeeded') continue
total += file.bytesTransferred
}
}
}
console.log(filesize(total))