This commit is contained in:
Sean Edmunds
2025-01-28 13:07:14 -06:00
parent a7da49d075
commit 2dbc823021

View File

@@ -14,23 +14,6 @@ const pool = mariadb.createPool({
connectionLimit: 5,
});
const options = {
port: 162,
disableAuthorization: true,
includeAuthentication: false,
accessControlModelType: snmp.AccessControlModelType.None,
address: null,
transport: "udp4",
};
const callback = (error, notification) => {
if (error) {
console.error(error);
} else {
console.log(notification);
}
};
function sqlEscape(str) {
return str.replace(/[\0\x08\x09\x1a\n\r"'\\\%]/g, (char) => {
switch (char) {
@@ -58,8 +41,6 @@ function sqlEscape(str) {
});
}
const receiver = snmp.createReceiver(options, callback);
// initializing app
const app = express();
@@ -134,7 +115,7 @@ app.patch("/trigger/api/messages", async (req, res) => {
app.delete("/trigger/api/messages", async (req, res) => {
const conn = await pool.getConnection();
const query = `DELETE FROM trigger_database.messages WHERE id = '${sqlEscape(req.body.id)}'`;
const query = `DELETE FROM trigger_database.messages WHERE id = '${req.body.id}'`;
conn
.query(query)
.then((rows) => {