sdelements / lets-chat

Self-hosted chat app for small teams
http://sdelements.github.io/lets-chat
MIT License
9.77k stars 1.58k forks source link

Make public rooms private #655

Open yzaguirre opened 8 years ago

yzaguirre commented 8 years ago

The public rooms "Edit room" dialog should have a private? check box option. Is there a quick fix with mongo?

yzaguirre commented 8 years ago

This is how I solved it using the API. First I edit the mongo collection to make the room private:

db.rooms.update(     { "slug": "FILL_ME" },     {       $set: {         "private": true       }     } )

Second call PUT /rooms/:room to set the password like this (I use httpie as the client):

#!/bin/bash
# Make the room private
protocol='https'
domain='chat.example.com:PORT'
slug='FILL_ME'
resource=$protocol://$domain/rooms/$slug
bearer='FILL_ME'
http PUT $resource Authorization:"Bearer $bearer" \
name='FILL_ME' \
slug=$slug \
description='FILL_ME' \
password='FILL_ME'

And it seems to work well :)