1
0

feat: Allow cors
All checks were successful
Remote Deploy / deploy (push) Successful in 6s

This commit is contained in:
2026-01-23 18:13:45 +01:00
parent c34f4ee1d1
commit 1013a3ba15
4 changed files with 37 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ const app = express();
import fs from "fs/promises";
import { getCurrentInterval } from "./scheduleRules.js";
import bodyParser from "body-parser";
import cors from "cors";
const VERSIONS = ["v1", "v2"];
const PORT = process.env.PORT || 3000;
@@ -26,6 +27,13 @@ globalThis.File = class File {};
app.use(bodyParser.json());
app.use(cors({
origin: "*",
methods: ["GET", "POST", "OPTIONS"],
allowedHeaders: ["Content-Type"],
}));
app.options("*", cors());
app.get('/', async (req, res) => {
const userAgent = req.headers['user-agent'] || '';
const isBrowser = /Mozilla|Chrome|Firefox|Safari|Edg/.test(userAgent);