Update v1.0.0-beta.12, addition of external APIs and optimization
This commit is contained in:
@@ -1,4 +1,17 @@
|
||||
const { getUserData } = require('../Middlewares/watcherMiddleware');
|
||||
const fs = require('fs').promises;
|
||||
const path = require('path');
|
||||
|
||||
const filePath = path.join(__dirname, '../data/user.json');
|
||||
|
||||
async function getUserData() {
|
||||
try {
|
||||
const fileContent = await fs.readFile(filePath, 'utf8');
|
||||
return JSON.parse(fileContent);
|
||||
} catch (err) {
|
||||
console.error(`Failed to read from ${filePath}: ${err}`);
|
||||
throw err;
|
||||
}
|
||||
}
|
||||
let userData = getUserData();
|
||||
|
||||
async function checkUserExistsDiscord(req, res, next) {
|
||||
|
||||
@@ -12,7 +12,7 @@ function sendDiscordWebhook(url, req, statusCode) {
|
||||
|
||||
const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
|
||||
|
||||
const statusEmoji = statusCode === 200 ? '✅' : '❌';
|
||||
const statusEmoji = [200, 302].includes(statusCode) ? '✅' : '❌';
|
||||
const statusMessage = `**Statut:** ${statusEmoji} (${statusCode})`;
|
||||
|
||||
const timestamp = new Date().toLocaleString('fr-FR', { timeZone: 'UTC', hour12: false });
|
||||
|
||||
Reference in New Issue
Block a user