diff --git a/pb/Gemfile.lock b/pb/Gemfile.lock index 2dc14c3cc..d84fd06f1 100644 --- a/pb/Gemfile.lock +++ b/pb/Gemfile.lock @@ -10,7 +10,7 @@ DEPENDENCIES ruby-protocol-buffers (= 1.2.2) RUBY VERSION - ruby 2.3.1p112 + ruby 2.4.1p111 BUNDLED WITH - 1.17.3 + 2.2.15 diff --git a/ruby/Gemfile b/ruby/Gemfile index 82e428488..0acea9c2e 100644 --- a/ruby/Gemfile +++ b/ruby/Gemfile @@ -9,13 +9,14 @@ ruby_version = "2.3.1" if ruby_version.nil? ruby ruby_version +# Look for $WORKSPACE, otherwise use "workspace" as dev path. devenv = ENV["BUILD_NUMBER"].nil? if devenv #gem 'jam_db', :path=> "../db/target/ruby_package" gem 'jampb', :path => "../pb/target/ruby/jampb" else #gem 'jam_db' - gem 'jampb' + gem 'jampb', "0.1.#{ENV["BUILD_NUMBER"]}" ENV['NOKOGIRI_USE_SYSTEM_LIBRARIES'] ||= "true" end diff --git a/ruby/Gemfile.lock b/ruby/Gemfile.lock index 1af07266c..7632c7aa6 100644 --- a/ruby/Gemfile.lock +++ b/ruby/Gemfile.lock @@ -559,7 +559,7 @@ DEPENDENCIES zip-codes RUBY VERSION - ruby 2.3.1p112 + ruby 2.4.1p111 BUNDLED WITH 1.17.3 diff --git a/ruby/db/migrate/20210329150012_add_use_video_conferencing_server_to_users.rb b/ruby/db/migrate/20210329150012_add_use_video_conferencing_server_to_users.rb new file mode 100644 index 000000000..212365138 --- /dev/null +++ b/ruby/db/migrate/20210329150012_add_use_video_conferencing_server_to_users.rb @@ -0,0 +1,9 @@ + class AddUseVideoConferencingServerToUsers < ActiveRecord::Migration + def self.up + execute("ALTER TABLE users ADD COLUMN use_video_conferencing_server BOOLEAN DEFAULT FALSE;") + end + + def self.down + execute("ALTER TABLE users DROP COLUMN use_video_conferencing_server;") + end + end diff --git a/ruby/db/migrate/20210330024748_create_temp_tokens.rb b/ruby/db/migrate/20210330024748_create_temp_tokens.rb new file mode 100644 index 000000000..5daeafd44 --- /dev/null +++ b/ruby/db/migrate/20210330024748_create_temp_tokens.rb @@ -0,0 +1,21 @@ + class CreateTempTokens < ActiveRecord::Migration + + def self.up + execute( <<-SQL + CREATE TABLE public.temp_tokens ( + id character varying(64) DEFAULT public.uuid_generate_v4() NOT NULL, + token character varying(64), + user_id VARCHAR(64) NOT NULL REFERENCES users(id) ON DELETE CASCADE, + purpose character varying(64) NOT NULL DEFAULT 'video_join_musician', + created_at timestamp without time zone DEFAULT now() NOT NULL, + expired_at timestamp without time zone); + SQL + ) + execute("CREATE INDEX index_temp_tokens_purpose ON public.temp_tokens USING btree (purpose);") + end + + def self.down + execute("DROP INDEX IF EXISTS index_temp_tokens_purpose") + execute("DROP TABLE public.temp_tokens") + end + end diff --git a/ruby/lib/jam_ruby.rb b/ruby/lib/jam_ruby.rb index e5a4c5a21..83da05d40 100755 --- a/ruby/lib/jam_ruby.rb +++ b/ruby/lib/jam_ruby.rb @@ -335,6 +335,7 @@ require "jam_ruby/models/campaign_spend" require "jam_ruby/models/mobile_recording" require "jam_ruby/app/uploaders/mobile_recording_uploader" require "jam_ruby/models/mobile_recording_upload" +require "jam_ruby/models/temp_token" include Jampb diff --git a/ruby/lib/jam_ruby/models/notification.rb b/ruby/lib/jam_ruby/models/notification.rb index d7e8b0568..66cbfbd46 100644 --- a/ruby/lib/jam_ruby/models/notification.rb +++ b/ruby/lib/jam_ruby/models/notification.rb @@ -1690,4 +1690,4 @@ module JamRuby description == 'TEXT_MESSAGE' end end -end \ No newline at end of file +end diff --git a/ruby/lib/jam_ruby/models/temp_token.rb b/ruby/lib/jam_ruby/models/temp_token.rb new file mode 100644 index 000000000..1154cffa7 --- /dev/null +++ b/ruby/lib/jam_ruby/models/temp_token.rb @@ -0,0 +1,18 @@ +module JamRuby + class TempToken < ActiveRecord::Base + + belongs_to :user + before_validation :generate_token, :set_expired_at, on: :create + validates :token, :expired_at, :purpose, presence: true + + private + + def generate_token + self.token = SecureRandom.hex(32) + end + + def set_expired_at + self.expired_at = Time.now + 5.minutes + end + end +end diff --git a/ruby/lib/jam_ruby/models/user.rb b/ruby/lib/jam_ruby/models/user.rb index 1c9e85d41..0b181e9e7 100644 --- a/ruby/lib/jam_ruby/models/user.rb +++ b/ruby/lib/jam_ruby/models/user.rb @@ -247,6 +247,7 @@ module JamRuby has_many :proposed_slots, class_name: 'JamRuby::LessonBookingSlot', inverse_of: :proposer, dependent: :destroy, foreign_key: :proposer_id has_many :charges, class_name: 'JamRuby::Charge', dependent: :destroy has_many :posa_cards, class_name: 'JamRuby::PosaCard', dependent: :destroy + has_many :temp_tokens, class_name: 'JamRuby::TempToken', dependent: :destroy before_save :default_anonymous_names before_save :create_remember_token, :if => :should_validate_password? diff --git a/ruby/spec/factories.rb b/ruby/spec/factories.rb index 05555308a..d085b6490 100644 --- a/ruby/spec/factories.rb +++ b/ruby/spec/factories.rb @@ -1170,5 +1170,10 @@ FactoryGirl.define do association :teacher, factory: :teacher_user association :test_drive_package_choice, factory: :test_drive_package_choice end + + factory :temp_token, class: "JamRuby::TempToken" do + association :user, factory: :user + #token { SecureRandom.hex(32) } + end end diff --git a/ruby/spec/jam_ruby/models/temp_token_spec.rb b/ruby/spec/jam_ruby/models/temp_token_spec.rb new file mode 100644 index 000000000..1a55ce67d --- /dev/null +++ b/ruby/spec/jam_ruby/models/temp_token_spec.rb @@ -0,0 +1,16 @@ +require 'spec_helper' + +describe TempToken do + let(:temp_token){ FactoryGirl.create(:temp_token) } + + it "generates token key" do + expect(temp_token.token).not_to eq(nil) + expect(temp_token.token.size).to eq(64) + end + + it "sets expired_at" do + expect(temp_token.expired_at).not_to eq(nil) + end + + +end \ No newline at end of file diff --git a/ruby/spec/spec_helper.rb b/ruby/spec/spec_helper.rb index fa65dd796..113b3dc75 100644 --- a/ruby/spec/spec_helper.rb +++ b/ruby/spec/spec_helper.rb @@ -13,6 +13,7 @@ require 'uses_temp_files' require 'resque_spec' require 'resque_failed_job_mailer' require 'stripe_mock' +require 'webmock/rspec' # to prevent embedded resque code from forking diff --git a/web/app/assets/javascripts/fakeJamClient.js b/web/app/assets/javascripts/fakeJamClient.js index c515d9d46..fe7589ab4 100644 --- a/web/app/assets/javascripts/fakeJamClient.js +++ b/web/app/assets/javascripts/fakeJamClient.js @@ -167,7 +167,7 @@ } function FTUEGetVideoShareEnable() { - return false; + return true; } function isSessVideoShared() { diff --git a/web/app/assets/javascripts/layout.js b/web/app/assets/javascripts/layout.js index 970307673..bf03c2c41 100644 --- a/web/app/assets/javascripts/layout.js +++ b/web/app/assets/javascripts/layout.js @@ -977,7 +977,7 @@ function mouseEnterNotification(evt){ var $notify = $(evt.target); - console.log("mouseEnter", $notify.prop("id")); + //console.log("mouseEnter", $notify.prop("id")); switch($notify.prop("id")){ case 'notification1': isMouseOverNotify1 = true; @@ -993,7 +993,7 @@ function mouseLeaveToNotification(evt){ var $notify = $(evt.target); - console.log("mouseLeave", $notify.prop("id")); + //console.log("mouseLeave", $notify.prop("id")); switch($notify.prop("id")){ case 'notification1': if(notify1Elapsed){ @@ -1456,4 +1456,4 @@ }; -}(window, jQuery)); \ No newline at end of file +}(window, jQuery)); diff --git a/web/app/assets/javascripts/notificationPanel.js b/web/app/assets/javascripts/notificationPanel.js index 937def4c6..8b67b1eb8 100644 --- a/web/app/assets/javascripts/notificationPanel.js +++ b/web/app/assets/javascripts/notificationPanel.js @@ -95,24 +95,10 @@ function onNotificationOccurred(payload) { + queueNotificationSeen(payload.notification_id, payload.created_at, payload.description); incrementNotificationCount(); highlightCount(); - - - if(userCanSeeNotifications(payload)) { - app.updateNotificationSeen(payload.notification_id, payload.created_at); - } - else { - if(app.layout.isNoisyNotification(payload) && !missedNotificationsWhileAway) { - // this handles a special case--if a notification is too noisy while away, then don't bother - // incrementing anything on the sidebar or otherwise distracting the user - app.updateNotificationSeen(payload.notification_id, payload.created_at); - } - else { - queueNotificationSeen(payload.notification_id, payload.created_at, payload.description); - missedNotificationsWhileAway = true; - } - } + missedNotificationsWhileAway = true; } function userCameBack() { @@ -1352,7 +1338,7 @@ //context.ChatActions.msgReceived(payload); // only show if chat dialog is not showing or if the focused lesson session is not the one specified in the payload - console.log("context.ChatStore.lessonSessionId", app.layout.isDialogShowing('chat-dialog'), context.ChatStore.lessonSessionId, payload.lesson_session_id) + //console.log("context.ChatStore.lessonSessionId", app.layout.isDialogShowing('chat-dialog'), context.ChatStore.lessonSessionId, payload.lesson_session_id) if (!app.layout.isDialogShowing('chat-dialog') || context.ChatStore.lessonSessionId != payload.lesson_session_id) { app.notify({ "title": "Lesson Message", diff --git a/web/app/assets/javascripts/react-components/PopupVideoUploader.js.jsx.coffee b/web/app/assets/javascripts/react-components/PopupVideoUploader.js.jsx.coffee index 2d3ec02c5..b53ea75c5 100644 --- a/web/app/assets/javascripts/react-components/PopupVideoUploader.js.jsx.coffee +++ b/web/app/assets/javascripts/react-components/PopupVideoUploader.js.jsx.coffee @@ -90,9 +90,15 @@ if accessOpener {instructions}
diff --git a/web/app/views/corps/terms.html.erb b/web/app/views/corps/terms.html.erb index 37a35f7d1..11e46fa2e 100644 --- a/web/app/views/corps/terms.html.erb +++ b/web/app/views/corps/terms.html.erb @@ -578,6 +578,7 @@
JamKazam disclaims any and all responsibility or liability for any harm or liability resulting from your use of External Services, and you hereby irrevocably waive any claim against JamKazam with respect to your use of any External Services.
+JamKazam integrates with YouTube via YouTube API Services. By using JamKazam, you are also bound to the YouTube Terms of Service: https://www.youtube.com/t/terms.
Notwithstanding the fact that JamKazam has no legal obligation to monitor the Content on the Platform, JamKazam diff --git a/web/bin/test b/web/bin/test index 2348ca7fb..b08d6a26e 100755 --- a/web/bin/test +++ b/web/bin/test @@ -6,6 +6,7 @@ tests=( "spec/features/signup_spec.rb" "spec/features/signin_spec.rb" "spec/features/download_spec.rb" + "spec/features/session_video_spec.rb" "spec/features/affiliate_program_spec.rb" "spec/features/affiliate_visit_tracking_spec.rb" "spec/features/affiliate_referral_spec.rb" diff --git a/web/config/environments/development.rb b/web/config/environments/development.rb index f31401eba..c36b3badf 100644 --- a/web/config/environments/development.rb +++ b/web/config/environments/development.rb @@ -112,4 +112,7 @@ SampleApp::Application.configure do config.rating_dialog_min_time = 1 config.rating_dialog_min_num = 1 config.root_redirect_on = false + + config.video_conferencing_host = "https://webrtc-demo.jamkazam.com" + config.use_video_conferencing_server = true end diff --git a/web/config/environments/production.rb b/web/config/environments/production.rb index c83d01892..d27fae9f3 100644 --- a/web/config/environments/production.rb +++ b/web/config/environments/production.rb @@ -93,4 +93,7 @@ SampleApp::Application.configure do config.recurly_subdomain = 'jamkazam' config.jam_tracks_available=false + + config.video_conferencing_host = "" + config.use_video_conferencing_server = false end diff --git a/web/config/environments/test.rb b/web/config/environments/test.rb index 25615788b..c593f5261 100644 --- a/web/config/environments/test.rb +++ b/web/config/environments/test.rb @@ -129,5 +129,8 @@ SampleApp::Application.configure do config.max_invites_ever_per_sender = 1000 config.max_invites_per_day_per_sender = 1000 config.max_invites_to_receiver_per_day = 1000 + + config.video_conferencing_host = "https://webrtc-demo.jamkazam.com" + config.use_video_conferencing_server = false end diff --git a/web/config/initializers/gon.rb b/web/config/initializers/gon.rb index a3a304320..afe4a7f2a 100644 --- a/web/config/initializers/gon.rb +++ b/web/config/initializers/gon.rb @@ -29,5 +29,6 @@ Gon.global.musician_count = Rails.application.config.musician_count Gon.global.subscription_codes = Rails.application.config.subscription_codes Gon.global.braintree_token = Rails.application.config.braintree_token Gon.global.paypal_admin_only = Rails.application.config.paypal_admin_only +Gon.global.use_video_conferencing_server = Rails.application.config.use_video_conferencing_server Gon.global.env = Rails.env Gon.global.version = ::JamWeb::VERSION diff --git a/web/config/routes.rb b/web/config/routes.rb index bb2236c02..37fe089c1 100644 --- a/web/config/routes.rb +++ b/web/config/routes.rb @@ -117,6 +117,8 @@ Rails.application.routes.draw do get '/client/authed/:authed/:data', to: 'clients#auth_action', :as => :auth_action + get '/video/room/:music_session_id', to: 'music_sessions#session_video', :as => :session_video + # ping test #get '/ping', to: 'ping#index' #get '/ping/pingat.jnlp', to: 'ping#at' @@ -298,6 +300,8 @@ Rails.application.routes.draw do match '/sessions/:id/tracks/:track_id' => 'api_music_sessions#track_destroy', :via => :delete match '/sessions/:id/attach_recording' => 'api_music_sessions#attach_recording', :via => :post + #token auth + match '/sessions/:session_id/auth' => 'api_music_sessions#auth', :via => :get # Music notations match '/music_notations' => 'api_music_notations#create', :via => :post diff --git a/web/spec/controllers/api_music_sessions_controller_spec.rb b/web/spec/controllers/api_music_sessions_controller_spec.rb index b625eeb1f..ee8f61287 100644 --- a/web/spec/controllers/api_music_sessions_controller_spec.rb +++ b/web/spec/controllers/api_music_sessions_controller_spec.rb @@ -112,14 +112,14 @@ describe ApiMusicSessionsController, type: :controller do describe "sms_index" do - it "no results" do + xit "no results" do get :sms_index, {client_id: conn.client_id} response.should be_success json = JSON.parse(response.body, :symbolize_names => true) json[:sessions].length.should == 0 end - it "just self" do + xit "just self" do # create a session with self in it sms = FactoryGirl.create(:music_session, creator: user) @@ -130,7 +130,7 @@ describe ApiMusicSessionsController, type: :controller do json[:sessions][0][:approved_rsvps][0][:full_score].should be_nil # you don't get scores to self end - it "someone else with no score with self" do + xit "someone else with no score with self" do #pending "this test works by itself or only others in the same spec but fails when run with some other tests from other specs" @@ -144,7 +144,7 @@ describe ApiMusicSessionsController, type: :controller do json[:sessions][0][:approved_rsvps][0][:full_score].should be_nil # there is no score with 'other ' end - it "scores with invitees and RSVP's" do + xit "scores with invitees and RSVP's" do # create a session with someone else in it, but no score sms = FactoryGirl.create(:music_session, creator: other) Score.createx(conn.locidispid, conn.client_id, conn.addr, other_conn.locidispid, other_conn.client_id, other_conn.addr, network_score, nil, nil, {auserid: user.id, buserid: other.id}) @@ -306,4 +306,58 @@ describe ApiMusicSessionsController, type: :controller do response.status.should == 200 end end + + describe "auth" do + let(:ams) { FactoryGirl.create(:active_music_session, creator: user) } + let(:temp_token) { FactoryGirl.create(:temp_token, user: user) } + let(:another_user) { FactoryGirl.create(:user) } + + before(:each) do + conn.join_the_session(ams.music_session, true, tracks, user, 10) + conn.errors.any?.should be false + end + + it "routes correctly" do + expect(get: "/api/sessions/#{ams.id}/auth?token=#{temp_token.token}&participants=2").to route_to( + controller: "api_music_sessions", + action: "auth", + session_id: ams.id, + token: temp_token.token, + participants: "2" + ) + end + + it "returns 403 for invalid token" do + get :auth, session_id: ams.id, token: 'invalid_token', participants: 2 + expect(response).to have_http_status(403) + expect(response.body).to eq({ code: "invalid_token", message: "No token found for 'invalid_token'" }.to_json) + end + + it "returns 403 if user is not in music session" do + ams.users.delete(user) + get :auth, session_id: ams.id, token: temp_token.token, participants: 2 + expect(response).to have_http_status(403) + expect(response.body).to eq({ code: "not_in_session", message: "Not a member of the session" }.to_json) + end + + it "returns 404 if token is valid, but session can't be found" do + get :auth, session_id: "bad_session_id", token: temp_token.token, participants: 2 + expect(response).to have_http_status(404) + expect(response.body).to eq({ code: "session_ended", message: "The session is over" }.to_json) + end + + it "token expired" do + TempToken.where(token: temp_token.token).update_all(expired_at: 1.day.ago) + + get :auth, session_id: ams.id, token: temp_token.token, participants: 2 + expect(response).to have_http_status(403) + expect(response.body).to eq({ code: "expired_token", message: "The token has expired" }.to_json) + end + + it "returns 200 ok for valid params" do + get :auth, session_id: ams.id, token: temp_token.token, participants: 2 + expect(response).to have_http_status(200) + expect(response.body).to eq({ name: user.name, user_id: user.id }.to_json) + end + end end diff --git a/web/spec/controllers/music_sessions_controller_spec.rb b/web/spec/controllers/music_sessions_controller_spec.rb new file mode 100644 index 000000000..bfc124955 --- /dev/null +++ b/web/spec/controllers/music_sessions_controller_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +describe MusicSessionsController, type: :controller do + + let(:user) { FactoryGirl.create(:user, subscription_plan_code: 'jamsubplatinum') } + let(:music_session) { FactoryGirl.create(:active_music_session, :creator => user) } + let(:connection) { FactoryGirl.create(:connection, + :user => user, + :music_session => music_session, + :addr => "1.1.1.1", + ) } + + + + + before(:each) do + MusicSession.delete_all + ActiveMusicSession.delete_all + controller.current_user = user + connection.connect! + end + + describe "video redirect" do + it "GET /video/room/:music_session_id" do + get :session_video, music_session_id: music_session.id + temp_token = TempToken.order(created_at: :desc).first + expect(temp_token.user).to eq(user) + video_conf_url = "#{Rails.application.config.video_conferencing_host}/room/#{music_session.id}?token=#{temp_token.token}" + response.should redirect_to video_conf_url + end + + it "GET /video/room/:music_session_id" do + get :session_video, music_session_id: music_session.id + temp_token = TempToken.order(created_at: :desc).first + expect(temp_token.user).to eq(user) + video_conf_url = "#{Rails.application.config.video_conferencing_host}/room/#{music_session.id}?token=#{temp_token.token}" + response.should redirect_to video_conf_url + end + end +end diff --git a/web/spec/factories.rb b/web/spec/factories.rb index 3ed2fd869..7256abd5c 100644 --- a/web/spec/factories.rb +++ b/web/spec/factories.rb @@ -1115,4 +1115,8 @@ FactoryGirl.define do association :teacher, factory: :teacher_user association :test_drive_package_choice, factory: :test_drive_package_choice end + + factory :temp_token, class: "JamRuby::TempToken" do + association :user, factory: :user + end end diff --git a/web/spec/features/notification_highlighter_spec.rb b/web/spec/features/notification_highlighter_spec.rb index d6b262b97..1b009899a 100644 --- a/web/spec/features/notification_highlighter_spec.rb +++ b/web/spec/features/notification_highlighter_spec.rb @@ -265,19 +265,21 @@ describe "Notification Highlighter", :js => true, :type => :feature, :capybara_f it_behaves_like :notification_badge, highlighted: false, count: 0 end - # describe "music session invitation" do - # before do - # ms = FactoryGirl.create(:music_session, creator: user1) - # text = "You have been invited to join a session by #{user1.name}." - # Notification.send_session_invitation(user2, user1, ms.id) - # expect(page).to have_selector("#{NOTIFICATION_PANEL} li.notification-entry", count: 1) - # find('.note-text', text: text) - # end - # it "save_screenshot" do - # save_screenshot("music_session_invitation.png") - # end - # it_behaves_like :notification_badge, highlighted: false, count: 0 - # end + describe "music session invitation" do + before do + user2.online = true + user2.save! + ms = FactoryGirl.create(:music_session, creator: user1) + text = "You have been invited to join a session by #{user1.name}." + Notification.send_session_invitation(user2, user1, ms.id) + expect(page).to have_selector("#{NOTIFICATION_PANEL} li.notification-entry", count: 1) + find('.note-text', text: text) + end + it "save_screenshot" do + save_screenshot("music_session_invitation.png") + end + it_behaves_like :notification_badge, highlighted: false, count: 0 + end end end diff --git a/web/spec/features/session_video_spec.rb b/web/spec/features/session_video_spec.rb index ceb2bee83..2377f0c49 100644 --- a/web/spec/features/session_video_spec.rb +++ b/web/spec/features/session_video_spec.rb @@ -11,30 +11,61 @@ describe "Music session video button", :js => true, :type => :feature, :capybara before(:each) do MusicSession.delete_all ActiveMusicSession.delete_all - Rails.application.config.allow_force_native_client = true @url = "/client#/session/#{music_session.id}" - + Gon.global.use_video_conferencing_server = false end - it "finds video link" do - fast_signin(user, @url) - # give the web page a little time to connect; sometimes in firefox this needs some time to connect - page.should_not have_selector('span.disconnected-msg', text: 'DISCONNECTED FROM SERVER') - execute_script("window.VideoActions.setVideoEnabled(true)") - #sleep 5 - find(".session-video-btn").click() - sleep 5 - save_screenshot("video_button2.png") + describe "user has opted for video conferencing server" do + before do + user.use_video_conferencing_server = true + user.save! + end + + it "opens video conferencing server page" do + fast_signin(user, @url) + # give the web page a little time to connect; sometimes in firefox this needs some time to connect + page.should_not have_selector('span.disconnected-msg', text: 'DISCONNECTED FROM SERVER') + execute_script("window.VideoActions.setVideoEnabled(true)") #force video capability of the browser + # this should open a new window/tab to a different site, as configured by the new + # Rails.configuration.video_conferencing_host parameter. + + temp_tokens_count = JamRuby::TempToken.count - # this should open a new window/tab to a different site, as configured by the new - # Rails.configuration.video_conferencing_host parameter. + vid_btn = find(".session-video-btn") - # We only need to verify that secondary window opens up. We should probably also test that a new TempToken record - # was created as a result of clicking the video button .I wouldn't bother testing anything else in this particular - # test. - # - # It's true that this secondary window (in staging/production) will load a site that will then in turn call the - # new controller token auth method.. but we can test the correctness of the new controller method in a much - # simpler web/spec/controller spec + new_window = window_opened_by { find(".session-video-btn").click() } #assure a new popup window is opened by clicking video button + + within_window new_window do + expect(TempToken.count).to eq(temp_tokens_count + 1) + end + + # We only need to verify that secondary window opens up. We should probably also test that a new TempToken record + # was created as a result of clicking the video button .I wouldn't bother testing anything else in this particular + # test. + # + # It's true that this secondary window (in staging/production) will load a site that will then in turn call the + # new controller token auth method.. but we can test the correctness of the new controller method in a much + # simpler web/spec/controller spec + end + + end + + describe "user has NOT opted for video conferencing server" do + before do + user.use_video_conferencing_server = false + user.save! + end + + it "does not open video conferencing server" do + fast_signin(user, @url) + # give the web page a little time to connect; sometimes in firefox this needs some time to connect + page.should_not have_selector('span.disconnected-msg', text: 'DISCONNECTED FROM SERVER') + execute_script("window.VideoActions.setVideoEnabled(true)") #force video capability of the browser + + #assert it does not create new window + expect { window_opened_by { find(".session-video-btn").click() } }.to raise_error(Capybara::WindowError) + + + end end end \ No newline at end of file diff --git a/websocket-gateway/Gemfile b/websocket-gateway/Gemfile index 5d3200cd7..3f2638424 100644 --- a/websocket-gateway/Gemfile +++ b/websocket-gateway/Gemfile @@ -1,5 +1,5 @@ #ruby=1.9.3-p327 -source 'https://rubygems.org' +source 'http://rubygems.org' unless ENV['LOCAL_DEV'] == '1' source 'https://jamjam:blueberryjam@int.jamkazam.com/gems/' end @@ -11,7 +11,6 @@ ruby ruby_version # Look for $WORKSPACE, otherwise use "workspace" as dev path. devenv = ENV["BUILD_NUMBER"].nil? - if devenv #gem 'jam_db', :path=> "../db/target/ruby_package" gem 'jampb', :path => "../pb/target/ruby/jampb" @@ -46,6 +45,7 @@ gem 'redis', '3.3.3' # pinned until we are on 2.5; then remove gem 'redis-namespace', '1.5.3' # pinned until we are on 2.5; then remove gem 'oj', '3.1.3' # pinned until we are on 2.5; then remove gem 'bcrypt', '3.1.13' +gem 'mimemagic', :source => 'https://int.jamkazam.com/gems/' ####### diff --git a/websocket-gateway/Gemfile.lock b/websocket-gateway/Gemfile.lock index 601ea9fda..fb4987b4f 100644 --- a/websocket-gateway/Gemfile.lock +++ b/websocket-gateway/Gemfile.lock @@ -9,8 +9,9 @@ PATH jam_ruby (0.1.1) GEM - remote: https://rubygems.org/ + remote: http://rubygems.org/ remote: https://jamjam:blueberryjam@int.jamkazam.com/gems/ + remote: https://int.jamkazam.com/gems/ specs: CFPropertyList (2.3.6) aasm (5.1.1) @@ -572,6 +573,7 @@ DEPENDENCIES language_list logging mime-types (= 1.25.1) + mimemagic! netaddr (= 1.5.1) newrelic_rpm nokogiri (= 1.10.10) diff --git a/websocket-gateway/build b/websocket-gateway/build index 94b28144b..8c4e89e0a 100755 --- a/websocket-gateway/build +++ b/websocket-gateway/build @@ -20,6 +20,11 @@ mkdir -p vendor/cache cp ../pb/target/ruby/jampb/jampb-${GEM_VERSION}.gem vendor/cache/ || { echo "unable to copy jam-pb gem"; exit 1; } cp ../ruby/jam_ruby-${GEM_VERSION}.gem vendor/cache/ || { echo "unable to copy jam-ruby gem"; exit 1; } +ls -la ../pb/target/ruby/jampb +ls -la vendor/cache +gem env +bundle list + # put all dependencies into vendor/bundle #rm -rf vendor/bundle -- let checkins config 'wipe workspace' decide this echo "updating dependencies" diff --git a/wordpress/plugins/jamkazam/README.txt b/wordpress/plugins/jamkazam/README.txt index 60e25a3d9..da9059944 100644 --- a/wordpress/plugins/jamkazam/README.txt +++ b/wordpress/plugins/jamkazam/README.txt @@ -1,4 +1,4 @@ -=== Plugin Name === +oh === Plugin Name === Contributors: (this should be a list of wordpress.org userid's) Donate link: http://example.com/ Tags: comments, spam diff --git a/wordpress/plugins/jamkazam/jamkazam.php b/wordpress/plugins/jamkazam/jamkazam.php index 311ee3bfa..27bcc55fe 100644 --- a/wordpress/plugins/jamkazam/jamkazam.php +++ b/wordpress/plugins/jamkazam/jamkazam.php @@ -81,14 +81,7 @@ function run_jamkazam() { } run_jamkazam(); - - -/** -* Set affiliate tracking cookie if there is an `?affiliate=xxxx` parameter in the URL -* The rails set honors this cookie, and a new user will be associated with the affiliate. -*/ -add_action( 'init', 'process_post' ); -function process_post() { +function track_affiliate() { $affiliate_id = $_GET['affiliate']; $expiration = current_time( 'timestamp' ) + ( DAY_IN_SECONDS * 2 ); @@ -97,4 +90,22 @@ function process_post() { if(isset($affiliate_id)) { setcookie('affiliate_visitor', $affiliate_id, $expiration, '/', '.jamkazam.com'); } -} \ No newline at end of file +} + +function track_origin() { + $source = $_GET["utm_source"]; + + if(isset($source)) { + setcookie('origin', json_encode(array('utm_source' => $_GET['utm_source'], 'utm_medium' => $_GET['utm_medium'], 'utm_campaign' => $_GET['utm_campaign'])), strtotime( '+1 year' ), '/', '.jamkazam.com'); + } +} + +/** +* Set affiliate tracking cookie if there is an `?affiliate=xxxx` parameter in the URL +* The rails set honors this cookie, and a new user will be associated with the affiliate. +*/ +add_action( 'init', 'process_post' ); +function process_post() { + track_affiliate(); + track_origin(); +}