Updates for the new libipc APIs.
parent
b96322cab5
commit
a31bd4c940
12
src/main.cr
12
src/main.cr
|
@ -60,10 +60,10 @@ IPC::Service.new "auth" do |event|
|
||||||
payload = message.payload
|
payload = message.payload
|
||||||
pp message
|
pp message
|
||||||
|
|
||||||
case RequestTypes.new message.user_type.to_i
|
case RequestTypes.new message.type.to_i
|
||||||
when RequestTypes::GetToken
|
when RequestTypes::GetToken
|
||||||
begin
|
begin
|
||||||
request = GetTokenRequest.from_json payload
|
request = GetTokenRequest.from_json String.new payload
|
||||||
rescue e
|
rescue e
|
||||||
client.send ResponseTypes::MalformedRequest.value.to_u8, e.message || ""
|
client.send ResponseTypes::MalformedRequest.value.to_u8, e.message || ""
|
||||||
|
|
||||||
|
@ -82,7 +82,7 @@ IPC::Service.new "auth" do |event|
|
||||||
JWT.encode user.to_h, authd_jwt_key, "HS256"
|
JWT.encode user.to_h, authd_jwt_key, "HS256"
|
||||||
when RequestTypes::AddUser
|
when RequestTypes::AddUser
|
||||||
begin
|
begin
|
||||||
request = AddUserRequest.from_json payload
|
request = AddUserRequest.from_json String.new payload
|
||||||
rescue e
|
rescue e
|
||||||
client.send ResponseTypes::MalformedRequest.value.to_u8, e.message || ""
|
client.send ResponseTypes::MalformedRequest.value.to_u8, e.message || ""
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@ IPC::Service.new "auth" do |event|
|
||||||
client.send ResponseTypes::Ok, user.to_json
|
client.send ResponseTypes::Ok, user.to_json
|
||||||
when RequestTypes::GetUserByCredentials
|
when RequestTypes::GetUserByCredentials
|
||||||
begin
|
begin
|
||||||
request = GetUserByCredentialsRequest.from_json payload
|
request = GetUserByCredentialsRequest.from_json String.new payload
|
||||||
rescue e
|
rescue e
|
||||||
client.send ResponseTypes::MalformedRequest, e.message || ""
|
client.send ResponseTypes::MalformedRequest, e.message || ""
|
||||||
next
|
next
|
||||||
|
@ -115,7 +115,7 @@ IPC::Service.new "auth" do |event|
|
||||||
end
|
end
|
||||||
when RequestTypes::GetUser
|
when RequestTypes::GetUser
|
||||||
begin
|
begin
|
||||||
request = GetUserRequest.from_json payload
|
request = GetUserRequest.from_json String.new payload
|
||||||
rescue e
|
rescue e
|
||||||
client.send ResponseTypes::MalformedRequest, e.message || ""
|
client.send ResponseTypes::MalformedRequest, e.message || ""
|
||||||
next
|
next
|
||||||
|
@ -130,7 +130,7 @@ IPC::Service.new "auth" do |event|
|
||||||
end
|
end
|
||||||
when RequestTypes::ModUser
|
when RequestTypes::ModUser
|
||||||
begin
|
begin
|
||||||
request = ModUserRequest.from_json payload
|
request = ModUserRequest.from_json String.new payload
|
||||||
rescue e
|
rescue e
|
||||||
client.send ResponseTypes::MalformedRequest, e.message || ""
|
client.send ResponseTypes::MalformedRequest, e.message || ""
|
||||||
next
|
next
|
||||||
|
|
Loading…
Reference in New Issue