mirror-filecoffee-filehost/index.js

29 lines
724 B
JavaScript
Raw Normal View History

2024-06-02 17:32:54 +02:00
require("dotenv").config();
const express = require("express");
const ejs = require("ejs");
2024-06-04 18:48:52 +02:00
const fileRoutes = require("./routes/file.routes");
2024-06-02 17:32:54 +02:00
const app = express();
2024-06-04 19:16:19 +02:00
const port = 3000;
2024-06-02 17:32:54 +02:00
const apiKeys = process.env.API_KEYS.split(",");
2024-06-04 18:45:19 +02:00
const allowPublicUploads = process.env.ALLOW_PUBLIC_UPLOADS === "true";
2024-06-02 17:32:54 +02:00
const hosterEmail = process.env.HOSTER_EMAIL;
let totalUploads = 0;
let totalSize = 0;
app.set("view engine", "ejs");
2024-06-04 18:45:19 +02:00
app.use(fileRoutes);
2024-06-02 17:32:54 +02:00
2024-06-04 18:45:19 +02:00
app.get("/", (req, res) => {
res.render("index", {
totalUploads: totalUploads,
totalSize: totalSize.toFixed(2), // Format to 2 decimal places
hosterEmail: hosterEmail,
2024-06-02 17:32:54 +02:00
});
2024-06-04 18:45:19 +02:00
});
2024-06-02 17:32:54 +02:00
2024-06-04 18:45:19 +02:00
app.listen(port, () => {
console.log(`Server is running on port ${port}`);
});