Compare commits

1 Commits
Author SHA1 Message Date
Vadher 688075238a removed db.json for cloud deployment 2026-07-19 17:20:56 +05:30
2 changed files with 7 additions and 2093 deletions
File diff suppressed because it is too large Load Diff
+7 -7
View File
@@ -9,7 +9,7 @@ const { init, broadcast } = require("./utils/utils");
const urlPath = path.join(__dirname, "database", "urls.json"); const urlPath = path.join(__dirname, "database", "urls.json");
dotenv.config(); dotenv.config();
const checkAllUrl = async (Store) => { const checkAllUrl = async () => {
try { try {
const urls = await fs.readFile(urlPath, "utf8"); const urls = await fs.readFile(urlPath, "utf8");
const parsedUrls = JSON.parse(urls); const parsedUrls = JSON.parse(urls);
@@ -18,10 +18,10 @@ const checkAllUrl = async (Store) => {
parsedUrls.map(async (url) => { parsedUrls.map(async (url) => {
const response = await checkUrl(url); const response = await checkUrl(url);
broadcast(response); broadcast(response);
Store.push(response); // Store.push(response);
}), }),
); );
StoreRecord(Store); // StoreRecord(Store);
broadcast({ type: "checking" }); broadcast({ type: "checking" });
} catch (err) { } catch (err) {
console.error("WebSocket polling error:", err.message); console.error("WebSocket polling error:", err.message);
@@ -33,15 +33,15 @@ const checkAllUrl = async (Store) => {
}; };
async function setupWebSocket(wss) { async function setupWebSocket(wss) {
init(wss); init(wss);
let Store = []; // let Store = [];
wss.on("connection", (ws) => { wss.on("connection", (ws) => {
checkAllUrl(Store); checkAllUrl();
}); });
setInterval( setInterval(
async () => { async () => {
Store = []; // Store = [];
checkAllUrl(Store); checkAllUrl();
}, },
process.env.TIME || 60 * 1000, process.env.TIME || 60 * 1000,
); );