diff --git a/app.yaml b/app.yaml index 98f616c..b55ef99 100644 --- a/app.yaml +++ b/app.yaml @@ -1,5 +1,19 @@ runtime: nodejs env: flex -entrypoint: npm run start:prod:linux -automatic_scaling: - max_instances: 1 +network: + session_affinity: true +liveness_check: + path: "/liveness_check" + check_interval_sec: 60 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 +readiness_check: + path: "/readiness_check" + check_interval_sec: 60 + timeout_sec: 4 + failure_threshold: 2 + success_threshold: 2 + app_start_timeout_sec: 600 +manual_scaling: + instances: 1 diff --git a/client/src/images/GitHub-Mark-Light-120px-plus.png b/client/src/images/GitHub-Mark-Light-120px-plus.png new file mode 100644 index 0000000..192846a Binary files /dev/null and b/client/src/images/GitHub-Mark-Light-120px-plus.png differ diff --git a/client/src/images/GitHub-Mark-Light-32px.png b/client/src/images/GitHub-Mark-Light-32px.png deleted file mode 100644 index 628da97..0000000 Binary files a/client/src/images/GitHub-Mark-Light-32px.png and /dev/null differ diff --git a/client/src/modules/DeckStateManager.js b/client/src/modules/DeckStateManager.js index 35ab21b..5b5415d 100644 --- a/client/src/modules/DeckStateManager.js +++ b/client/src/modules/DeckStateManager.js @@ -1,7 +1,7 @@ export class DeckStateManager { constructor() { this.deck = null; - this.customRoleOptions = null; + this.customRoleOptions = []; } addToDeck(role) { diff --git a/client/src/modules/GameCreationStepManager.js b/client/src/modules/GameCreationStepManager.js index 96345b0..a47a1a4 100644 --- a/client/src/modules/GameCreationStepManager.js +++ b/client/src/modules/GameCreationStepManager.js @@ -67,7 +67,6 @@ export class GameCreationStepManager { this.currentGame.hasTimer = false; this.currentGame.timerParams = null; } - console.log(this.currentGame); cancelCurrentToast(); this.removeStepElementsFromDOM(this.step); this.incrementStep(); @@ -102,6 +101,10 @@ export class GameCreationStepManager { ) { window.location = ('/game/' + res.content); } + }).catch((e) => { + if (e.status === 429) { + toast('You\'ve sent this request too many times.', 'error', true, true, 6); + } }); } } @@ -450,8 +453,9 @@ function initializeRemainingEventListeners(deckManager) { e.preventDefault(); let name = document.getElementById("role-name").value.trim(); let description = document.getElementById("role-description").value.trim(); + let team = document.getElementById("role-alignment").value.toLowerCase().trim(); if (!deckManager.getCustomRoleOption(name)) { // confirm there is no existing custom role with the same name - deckManager.addToCustomRoleOptions({role: name, description: description}); + deckManager.addToCustomRoleOptions({role: name, description: description, team: team}); updateCustomRoleOptionsList(deckManager, document.getElementById("deck-select")) ModalManager.dispelModal("add-role-modal", "add-role-modal-background"); toast("Role Added", "success", true); @@ -481,10 +485,10 @@ function addOptionsToList(options, selectEl) { }); for (let i = 0; i < options.length; i ++) { let optionEl = document.createElement("option"); - let alignmentClass = customCards[i].team === globals.ALIGNMENT.GOOD ? globals.ALIGNMENT.GOOD : globals.ALIGNMENT.EVIL + let alignmentClass = options[i].team === globals.ALIGNMENT.GOOD ? globals.ALIGNMENT.GOOD : globals.ALIGNMENT.EVIL optionEl.classList.add(alignmentClass); - optionEl.setAttribute("value", customCards[i].role); - optionEl.innerText = customCards[i].role; + optionEl.setAttribute("value", options[i].role); + optionEl.innerText = options[i].role; selectEl.appendChild(optionEl); } } diff --git a/client/src/modules/GameStateRenderer.js b/client/src/modules/GameStateRenderer.js index 5b59379..aabf69e 100644 --- a/client/src/modules/GameStateRenderer.js +++ b/client/src/modules/GameStateRenderer.js @@ -39,7 +39,9 @@ export class GameStateRenderer { title.innerText = "Lobby"; document.getElementById("game-title").appendChild(title); let gameLinkContainer = document.getElementById("game-link"); - gameLinkContainer.innerText = window.location; + let linkDiv = document.createElement("div"); + linkDiv.innerText = window.location; + gameLinkContainer.prepend(linkDiv); gameLinkContainer.addEventListener('click', () => { navigator.clipboard.writeText(gameLinkContainer.innerText).then(() => { toast('Link copied!', 'success', true); @@ -265,7 +267,6 @@ function renderPotentialMods(gameState, group, transferModHandlers, socket) { container.addEventListener('click', transferModHandlers[member.id]); modalContent.appendChild(container); - console.log('test'); } } } diff --git a/client/src/modules/GameTimerManager.js b/client/src/modules/GameTimerManager.js index ad34eba..4fe03f9 100644 --- a/client/src/modules/GameTimerManager.js +++ b/client/src/modules/GameTimerManager.js @@ -114,7 +114,6 @@ export class GameTimerManager { if(!socket.hasListeners(globals.COMMANDS.GET_TIME_REMAINING)) { socket.on(globals.COMMANDS.GET_TIME_REMAINING, (timeRemaining, paused) => { - console.log('received time remaining from server'); if (paused) { this.displayPausedTime(timeRemaining); } else if (timeRemaining === 0) { @@ -151,6 +150,16 @@ export class GameTimerManager { pauseBtn.addEventListener('click', this.pauseListener); document.getElementById('play-pause').appendChild(pauseBtn); } + + processTimeRemaining(timeRemaining, paused, timerWorker) { + if (paused) { + this.displayPausedTime(timeRemaining); + } else if (timeRemaining === 0) { + this.displayExpiredTime(); + } else { + this.resumeGameTimer(timeRemaining, globals.CLOCK_TICK_INTERVAL_MILLIS, null, timerWorker); + } + } } function returnHumanReadableTime(milliseconds, tenthsOfSeconds=false) { diff --git a/client/src/modules/StateBucket.js b/client/src/modules/StateBucket.js index 62c624a..7571fc2 100644 --- a/client/src/modules/StateBucket.js +++ b/client/src/modules/StateBucket.js @@ -1,5 +1,6 @@ /* It started getting confusing where I am reading/writing to the game state, and thus the state started to get inconsistent. Creating a bucket to hold it so I can overwrite the gameState object whilst still preserving a reference to the containing bucket. + Now several components can read a shared game state. */ export const stateBucket = { currentGameState: null, diff --git a/client/src/modules/Templates.js b/client/src/modules/Templates.js index ae6a5b3..7ef70cb 100644 --- a/client/src/modules/Templates.js +++ b/client/src/modules/Templates.js @@ -128,6 +128,9 @@ export const templates = { "" + "
" + "
" + "" + + "
" + + "
" + "" + "