JO Server Admin 1.0.0-beta.1
============================

A web page to manage your Joint Operations: Typhoon Rising server: see who is
online, kick or ban players, switch maps, change settings, fill your map
rotation, send messages to players, run a chat bot and start or stop the server.
It runs on the PC that hosts the game (Windows, or Linux with Wine) and talks to
the game's Remote Admin port directly over one connection.

Made by *HmS*NoN for the HardMaps community.


BETA
----
This is a beta: it works on our own servers, and we want to hear how it works
on yours. Found a problem or have an idea? Tell us:
  Forum: https://hardmaps.com/forum/viewtopic.php?t=21
  Mail:  hardmaps.website@gmail.com
Please mention your version (Settings tab), Windows or Linux, what you did and
what happened, and add a screenshot if you can.


INSTALL
-------
1. Run JOServerAdmin-Setup.exe.
   Windows may show "Windows protected your PC", because the program is not
   signed. Click "More info" and then "Run anyway".
2. Click OK to install. It installs for your Windows user only, so no
   administrator rights are needed. It adds a Start menu and desktop shortcut.
3. Choose whether it should start with Windows.
4. The admin page opens in your browser (http://localhost:8787).

To remove it: Windows Settings > Apps > JO Server Admin > Uninstall.
Joint Operations itself is never changed by the uninstall.


FIRST SETUP (in the browser, takes 2 minutes)
--------------------------------------------
Step 1  Game folder: pick the folder with JointOps.exe. It searches your drives.
Step 2  Remote Admin: if RAT is still off, choose a user name and password.
        The tool writes the admin port to game.cfg and the user to admin.cfg
        (a backup is made first). Close Joint Operations before this step.
Step 3  Access: only this PC, or also your home network (phone, other PC).
        If you choose the home network, Windows may ask to allow it through
        the firewall: allow it for private networks only.

After the setup you log in with your Remote Admin password.


DAILY USE
---------
1. Dashboard > Start server (or start JO yourself with /w /serveonly).
2. In the game window: log in with your NovaHQ account (or NovaWorld account)
   and host a co-op game with the FIRST map of your rotation list.
   With NovaHQ Heartbeat 2.1.1 or newer you do not need a NovaWorld account.
3. Dashboard > Fill rotation. Every map from your list that is not in the
   server rotation yet is added, so it does not matter which map you hosted with
   (a few seconds in total). Tick "Shuffle order" for a random order.

Dashboard        Now playing, players (warn, kick, ban, switch team, kill,
                 zero score), the live map rotation (next map, play now,
                 remove) and live settings.
Messages         Repeated messages (for example every 5 minutes), a message
                 right now, and the latest server chat. Repeated messages keep
                 running while the page is closed, as long as the tool runs.
Bot              Welcome message for new players, chat commands (!help
                 !rules !map !next !stats !top), map voting (!rtv, !vote name),
                 a word filter that warns and kicks, kill streak messages and
                 player stats (kills, deaths, visits) that survive restarts.
Game settings    Everything in game.cfg and NHQHeartbeat.ini: sniper zoom,
                 recoil, weapons, classes, timers, server name, send rate...
                 Stop the server before you save: the game overwrites
                 game.cfg when it exits.
Rotation list    Your list of maps. Add custom maps from your game folder.
                 Save lists as presets (for example "HmS event") and load them.
Console          Type any Remote Admin command and see the answer, and set
                 weapons live (always, armory only, never).
Settings         Start with Windows, run the setup again, quit.


MESSAGES AND ADMIN RIGHTS
-------------------------
Remote Admin can only send and read chat when the user has FF rights in
admin.cfg. Users made by this tool's setup get FF. Made your user yourself,
or with 3F? The Messages tab shows a button "Allow chat" that sets
the rights to FF (a backup is made first). Restart the server afterwards.


CHAT, THE BOT AND THE 59-CHARACTER LIMIT
----------------------------------------
- The game cuts chat lines after 59 characters. The tool keeps every message
  within that limit.
- Only general chat (T) reaches Remote Admin, as "NAME: text". Team chat (Y)
  and squad chat (U) do not, so players type bot commands with T.
- The bot checks the server every 4 seconds over one connection that stays
  open. It works while the page is closed, as long as the tool runs.


MAP NAMES WITH SPACES
---------------------
Remote Admin cannot add a map whose file name contains spaces (for example
"HmS Room Service TR.bms"). On the Rotation list tab, "Fix map names" renames
those files once (spaces become _). Stop the server first. A list of renamed
files is saved in renamed-maps.txt in your game folder.


NOVAHQ HEARTBEAT
----------------
The Dashboard and Settings show which NovaHQ Heartbeat (dinput8.dll) is in
your game folder, and whether a newer version is out on GitHub
(checked every 6 hours, or with "Check now" on Settings). To update: stop the
server, replace dinput8.dll with the new one, keep your own NHQHeartbeat.ini.


GOOD TO KNOW
------------
- Your password is never stored by this tool. It is checked against admin.cfg
  and kept in memory while you are logged in.
- Before every change to game.cfg, admin.cfg or NHQHeartbeat.ini, a backup is
  saved next to the file (name.date-time.bak; the last 5 are kept).
- The page is never reachable from the internet unless you forward its port
  in your router. Do not do that.
- Keep the Remote Admin port (default 40000) closed in your router as well.
- RAT.exe is no longer needed: the tool talks to the Remote Admin port itself,
  over one connection, and never sends commands while the map is changing.
- Settings for the tool are stored in %APPDATA%\JO Server Admin.


TROUBLESHOOTING
---------------
"Could not log in to Remote Admin"
    - Is the server hosted (not just started)? RAT only answers while hosting.
    - Settings > Run setup again, step 2: check the port and user.
    - admin.cfg has an ip_restrict line (default 192.168.*). The address shown
      in step 2 (Advanced) must match it.
The page does not open
    - Open JO Server Admin from the Start menu; it opens the page again.
    - If port 8787 is taken, the tool uses the next free port (8788, ...).
