This commit is contained in:
Expand-sys 2021-04-22 15:50:00 +10:00
parent ccb5318862
commit 16cf67cc23
3 changed files with 50 additions and 14 deletions

View file

@ -1,2 +1,24 @@
# ccashfrontend
# yeah so like i dont have to document shit and if you wanna fight meet me round back of maccas mmmkay
## shit i have to learn how to document shit but to make things interesting no backspeace
oh okay its still going to boorin be boring as fuck its just going to be more annoying without backspaece
## USeing the fuckier
so to start using this beiutiful perice of shit you are going to need to do some things these thisgns inclugde heading over
to twixie boyis [Github](https://github.com/EntireTwix/CCash) and setting up the api for yourself follow his documentation he it will eb easier to foollow than this mess
thatbeing said goodluck.
from heere is will assume you have set up the api server
if deploying to a serverless application make sure you se t the environmental variables forst. these are as follwos
* BANKAPIURL=<your api url including http/s and the trailing slash NOT BANKF>
* SECURE=<true if you have ssl on your front end host>
* PORT=<put the port in here>
* SETUP=<true when you have set the above this just gets rid of the setup page that will show if it equals false or the .env file is not fojound>
if you are deploying on a vps then
1. git clone repository
1. run npm install
1. run with your favourite node webserver if you dont know any use [pm2](https://pm2.keymetrics.io/)
1. go through set up at localhost:<port number you set earlier>
1. restart the application and badda bim badda boom you done

View file

@ -151,22 +151,27 @@ app.get('/BankF', ensureAuthenticated, async function(req, res){
}
logsent = logsent.body.value
if(logsent == 1){
if(logsent == 1 || logsent == -1){
logsent = undefined
}else if (logsent == -1){
logsent = undefined
} else{
}else{
logsent = logsent.filter(({ from }) => from === req.session.user)
}
logrec = logrec.body.value
if(logrec == 1){
logrec = undefined
}else if (logrec == -1){
if(logrec == 1 || logrec == -1){
logrec = undefined
} else{
logrec = logrec.filter(({ to }) => to === req.session.user)
}
for( i in logrec){
logrec[i].time = Date(logrec[i].time)
console.log(logrec[i].time)
}
for( i in logsent){
logsent[i].time = Date(logsent[i].time)
console.log(logsent[i].time)
}
res.render('bankf',{
date: Date(1394104654000),
logrec:logrec,
logsent:logsent,
user: req.session.user,
@ -206,7 +211,7 @@ app.post('/sendfunds', async function(req, res){
res.redirect('/BankF')
} else {
errors.push({msg: "Transfer Unsuccessful"})
let logsent
let logrec
try{
@ -239,16 +244,24 @@ app.post('/sendfunds', async function(req, res){
logsent = logsent.filter(({ from }) => from === req.session.user)
}
logrec = logrec.body.value
if(logrec == 1){
logrec = undefined
}else if (logrec == -1){
if(logrec == 1 || logrec == -1){
logrec = undefined
} else{
logrec = logrec.filter(({ to }) => to === req.session.user)
}
for( i in logrec){
let d = new Date(logrec[i].time)
logrec[i].time = d
console.log(logrec[i].time)
}
for( i in logsent){
let d = new Date(logsent[i].time)
logsent[i].time = d
console.log(logsent[i].time)
}
res.render("bankf",{
logsent:logsent,
logrec:logrec,
errors:errors,

View file

@ -2,6 +2,7 @@ extends layout
block content
p #{date}
.container
h1 Welcome to the bank interface #{user}
.card.shadow-lg
@ -44,7 +45,7 @@ block content
if logsent
each log in logsent
hr
p Date: #{log.date}
p Date: #{log.time}
p You sent #{log.to} $#{log.amount}
hr
#received.tab-pane(role='tabpanel', aria-labelledby='contact-tab')