connection policy
This commit is contained in:
parent
e451e765f5
commit
8393506f52
|
|
@ -3,7 +3,7 @@ ActiveAdmin.register JamRuby::GenericState, :as => 'GenericState' do
|
|||
|
||||
config.clear_action_items!
|
||||
filter :env
|
||||
permit_params :top_message, :event_page_top_logo_url
|
||||
permit_params :top_message, :event_page_top_logo_url, :connection_policy
|
||||
|
||||
actions :all, :except => [:destroy]
|
||||
|
||||
|
|
|
|||
|
|
@ -397,7 +397,7 @@ ActiveAdmin.register JamRuby::User, :as => 'Users' do
|
|||
table_for user.purchased_jam_tracks.unscope(:order).order('original_artist asc', 'name asc') do
|
||||
column "Artist", :original_artist
|
||||
column "Name", :name
|
||||
column "Can Download", :can_download, as: :boolean, hint: 'Can download is the 2.99 value (have download rights)'
|
||||
column "Can Download", :can_download
|
||||
column "Version", :version
|
||||
column "ID", :id
|
||||
end
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@
|
|||
<%= f.semantic_errors *f.object.errors.keys %>
|
||||
<%= f.inputs do %>
|
||||
<%= f.input(:top_message, :input_html => {:maxlength => 10000, :rows=>10, :class => 'autogrow'}) %>
|
||||
<%= f.input(:connection_policy, :input_html => {:maxlength => 100000, :rows=>10, :class => 'autogrow'}) %>
|
||||
<%= f.input(:event_page_top_logo_url, :input_html => {:maxlength => 200}, :hint => '/assets/logo.png') %>
|
||||
<% end %>
|
||||
<%= f.actions %>
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
class JamRuby::GenericState
|
||||
before_validation do
|
||||
if self.connection_policy == ''
|
||||
self.connection_policy = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
@ -142,4 +142,6 @@ UPDATE users set stored_credit_card = true where recurly_code is not null;
|
|||
CREATE INDEX msuh_user_id ON music_sessions_user_history USING btree (user_id);
|
||||
CREATE INDEX msuh_created_at ON music_sessions_user_history USING btree (created_at);
|
||||
|
||||
CREATE INDEX bands_musicians_user_id_idx ON bands_musicians USING btree (user_id);
|
||||
CREATE INDEX bands_musicians_user_id_idx ON bands_musicians USING btree (user_id);
|
||||
|
||||
ALTER TABLE generic_state ADD COLUMN connection_policy VARCHAR;
|
||||
|
|
@ -287,6 +287,7 @@ message LoginAck {
|
|||
optional int32 client_id_int = 11;
|
||||
repeated Ars arses = 12;
|
||||
optional SiteSubscription subscription = 13;
|
||||
optional string connection_policy = 14;
|
||||
}
|
||||
|
||||
message ConnectAck {
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ module JamRuby
|
|||
)
|
||||
end
|
||||
# create a login ack (login was successful)
|
||||
def login_ack(public_ip, client_id, token, heartbeat_interval, music_session_id, reconnected, user_id, connection_expire_time, username, client_id_int, client_update_data = nil, arses = [], subscription=nil)
|
||||
def login_ack(public_ip, client_id, token, heartbeat_interval, music_session_id, reconnected, user_id, connection_expire_time, username, client_id_int, client_update_data = nil, arses = [], subscription=nil, connection_policy = nil)
|
||||
client_update = Jampb::ClientUpdate.new(
|
||||
product: client_update_data[:product],
|
||||
version: client_update_data[:version],
|
||||
|
|
@ -119,7 +119,8 @@ module JamRuby
|
|||
broadcasting_type: subscription[:broadcasting_type],
|
||||
max_players: subscription[:max_players],
|
||||
pro_audio: subscription[:pro_audio]
|
||||
)
|
||||
),
|
||||
:connection_policy => connection_policy
|
||||
)
|
||||
|
||||
Jampb::ClientMessage.new(
|
||||
|
|
|
|||
|
|
@ -3,11 +3,12 @@ module JamRuby
|
|||
class GenericState < ActiveRecord::Base
|
||||
|
||||
|
||||
attr_accessible :top_message, :event_page_top_logo_url, as: :admin
|
||||
attr_accessible :top_message, :event_page_top_logo_url, :connection_policy, as: :admin
|
||||
|
||||
self.table_name = 'generic_state'
|
||||
|
||||
validates :env, :inclusion => {:in => ['development', 'staging', 'production', 'test']}
|
||||
validates :connection_policy, json: true
|
||||
|
||||
def self.env
|
||||
GenericState.singleton.env
|
||||
|
|
@ -42,6 +43,10 @@ module JamRuby
|
|||
GenericState.singleton.event_page_top_logo_url
|
||||
end
|
||||
|
||||
def self.connection_policy
|
||||
GenericState.connection_policy
|
||||
end
|
||||
|
||||
def self.singleton
|
||||
GenericState.find('default')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -245,6 +245,15 @@
|
|||
// tell the backend that we have logged in
|
||||
try {
|
||||
var msg = {user_id: payload.user_id, token: payload.token, username: payload.username, arses: payload.arses, client_id_int: payload.client_id_int, subscription: payload.subscription}
|
||||
if(payload.connection_policy) {
|
||||
try {
|
||||
msg.policy= JSON.parse(payload.connection_policy)
|
||||
}
|
||||
catch(e) {
|
||||
msg.policy = null
|
||||
console.log("unable to parse connection policy", e)
|
||||
}
|
||||
}
|
||||
console.log("logged with new msg", msg)
|
||||
context.jamClient.OnLoggedIn(msg); // ACTS AS CONTINUATION
|
||||
}
|
||||
|
|
|
|||
|
|
@ -980,7 +980,8 @@ module JamWebsockets
|
|||
connection.client_id_int,
|
||||
client_update,
|
||||
arses,
|
||||
user.subscription_rules(false))
|
||||
user.subscription_rules(false),
|
||||
@stored_policy)
|
||||
stats_logged_in
|
||||
send_to_client(client, login_ack)
|
||||
|
||||
|
|
@ -1371,6 +1372,7 @@ module JamWebsockets
|
|||
|
||||
stored_ars_raw = Ars.active_arses(true)
|
||||
stored_ars_beta_raw = Ars.active_arses(false)
|
||||
@stored_policy = GenericState.singleton.connection_policy
|
||||
|
||||
stored_ars = []
|
||||
stored_ars_beta = []
|
||||
|
|
|
|||
Loading…
Reference in New Issue