deploy 123

This commit is contained in:
slonkazoid 2024-03-07 18:10:10 +03:00
parent 1b747886b2
commit b6a40f282f
Signed by: slonk
SSH key fingerprint: SHA256:tbZfJX4IOvZ0LGWOWu5Ijo8jfMPi78TU7x1VoEeCIjM
3 changed files with 13 additions and 2 deletions

View file

@ -2,6 +2,7 @@ import express from "express";
import logRequest from "./logger.js"; import logRequest from "./logger.js";
import { parse } from "node-html-parser"; import { parse } from "node-html-parser";
import { format } from "util"; import { format } from "util";
import escape from "escape-html";
const config = { const config = {
FUCKING_ENDPOINT: FUCKING_ENDPOINT:
@ -30,7 +31,11 @@ app.get("/*/status/*", async (req, res) => {
} catch (err) { } catch (err) {
return res return res
.status(500) .status(500)
.send("Error from Twitter API: " + format("%s", err)); .send(
`<p>Error from Twitter API:</p><pre>${escape(
format("%s", err)
)}</pre>`
);
} }
if (twitter_res.status == 200) { if (twitter_res.status == 200) {
let body; let body;
@ -39,7 +44,11 @@ app.get("/*/status/*", async (req, res) => {
} catch (err) { } catch (err) {
return res return res
.status(500) .status(500)
.send("Error from Twitter API: " + format("%s", err)); .send(
`<p>Error from Twitter API:</p><pre>${escape(
format("%s", err)
)}</pre>`
);
} }
let html = parse(body.html); let html = parse(body.html);
let block = html.firstChild; let block = html.firstChild;

1
package-lock.json generated
View file

@ -10,6 +10,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"ejs": "^3.1.9", "ejs": "^3.1.9",
"escape-html": "^1.0.3",
"express": "^4.18.3", "express": "^4.18.3",
"node-html-parser": "^6.1.12" "node-html-parser": "^6.1.12"
} }

View file

@ -12,6 +12,7 @@
"license": "ISC", "license": "ISC",
"dependencies": { "dependencies": {
"ejs": "^3.1.9", "ejs": "^3.1.9",
"escape-html": "^1.0.3",
"express": "^4.18.3", "express": "^4.18.3",
"node-html-parser": "^6.1.12" "node-html-parser": "^6.1.12"
} }