Skip to content

Commit

Permalink
don't send empty params on subscribe, config clarifications
Browse files Browse the repository at this point in the history
  • Loading branch information
or-else committed Nov 3, 2019
1 parent caa370e commit cc572fb
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 11 deletions.
23 changes: 12 additions & 11 deletions server/tinode.conf
Expand Up @@ -136,12 +136,13 @@
"serial_num": 1,

// Secret key (HMAC salt) for signing the tokens. Generate your own then keep it secret.
// 32 random bytes base64 encioded.
// Any 32 random bytes base64 encoded.
//
// === IMPORTANT ===
//
// CHANGE IT IN PRODUCTION!!! Otherwise anyone will be able to log in
// to your server without the password.
// to your server without the password. It's just random bytes, use any suitable
// means to get it.
"key": "wfaY2RgF2S1OQI/ZlK+LSrp1KB2jwAdGAIHQ7JZn+Kc="
}
},
Expand Down Expand Up @@ -282,15 +283,15 @@
// Then insert the file contents here. Yes, this is convoluted, but that's Google's fault.
"credentials": {
"type": "service_account",
"project_id": "your-project-id",
"private_key_id": "some-random-looking-hex-number",
"private_key": "-----BEGIN PRIVATE KEY----- base64-encoded bits of your private key \n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-abc123@your-project-id.iam.gserviceaccount.com",
"client_id": "1234567890123456789",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-abc123%40your-project-id.iam.gserviceaccount.com"
"project_id": "your-project-id",
"private_key_id": "some-random-looking-hex-number",
"private_key": "-----BEGIN PRIVATE KEY----- base64-encoded bits of your private key \n-----END PRIVATE KEY-----\n",
"client_email": "firebase-adminsdk-abc123@your-project-id.iam.gserviceaccount.com",
"client_id": "1234567890123456789",
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://oauth2.googleapis.com/token",
"auth_provider_x509_cert_url": "https://www.googleapis.com/oauth2/v1/certs",
"client_x509_cert_url": "https://www.googleapis.com/robot/v1/metadata/x509/firebase-adminsdk-abc123%40your-project-id.iam.gserviceaccount.com"
},

// An alternative way to provide Firebase service account credentials.
Expand Down
6 changes: 6 additions & 0 deletions server/topic.go
Expand Up @@ -861,6 +861,12 @@ func (t *Topic) subCommonReply(h *Hub, sreg *sessionJoin) error {
if sreg.created && sreg.pkt.topic != toriginal {
params["tmpname"] = sreg.pkt.topic
}

if len(params) == 0 {
// Don't send empty params '{}'
params = nil
}

sreg.sess.queueOut(NoErrParams(sreg.pkt.id, toriginal, now, params))

return nil
Expand Down

0 comments on commit cc572fb

Please sign in to comment.