miroslavpejic85 / mirotalk

🚀 WebRTC - P2P - Simple, Secure, Fast Real-Time Video Conferences Up to 4k and 60fps, compatible with all browsers and platforms.
https://p2p.mirotalk.com
GNU Affero General Public License v3.0
2.59k stars 502 forks source link

Add "Toggle hide myself", "username" and "password" in Direct Join params #195

Closed Jeanne-D4RK closed 5 months ago

Jeanne-D4RK commented 6 months ago

Feature request

I would love to have be able to

Pros

I want to use this awesome app as a self hosted smart doorbell.

Regarding username and password : I want to use this app internet facing but don't want to allow anybody to create a room, therefore I enabled host protection but I want the access the doorbell room seamlessly for users (1 click).

Regarding the hideMyself feature : the doorbell does not have a screen, I don't need to see my own camera feedback (it won't be enabled anyway), only the video doorbell feed.

Additional context

None

PS: Thanks for this awesome work, it's very easy to get started and works very nicely!

miroslavpejic85 commented 5 months ago

Hello @IsThisUsernameFree,

PS: Thanks for this awesome work, it's very easy to get started and works very nicely!

Thank you so much for your positive feedback!

I'll assign myself the task, asap I have some time I'll implement everything with some further improvements that I have in mind ;)

Have a good day! Miroslav

miroslavpejic85 commented 5 months ago

New query params

| Params     | Type    | Description                                                                                                                                    |
| ---------- | ------- | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `hide`     | boolean | Determines whether to hide the user from the room view. Set to `0` to not hide or `1` to hide                                                  |
| `username` | string  | Represents the authentication username for the user. Only required if `HOST_PROTECTED` or `HOST_USER_AUTH` is set to `true` in the `.env` file |
| `password` | string  | Represents the authentication password for the user. Only required if `HOST_PROTECTED` or `HOST_USER_AUTH` is set to `true` in the `.env` file |

Host protection and User auth

Reference: https://github.com/miroslavpejic85/mirotalk/commit/285c92605585bf204996dc0bade9b3e7c62d75df#commitcomment-103108955

We introduced 2 new variables:


.env file

  1. Remove the old variables:

    HOST_USERNAME=username
    HOST_PASSWORD=password
  2. Add the new variables:

    
    # Host protection
    # HOST_PROTECTED: When set to true, it requires a valid username and password from the HOST_USERS list to initialize or join a room.
    # HOST_USER_AUTH: When set to true, it also requires a valid username and password, but these need to be provided in the URL parameters.
    # HOST_USERS: This is the list of valid host users along with their credentials.

HOST_PROTECTED=false # true or false

HOST_USER_AUTH=false # true or false

HOST_USERS='[{"username": "username", "password": "password"},{"username": "username2", "password": "password2"}]'



---

If `HOST_PROTECTED` is set to `true`, the logic remains the same as before. 
If `HOST_USER_AUTH` is set to `true`, user login is required.

---

## Task Goal

- Add "hideMyself=true" in the url to join the room with my own view toggled off.

1. [https://p2p.mirotalk.com/join?room=test&name=mirotalk&hide=1](https://p2p.mirotalk.com/join?room=test&name=mirotalk&hide=1)

- Login directly using username and password via the direct join URL

1. Set `HOST_PROTECTED` to `true`.
2. Define `HOST_USERS` as a JSON array with at least one user, specifying a username and password in the .env file.
3. When joining a room, bypassing the login page, use the URL format: `http://your.domain.name/join?room=test&name=mirotalk&username=username&password=password`