Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Api-Server/discordWebhook.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand All @@ -27,4 +27,4 @@ export const sendDiscordNotification = async (fileName, fileUrl) => {
} catch (error) {
console.error('Error sending notification to Discord:', error);
}
};
};
1 change: 1 addition & 0 deletions Api-Server/example.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 3 additions & 2 deletions Api-Server/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down Expand Up @@ -160,4 +161,4 @@ setInterval(() => {
});
}
});
}, 1800000); // 30 minutes in milliseconds
}, 1800000); // 30 minutes in milliseconds
3 changes: 2 additions & 1 deletion example.env
Original file line number Diff line number Diff line change
Expand Up @@ -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
4 changes: 2 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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.');
Expand Down Expand Up @@ -207,4 +207,4 @@ Missing or incorrect environment variables:`);
}, 1800000); // 30 minutes in milliseconds
}

AnoUploader();
AnoUploader();