This commit is contained in:
GreenyDev 2023-04-28 20:47:15 -04:00
parent b721bce67b
commit 4836de517c

8
app.js
View file

@ -14,11 +14,11 @@ import bcrypt from "bcrypt";
const PORT = process.env.PORT || 3000;
const __dirname = process.cwd();
const ACTIVE_CODES = new Set();
if (!fs.existsSync("./memory.txt")) {
fs.writeFileSync("./memory.txt", "", "utf-8");
if (!fs.existsSync("./tmp/memory.txt")) {
fs.writeFileSync("./tmp/memory.txt", "", "utf-8");
}
let TOKENS = fs
.readFileSync("./memory.txt", "utf-8")
.readFileSync("./tmp/memory.txt", "utf-8")
.trim()
.split("\n")
.map((token) => {
@ -138,7 +138,7 @@ app.post("/validate-otp", (req, res) => {
});
fs.writeFileSync(
"./memory.txt",
"./tmp/memory.txt",
TOKENS.map((token) => {
return `${token.id}:${token.token}:${token.expiration}`;
}).join("\n"),