Skip to content

Commit 177141a

Browse files
committed
[blunder] [bad] [never-do] Hardcode and replace http://localhost:3000 with https://api.flux.codegasms.com
1 parent e8cfa7d commit 177141a

File tree

14 files changed

+242
-353
lines changed

14 files changed

+242
-353
lines changed

client/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ npm run fmt # format your code
1919

2020
## Routing
2121

22-
(Assuming your app is running on [localhost:3000](http://localhost:3000))
22+
(Assuming your app is running on [localhost:3000](https://api.flux.codegasms.com))
2323

2424
- `views`: all the `/pages` of our app live here
2525
- `views/index.ejs` is available at `localhost:3000/`

client/docs/examples/razorpay.html

Lines changed: 90 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -1,104 +1,100 @@
11
<!doctype html>
22
<html lang="en">
3-
<head>
4-
<meta charset="UTF-8" />
5-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
6-
<title>Document</title>
7-
</head>
8-
<script src="https://cdn.tailwindcss.com"></script>
93

10-
<body>
11-
<div class="m-12">
12-
<button
13-
id="createOrder"
14-
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded"
15-
>
16-
Create Order
17-
</button>
18-
<button
19-
id="rzp-button1"
20-
class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded hidden"
21-
>
22-
Pay with Razorpay
23-
</button>
24-
</div>
4+
<head>
5+
<meta charset="UTF-8" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Document</title>
8+
</head>
9+
<script src="https://cdn.tailwindcss.com"></script>
2510

26-
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
27-
<script>
28-
let data = null;
29-
document
30-
.getElementById('createOrder')
31-
.addEventListener('click', async function postData(e) {
32-
const baseUrl = 'http://localhost:3000/orders/create';
11+
<body>
12+
<div class="m-12">
13+
<button id="createOrder" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded">
14+
Create Order
15+
</button>
16+
<button id="rzp-button1" class="bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded hidden">
17+
Pay with Razorpay
18+
</button>
19+
</div>
3320

34-
try {
35-
const response = await fetch(baseUrl, {
36-
method: 'POST',
37-
headers: {
38-
accept: 'application/json',
39-
'Content-Type': 'application/json',
40-
},
41-
credentials: 'include',
42-
body: JSON.stringify({
43-
amount: 200,
44-
currency: 'INR',
45-
receipt: 'receipt-hello',
46-
}),
47-
});
21+
<script src="https://checkout.razorpay.com/v1/checkout.js"></script>
22+
<script>
23+
let data = null;
24+
document
25+
.getElementById('createOrder')
26+
.addEventListener('click', async function postData(e) {
27+
const baseUrl = 'https://api.flux.codegasms.com/orders/create';
28+
29+
try {
30+
const response = await fetch(baseUrl, {
31+
method: 'POST',
32+
headers: {
33+
accept: 'application/json',
34+
'Content-Type': 'application/json',
35+
},
36+
credentials: 'include',
37+
body: JSON.stringify({
38+
amount: 200,
39+
currency: 'INR',
40+
receipt: 'receipt-hello',
41+
}),
42+
});
43+
console.log(response.status);
44+
if (!response.ok) {
4845
console.log(response.status);
49-
if (!response.ok) {
50-
console.log(response.status);
51-
console.log(response.statusText);
52-
alert('Could not create order! Make sure setup is correct');
53-
} else {
54-
data = await response.json();
55-
console.log(data);
56-
console.log('end of flow');
57-
}
58-
// console.log(response.body);
59-
} catch (err) {
60-
console.log('error happened');
61-
console.log(err);
62-
if (err?.response) {
63-
console.log(await err.response.json());
64-
}
46+
console.log(response.statusText);
47+
alert('Could not create order! Make sure setup is correct');
48+
} else {
49+
data = await response.json();
50+
console.log(data);
51+
console.log('end of flow');
6552
}
66-
alert(
67-
`Order created: id: ${data.order.id}. Click on Pay with Razorpay`
68-
);
69-
if (data != null) {
70-
document.getElementById('rzp-button1').classList.remove('hidden');
71-
document.getElementById('createOrder').classList.add('hidden');
53+
// console.log(response.body);
54+
} catch (err) {
55+
console.log('error happened');
56+
console.log(err);
57+
if (err?.response) {
58+
console.log(await err.response.json());
7259
}
73-
var options = {
74-
key: data.key,
75-
amount: data.order.amount,
76-
// Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise
77-
currency: data.order.currency,
78-
name: 'Flux@Codegasms',
79-
description: 'Get your orgasms here!',
80-
image: 'https://i.ibb.co/ZJG2pG2/download-7.jpg',
81-
order_id: data.order.id,
82-
callback_url: `http://localhost:3000/${data.verifyUrl}?frontendBase=http://localhost:5501&successRedirect=/success&failureRedirect=/failure`,
60+
}
61+
alert(
62+
`Order created: id: ${data.order.id}. Click on Pay with Razorpay`
63+
);
64+
if (data != null) {
65+
document.getElementById('rzp-button1').classList.remove('hidden');
66+
document.getElementById('createOrder').classList.add('hidden');
67+
}
68+
var options = {
69+
key: data.key,
70+
amount: data.order.amount,
71+
// Amount is in currency subunits. Default currency is INR. Hence, 50000 refers to 50000 paise
72+
currency: data.order.currency,
73+
name: 'Flux@Codegasms',
74+
description: 'Get your orgasms here!',
75+
image: 'https://i.ibb.co/ZJG2pG2/download-7.jpg',
76+
order_id: data.order.id,
77+
callback_url: `https://api.flux.codegasms.com/${data.verifyUrl}?frontendBase=http://localhost:5501&successRedirect=/success&failureRedirect=/failure`,
8378

84-
notes: {
85-
'custom-data': 'data',
86-
},
87-
theme: {
88-
color: '#3399cc',
89-
},
90-
};
91-
if (data.prefill) {
92-
options['prefill'] = data.prefill;
93-
}
79+
notes: {
80+
'custom-data': 'data',
81+
},
82+
theme: {
83+
color: '#3399cc',
84+
},
85+
};
86+
if (data.prefill) {
87+
options['prefill'] = data.prefill;
88+
}
89+
90+
var rzp1 = new Razorpay(options);
91+
document.getElementById('rzp-button1').onclick = function(e) {
92+
rzp1.open();
93+
e.preventDefault();
94+
};
95+
});
96+
console.log(data);
97+
</script>
98+
</body>
9499

95-
var rzp1 = new Razorpay(options);
96-
document.getElementById('rzp-button1').onclick = function (e) {
97-
rzp1.open();
98-
e.preventDefault();
99-
};
100-
});
101-
console.log(data);
102-
</script>
103-
</body>
104-
</html>
100+
</html>

client/public/js/admin/admin.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
1-
const SERVER_URL = 'http://localhost:3000';
1+
const SERVER_URL = 'https://api.flux.codegasms.com';
22

33
async function fetchUsers() {
44
return fetch(`${SERVER_URL}/users`, {
5-
method: 'GET',
6-
credentials: 'include',
7-
headers: {
8-
accept: 'application/json',
9-
},
10-
})
5+
method: 'GET',
6+
credentials: 'include',
7+
headers: {
8+
accept: 'application/json',
9+
},
10+
})
1111
.then((res) => res.json())
12-
.then((users) => users
13-
.map((user, index) => {
12+
.then((users) =>
13+
users.map((user, index) => {
1414
return {
1515
index: index + 1,
1616
name: user.fullName,
1717
company: 'User',
1818
jobTitle: user.role,
19-
avatar: '/images/free-plan.png'
19+
avatar: '/images/free-plan.png',
2020
};
2121
})
2222
);

client/public/js/flux-mods/mods.js

Lines changed: 32 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
1-
const SERVER_URL = 'http://localhost:3000';
1+
const SERVER_URL = 'https://api.flux.codegasms.com';
22

33
const convertFileButtons = document.getElementsByClassName('convertFile');
44

55
for (var i = 0; i < convertFileButtons.length; i++) {
66
const convertFileButton = convertFileButtons[i];
77

88
convertFileButton.addEventListener('click', async (e) => {
9-
const filePath = document.querySelector(`#filePath-${convertFileButton.id}`).value;
9+
const filePath = document.querySelector(
10+
`#filePath-${convertFileButton.id}`
11+
).value;
1012
if (filePath === undefined) {
1113
console.log("User didn't enter a valid name");
1214
}
@@ -33,35 +35,40 @@ for (var i = 0; i < convertFileButtons.length; i++) {
3335
},
3436
body: JSON.stringify({
3537
spaceParent: spaceParent,
36-
fileName: fileName
37-
})
38+
fileName: fileName,
39+
}),
3840
})
39-
.then((res) => res.json())
40-
.then((data) => data._id);
41+
.then((res) => res.json())
42+
.then((data) => data._id);
4143

4244
const body = JSON.stringify({
43-
"fileId": fileId,
44-
"override": false,
45-
"modParams": {}
45+
fileId: fileId,
46+
override: false,
47+
modParams: {},
4648
});
4749

48-
const convertedFile = await fetch(`${SERVER_URL}/mods/apply/${convertFileButton.id}`, {
49-
method: 'POST',
50-
credentials: 'include',
51-
headers: {
52-
accept: 'application/json',
53-
'Content-Type': 'application/json',
54-
},
55-
body: body,
56-
})
57-
.then((res) => res.json())
58-
.then((data) => {
59-
console.log(data);
60-
return data;
61-
// return data;
62-
});
50+
const convertedFile = await fetch(
51+
`${SERVER_URL}/mods/apply/${convertFileButton.id}`,
52+
{
53+
method: 'POST',
54+
credentials: 'include',
55+
headers: {
56+
accept: 'application/json',
57+
'Content-Type': 'application/json',
58+
},
59+
body: body,
60+
}
61+
)
62+
.then((res) => res.json())
63+
.then((data) => {
64+
console.log(data);
65+
return data;
66+
// return data;
67+
});
6368

64-
alert(`Converted file ${convertedFile.spaceParent}${convertedFile.spaceParent === '/' ? '' : '/'}${convertedFile.fileName} saved in spaces!`);
69+
alert(
70+
`Converted file ${convertedFile.spaceParent}${convertedFile.spaceParent === '/' ? '' : '/'}${convertedFile.fileName} saved in spaces!`
71+
);
6572

6673
location.reload();
6774
});

client/public/js/flux-mods/pricing.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,12 @@
1-
const response = await fetch('http://localhost:3000/mods/token-plans', {
2-
method: 'GET',
3-
headers: {
4-
accept: 'application/json',
5-
},
6-
});
1+
const response = await fetch(
2+
'https://api.flux.codegasms.com/mods/token-plans',
3+
{
4+
method: 'GET',
5+
headers: {
6+
accept: 'application/json',
7+
},
8+
}
9+
);
710

811
const defaultPlans = [
912
{
@@ -184,7 +187,7 @@ window.onload = () => {
184187
const price = calculateDiscountedPrice(plan, currentType);
185188

186189
var data = null;
187-
const baseUrl = 'http://localhost:3000/billing/create';
190+
const baseUrl = 'https://api.flux.codegasms.com/billing/create';
188191

189192
try {
190193
const response = await fetch(baseUrl, {
@@ -229,7 +232,7 @@ window.onload = () => {
229232
description: 'Thank You For Ordering!',
230233
image: 'https://i.ibb.co/ZJG2pG2/download-7.jpg',
231234
order_id: data.order.id,
232-
callback_url: `http://localhost:3000/${data.verifyUrl}?frontendBase=http://localhost:8000&successRedirect=/mods/success&failureRedirect=/mods/failure`,
235+
callback_url: `https://api.flux.codegasms.com/${data.verifyUrl}?frontendBase=http://localhost:8000&successRedirect=/mods/success&failureRedirect=/mods/failure`,
233236

234237
notes: {
235238
'custom-data': 'data',

client/public/js/space/pricing.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const response = await fetch('http://localhost:3000/spaces/quotas', {
1+
const response = await fetch('https://api.flux.codegasms.com/spaces/quotas', {
22
method: 'GET',
33
headers: {
44
accept: 'application/json',
@@ -182,7 +182,7 @@ window.onload = () => {
182182
const price = calculateDiscountedPrice(plan, currentType);
183183

184184
var data = null;
185-
const baseUrl = 'http://localhost:3000/billing/create';
185+
const baseUrl = 'https://api.flux.codegasms.com/billing/create';
186186

187187
try {
188188
const response = await fetch(baseUrl, {
@@ -227,7 +227,7 @@ window.onload = () => {
227227
description: 'Thank You For Ordering!',
228228
image: 'https://i.ibb.co/ZJG2pG2/download-7.jpg',
229229
order_id: data.order.id,
230-
callback_url: `http://localhost:3000/${data.verifyUrl}?frontendBase=http://localhost:8000&successRedirect=/space/success&failureRedirect=/space/failure`,
230+
callback_url: `https://api.flux.codegasms.com/${data.verifyUrl}?frontendBase=http://localhost:8000&successRedirect=/space/success&failureRedirect=/space/failure`,
231231

232232
notes: {
233233
'custom-data': 'data',

client/public/js/space/space.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
const SERVER_URL = 'http://localhost:3000';
1+
const SERVER_URL = 'https://api.flux.codegasms.com';
22

33
function rightClick(e) {
44
e.preventDefault();

0 commit comments

Comments
 (0)