space-wizards / SS14.Admin

Administration panel for SS14 game servers
MIT License
9 stars 26 forks source link

AHelps in SS14.Admin #69

Open juliangiebel opened 5 months ago

juliangiebel commented 5 months ago

Allow admins to see and reply to ahelps from multiple servers in SS14.Admin

SS14 Ahelp API idea if

Rewrite BwoinkSystem into a manager, move integrations into their own integration classes and raise an event for integrations to queue a new message. Add server API endpoint for sending an ahelp message

Image

Postgres Notify as an alternative

When AHelps get stored in the database SS14.Admin could subscribe to new AHelps by using the subscribe and notify feature of postgres. This removes the need for some kind of webhook. https://www.postgresql.org/docs/current/sql-notify.html

SS14.Admin Blazor component for the ahelp client

To have SignalR in blazor not be a massive pita it needs to automatically reconnect and not have a massive fucking banner when doing so. Also only the interactive elements should get grayed out and not the entire page.

Code example for better automatic reconnect (Taken from old code. Needs adapting)

https://github.com/Megabit/Blazorise/blob/4502b4d6dc6ae6ec0e6619afbed561a40bd70707/Documentation/Blazorise.Docs.Server/Pages/_Layout.cshtml#L52

        Blazor.start({
            reconnectionHandler: {
                onConnectionDown: (options, error) => {
                    var isReloading = false;

                    async function attemptReload() {

                        if (!isReloading) {
                            isReloading = true;
                            var request = new Request({
                                url: '/healthcheck',
                                method: 'GET'
                            });
                            var result = await fetch(request);

                            if (result.status == 200) {
                                document.location.reload();
                            }
                            isReloading = false;
                        }
                    }
                    setInterval(attemptReload, 1500);
                }
            }
        });