Skip to content

Commit b6f9db6

Browse files
committed
2 parents 32249e6 + 6f7e20d commit b6f9db6

15 files changed

+44
-45
lines changed

_config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ description: "Stock AI Game"
33
owner_name: CSA-AI
44
github_username: CSA-AI
55
github_repo: "AI_Frontend_Mort"
6-
baseurl: "/CSA_AI_Frontend"
6+
baseurl: ""
77
future: true
88
remote_theme: jekyll/minima
99
minima:

_layouts/loggedin.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ <h2 class="font-bold text-xl"><span id="profileName">UserName</span></h2>
176176
document.getElementById('pic').innerHTML = `<img id="profilePic" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTPjKATmnhrK5tAwwubWT4StUWrCzms3kOx0eYfXtHqLg&s">`;
177177
}
178178

179-
const setURL = "http://csa-ai.stu.nighthawkcodingsociety.com/api/person/updateStocks";
179+
const setURL = "http://localhost:8017/api/person/updateStocks";
180180

181181
const fileInput = document.getElementById('file-input');
182182
const errorMessage = document.getElementById('errorMessage');
@@ -270,7 +270,7 @@ <h2 class="font-bold text-xl"><span id="profileName">UserName</span></h2>
270270
const profileNameSpan = document.getElementById("profileName");
271271
const profileEmailSpan = document.getElementById("profileEmail");
272272

