Support usage from within Discord
I think it'd be interesting to be usable as a Discord activity. Discord activities are easy for everyone to use and improve the games discoverability.
It's a hard requirement not to be bound to Discord though. Everything needs to function without it. This means, we should avoid relying on their SDK or anything like that. Everything must be losely coupled.
AFAIK right now there are 2 issues.
- [x] The inline scripts need to be downloaded scripts instead, as per discord security policy ... god knows why
- [x] Inline event handlers need to be moved into the JS code
- [x] The websocket URL needs to be aware of the proxy. (iframe start location can be used)
- [x] Session management needs to be integrated somehow.
- [ ] Disable clients per ip setting
- [ ] Solve #308
This happens quite often on discord, due to the layout when playing without fullscreen
Session Management
For this we need to use the instanceid discord provides: https://discord.com/developers/docs/activities/development-guides#using-instanceid
We need to make sure people at least automatically join the instance or can see them even if they are private. That way, we only need to make slight changes to the API.
Steps 1 to 3 were done with 6cc2e41
Session management is still missing. The cherry on top would be to properly integrate, however, that would require loading the discord sdk afaik. If it is a simple small file, I will consider it, otherwise we'll go for half-assed integration for now.
A first version of the app is deployed already: https://discord.com/oauth2/authorize?client_id=1320396325925163070
I think it should be startable by anyone. However, it is not discoverable for now.
For the record: What's actually left here, is to make the whole thing into a proper single page application, as the discord SDK won't work otherwise. This is due to the fact, that all parameters are passed on the initial startup and its quite a pain in the ass to get everything through into the lobby. While I tried this, for some reason it did not work anyway and I couldn't debug it.