Remove unnecessary 'async' keyword
This commit is contained in:
+2
-2
@@ -6,7 +6,7 @@ const HASHES_DB = config.cookies.server_hashes;
|
||||
const HASHES_COOKIE = config.cookies.client_hashes;
|
||||
const HASHES_DIFF = HASHES_DB - HASHES_COOKIE;
|
||||
export const setup = function (router, con, server) {
|
||||
router.use("/*", async function (req, res, next) {
|
||||
router.use("/*", function (req, res, next) {
|
||||
res.set("Access-Control-Allow-Origin", "*"); //we'll allow it for now
|
||||
let unsigned;
|
||||
if (req.body.user == undefined || req.body.pass == undefined) {
|
||||
@@ -49,7 +49,7 @@ export const setup = function (router, con, server) {
|
||||
});
|
||||
});
|
||||
|
||||
router.use("/api/*", async function (req, res, next) {
|
||||
router.use("/api/*", function (req, res, next) {
|
||||
res.set("Access-Control-Allow-Origin", "*"); //we'll allow it for now
|
||||
if (config["allow_getotheruser_without_cookie"] && req.originalUrl.split("\?")[0] == "/api/getotheruser") {
|
||||
next();
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
//const web_version = require("unsafe_encrypt").web_version
|
||||
import { web_version } from "unsafe_encrypt";
|
||||
export const setup = function (router, con, server) {
|
||||
router.get("/api/getPersonalPosts", async function (req, res) {
|
||||
router.get("/api/getPersonalPosts", function (req, res) {
|
||||
res.set("Access-Control-Allow-Origin", "");
|
||||
let otherperson = encodeURIComponent(req.query.otherperson || "");
|
||||
if (typeof otherperson != "string" || otherperson.length > 100 || otherperson == "") {
|
||||
@@ -21,7 +21,7 @@ export const setup = function (router, con, server) {
|
||||
res.json(result);
|
||||
});
|
||||
});
|
||||
router.get("/api/dms/conversations", async function (req, res) {
|
||||
router.get("/api/dms/conversations", function (req, res) {
|
||||
res.set("Access-Control-Allow-Origin", "*");
|
||||
const columns = [
|
||||
"dms_user_name", "dms_receiver"
|
||||
@@ -34,12 +34,12 @@ export const setup = function (router, con, server) {
|
||||
res.json(result);
|
||||
});
|
||||
});
|
||||
router.get("/api/dms/encrypt.js", async function (req, res) {
|
||||
router.get("/api/dms/encrypt.js", function (req, res) {
|
||||
res.set("Access-Control-Allow-Origin", "*");
|
||||
res.send(web_version());
|
||||
});
|
||||
//
|
||||
router.get("/api/dms/getDM", async function (req, res) {
|
||||
router.get("/api/dms/getDM", function (req, res) {
|
||||
res.set("Access-Control-Allow-Origin", "*");
|
||||
let arg = req.query.id;
|
||||
let uriencusername = encodeURIComponent(res.locals.username);
|
||||
|
||||
@@ -16,11 +16,11 @@ export const setup = function (router, con, server) {
|
||||
}
|
||||
|
||||
|
||||
router.get("/api/dms/pid", async function (req, res) {
|
||||
router.get("/api/dms/pid", function (req, res) {
|
||||
res.set("Access-Control-Allow-Origin", "*");
|
||||
res.json({ "pid": createPID() });
|
||||
});
|
||||
router.post("/api/dms/post", async function (req, res) {
|
||||
router.post("/api/dms/post", function (req, res) {
|
||||
if (!req.body.message) {
|
||||
res.json({ "error": "no message to post" });
|
||||
return;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
function allowAllTraffic(router, str, type) {
|
||||
router.options(str, async function (req, res, next) {
|
||||
router.options(str, function (req, res, next) {
|
||||
res.set("Access-Control-Allow-Origin", "*"); //we'll allow it for now
|
||||
res.set("Access-Control-Allow-Methods", type || "GET");
|
||||
res.set("Access-Control-Allow-Headers", "Content-Type");
|
||||
|
||||
+3
-3
@@ -14,11 +14,11 @@ export const setup = function (router, con, server) {
|
||||
return pid
|
||||
}
|
||||
|
||||
router.get("/api/pid", async function (req, res) {
|
||||
router.get("/api/pid", function (req, res) {
|
||||
res.set("Access-Control-Allow-Origin", "*");
|
||||
res.json({ "pid": createPID() });
|
||||
});
|
||||
router.post("/api/post", async function (req, res) {
|
||||
router.post("/api/post", function (req, res) {
|
||||
if (!req.body.message) {
|
||||
res.json({ "error": "no message to post" });
|
||||
return;
|
||||
@@ -89,7 +89,7 @@ export const setup = function (router, con, server) {
|
||||
data: post_obj
|
||||
};
|
||||
let messagestr = JSON.stringify(message);
|
||||
server.wss.clients.forEach(async function (ws) {
|
||||
server.wss.clients.forEach( function (ws) {
|
||||
ws.send(messagestr);
|
||||
});
|
||||
res.json({ "success": "successfully posted message" });
|
||||
|
||||
Reference in New Issue
Block a user