Compare commits
2 Commits
9d2c4170d2
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c77a4b935 | |||
|
|
7e958db51c |
11
Dockerfile
11
Dockerfile
@@ -21,19 +21,14 @@ RUN mkdir -p /app/config /app/data/pdfs
|
|||||||
# Crée le fichier projects.json
|
# Crée le fichier projects.json
|
||||||
COPY config/projects.json.example /app/config/projects.json
|
COPY config/projects.json.example /app/config/projects.json
|
||||||
|
|
||||||
# Crée un utilisateur non-root pour la sécurité
|
# Ajuste les permissions pour être plus permissives
|
||||||
RUN addgroup -g 1001 -S nodejs && \
|
RUN chmod -R 777 /app/config
|
||||||
adduser -S botuser -u 1001
|
|
||||||
|
|
||||||
# Change la propriété des fichiers
|
|
||||||
RUN chown -R botuser:nodejs /app
|
|
||||||
USER botuser
|
|
||||||
|
|
||||||
# Définit les variables d'environnement par défaut
|
# Définit les variables d'environnement par défaut
|
||||||
ENV NODE_ENV=production
|
ENV NODE_ENV=production
|
||||||
ENV LOG_LEVEL=info
|
ENV LOG_LEVEL=info
|
||||||
|
|
||||||
# Commande de démarrage
|
# Commande de démarrage (en tant que root)
|
||||||
CMD ["node", "src/index.js"]
|
CMD ["node", "src/index.js"]
|
||||||
|
|
||||||
# Labels pour la documentation
|
# Labels pour la documentation
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ services:
|
|||||||
|
|
||||||
# Volumes pour la configuration
|
# Volumes pour la configuration
|
||||||
volumes:
|
volumes:
|
||||||
- ./config/projects.json:/app/config/projects.json:ro # Fichier projects.json en lecture seule
|
- ./config/projects.json:/app/config/projects.json
|
||||||
- pdf-data:/app/data/pdfs #
|
- pdf-data:/app/data/pdfs #
|
||||||
|
|
||||||
# Réseau
|
# Réseau
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ class PdfHandler {
|
|||||||
const urlOption = interaction.options.getString('url');
|
const urlOption = interaction.options.getString('url');
|
||||||
const isPublic = interaction.options.getBoolean('public') === true;
|
const isPublic = interaction.options.getBoolean('public') === true;
|
||||||
|
|
||||||
|
if (attachment && urlOption) {
|
||||||
|
await interaction.editReply({ content: '❌ Fournis soit un fichier PDF, soit une URL, mais pas les deux.' });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const sourceUrl = attachment ? attachment.url : urlOption;
|
const sourceUrl = attachment ? attachment.url : urlOption;
|
||||||
if (!attachment && !urlOption) {
|
if (!attachment && !urlOption) {
|
||||||
await interaction.editReply({ content: '❌ Fournis un PDF (fichier) ou une URL https:// vers un PDF.' });
|
await interaction.editReply({ content: '❌ Fournis un PDF (fichier) ou une URL https:// vers un PDF.' });
|
||||||
|
|||||||
Reference in New Issue
Block a user