From fc9d69f5f956c2781bdf67494e1930f6474bf4d7 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Sat, 2 Sep 2023 15:23:22 -0500 Subject: [PATCH] Update to pass product from client back to ArtifactUpdate --- ruby/lib/jam_ruby/models/artifact_update.rb | 4 +-- web/app/assets/javascripts/JamServer.js | 1 + web/app/assets/javascripts/clientUpdate.js | 30 +++++++++---------- .../lib/jam_websockets/router.rb | 5 ++-- 4 files changed, 21 insertions(+), 19 deletions(-) diff --git a/ruby/lib/jam_ruby/models/artifact_update.rb b/ruby/lib/jam_ruby/models/artifact_update.rb index eb61b19e2..bf0d9d0a6 100644 --- a/ruby/lib/jam_ruby/models/artifact_update.rb +++ b/ruby/lib/jam_ruby/models/artifact_update.rb @@ -43,8 +43,8 @@ module JamRuby Notification.send_client_update(product, version, determine_url, size) end - def self.find_client_by_os(os, environment=DEFAULT_ENVIRONMENT) - ArtifactUpdate.find_by_product_and_environment("#{CLIENT_PREFIX_MODERN}/#{os}", environment) + def self.find_client_by_os(product, os, environment=DEFAULT_ENVIRONMENT) + ArtifactUpdate.find_by_product_and_environment("#{product}/#{os}", environment) end def determine_url diff --git a/web/app/assets/javascripts/JamServer.js b/web/app/assets/javascripts/JamServer.js index 12759d580..6830469a9 100644 --- a/web/app/assets/javascripts/JamServer.js +++ b/web/app/assets/javascripts/JamServer.js @@ -833,6 +833,7 @@ client_id: client_id, machine: machine, os: os, + product: 'JamClientModern', //jamblaster_serial_no: context.PlatformStore.jamblasterSerialNo(), udp_reachable: context.JK.StunInstance ? !context.JK.StunInstance.sync() diff --git a/web/app/assets/javascripts/clientUpdate.js b/web/app/assets/javascripts/clientUpdate.js index 83321688f..0fd4230c8 100644 --- a/web/app/assets/javascripts/clientUpdate.js +++ b/web/app/assets/javascripts/clientUpdate.js @@ -18,7 +18,7 @@ function cancelUpdate(e) { if ((e.ctrlKey || e.metaKey) && e.keyCode == 78) { - logger.debug("update canceled!"); + console.log("update canceled!"); app.layout.closeDialog('client-update'); app.clientUpdating = false; } @@ -82,7 +82,7 @@ /***************************************/ function clientUpdateDownloadProgress(bytesReceived, bytesTotal, downloadSpeedMegSec, timeRemaining) { // this fires way too many times to leave in. uncomment if debugging update feature - //logger.debug("bytesReceived: " + bytesReceived, ", bytesTotal: " + bytesTotal, ", downloadSpeed: " + downloadSpeedMegSec, ", timeRemaining: " + timeRemaining + ", updateSize: " + updateSize); + //console.log("bytesReceived: " + bytesReceived, ", bytesTotal: " + bytesTotal, ", downloadSpeed: " + downloadSpeedMegSec, ", timeRemaining: " + timeRemaining + ", updateSize: " + updateSize); bytesReceived = Number(bytesReceived) bytesTotal = Number(bytesTotal) @@ -93,7 +93,7 @@ } function clientUpdateDownloadSuccess(updateLocation) { - logger.debug("client update downloaded successfully to: " + updateLocation); + console.log("client update downloaded successfully to: " + updateLocation); updateClientUpdateDialog("update-proceeding"); @@ -117,7 +117,7 @@ userTimeToRead = 1000; // older clients didn't pass this in, and exit very quickly } - logger.debug("client update launching in: " + userTimeToRead); + console.log("client update launching in: " + userTimeToRead); // set timer to update countdown var rounded = Math.round(userTimeToRead / 1000); @@ -145,7 +145,7 @@ } function clientUpdateLaunchStatuses(statuses) { - logger.debug("client update launch statuses"); + console.log("client update launch statuses"); if (statuses) { for (var i = 0; i < statuses.length; i++) { @@ -155,7 +155,7 @@ } function clientUpdateLaunchStatusChange(done, status) { - logger.debug("client update launch status change. starting=" + done + ", status=" + status); + console.log("client update launch status change. starting=" + done + ", status=" + status); if (!done) { var $ellipses = $('.'); @@ -203,14 +203,14 @@ async function runCheck(product, version, uri, size, currentVersion) { if (app.clientUpdating) { - logger.debug("client is already updating; skipping") + console.log("client is already updating; skipping") return } - logger.debug("runCheck: product , version", product, version) + console.log("runCheck: product , version", product, version) // check kill switch before all other logic if (!gon.check_for_client_updates) { - logger.debug("runCheck: skipping client update because the server is telling us not to") + console.log("runCheck: skipping client update because the server is telling us not to") return; } @@ -218,7 +218,7 @@ currentVersion = await context.jamClient.ClientUpdateVersion() //.then(function(currentVersion){ if (!forceShow && (currentVersion == null || currentVersion.indexOf("Compiled")) > -1) { // this is a developer build; it doesn't make much sense to do an packaged update, so skip - logger.debug("skipping client update check because this is a development build ('" + currentVersion + "')") + console.log("skipping client update check because this is a development build ('" + currentVersion + "')") return; } @@ -239,7 +239,7 @@ updateSize = size; if(context.SessionStore.inSession()) { - logger.debug("deferring client update because in session") + console.log("deferring client update because in session") return; } @@ -266,7 +266,7 @@ // check kill switch before all other logic if (!gon.check_for_client_updates) { - logger.debug("skipping client update because the server is telling us not to") + console.log("skipping client update because the server is telling us not to") return; } @@ -276,7 +276,7 @@ if (!forceShow && (currentVersion == null || currentVersion.indexOf("Compiled")) > -1) { // this is a developer build; it doesn't make much sense to do an packaged update, so skip - logger.debug("skipping client update check because this is a development build ('" + currentVersion + "')") + console.log("skipping client update check because this is a development build ('" + currentVersion + "')") return; } @@ -300,7 +300,7 @@ } async function startDownload(url) { - logger.debug("starting client updater download from: " + url); + console.log("starting client updater download from: " + url); updateClientUpdateDialog("update-downloading") @@ -311,7 +311,7 @@ } async function startUpdate(updaterFilePath) { - logger.debug("starting client update from: " + updaterFilePath) + console.log("starting client update from: " + updaterFilePath) await context.jamClient.ClientUpdateStartUpdate(updaterFilePath, "JK.ClientUpdate.LaunchUpdateSuccessCallback", diff --git a/websocket-gateway/lib/jam_websockets/router.rb b/websocket-gateway/lib/jam_websockets/router.rb index 202301089..29c4bd322 100644 --- a/websocket-gateway/lib/jam_websockets/router.rb +++ b/websocket-gateway/lib/jam_websockets/router.rb @@ -792,6 +792,7 @@ module JamWebsockets client_type = options["client_type"] machine_fingerprint = options["machine"] os = options["os"] + product = options["product"].nil? ? JamRuby::ArtifactUpdate::CLIENT_PREFIX : options['product'] udp_reachable = options["udp_reachable"].nil? ? true : options["udp_reachable"] == 'true' jamblaster_serial_no = options["jamblaster_serial_no"] ipv4_link_local = options["ipv4_link_local"] @@ -1000,7 +1001,7 @@ module JamWebsockets puts "O/S = #{os}" puts "=========================" # if we have OS data, try to grab client update data and let the client have it - update = ArtifactUpdate.find_client_by_os(os) if client_type == Connection::TYPE_CLIENT && os + update = ArtifactUpdate.find_client_by_os(product, os) if client_type == Connection::TYPE_CLIENT && os client_update = update.update_data if update @@ -1050,7 +1051,7 @@ module JamWebsockets end end # if we have OS data, try to grab client update data and let the client have it - update = ArtifactUpdate.find_client_by_os(os) if client_type == Connection::TYPE_CLIENT && os + update = ArtifactUpdate.find_client_by_os(product, os) if client_type == Connection::TYPE_CLIENT && os client_update = update.update_data if update