fix url pathing

This commit is contained in:
Expand-sys 2021-10-21 13:35:59 +11:00
parent c7783f508c
commit 9d42cd2770
3 changed files with 15 additions and 15 deletions

View file

@ -46,7 +46,7 @@ fastify.register(require("point-of-view"), {
}); });
const api = `${process.env.BANKAPIURL}`; const api = `${process.env.BANKAPIURL}`;
console.log(api);
function papy() { function papy() {
const rndInt = Math.floor(Math.random() * 1337); const rndInt = Math.floor(Math.random() * 1337);
let random = false; let random = false;
@ -134,7 +134,7 @@ fastify.get(
const user = req.session.get("user"); const user = req.session.get("user");
const password = req.session.get("password"); const password = req.session.get("password");
const auth = req.session.get("b64"); const auth = req.session.get("b64");
balance = await got(`${api}/user/balance`, { balance = await got(`${api}user/balance`, {
headers: { headers: {
Authorization: auth, Authorization: auth,
Accept: "application/json", Accept: "application/json",
@ -147,7 +147,7 @@ fastify.get(
console.log(balance); console.log(balance);
console.log("start " + Date.now()); console.log("start " + Date.now());
let logsent = await got(`${api}/user/log`, { let logsent = await got(`${api}user/log`, {
headers: { headers: {
Authorization: auth, Authorization: auth,
Accept: "application/json", Accept: "application/json",
@ -239,7 +239,7 @@ fastify.post(
let result; let result;
let auth = req.session.get("b64"); let auth = req.session.get("b64");
try { try {
result = await got.post(`${api}/user/transfer`, { result = await got.post(`${api}user/transfer`, {
headers: { headers: {
Authorization: auth, Authorization: auth,
Accept: "application/json", Accept: "application/json",
@ -277,7 +277,7 @@ fastify.post("/register", async function (req, res) {
//let checkuser = await client.addUser(name, password); //let checkuser = await client.addUser(name, password);
try { try {
let checkuser = await got.post(`${api}/user/register`, { let checkuser = await got.post(`${api}user/register`, {
headers: { headers: {
Accept: "application/json", Accept: "application/json",
}, },
@ -309,7 +309,7 @@ fastify.post("/login", async function (req, res) {
auth = `Basic ${auth}`; auth = `Basic ${auth}`;
let adminTest; let adminTest;
try { try {
adminTest = await got.post(`${api}/admin/verify_account`, { adminTest = await got.post(`${api}admin/verify_account`, {
headers: { headers: {
Authorization: auth, Authorization: auth,
Accept: "application/json", Accept: "application/json",
@ -330,7 +330,7 @@ fastify.post("/login", async function (req, res) {
let verified; let verified;
//verified = await client.verifyPassword(name, password); //verified = await client.verifyPassword(name, password);
try { try {
verified = await got.post(`${api}/user/verify_password`, { verified = await got.post(`${api}user/verify_password`, {
headers: { headers: {
Authorization: auth, Authorization: auth,
Accept: "application/json", Accept: "application/json",

View file

@ -53,7 +53,7 @@ module.exports = function (fastify, opts, done) {
} }
let post; let post;
try { try {
post = await got.post(`${api}/admin/user/register`, { post = await got.post(`${api}admin/user/register`, {
headers: { headers: {
Authorization: req.session.get("b64"), Authorization: req.session.get("b64"),
Accept: "application/json", Accept: "application/json",
@ -88,7 +88,7 @@ module.exports = function (fastify, opts, done) {
req.session.set("errors", ""); req.session.set("errors", "");
let responsecode; let responsecode;
try { try {
balance = await got(`${api}/user/balance`, { balance = await got(`${api}user/balance`, {
headers: { headers: {
Authorization: req.session.get("b64"), Authorization: req.session.get("b64"),
Accept: "application/json", Accept: "application/json",
@ -125,7 +125,7 @@ module.exports = function (fastify, opts, done) {
req.session.successes = []; req.session.successes = [];
req.session.errors = []; req.session.errors = [];
try { try {
patch = await got.patch(`${api}/admin/set_balance`, { patch = await got.patch(`${api}admin/set_balance`, {
headers: { headers: {
Authorization: req.session.get("b64"), Authorization: req.session.get("b64"),
Accept: "application/json", Accept: "application/json",
@ -160,7 +160,7 @@ module.exports = function (fastify, opts, done) {
req.session.errors = []; req.session.errors = [];
try { try {
patch = await got.post(`${api}/admin/impact_balance`, { patch = await got.post(`${api}admin/impact_balance`, {
headers: { headers: {
Authorization: req.session.get("b64"), Authorization: req.session.get("b64"),
Accept: "application/json", Accept: "application/json",
@ -192,7 +192,7 @@ module.exports = function (fastify, opts, done) {
if (new_pass == password2) { if (new_pass == password2) {
try { try {
patch = await got.patch(`${api}/user/change_password`, { patch = await got.patch(`${api}user/change_password`, {
headers: { headers: {
Authorization: req.session.get("b64"), Authorization: req.session.get("b64"),
Accept: "application/json", Accept: "application/json",
@ -227,7 +227,7 @@ module.exports = function (fastify, opts, done) {
if (attempt != req.session.get("adminp")) if (attempt != req.session.get("adminp"))
try { try {
let deleteUser = await got.delete(`${api}/admin/user/delete`, { let deleteUser = await got.delete(`${api}admin/user/delete`, {
headers: { headers: {
Authorization: req.session.get("b64"), Authorization: req.session.get("b64"),
Accept: "application/json", Accept: "application/json",

View file

@ -64,7 +64,7 @@ module.exports = function (fastify, opts, done) {
res.redirect("/settings"); res.redirect("/settings");
} else { } else {
try { try {
patch = await got.patch(`${api}/user/change_password`, { patch = await got.patch(`${api}user/change_password`, {
headers: { headers: {
Authorization: auth, Authorization: auth,
Accept: "application/json", Accept: "application/json",
@ -116,7 +116,7 @@ module.exports = function (fastify, opts, done) {
let auth = btoa(`${name}:${password}`); let auth = btoa(`${name}:${password}`);
auth = `Basic ${auth}`; auth = `Basic ${auth}`;
try { try {
del = await got.delete(`${api}/user/delete`, { del = await got.delete(`${api}user/delete`, {
headers: { headers: {
Authorization: auth, Authorization: auth,
Accept: "application/json", Accept: "application/json",