Invite system

This system allows server hosts/owners to invite users and give them access from the start.
At the moment, access groups are not included, only authorization and permissions.

You can decide if the server is listening for invitations and on what port by modifying the server configuration.
(FileStorage/Configuration/Server.cfg)

Keep in mind that without invitations, you have to add users manually by getting their public key. (available in the User settings tab)

As a server owner you can manage invitations in the invitations tab in the admin panel:

Server invitation admin

After clicking the "Create" button you will see a creator window:

Server invitation creation

You decide on the time and use limits on this invitation as well as the default permissions given when someone uses it.

For better security, you can not grant the "Administrator" permission through a invitation.
(It is checked server-side as well, you can not just modify the serialized invitation and put it in there manually)

Be careful when sending out unlimited-use or highly-privileged invitations to random people.

Someone will eventually make a bot to spam servers with invitation accepts and you will end up with a ton of random users in the database.

I recommend sending one-use invites to specific people.
Make use and time limited invites when a bigger group of people is involved.

After you created an invitation and select it, you will have the "Get URL" button enabled.

When clicked, you will get a window allowing you to customize the URL before copying.

Server invitation URL creator

At the time of writing this, some of the automatically filled-in information are taken from your client and some from the server.
This means, you have to correct some things if they are incorrect.

The server name is usually just the name the server owner picked.
Someone can rename the server on their side, you can set the first name they will see.

The server address is filled in as the one you use to connect to the server.
You can use a direct IP address or a more friendly domain name instead if you know how to do it.

The listen port has to match what the server is listening on for invites.
It is port 9000 by default if you didn't change it.
If you did - you will have to put in the correct number as it is not filled in from the server at the time of writing.

User Redirection page

This option embeds the invitation inside a parameter on a redirect website.
The main player domain is providing the "protocol-redirect.watchtogetherplayer.com" endpoint which expects the "invite" parameter to be set containing the invitations.

This allows less technical users to simply click the link so their browser opens it and redirects to a custom "URL Protocol" which the player registers after starting if the user allows it.

User markdown

This option embeds the final URL inside markdown syntax allowing it to appear as "Watch Together Server Invitation" instead of the whole blob of text as a link, in places where it's supported like Discord.

Accepting

On platforms where URL Protocol handling is implemented (Windows at the time of writing), users can simply click the link and tell their browser to open it in the application.

If a given platform doesn't support the protocol yet, they have to copy the link and open up server settings where they will find "Accept" buttons for both server and watch group invitations.

The popup should automatically paste in the invitation when it appears if you copied it before, if not, paste it in the text field inside.

If everything works as expected, the user will get a popup asking them if they accept the invitation:

Server invitation

Once they accept, the server is put on their server list and they are informed if the process succeeded.

They can then then proceed to pick the server in the server tab and connect to it.

Alternatively, once a user is already on the server, you can send them watch group invitations