Skip to content

Unhackables/chatroom

Repository files navigation

Yunbi Chat

Deploy

Rails

# app/helpers/application_helper.rb
def chat_token
    payload = {
      jti: current_user.id.to_s,
      iss: current_user.nickname,
      sub: Digest::MD5.hexdigest(current_user.email)[0...3].upcase,
      adi: Settings.roles.chatroom.admin.include?(current_user.email)
    }
    JWT.encode payload, 'xxx', 'HS256'
  end
# app/views/welcome/index.html.erb
<iframe frameborder="0" name="Iframe1" src="https://bcachat.com:4443/?xtoken=<%= chat_token %>" 
width="100%" height="350"></iframe>

Phoenix

# web/controllers/page_controller.ex
{:ok, claims} = JsonWebToken.verify(jwt, %{key: "xxx"})

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published