This commit is contained in:
Seth Call 2021-04-11 13:33:59 -05:00
commit 940470dbc3
41 changed files with 371 additions and 78 deletions

View File

@ -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

View File

@ -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

View File

@ -559,7 +559,7 @@ DEPENDENCIES
zip-codes
RUBY VERSION
ruby 2.3.1p112
ruby 2.4.1p111
BUNDLED WITH
1.17.3

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -1690,4 +1690,4 @@ module JamRuby
description == 'TEXT_MESSAGE'
end
end
end
end

View File

@ -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

View File

@ -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?

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -167,7 +167,7 @@
}
function FTUEGetVideoShareEnable() {
return false;
return true;
}
function isSessVideoShared() {

View File

@ -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));
}(window, jQuery));

View File

@ -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",

View File

@ -90,9 +90,15 @@ if accessOpener
{instructions}
<div className="control-holder">
{action}
<div className="video-terms"><a href="https://www.jamkazam.com/corp/privacy" onClick={this.openPrivacyPolicy}>JamKazam Privacy Policy</a></div>
</div>
</div>`
openPrivacyPolicy: (e) ->
e.preventDefault()
$link = $(e.target)
AppActions.openExternalUrl($link.attr('href'))
getInitialState: () ->
{auth: null, uploadState: VideoUploaderStore.getState(), deleteMe: false}

View File

@ -3,6 +3,17 @@ SessionActions = @SessionActions
@SessionVideoBtn = React.createClass({
mixins: [
Reflux.listenTo(UserStore, "onUserChanged")
]
useVideoConferencingServer: () ->
gon.global.use_video_conferencing_server || @state.user?.use_video_conferencing_server
onUserChanged: (userState) ->
@setState({user: userState?.user})
openBrowserToPayment: () ->
context.JK.popExternalLink("/client#/account/subscription", true)
@ -10,9 +21,19 @@ SessionActions = @SessionActions
context.JK.popExternalLink("https://jamkazam.freshdesk.com/support/solutions/articles/66000122535-what-are-jamkazam-s-free-vs-premium-features-")
return 'noclose'
openBrowserToNewVideoServer: () ->
context.JK.popExternalLink("/video/room/#{context.SessionStore.id()}")
sessionWebCam: (e) ->
e.preventDefault();
if @useVideoConferencingServer()
@openBrowserToNewVideoServer()
else
@connectWithLegacyVideoServer()
connectWithLegacyVideoServer: () ->
canVideo = window.SessionStore.canVideo()
if canVideo

View File

@ -34,6 +34,9 @@ body.video-upload {
width: 100%;
left: 0;
}
.video-terms {
margin:10px 0 0 0;
}
.progress-bar {
background-color:#ED3618;

View File

@ -807,6 +807,31 @@ class ApiMusicSessionsController < ApiController
end
end
def auth
token = nil
begin
token = TempToken.find_by_token!(params[:token])
rescue ActiveRecord::RecordNotFound
return render json: { code: "invalid_token", message: "No token found for '#{params[:token]}'" }, status: :forbidden
end
if token.expired_at < Time.now.utc
return render json: {code: "expired_token", message: "The token has expired" }, status: :forbidden
end
begin
music_session = ActiveMusicSession.find(params[:session_id])
if !music_session.users.exists?(token.user.id)
return render json: { code: "not_in_session", message: "Not a member of the session" }, status: :forbidden
end
return render json: { name: token.user.name, user_id: token.user.id }, status: 200
rescue ActiveRecord::RecordNotFound
return render json: { code: "session_ended", message: "The session is over" }, status: 404
end
end
private
def lookup_session

View File

@ -65,10 +65,10 @@ class ApplicationController < ActionController::Base
should_set = params[:utm_source] || origin.nil?
if should_set
if params[:utm_source]
cookies.permanent[:origin] = {utm_source: params[:utm_source], utm_medium: params[:utm_medium], utm_campaign: params[:utm_campaign], referrer: request.referrer }.to_json
elsif request.referer
begin
cookies.permanent[:origin] = {utm_source: "organic", utm_medium: "organic", utm_campaign: URI.parse(request.referer).host, referrer: request.referer}.to_json
rescue

View File

@ -50,4 +50,5 @@ class ClientsController < ApplicationController
redirect_to client_url
end
end
end

View File

@ -53,4 +53,10 @@ class MusicSessionsController < ApplicationController
end
end
def session_video
music_session = current_user.music_sessions.find(params[:music_session_id])
tok = current_user.temp_tokens.create
video_conf_url = "#{Rails.application.config.video_conferencing_host}/room/#{music_session.id}?token=#{tok.token}"
redirect_to video_conf_url
end
end

View File

@ -1,7 +1,8 @@
object @user
attributes :id, :first_name, :last_name, :name, :city, :state, :country, :location, :online, :photo_url, :musician, :gender, :birth_date, :internet_service_provider, :friend_count, :liker_count, :like_count, :follower_count, :following_count, :admin,
:recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_session_count, :age, :website, :skill_level, :reuse_card, :email_needs_verification, :is_a_teacher, :is_a_student, :is_onboarder, :timezone
:recording_count, :session_count, :biography, :favorite_count, :audio_latency, :upcoming_session_count, :age, :website, :skill_level, :reuse_card, :email_needs_verification, :is_a_teacher, :is_a_student, :is_onboarder, :timezone,
:use_video_conferencing_server
node :location do |user|
if user.musician?

View File

@ -216,6 +216,12 @@
Facebook to suggest users that you may wish to connect with as a friend or follow on the Platform. It will be up to you
if you choose to connect with or follow these users and you can disconnect or unfollow them at any time.
</li>
<li>If you are a YouTube user and upload a video to YouTube with JamKazam Apps, we then store an authorization token
provided by YouTube API Services to make login on your behalf. We also record the link of the uploaded video, and if you indicated
that the recorded video should be public, then this link will show up in the JamKazam Apps for other users to potentially
view. We do not share any information obtained by YouTube APIs with any third party. You may at any time revoke
JamKazam Apps ability to login on your behalf by revoking permission via Google security settings (<a href="https://security.google.com/settings/security/permissions">https://security.google.com/settings/security/permissions</a>). Please
also refer to the Google Privacy Policy (<a href="http://www.google.com/policies/privacy">http://www.google.com/policies/privacy</a>).</li>
</ul>
<p>

View File

@ -578,6 +578,7 @@
<p>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. </p>
<p>JamKazam integrates with YouTube via YouTube API Services. By using JamKazam, you are also bound to the YouTube Terms of Service: <a href="https://www.youtube.com/t/terms">https://www.youtube.com/t/terms</a>.</p>
<h2 id="blocking-and-removal-of-content">Blocking and Removal of Content</h2>
<p>Notwithstanding the fact that JamKazam has no legal obligation to monitor the Content on the Platform, JamKazam

View File

@ -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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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/'
#######

View File

@ -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)

View File

@ -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"

View File

@ -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

View File

@ -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');
}
}
}
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();
}