273-
fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/" + userId, {
273+
fetch("http://localhost:8017/api/person/" + userId, {
274274
method: 'GET',
275275
headers: {
276276
'Content-Type': 'application/json',
@@ -318,11 +318,11 @@ <h2 class="font-bold text-xl"><span id="profileName">UserName</span></h2>
318318
redirect: "follow"
319319
};
320320

321-
fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/image/post", requestOptions)
321+
fetch("http://localhost:8017/api/person/image/post", requestOptions)
322322
.then((response) => response.text())
323323
.then((result) => console.log(result))
324324
.then((blob) => {
325-
document.getElementById('pic').innerHTML = `<img id="profilePic" src="http://csa-ai.stu.nighthawkcodingsociety.com/api/person/image/${userEmail}" onerror="handleImageError()"/>`;
325+
document.getElementById('pic').innerHTML = `<img id="profilePic" src="http://localhost:8017/api/person/image/${userEmail}" onerror="handleImageError()"/>`;
326326
}
327327

328328
)
@@ -347,7 +347,7 @@ <h2 class="font-bold text-xl"><span id="profileName">UserName</span></h2>
347347
const userEmail = decodedToken.sub;
348348
const profilePicElement = document.getElementById('profilePic');
349349
const defaultPicUrl = "https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTPjKATmnhrK5tAwwubWT4StUWrCzms3kOx0eYfXtHqLg&s";
350-
const profilePicUrl = `http://csa-ai.stu.nighthawkcodingsociety.com/api/person/image/${userEmail}`;
350+
const profilePicUrl = `http://localhost:8017/api/person/image/${userEmail}`;
351351

352352
isValidImageURL(profilePicUrl).then(isValid => {
353353
if (isValid) {

pages/aslsignin.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@
227227
// Convert the cropped canvas to a data URL and send it
228228
const imageData = cropCanvas.toDataURL('image/png').replace(/^data:image\/\w+;base64,/, '');
229229

230-
fetch('https://csa-ai.stu.nighthawkcodingsociety.com/image', {
230+
fetch('http://localhost:8017/image', {
231231
method: 'POST',
232232
headers: { 'Content-Type': 'application/json' },
233233
body: JSON.stringify({ image: imageData }),

pages/dashboard.html

+4-4
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ <h2 class="text-2xl font-bold mb-4">Your Stocks</h2>
182182
redirect: "follow"
183183
};
184184

185-
fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/stock/tickers/" + email + "/" + classCode, requestOptions)
185+
fetch("http://localhost:8017/api/stock/tickers/" + email + "/" + classCode, requestOptions)
186186
.then((response) => response.json())
187187
.then((data) => {
188188
console.log(data)
@@ -231,7 +231,7 @@ <h2 class="text-2xl font-bold mb-4">Your Stocks</h2>
231231
redirect: "follow"
232232
};
233233

234-
fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/classCodes/" + email, requestOptions)
234+
fetch("http://localhost:8017/api/person/classCodes/" + email, requestOptions)
235235
.then((response) => response.json()) // Parse response as JSON
236236
.then((result) => {
237237
const dropdown = document.getElementById("dropdown");
@@ -266,7 +266,7 @@ <h2 class="text-2xl font-bold mb-4">Your Stocks</h2>
266266
redirect: "follow"
267267
};
268268

269-
fetch(`http://csa-ai.stu.nighthawkcodingsociety.com/api/person/class/${classCode}/${email}`, requestOptions)
269+
fetch(`http://localhost:8017/api/person/class/${classCode}/${email}`, requestOptions)
270270
.then((response) => response.json())
271271
.then((data) => {
272272
// Update game title
@@ -303,7 +303,7 @@ <h2 class="text-2xl font-bold mb-4">Your Stocks</h2>
303303
redirect: "follow"
304304
};
305305

306-
fetch(`http://csa-ai.stu.nighthawkcodingsociety.com/api/stock/accountValueChange/${classCode}/${email}?date=${date}`, requestOptions)
306+
fetch(`http://localhost:8017/api/stock/accountValueChange/${classCode}/${email}?date=${date}`, requestOptions)
307307
.then(response => response.json())
308308
.then(data => {
309309
const dailyChange = data.totalChange;

pages/framesignin.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@
125125
canvas.getContext('2d').drawImage(video, 0, 0, canvas.width, canvas.height);
126126
// Get base64 representation of the image data
127127
const imageData = canvas.toDataURL('image/png').replace(/^data:image\/\w+;base64,/, '');
128-
fetch('https://csa-ai.stu.nighthawkcodingsociety.com/image', {
128+
fetch('http://localhost:8017/image', {
129129
method: 'POST',
130130
headers: {
131131
'Content-Type': 'application/json',
@@ -139,7 +139,7 @@
139139
.catch(error => {
140140
console.error('error:', error);
141141
});
142-
fetch('https://csa-ai.stu.nighthawkcodingsociety.com/predictions')
142+
fetch('http://localhost:8017/predictions')
143143
.then(response => response.json())
144144
.then(data => {
145145
const recentPrediction = data[data.length - 1];

pages/games.html

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ <h3 class="font-bold text-lg">Enter Game Code</h3>
4949
const token = getCookie("token");
5050
const decodedToken = parseJwt(token);
5151
const email = decodedToken.sub;
52-
const endpoint = `http://csa-ai.stu.nighthawkcodingsociety.com/api/person/classCodes/${email}`;
52+
const endpoint = `http://localhost:8017/api/person/classCodes/${email}`;
5353

5454
fetch(endpoint)
5555
.then(response => response.json())
@@ -122,7 +122,7 @@ <h2 class="card-title text-xl font-semibold">${game.className}</h2>
122122
buyingPower: 100000.00
123123
};
124124

125-
fetch('http://csa-ai.stu.nighthawkcodingsociety.com/api/person/joinGame', {
125+
fetch('http://localhost:8017/api/person/joinGame', {
126126
method: 'POST',
127127
headers: {
128128
'Content-Type': 'application/json',

pages/graph_prediction.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
alphaCloses.reverse();
7878

7979
// Fetch LSTM prediction data
80-
const lstmResponse = await fetch(`http://csa-ai.stu.nighthawkcodingsociety.com/api/lstm/${symbol}`);
80+
const lstmResponse = await fetch(`http://localhost:8017/api/lstm/${symbol}`);
8181
const lstmData = await lstmResponse.json();
8282

8383
let lstmTimes = [];

pages/history.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ <h1 class="text-5xl font-bold text-info">Purchase History</h1>
141141
redirect: "follow"
142142
};
143143

144-
fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/stock/trades/" + email, requestOptions)
144+
fetch("http://localhost:8017/api/stock/trades/" + email, requestOptions)
145145
.then((response) => response.json())
146146
.then((data) => {
147147
populateTable(data);

pages/performance.html

+6-7
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ <h2 class="text-2xl font-bold mb-4">User Performance</h2>
5252
<table id="example" class="table-auto w-full">
5353
<thead>
5454
<tr>
55-
<th class="px-4 py-2 sorting">Rank</th>
56-
<th class="px-4 py-2 sorting" >Name</th>
57-
<th class="px-4 py-2 sorting" id="accountValue">Account value</th>
58-
<th class="px-4 py-2 sorting" id="accountGrowth">Account growth</th>
55+
<th class="px-4 py-2 sorting" onclick="">Rank</th>
56+
<th class="px-4 py-2 sorting">Name</th>
57+
<th class="px-4 py-2 sorting">Account value</th>
58+
<th class="px-4 py-2 sorting">Account growth</th>
5959
<th class="px-4 py-2 sorting">rating (higher or lower)</th>
6060
</tr>
6161
</thead>
@@ -73,7 +73,7 @@ <h2 class="text-2xl font-bold mb-4">User Performance</h2>
7373
const content = document.getElementById("tableContent");
7474

7575
// Fetch data from the API
76-
fetch('https://csa-ai.stu.nighthawkcodingsociety.com/api/performance/accountValue')
76+
fetch('http://localhost:8017/api/performance/accountValue')
7777
.then(response => response.json())
7878
.then(data => {
7979
data.forEach((user, index) => {
@@ -93,5 +93,4 @@ <h2 class="text-2xl font-bold mb-4">User Performance</h2>
9393
})
9494
.catch(error => console.error('Error fetching data:', error));
9595
});
96-
97-
</script>
96+
</script>

pages/profile.html

+8-8
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
<div class="text-center ml-20 lg:text-left">
5252
<div class="avatar" onclick="my_modal_1.showModal()">
5353
<div id = "pic" class="w-24 rounded-full shadow-2xl" >
54-
<!-- <img id="profilePic" src="http://csa-ai.stu.nighthawkcodingsociety.com/api/person/image/${userEmail}" onerror="handleImageError()"/> -->
54+
<!-- <img id="profilePic" src="http://localhost:8017/api/person/image/${userEmail}" onerror="handleImageError()"/> -->
5555
</div>
5656
</div>
5757
<dialog id="my_modal_1" class="modal">
@@ -120,14 +120,14 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
120120
const token1 = getCookie("token");
121121
const decodedToken = parseJwt(token1);
122122
const userEmail = decodedToken.sub;
123-
document.getElementById('pic').innerHTML = `<img id="profilePic" src="http://csa-ai.stu.nighthawkcodingsociety.com/api/person/image/${userEmail}" onerror="handleImageError()"/>`;
123+
document.getElementById('pic').innerHTML = `<img id="profilePic" src="http://localhost:8017/api/person/image/${userEmail}" onerror="handleImageError()"/>`;
124124
function handleImageError() {
125125
imgElement = document.getElementById('profilePic');
126126

127127
imgElement.style.display = 'none';
128128
document.getElementById('pic').innerHTML = `<img id="profilePic" src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTPjKATmnhrK5tAwwubWT4StUWrCzms3kOx0eYfXtHqLg&s">`; // Display an error message
129129
}
130-
var setURL = "http://csa-ai.stu.nighthawkcodingsociety.com/api/person/updateStocks"
130+
var setURL = "http://localhost:8017/api/person/updateStocks"
131131

132132
const fileInput = document.getElementById('file-input');
133133
const errorMessage = document.getElementById('errorMessage');
@@ -235,7 +235,7 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
235235
const userId = decodedToken.id;
236236
const profileEmailSpan = document.getElementById("profileEmail");
237237

238-
fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/" + userId, {
238+
fetch("http://localhost:8017/api/person/" + userId, {
239239
method: 'GET',
240240
headers: {
241241
'Content-Type': 'application/json',
@@ -337,7 +337,7 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
337337
redirect: "follow"
338338
};
339339

340-
fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/stats/" + userId, requestOptions)
340+
fetch("http://localhost:8017/api/person/stats/" + userId, requestOptions)
341341
.then(response => {
342342
if (!response.ok) {
343343
throw new Error('Network response was not ok');
@@ -390,11 +390,11 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
390390
redirect: "follow"
391391
};
392392

393-
fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/image/post", requestOptions)
393+
fetch("http://localhost:8017/api/person/image/post", requestOptions)
394394
.then((response) => response.text())
395395
.then((result) => console.log(result))
396396
.then((blob) => {
397-
document.getElementById('pic').innerHTML = `<img id="profilePic" src="http://csa-ai.stu.nighthawkcodingsociety.com/api/person/image/${userEmail}" onerror="handleImageError()"/>`;
397+
document.getElementById('pic').innerHTML = `<img id="profilePic" src="http://localhost:8017/api/person/image/${userEmail}" onerror="handleImageError()"/>`;
398398
}
399399

400400
)
@@ -413,7 +413,7 @@ <h2 class="text-2xl mb-4">Stock Predictions</h2>
413413
// redirect: "follow"
414414
// };
415415

416-
// fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/image/" + userEmail, requestOptions)
416+
// fetch("http://localhost:8017/api/person/image/" + userEmail, requestOptions)
417417
// .then((response) => response.blob()) // Fetch image as Blob
418418
// .then((blob) => {
419419
// const url = URL.createObjectURL(blob); // Create URL for Blob

pages/signin.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -129,8 +129,8 @@
129129
}
130130
}
131131

132-
const signup_url = 'https://csa-ai.stu.nighthawkcodingsociety.com/api/person/createPerson';
133-
const login_url = 'https://csa-ai.stu.nighthawkcodingsociety.com/api/person/authenticate';
132+
const signup_url = 'http://localhost:8017/api/person/createPerson';
133+
const login_url = 'http://localhost:8017/authenticate';
134134

135135
function showErrorMessage(message) {
136136
const errorAlert = document.getElementById("errorAlert");
@@ -184,7 +184,7 @@
184184
document.cookie = "token=" + data.token + "; path=/";
185185
console.log(data)
186186
if (data.status !== 401) {
187-
window.location.replace("{{ site.baseurl }}/pages/aslsignin.html");
187+
window.location.replace("{{ site.baseurl }}/pages/dashboard.html");
188188
} else {
189189
console.log("bad email and password");
190190
showErrorMessage("Invalid email or password");

pages/statslive-backup.html

+3-3
Original file line numberDiff line numberDiff line change
@@ -353,7 +353,7 @@ <h2>Volume: <span>${volume}</span></h2>
353353
};
354354

355355
// Return the fetch promise chain
356-
return fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/classCodes/" + email, requestOptions)
356+
return fetch("http://localhost:8017/api/person/classCodes/" + email, requestOptions)
357357
.then((response) => response.json()) // Parse response as JSON
358358
.then((result) => {
359359
const dropdown = document.getElementById("dropdown");
@@ -400,7 +400,7 @@ <h2>Volume: <span>${volume}</span></h2>
400400
redirect: "follow"
401401
};
402402

403-
fetch(`http://csa-ai.stu.nighthawkcodingsociety.com/api/person/class/${classCode}/${email}`, requestOptions)
403+
fetch(`http://localhost:8017/api/person/class/${classCode}/${email}`, requestOptions)
404404
.then((response) => response.json())
405405
.then((data) => {
406406
console.log(data);
@@ -464,7 +464,7 @@ <h2>Volume: <span>${volume}</span></h2>
464464
};
465465

466466
// Submit trade data
467-
const response = await fetch('http://csa-ai.stu.nighthawkcodingsociety.com/api/stock/trade', {
467+
const response = await fetch('http://localhost:8017/api/stock/trade', {
468468
method: 'POST',
469469
headers: {
470470
'Content-Type': 'application/json'

pages/statslive.html

+5-5
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ <h2>Volume: <span>${volume}</span></h2>
373373
};
374374

375375
// Return the fetch promise chain
376-
return fetch("http://csa-ai.stu.nighthawkcodingsociety.com/api/person/classCodes/" + email, requestOptions)
376+
return fetch("http://localhost:8017/api/person/classCodes/" + email, requestOptions)
377377
.then((response) => response.json()) // Parse response as JSON
378378
.then((result) => {
379379
const dropdown = document.getElementById("dropdown");
@@ -420,7 +420,7 @@ <h2>Volume: <span>${volume}</span></h2>
420420
redirect: "follow"
421421
};
422422

423-
fetch(`http://csa-ai.stu.nighthawkcodingsociety.com/api/person/class/${classCode}/${email}`, requestOptions)
423+
fetch(`http://localhost:8017/api/person/class/${classCode}/${email}`, requestOptions)
424424
.then((response) => response.json())
425425
.then((data) => {
426426
console.log(data);
@@ -485,7 +485,7 @@ <h2>Volume: <span>${volume}</span></h2>
485485
};
486486

487487
// Submit trade data
488-
const response = await fetch('http://csa-ai.stu.nighthawkcodingsociety.com/api/stock/trade', {
488+
const response = await fetch('http://localhost:8017/api/stock/trade', {
489489
method: 'POST',
490490
headers: {
491491
'Content-Type': 'application/json'
@@ -521,7 +521,7 @@ <h2>Volume: <span>${volume}</span></h2>
521521
}
522522

523523
async function adjustAccountValue(email, classCode, newValue) {
524-
const url = 'http://csa-ai.stu.nighthawkcodingsociety.com/api/person/adjustAccountValue';
524+
const url = 'http://localhost:8017/api/person/adjustAccountValue';
525525
const data = {
526526
email: email,
527527
classCode: classCode,
@@ -537,7 +537,7 @@ <h2>Volume: <span>${volume}</span></h2>
537537
}
538538

539539
async function adjustBuyingPower(email, classCode, newValue) {
540-
const url = 'http://csa-ai.stu.nighthawkcodingsociety.com/api/person/adjustBuyingPower';
540+
const url = 'http://localhost:8017/api/person/adjustBuyingPower';
541541
const data = {
542542
email: email,
543543
classCode: classCode,

pages/stattest.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,7 @@ <h3 class="font-bold text-lg">Enter Trade Info</h3>
289289

290290
function fetchLSTMData() {
291291
const symbol = document.getElementById("symbol").value || 'AAPL';
292-
const url = `http://csa-ai.stu.nighthawkcodingsociety.com/api/lstm/${symbol}`;
292+
const url = `http://localhost:8017/api/lstm/${symbol}`;
293293

294294
axios.get(url)
295295
.then(function (response) {

pages/stockkeys.html

+1-1
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ <h1 id="pageTitle" class="text-3xl">Stock Dashboard</h1>
107107
};
108108
document.getElementById('pageTitle').textContent = keyToTitle[key];
109109

110-
fetch(`http://localhost:8017/api/stockObject/${key}`)
110+
fetch(`https://csa-ai.stu.nighthawkcodingsociety.com/api/stockObject/${key}`)
111111
.then(response => {
112112
if (!response.ok) throw new Error(`Failed to fetch data: ${response.statusText}`);
113113
return response.json();

0 commit comments

Comments
 (0)