camuschat / camus

Peer-to-peer group video chat using WebRTC, Python, and TypeScript
GNU Affero General Public License v3.0
152 stars 44 forks source link

Client api #44

Open abhatikar opened 3 years ago

abhatikar commented 3 years ago

Suppose i have a server running, can i invoke a client from a script to create a room? Basically can i run it headless.? Thanks in advance

mrgnr commented 3 years ago

@abhatikar There is currently no client API, but you can use curl for creating a room:

# Do a GET request and parse the CSRF token
csrf_token=$(curl \
    -c cookies.txt \
    -b cookies.txt \
    localhost:5000/ | \
    grep csrf_token | \
    grep -Po 'value="\K[^"]*'
)

# Do a POST request to create the room
curl \
    -c cookies.txt \
    -b cookies.txt \
    -X POST \
    -F "room_name=Test Room" \
    -F "password=hello" \
    -F "public=Yes" \
    -F "guest_limit=10" \
    -F "csrf_token=$csrf_token" \
    localhost:5000/

Assuming you have a Camus server running at localhost:5000, the above commands will create a public room called "Test Room" with a password "hello" and a guest limit of 10.