Added Guacamole Client type
This commit is contained in:
10
server.cjs
10
server.cjs
@@ -730,7 +730,7 @@ app.get("/trigger/api/guacamoleClients", async (_req, res) => {
|
|||||||
|
|
||||||
app.post("/trigger/api/guacamoleClients", async (req, res) => {
|
app.post("/trigger/api/guacamoleClients", async (req, res) => {
|
||||||
const conn = await pool.getConnection();
|
const conn = await pool.getConnection();
|
||||||
const query = `INSERT INTO trigger_database.guacamoleClients (clientName, clientIdentifier, enabled) VALUES (${escapeString(req.body.clientName)}, ${escapeString(req.body.clientIdentifier)}, ${req.body.enabled})`;
|
const query = `INSERT INTO trigger_database.guacamoleClients (clientName, clientIdentifier, enabled, type) VALUES (${escapeString(req.body.clientName)}, ${escapeString(req.body.clientIdentifier)}, ${req.body.enabled}, ${escapeString(req.body.type)})`;
|
||||||
conn
|
conn
|
||||||
.query(query)
|
.query(query)
|
||||||
.then((_rows) => {
|
.then((_rows) => {
|
||||||
@@ -744,7 +744,7 @@ app.post("/trigger/api/guacamoleClients", async (req, res) => {
|
|||||||
|
|
||||||
app.patch("/trigger/api/guacamoleClients", async (req, res) => {
|
app.patch("/trigger/api/guacamoleClients", async (req, res) => {
|
||||||
const conn = await pool.getConnection();
|
const conn = await pool.getConnection();
|
||||||
const query = `UPDATE trigger_database.guacamoleClients SET clientName = ${escapeString(req.body.clientName)}, clientIdentifier = ${escapeString(req.body.clientIdentifier)} , enabled = ${req.body.enabled} WHERE id = ${req.body.id}`;
|
const query = `UPDATE trigger_database.guacamoleClients SET clientName = ${escapeString(req.body.clientName)}, clientIdentifier = ${escapeString(req.body.clientIdentifier)} , enabled = ${req.body.enabled}, type = ${escapeString(req.body.type)} WHERE id = ${req.body.id}`;
|
||||||
conn
|
conn
|
||||||
.query(query)
|
.query(query)
|
||||||
.then((_rows) => {
|
.then((_rows) => {
|
||||||
@@ -770,12 +770,6 @@ app.delete("/trigger/api/guacamoleClients", async (req, res) => {
|
|||||||
conn.end();
|
conn.end();
|
||||||
});
|
});
|
||||||
|
|
||||||
app.post("/trigger/api/wakeClient", async (req, res) => {
|
|
||||||
wol.wake(req.body.macAddress, () => {
|
|
||||||
res.status(200).send({ status: "success" });
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
// Search //
|
// Search //
|
||||||
//////////////////////////////////////////////
|
//////////////////////////////////////////////
|
||||||
|
|||||||
Reference in New Issue
Block a user