From 16c5ee9c78098ae44d92b5ca26c006e3f56f5cf3 Mon Sep 17 00:00:00 2001 From: Seth Call Date: Tue, 1 Sep 2020 13:33:04 -0500 Subject: [PATCH] ftue changes --- ruby/lib/jam_ruby/connection_manager.rb | 84 ++++++++++--------- ruby/lib/jam_ruby/models/geo_ip_locations.rb | 8 +- ruby/lib/jam_ruby/models/jam_isp.rb | 2 + ruby/lib/jam_ruby/models/latency_tester.rb | 26 +++--- ruby/lib/jam_ruby/models/user.rb | 7 +- web/app/assets/javascripts/globals.js | 8 +- .../SessionStatsHover.js.jsx.coffee | 16 +--- .../javascripts/wizard/frame_buffers.js | 10 ++- .../wizard/gear/step_select_gear.js | 38 +++++---- .../client/wizard/framebuffers.scss | 1 + .../stylesheets/client/wizard/gearWizard.scss | 16 +++- .../clients/wizard/_framebuffers.html.slim | 4 +- web/config/application.rb | 2 +- .../lib/jam_websockets/router.rb | 1 + 14 files changed, 122 insertions(+), 101 deletions(-) diff --git a/ruby/lib/jam_ruby/connection_manager.rb b/ruby/lib/jam_ruby/connection_manager.rb index a540bab41..02b1d0845 100644 --- a/ruby/lib/jam_ruby/connection_manager.rb +++ b/ruby/lib/jam_ruby/connection_manager.rb @@ -60,35 +60,35 @@ module JamRuby if ip_address and !ip_address.eql?(conn.ip_address) # turn ip_address string into a number, then fetch the isp and block records and update location info - addr = JamIsp.ip_to_num(ip_address) + #addr = JamIsp.ip_to_num(ip_address) #puts("============= JamIsp.ip_to_num returns #{addr} for #{ip_address} =============") - isp = JamIsp.lookup(addr) + #isp = JamIsp.lookup(addr) #puts("============= JamIsp.lookup returns #{isp.inspect} for #{addr} =============") - if isp.nil? then - ispid = 0 - else - ispid = isp.coid - end + #if isp.nil? then + # ispid = 0 + #else + # ispid = isp.coid + #end - block = GeoIpBlocks.lookup(addr) + #block = GeoIpBlocks.lookup(addr) #puts("============= GeoIpBlocks.lookup returns #{block.inspect} for #{addr} =============") - if block.nil? then - locid = 0 - else - locid = block.locid - end + #if block.nil? then + # locid = 0 + #else + # locid = block.locid + #end - location = GeoIpLocations.find_by_locid(locid) - if location.nil? || isp.nil? || block.nil? - locidispid = nil - else - locidispid = locid*1000000+ispid - end + #location = GeoIpLocations.find_by_locid(locid) + #if location.nil? || isp.nil? || block.nil? + # locidispid = nil + #else + # locidispid = locid*1000000+ispid + #end conn.ip_address = ip_address - conn.addr = addr - conn.locidispid = locidispid + #conn.addr = addr + #conn.locidispid = locidispid conn.save!(validate: false) end @@ -186,32 +186,34 @@ SQL # turn ip_address string into a number, then fetch the isp and block records - addr = JamIsp.ip_to_num(ip_address) + addr = nil + #addr = JamIsp.ip_to_num(ip_address) #puts("============= JamIsp.ip_to_num returns #{addr} for #{ip_address} =============") - isp = JamIsp.lookup(addr) + #isp = JamIsp.lookup(addr) #puts("============= JamIsp.lookup returns #{isp.inspect} for #{addr} =============") - if isp.nil? then - ispid = 0 - else - ispid = isp.coid - end + #if isp.nil? then + # ispid = 0 + #else + # ispid = isp.coid + #end - block = GeoIpBlocks.lookup(addr) + #block = GeoIpBlocks.lookup(addr) #puts("============= GeoIpBlocks.lookup returns #{block.inspect} for #{addr} =============") - if block.nil? then - locid = 0 - else - locid = block.locid - end - - location = GeoIpLocations.find_by_locid(locid) - if location.nil? || isp.nil? || block.nil? - locidispid = nil - else - locidispid = locid*1000000+ispid - end + #if block.nil? then + # locid = 0 + #else + # locid = block.locid + #end + #location = GeoIpLocations.find_by_locid(locid) + #if location.nil? || isp.nil? || block.nil? + # locidispid = nil + #else + # locidispid = locid*1000000+ispid + #end + addr = IPAddr.new(ip_address).to_i + locidispid = nil lock_connections(conn) conn.exec("INSERT INTO connections (user_id, client_id, channel_id, ip_address, client_type, addr, locidispid, aasm_state, stale_time, expire_time, udp_reachable, gateway, is_jamblaster) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13)", diff --git a/ruby/lib/jam_ruby/models/geo_ip_locations.rb b/ruby/lib/jam_ruby/models/geo_ip_locations.rb index 052c0b213..78c08ba1f 100644 --- a/ruby/lib/jam_ruby/models/geo_ip_locations.rb +++ b/ruby/lib/jam_ruby/models/geo_ip_locations.rb @@ -45,10 +45,10 @@ module JamRuby end end - isp = JamIsp.lookup(addr) - if isp - ispid = isp.coid - end + #isp = JamIsp.lookup(addr) + #if isp + # ispid = isp.coid + #end end {city: city, state: state, country: country, addr: addr, locidispid: (locid.nil? || ispid.nil?) ? nil : Score.compute_locidispid(locid, ispid) } diff --git a/ruby/lib/jam_ruby/models/jam_isp.rb b/ruby/lib/jam_ruby/models/jam_isp.rb index 2d6e60031..ceed7dc71 100644 --- a/ruby/lib/jam_ruby/models/jam_isp.rb +++ b/ruby/lib/jam_ruby/models/jam_isp.rb @@ -1,4 +1,5 @@ require 'ipaddr' +=begin module JamRuby class JamIsp < ActiveRecord::Base @@ -219,3 +220,4 @@ module JamRuby end end end +=end diff --git a/ruby/lib/jam_ruby/models/latency_tester.rb b/ruby/lib/jam_ruby/models/latency_tester.rb index 34dbec3ad..39803063a 100644 --- a/ruby/lib/jam_ruby/models/latency_tester.rb +++ b/ruby/lib/jam_ruby/models/latency_tester.rb @@ -49,21 +49,21 @@ module JamRuby if ip_address and !ip_address.eql?(connection.ip_address) # locidispid stuff - addr = JamIsp.ip_to_num(ip_address) - isp = JamIsp.lookup(addr) - if isp.nil? then ispid = 0 else ispid = isp.coid end - block = GeoIpBlocks.lookup(addr) - if block.nil? then locid = 0 else locid = block.locid end - location = GeoIpLocations.find_by_locid(locid) - if location.nil? || isp.nil? || block.nil? - locidispid = nil - else - locidispid = locid*1000000+ispid - end + #addr = JamIsp.ip_to_num(ip_address) + #isp = JamIsp.lookup(addr) + #if isp.nil? then ispid = 0 else ispid = isp.coid end + #block = GeoIpBlocks.lookup(addr) + #if block.nil? then locid = 0 else locid = block.locid end + #location = GeoIpLocations.find_by_locid(locid) + #if location.nil? || isp.nil? || block.nil? + # locidispid = nil + #else + # locidispid = locid*1000000+ispid + #end connection.ip_address = ip_address - connection.addr = addr - connection.locidispid = locidispid + #connection.addr = addr + #connection.locidispid = locidispid end connection.client_type = 'latency_tester' diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index e76563b35..99bc0aa4b 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -4,7 +4,7 @@ include Devise::Models module JamRuby class User < ActiveRecord::Base - include Geokit::ActsAsMappable::Glue unless defined?(acts_as_mappable) + #include Geokit::ActsAsMappable::Glue unless defined?(acts_as_mappable) include HtmlSanitize #include ::AutoStripAttributes html_sanitize strict: [:first_name, :last_name, :city, :state, :country, :biography] @@ -68,7 +68,7 @@ module JamRuby devise :database_authenticatable, :recoverable, :rememberable - acts_as_mappable + #acts_as_mappable after_save :update_teacher_pct @@ -1833,7 +1833,8 @@ module JamRuby # gets the GeoIpLocation for the user's last_jam_locidispid (where are they REALLY, vs profile info) def geoiplocation - GeoIpLocations.find_by_locid(last_jam_locidispid / 1000000) if last_jam_locidispid + return nil + #GeoIpLocations.find_by_locid(last_jam_locidispid / 1000000) if last_jam_locidispid end def update_last_jam(remote_ip, reason) diff --git a/web/app/assets/javascripts/globals.js b/web/app/assets/javascripts/globals.js index 922953b86..ca8a0765d 100644 --- a/web/app/assets/javascripts/globals.js +++ b/web/app/assets/javascripts/globals.js @@ -317,14 +317,14 @@ display: 'MacOSX Built-In', shortName: 'Built-In', videoURL: "https://www.youtube.com/watch?v=7-9PW50ygHk", - showKnobs: false, + showKnobs: true, showASIO: false }, MacOSX_interface: { display: 'MacOSX external interface', shortName: 'External', videoURL: "https://www.youtube.com/watch?v=7BLld6ogm14", - showKnobs: false, + showKnobs: true, showASIO: false }, Win32_wdm: { @@ -338,14 +338,14 @@ display: 'Windows ASIO', shortName : 'ASIO', videoURL: "https://www.youtube.com/watch?v=PGUmISTVVMY", - showKnobs: false, + showKnobs: true, showASIO: true }, Win32_asio4all: { display: 'Windows ASIO4ALL', shortName : 'ASIO4ALL', videoURL: "https://www.youtube.com/watch?v=PGUmISTVVMY", - showKnobs: false, + showKnobs: true, showASIO: true }, Linux: { diff --git a/web/app/assets/javascripts/react-components/SessionStatsHover.js.jsx.coffee b/web/app/assets/javascripts/react-components/SessionStatsHover.js.jsx.coffee index 030cd816d..14966c736 100644 --- a/web/app/assets/javascripts/react-components/SessionStatsHover.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/SessionStatsHover.js.jsx.coffee @@ -177,21 +177,7 @@ StatsInfo = { audio_type = 'JamBlaster' audioStats.push(@stat(audio, 'audio', 'Gear Driver', 'audio_in_type', audio_type)) if audio.framesize? - framesize = '?' - if audio.framesize == 1.0 - framesize = '1 ms' - else if audio.framesize == 2.0 - framesize = '1 ms' - else if audio.framesize == 2.5 - framesize = '2.5 ms' - else if audio.framesize == 5 - framesize = '5 ms' - else if audio.framesize == 10 - framesize = '10 ms' - else if audio.framesize == 20 - framesize = '20 ms' - else if audio.framesize == 40 - framesize = '40 ms' + framesize = audio.framesize + ' ms' audioStats.push(@stat(audio, 'audio', 'Frame Size', 'framesize', framesize)) networkTag = null diff --git a/web/app/assets/javascripts/wizard/frame_buffers.js b/web/app/assets/javascripts/wizard/frame_buffers.js index ed16d43bc..57466b16c 100644 --- a/web/app/assets/javascripts/wizard/frame_buffers.js +++ b/web/app/assets/javascripts/wizard/frame_buffers.js @@ -19,7 +19,9 @@ var ADJUST_GEAR_LINK_CLICKED = 'frame_buffers.adjust_gear_settings_clicked'; function selectedFramesize() { - return parseFloat($frameSize.val()); + var selectedFrameSize = parseFloat($frameSize.val()); + console.log("selected FrameSize: ", selectedFrameSize) + return selectedFrameSize; } function selectedBufferIn() { @@ -67,6 +69,7 @@ } function switchToWdm() { + /** if($frameSize.find('option').length == 3){ console.log("switching to WDM framesizez") $frameSize.html('') @@ -74,11 +77,12 @@ } else { console.log("nothing to switch to on WDM") - } + }*/ } function switchOffWdm() { + /** if($frameSize.find('option').length != 3){ console.log("switching off of WDM") $frameSize.html('') @@ -86,7 +90,7 @@ } else { console.log("nothing to clean up on WDM") - } + }*/ } diff --git a/web/app/assets/javascripts/wizard/gear/step_select_gear.js b/web/app/assets/javascripts/wizard/gear/step_select_gear.js index 5cc6b0439..e3e7b4e44 100644 --- a/web/app/assets/javascripts/wizard/gear/step_select_gear.js +++ b/web/app/assets/javascripts/wizard/gear/step_select_gear.js @@ -547,29 +547,46 @@ function onSampleRateChanged() { console.log("onSampleRateChanged: ", sampleRate.selectedSampleRate()) - context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); + //context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); jamClient.FTUESetPreferredMixerSampleRate(sampleRate.selectedSampleRate()); jamClient.FTUESetPreferredOutputSampleRate(sampleRate.selectedSampleRate()); invalidateScore(); + safeAtttemptScore(); } function onFramesizeChanged() { - context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); + //context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); updateDefaultBuffers(); jamClient.FTUESetFrameSize(frameBuffers.selectedFramesize()); invalidateScore(); + safeAtttemptScore(); } function onBufferInChanged() { - context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); + //context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); jamClient.FTUESetInputLatency(frameBuffers.selectedBufferIn()); invalidateScore(); + safeAtttemptScore() } function onBufferOutChanged() { - context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); + //context.JK.prodBubble($resyncBtn, 'push-resync-when-done', {}, {positions:['top']}); jamClient.FTUESetOutputLatency(frameBuffers.selectedBufferOut()); invalidateScore(); + safeAtttemptScore() + } + + function safeAtttemptScore() { + scheduleRescanSystem(function() { + if (getSelectedInputs().length > 0 && getSelectedOutputs().length == 2) { + logger.debug("after rescan, ready to attempt score") + attemptScore(); + } + else { + logger.debug("after rescan, not ready to attempt score") + } + }, 500, false); + return false; } function getSelectedInputs() { @@ -583,21 +600,12 @@ function initializeResync() { $resyncBtn.unbind('click').click(function () { - if($highLatencyNotice) { + if ($highLatencyNotice) { $highLatencyNotice.btOff() $highLatencyNotice = null; } - scheduleRescanSystem(function() { - if (getSelectedInputs().length > 0 && getSelectedOutputs().length == 2) { - logger.debug("after rescan, ready to attempt score") - attemptScore(); - } - else { - logger.debug("after rescan, not ready to attempt score") - } - }, 3000, false); - return false; + safeAtttemptScore() }) } diff --git a/web/app/assets/stylesheets/client/wizard/framebuffers.scss b/web/app/assets/stylesheets/client/wizard/framebuffers.scss index abc010194..26b700dcf 100644 --- a/web/app/assets/stylesheets/client/wizard/framebuffers.scss +++ b/web/app/assets/stylesheets/client/wizard/framebuffers.scss @@ -22,6 +22,7 @@ .buffers { float:left; width:60%; + display:none; h2 { margin-left:5px; diff --git a/web/app/assets/stylesheets/client/wizard/gearWizard.scss b/web/app/assets/stylesheets/client/wizard/gearWizard.scss index b84fb7f5c..facf73890 100644 --- a/web/app/assets/stylesheets/client/wizard/gearWizard.scss +++ b/web/app/assets/stylesheets/client/wizard/gearWizard.scss @@ -177,6 +177,20 @@ .frame-and-buffers { display: none; margin-top: 5px; + + .framesize { + float:none; + width:auto; + margin-right:0; + + .dropdown-wrapper.easydropdown-wrapper { + width:73px; + } + } + .framesize h2 { + display:inline; + margin-right:15px; + } } .audio-port { @@ -723,7 +737,7 @@ } .easydropdown-wrapper { width:auto; - float:left; + } } diff --git a/web/app/views/clients/wizard/_framebuffers.html.slim b/web/app/views/clients/wizard/_framebuffers.html.slim index e275b9d9d..cee29bbe8 100644 --- a/web/app/views/clients/wizard/_framebuffers.html.slim +++ b/web/app/views/clients/wizard/_framebuffers.html.slim @@ -1,7 +1,9 @@ .frame-and-buffers .framesize - h2 Frame + h2 Frame Size: select.select-frame-size + option val='1' 1 + option val='2' 2 option val='2.5' 2.5 option val='5' 5 option val='10' 10 diff --git a/web/config/application.rb b/web/config/application.rb index 69adb31bc..89460a423 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -306,7 +306,7 @@ if defined?(Bundler) config.middleware.insert_before "ActionDispatch::Cookies", "Middlewares::ClearDuplicatedSession" config.network_test_required = false # how long should the frontend wait for the IO to stabilize before asking for a IO score? - config.ftue_io_wait_time = 10 + config.ftue_io_wait_time = 5 # what should the threshold be for us to say, 'this person can't play at this rate' during the network test config.ftue_packet_rate_treshold = 0.95 # how long to test at each network test step diff --git a/websocket-gateway/lib/jam_websockets/router.rb b/websocket-gateway/lib/jam_websockets/router.rb index fd39e628d..3404e67fc 100644 --- a/websocket-gateway/lib/jam_websockets/router.rb +++ b/websocket-gateway/lib/jam_websockets/router.rb @@ -63,6 +63,7 @@ module JamWebsockets @maximum_minutely_heartbeat_rate_client = nil @gateway_name = nil @stored_ars = nil + @stored_ars_beta = nil @ar_base_logger = ::Logging::Repository.instance[ActiveRecord::Base] @message_stats = {} @time_it_sums = {}