admin build

This commit is contained in:
Seth Call 2020-10-18 15:39:23 -05:00
parent 5073c4757d
commit a26715b932
5 changed files with 64 additions and 17 deletions

View File

@ -2,4 +2,29 @@ ActiveAdmin.register JamRuby::Ars, :as => 'Ars' do
menu :label => 'NAS', :parent => 'Operations'
form do |f|
f.inputs 'Controls' do
f.input :active
f.input :beta
end
f.inputs 'Meta' do
f.input :name
f.input :provider
f.input :id_int
f.input :ip
f.input :username
f.input :password, as: :string
f.input :port
f.input :continent
f.input :country, as: :string
f.input :city
f.input :subdivision
f.input :latitude
f.input :longitude
end
f.actions
end
end

View File

@ -1,6 +1,5 @@
class JamRuby::Ars
attr_accessible :password
attr_accessible :password, :username, :active, :beta, :name, :provider, :id_int, :ip, :port, :continent, :country, :city, :subdivision, :latitude, :longitude, as: :admin
end

View File

@ -816,6 +816,12 @@ message Ars {
optional string username = 4;
optional string password = 5;
optional int32 port = 6;
optional string country = 7;
optional string continent = 8;
optional string subdivision = 9;
optional double latitude = 10;
optional double longitude = 11;
optional string city = 12;
}
// target: client

View File

@ -68,8 +68,23 @@ module JamRuby
)
end
def ars_body(ars)
Jampb::Ars.new(
:id => ars.id_int,
:ip => ars.ip,
:username => ars.username,
:password => ars.password,
:port => ars.port,
:country => ars.country,
:continent => ars.continent,
:city => ars.city,
:subdivision => ars.subdivision,
:latitude => ars.latitude,
:longitude => ars.longitude
)
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, ars_list = 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 = [])
client_update = Jampb::ClientUpdate.new(
product: client_update_data[:product],
version: client_update_data[:version],
@ -77,18 +92,6 @@ module JamRuby
size: client_update_data[:size]
) if client_update_data
arses = []
ars_list.each do |ars|
arses << Jampb::Ars.new(
:id => ars.id_int,
:ip => ars.ip,
:username => ars.username,
:password => ars.password,
:port => ars.port
)
end if ars_list
login_ack = Jampb::LoginAck.new(
:public_ip => public_ip,

View File

@ -1362,8 +1362,22 @@ module JamWebsockets
# it's possible that a client will not be represented in the database anymore, due to hard to trace/guess scenario
# usually involve reconnects. Double-check that all clients in memory are actually in the database. if not, delete them from memory
@stored_ars = Ars.active_arses(true)
@stored_ars_beta = Ars.active_arses(false)
stored_ars_raw = Ars.active_arses(true)
stored_ars_beta_raw = Ars.active_arses(false)
stored_ars = []
stored_ars_beta = []
stored_ars_raw.each do |ars|
stored_ars << @message_factory.ars_body(ars)
end
stored_ars_beta_raw.each do |ars|
stored_ars_beta << @message_factory.ars_body(ars)
end
@stored_ars = stored_ars
@stored_ars_beta = stored_ars_beta
puts "STORADE ARS #{@stored_ars}"
puts "STORADE ARS BETA #{@stored_ars_beta}"
if @client_lookup.length == 0
return