Skip to content

Commit

Permalink
Merge pull request #104 from GreenyDEV/main
Browse files Browse the repository at this point in the history
Fixes Cyclic Read only filesystem bug
  • Loading branch information
GreenyDEV authored Apr 29, 2023
2 parents b721bce + 6c7d34b commit 3bc8f31
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ import nodemailer from "nodemailer";
import * as uuid from "uuid";
import fs from "node:fs";
import bcrypt from "bcrypt";

// fx
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) => {
Expand Down Expand Up @@ -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"),
Expand Down
1 change: 1 addition & 0 deletions tmp/memory.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
epic

0 comments on commit 3bc8f31

Please sign in to comment.