Skip to content

Commit e0e16c3

Browse files
committed
remove game state sync (for now)
1 parent c4d873a commit e0e16c3

2 files changed

Lines changed: 543 additions & 540 deletions

File tree

static/assets/scripts/home.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ try {
8282
const games = [];
8383
const params = {
8484
TableName: 'games_list',
85-
ProjectionExpression: 'gameID, clicks, description, fName, tags, thumbPath',
85+
ProjectionExpression: 'gameID, clicks, description, fName, tags, thumbPath, uploadedTimestamp, updatedTimestamp',
8686
FilterExpression: 'isOnline = :o',
8787
ExpressionAttributeValues: {
8888
':o': true
@@ -215,7 +215,7 @@ try {
215215
incrementClicks(id);
216216
window.open(links[0].href, '_blank');
217217
});
218-
checkSeenGame(id, card);
218+
checkSeenGame(game, card);
219219
cardsCache.push(card);
220220
cardsContainer.appendChild(card);
221221
});
@@ -293,9 +293,9 @@ try {
293293
}
294294
const [chosenServer, index, path] = await testOpenServers();
295295
window.ccPorted.gameServer = {};
296-
window.ccPorted.gameServer.server = chosenServer;
296+
window.ccPorted.gameServer.server = chosenServer.trim();
297297
window.ccPorted.gameServer.index = index;
298-
window.ccPorted.gameServer.path = path
298+
window.ccPorted.gameServer.path = path.trim();
299299
const gamesJson = await importGames();
300300
setTimeout(() => {
301301
baseRender(gamesJson);
@@ -321,7 +321,7 @@ try {
321321
incrementClicks(id);
322322
window.open(links[0].href, '_blank');
323323
});
324-
checkSeenGame(id, card);
324+
checkSeenGame(game, card);
325325
cardsCache.push(card);
326326
cardsContainer.appendChild(card);
327327
});
@@ -510,10 +510,14 @@ try {
510510
searchInput.focus();
511511
}
512512
function checkSeenGame(game, card) {
513+
console.log(`Checking seen game`, game);
513514
const uploaded = game.uploadedTimestamp;
514515
const updated = game.updatedTimestamp;
515516
const now = Date.now();
516517
const threshold = 1000 * 60 * 60 * 24 * 2; // 2 days
518+
if(uploaded || updated){
519+
console.log(`Uploaded: ${uploaded}, Updated: ${updated}, Now: ${now}`);
520+
}
517521
if (uploaded && updated) {
518522
if (now - uploaded < threshold) {
519523
card.classList.add("new");

0 commit comments

Comments
 (0)