Download src/security/featureExtractor.js from TwanAPI/trsstapi: direct link, hf CLI and curl.
- Browser
- Download file 319 Bytes
-
https://huggingface.co/spaces/TwanAPI/trsstapi/resolve/a169e77e4e1c4724b019a20cfa2d36f39e4a92d3/src/security/featureExtractor.js
- Command line
-
hf download hf://spaces/TwanAPI/trsstapi@a169e77e4e1c4724b019a20cfa2d36f39e4a92d3/src/security/featureExtractor.js
-
curl -L -o featureExtractor.js https://huggingface.co/spaces/TwanAPI/trsstapi/resolve/a169e77e4e1c4724b019a20cfa2d36f39e4a92d3/src/security/featureExtractor.js
319 Bytes
| import { AuditLog } from "../models/AuditLog.js"; | |
| export async function extractFeatures(log) { | |
| const since = new Date(Date.now() - 10 * 60 * 1000); | |
| const ipCount = await AuditLog.countDocuments({ | |
| ip: log.ip, | |
| createdAt: { $gte: since }, | |
| }); | |
| return [log.createdAt.getHours(), Math.min(ipCount, 100)]; | |
| } | |