This commit is contained in:
27
package-lock.json
generated
27
package-lock.json
generated
@@ -12,6 +12,7 @@
|
||||
"body-parser": "^2.2.0",
|
||||
"cheerio": "^1.1.2",
|
||||
"concurrently": "^9.2.0",
|
||||
"cors": "^2.8.6",
|
||||
"dotenv": "^17.2.3",
|
||||
"exceljs": "^4.4.0",
|
||||
"express": "^5.1.0",
|
||||
@@ -809,6 +810,23 @@
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
||||
"license": "MIT"
|
||||
},
|
||||
"node_modules/cors": {
|
||||
"version": "2.8.6",
|
||||
"resolved": "https://registry.npmjs.org/cors/-/cors-2.8.6.tgz",
|
||||
"integrity": "sha512-tJtZBBHA6vjIAaF6EnIaq6laBBP9aq/Y3ouVJjEfoHbRBcHBAHYcMh/w8LDrk2PvIMMq8gmopa5D4V8RmbrxGw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"object-assign": "^4",
|
||||
"vary": "^1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.10"
|
||||
},
|
||||
"funding": {
|
||||
"type": "opencollective",
|
||||
"url": "https://opencollective.com/express"
|
||||
}
|
||||
},
|
||||
"node_modules/cosmiconfig": {
|
||||
"version": "9.0.0",
|
||||
"resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-9.0.0.tgz",
|
||||
@@ -2152,6 +2170,15 @@
|
||||
"url": "https://github.com/fb55/nth-check?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/object-assign": {
|
||||
"version": "4.1.1",
|
||||
"resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
|
||||
"integrity": "sha512-rJgTQnkUnH1sFw8yT6VSU3zD3sWmu6sZhIseY8VX+GRu3P6F7Fu+JNDoXfklElbLJSnc3FUQHVe4cU5hj+BcUg==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/object-inspect": {
|
||||
"version": "1.13.4",
|
||||
"resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz",
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
"body-parser": "^2.2.0",
|
||||
"cheerio": "^1.1.2",
|
||||
"concurrently": "^9.2.0",
|
||||
"cors": "^2.8.6",
|
||||
"dotenv": "^17.2.3",
|
||||
"exceljs": "^4.4.0",
|
||||
"express": "^5.1.0",
|
||||
|
||||
@@ -19,7 +19,7 @@ globalThis.File = class File {};
|
||||
export default async function parseTeachers() {
|
||||
const url = "https://spsejecna.cz/ucitel";
|
||||
const response = await fetch(url);
|
||||
const data = await response.text(); // fetch needs .text() to get HTML
|
||||
const data = await response.text();
|
||||
const $ = cheerio.load(data);
|
||||
|
||||
const map = {};
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user