# Windrose Server Manager

A self-hosted admin tool for **Windrose** dedicated servers (Kraken Express, UE5.6).

Sits next to your dedicated server, talks to it over RCON + log tail, and gives you:

- A web dashboard at `http://localhost:8080`
- Player join / leave / count tracking with friendly names (resolved from log)
- Discord webhook routing — ban/restart/player/system events posted to channels you choose
- Scheduled in-game announcements (`/say` via RCON) on cron expressions
- Scheduled and ad-hoc restarts with countdown notifications and graceful drain
- Manual RCON console
- Live tail of the dedicated-server log (`R5.log`)
- Player + ban management UI
- An audit log of every admin action
- Optional connection to **[Windrose Hub](https://windrose.certifriedmultitool.com)** so you can manage multiple servers from one cloud dashboard, with no port-forwarding on your end

Built on .NET 8 (ASP.NET Core, Blazor Server). Runs as a Windows service or a console app.

---

## Quick start (using the prebuilt release)

Two ways to run, pick what you want:

**Local only** (simplest, no cloud dashboard):

1. Download the latest `WindroseServerManager-vX.Y.Z-win-x64.zip`, unzip somewhere (e.g. `C:\WSM`)
2. Copy `appsettings.Local.minimal.json` → `appsettings.Local.json`, replace `YOUR_RCON_PASSWORD_HERE` with your actual RCON password
3. Double-click `WindroseServerManager.exe` — a native desktop window opens with the full UI. Done.

**With the cloud hub** (multi-server dashboard from anywhere):

1. Same download + unzip step
2. Copy `appsettings.Local.example.json` → `appsettings.Local.json`. Fill in your RCON password and (optionally) the auth password and Discord webhook URLs
3. Sign up at https://windrose.certifriedmultitool.com (email or "Sign in with Discord"), click Add server, copy the token
4. Paste the token into the `Hub` block of your config, set `Hub.Enabled: true`
5. Run `install-as-service.ps1` from an elevated PowerShell, then `Start-Service WindroseServerManager`
6. Open http://localhost:8080 locally and https://windrose.certifriedmultitool.com remotely

Detailed walkthrough in [docs/USER_SETUP.md](docs/USER_SETUP.md).

---

## What does it actually do?

Two components, one process:

**Local web UI** at `http://localhost:8080` — your dashboard. Polls RCON every 30s, tails `R5.log` for events RCON doesn't surface (ServerAccount lines, name lookups, etc.), supervises the dedicated-server process for restarts.

**Optional hub agent** — a single outbound WebSocket to `wss://windrose.certifriedmultitool.com/api/agent` (or your own self-hosted hub). Streams events upward, accepts commands downward (restart, RCON, start/stop). Outbound-only means no port forwarding, no firewall changes, no tunnels. The hub gives you a multi-server dashboard from anywhere.

```
                                   ┌──────────────────┐
                                   │ Discord webhooks │
                                   └────────┬─────────┘
                                            ▲ (events)
                                            │
                                            │
 ┌─────────────────────────┐         ┌──────┴───────────────┐         ┌──────────────────┐
 │ Windrose Dedicated      │ ◀ RCON ─│ Windrose Server      │ ◀ wss ─ │ Hub (optional)   │
 │ Server (this box)       │         │ Manager (this box)   │         │ multi-server UI  │
 │ R5.log ─────────────────│ ◀ tail ─│                      │ ─ wss ▶ │                  │
 └─────────────────────────┘         │ http://localhost:8080│         │ windrose.certi…  │
                                     │ web dashboard        │         │ certifriedmulti… │
                                     └──────────────────────┘         └──────────────────┘
```

---

## Documentation

| File                                             | For                                                                  |
|--------------------------------------------------|----------------------------------------------------------------------|
| [docs/USER_SETUP.md](docs/USER_SETUP.md)         | First-time install + connecting to windrose.certifriedmultitool.com  |
| [docs/SELF_HOSTING.md](docs/SELF_HOSTING.md)     | Running your own hub instance (replacing certifried)                 |
| [docs/CONFIG_REFERENCE.md](docs/CONFIG_REFERENCE.md) | Every appsettings option, what it does, defaults                 |
| [docs/OPERATIONS.md](docs/OPERATIONS.md)         | Day-to-day ops: restarts, log locations, troubleshooting             |
| [docs/REMOTE_ACCESS.md](docs/REMOTE_ACCESS.md)   | Exposing the local web UI through Cloudflare Tunnel etc.             |

---

## Hosted hub

I run a free hub at **https://windrose.certifriedmultitool.com**. Two ways to sign in:

- **Email + password** — classic. PBKDF2-HMAC-SHA256 hashed, 30-day sliding sessions.
- **Sign in with Discord** — OAuth2 with `identify` + `email` scopes. No access tokens are stored, the hub just uses Discord to identify you on the spot.

You can use either. From your **Account** page you can link the other method to the same account (handy if you started with email and want one-click Discord login next time, or if you signed up with Discord and want a backup password). If you accidentally created two accounts, the hub detects the duplicate when you try to link and offers to merge them (transferring all agents from the duplicate before deleting it).

Once signed in, click "Add server" to generate an agent token, paste it into your manager's `appsettings.Local.json`, restart the service, and your server appears online in the dashboard. Restart, send RCON, watch events live — all from anywhere on the internet, no port forwarding needed.

If you prefer to host your own hub (or don't trust mine), see [docs/SELF_HOSTING.md](docs/SELF_HOSTING.md).

---

## Building from source

You'll need .NET 8 SDK.

```powershell
git clone <this-repo>
cd Windrose-ServerManager
dotnet build
dotnet run --project src/WindroseServerManager.Web
```

Listens on `http://localhost:8080`. To produce a release-style single-file EXE:

```powershell
dotnet publish src/WindroseServerManager.Web `
  -c Release -r win-x64 --self-contained true `
  -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true `
  -o release/staging
```

Output is `release/staging/WindroseServerManager.Web.exe` (~95 MB, no .NET install needed on the target machine).

---

## License

MIT (TBD — confirm before publication).

## Source layout

```
src/
  WindroseServerManager.Core         shared event types, config models, in-memory bus
  WindroseServerManager.Rcon         CoreRCON wrapper + connection lifecycle
  WindroseServerManager.LogTail      R5.log tail, ServerAccount parsing, name lookups
  WindroseServerManager.Process      dedicated-server process supervision (start/stop/restart)
  WindroseServerManager.Discord      webhook router + audit log + routing rules store
  WindroseServerManager.Scheduling   cron-driven announcements + restarts
  WindroseServerManager.Hub          outbound WebSocket agent to a hub
  WindroseServerManager.Web          ASP.NET Core host + Blazor Server UI

tests/                               unit tests
scripts/                             dev install/uninstall PowerShell scripts
docs/                                user-facing documentation
release/                             build output (gitignored)
```
