diff --git a/Api-Server/discordWebhook.js b/Api-Server/discordWebhook.js index 33d8a06..e5a5859 100644 --- a/Api-Server/discordWebhook.js +++ b/Api-Server/discordWebhook.js @@ -2,7 +2,7 @@ import axios from 'axios'; import dayjs from 'dayjs'; -const webhookUrl = 'Discord webhook URL'; // Discord webhook URL +const webhookUrl = process.env.DISCORD_WEBHOOK_URL; // Get from environment variable // Function to send message to Discord export const sendDiscordNotification = async (fileName, fileUrl) => { @@ -27,4 +27,4 @@ export const sendDiscordNotification = async (fileName, fileUrl) => { } catch (error) { console.error('Error sending notification to Discord:', error); } -}; +}; \ No newline at end of file diff --git a/Api-Server/example.env b/Api-Server/example.env index 8a03def..55b57e6 100644 --- a/Api-Server/example.env +++ b/Api-Server/example.env @@ -4,3 +4,4 @@ GITHUB_TOKEN=TOKEN GITHUB_REPO=FreeCode911/AnoUpload PORT=8080 WEBSITE_URL=https://lykfile.me +DISCORD_WEBHOOK_URL=YOUR_DISCORD_WEBHOOK_URL \ No newline at end of file diff --git a/Api-Server/index.mjs b/Api-Server/index.mjs index bc847c9..0fe0d70 100644 --- a/Api-Server/index.mjs +++ b/Api-Server/index.mjs @@ -15,8 +15,9 @@ const maxContentLength = parseInt(process.env.MAX_CONTENT_LENGTH, 10); const githubToken = process.env.GITHUB_TOKEN; const githubRepo = process.env.GITHUB_REPO; const websiteUrl = process.env.WEBSITE_URL || 'http://localhost'; +const discordWebhookUrl = process.env.DISCORD_WEBHOOK_URL; -if (!uploadFolder || isNaN(maxContentLength) || !githubToken || !githubRepo || !websiteUrl) { +if (!uploadFolder || isNaN(maxContentLength) || !githubToken || !githubRepo || !websiteUrl || !discordWebhookUrl) { console.error(`Missing or incorrect environment variables.`); process.exit(1); } @@ -160,4 +161,4 @@ setInterval(() => { }); } }); -}, 1800000); // 30 minutes in milliseconds +}, 1800000); // 30 minutes in milliseconds \ No newline at end of file diff --git a/example.env b/example.env index 3ed8b60..55b57e6 100644 --- a/example.env +++ b/example.env @@ -3,4 +3,5 @@ MAX_CONTENT_LENGTH=1073741824 GITHUB_TOKEN=TOKEN GITHUB_REPO=FreeCode911/AnoUpload PORT=8080 -WEBSITE_URL=https://lykfile. +WEBSITE_URL=https://lykfile.me +DISCORD_WEBHOOK_URL=YOUR_DISCORD_WEBHOOK_URL \ No newline at end of file diff --git a/index.js b/index.js index fa8a196..8d4c5bd 100644 --- a/index.js +++ b/index.js @@ -102,7 +102,7 @@ Missing or incorrect environment variables:`); app.use(express.static(path.join(__dirname, 'public'))); app.get('/', (req, res) => { - res.sendFile(path.join(__dirname, 'public', 'upload.html'), (err) => { + res.sendFile(path.join(__dirname, 'public', 'index.html'), (err) => { if (err) { console.error(`Error sending upload form: ${err.message}`); res.status(500).send('Error loading upload form.'); @@ -207,4 +207,4 @@ Missing or incorrect environment variables:`); }, 1800000); // 30 minutes in milliseconds } -AnoUploader(); +AnoUploader(); \ No newline at end of file