okeh
21
index.js
|
|
@ -15,7 +15,7 @@ const dotenv = require("dotenv");
|
|||
const fs = require("fs");
|
||||
const mongoose = require("mongoose");
|
||||
const { CCashClient } = require("ccash-client-js");
|
||||
dotenv.config();
|
||||
dotenv.config({ path: ".env" });
|
||||
const { postUser } = require(`${root}/helpers/functions.js`);
|
||||
|
||||
app.set("views", path.join(__dirname, "views"));
|
||||
|
|
@ -34,7 +34,10 @@ app.use(function (req, res, next) {
|
|||
next();
|
||||
});
|
||||
app.set("trust proxy", 1); // trust first proxy
|
||||
const secure = process.env.SECURE;
|
||||
const secure = false;
|
||||
if (process.env.SECURE == true) {
|
||||
secure = true;
|
||||
}
|
||||
app.use(
|
||||
session({
|
||||
secret: "fuck shit cunt",
|
||||
|
|
@ -81,8 +84,9 @@ app.post("/setup", async function (req, res) {
|
|||
}
|
||||
process.env.BANKAPIURL = url;
|
||||
console.log(process.env.BANKAPIURL);
|
||||
fs.rmSync(`/app/config/.env`);
|
||||
fs.writeFileSync(
|
||||
".env",
|
||||
`/app/config/.env`,
|
||||
"BANKAPIURL=" +
|
||||
process.env.BANKAPIURL +
|
||||
"\n" +
|
||||
|
|
@ -90,7 +94,8 @@ app.post("/setup", async function (req, res) {
|
|||
process.env.SECURE +
|
||||
"\nSETUP=true"
|
||||
);
|
||||
fs.writeFileSync("tmp/restart.txt", "");
|
||||
|
||||
fs.writeFileSync(`${root}/tmp/restart.txt`, "");
|
||||
res.redirect("/");
|
||||
});
|
||||
|
||||
|
|
@ -101,7 +106,7 @@ app.get("/", async function (req, res) {
|
|||
const client = new CCashClient(process.env.BANKAPIURL);
|
||||
let checkalive;
|
||||
try {
|
||||
checkalive = await client.help();
|
||||
checkalive = await client.ping();
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
|
|
@ -135,11 +140,7 @@ app.get("/BankF", ensureAuthenticated, async function (req, res) {
|
|||
console.log(err);
|
||||
}
|
||||
let balance = 0;
|
||||
try {
|
||||
balance = await client.balance(req.session.user);
|
||||
} catch (err) {
|
||||
console.log(err);
|
||||
}
|
||||
balance = await client.balance(req.session.user);
|
||||
let logsent;
|
||||
console.log("start " + Date.now());
|
||||
try {
|
||||
|
|
|
|||
|
Before Width: | Height: | Size: 80 B |
|
Before Width: | Height: | Size: 454 B |
|
Before Width: | Height: | Size: 1,009 B |
|
Before Width: | Height: | Size: 943 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 593 B |
|
Before Width: | Height: | Size: 180 B |
|
Before Width: | Height: | Size: 908 B |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 172 B |
|
Before Width: | Height: | Size: 222 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 586 B |
|
Before Width: | Height: | Size: 2 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 209 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 482 B |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 558 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 937 B |
|
Before Width: | Height: | Size: 918 B |
|
Before Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 328 B |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 530 B |
|
Before Width: | Height: | Size: 548 B |
|
Before Width: | Height: | Size: 563 B |
|
Before Width: | Height: | Size: 541 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 981 B |
|
Before Width: | Height: | Size: 412 B |
|
Before Width: | Height: | Size: 432 B |
|
Before Width: | Height: | Size: 449 B |
|
Before Width: | Height: | Size: 433 B |
|
Before Width: | Height: | Size: 997 B |
|
Before Width: | Height: | Size: 802 B |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.7 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 871 B |
|
Before Width: | Height: | Size: 145 B |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.5 KiB |
|
Before Width: | Height: | Size: 707 B |
|
Before Width: | Height: | Size: 491 B |
|
Before Width: | Height: | Size: 974 B |
|
Before Width: | Height: | Size: 561 B |
|
Before Width: | Height: | Size: 634 B |
|
Before Width: | Height: | Size: 518 B |
|
Before Width: | Height: | Size: 320 B |
|
Before Width: | Height: | Size: 187 B |
|
Before Width: | Height: | Size: 422 B |
|
Before Width: | Height: | Size: 726 B |
|
Before Width: | Height: | Size: 934 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 364 B |
|
Before Width: | Height: | Size: 311 B |
|
Before Width: | Height: | Size: 561 B |
|
Before Width: | Height: | Size: 414 B |
|
Before Width: | Height: | Size: 385 B |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 1.9 KiB |
|
Before Width: | Height: | Size: 233 B |
|
Before Width: | Height: | Size: 796 B |
|
Before Width: | Height: | Size: 830 B |
|
Before Width: | Height: | Size: 680 B |
|
Before Width: | Height: | Size: 785 B |
|
Before Width: | Height: | Size: 287 B |
|
Before Width: | Height: | Size: 736 B |
|
Before Width: | Height: | Size: 978 B |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 826 B |
|
Before Width: | Height: | Size: 856 B |
|
Before Width: | Height: | Size: 843 B |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 723 B |
|
Before Width: | Height: | Size: 1 KiB |
|
Before Width: | Height: | Size: 878 B |
|
Before Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1 KiB |