deploy 123
This commit is contained in:
parent
1b747886b2
commit
b6a40f282f
3 changed files with 13 additions and 2 deletions
13
index.js
13
index.js
|
@ -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
1
package-lock.json
generated
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
|
@ -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"
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue