split files + restrict public context

This commit is contained in:
gautier
2026-05-08 13:18:11 +02:00
parent ce38183467
commit c169fafb2e
6 changed files with 1674 additions and 647 deletions
+22 -1
View File
@@ -2,7 +2,12 @@ import fs from 'fs';
import express from 'express';
import axios from 'axios';
import https from 'https';
import path from 'path';
import { HttpsProxyAgent } from 'https-proxy-agent'; // <-- AJOUT
import { fileURLToPath } from 'url';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
// ==========================================
// Lecture du fichier config.ini (inchangé)
@@ -81,10 +86,26 @@ jiraClient.interceptors.response.use(
// ==========================================
// Serveur Express
// ==========================================
// const app = express();
//app.use(express.json({ limit: '10mb' }));
//app.use(express.static('.')); // Sert index.html à /
const app = express();
// 1. Middlewares
app.use(express.json({ limit: '10mb' }));
app.use(express.static('.')); // Sert index.html à /
// 2. Fichiers statiques (CSS, JS client, Images)
// On ne sert QUE le contenu du dossier public
app.use(express.static(path.join(__dirname, 'public')));
// 3. Routes HTML
app.get('/', (req, res) => {
// On va chercher l'index dans /views/
res.sendFile(path.join(__dirname, 'index.html'));
});
// Endpoint d'extraction