# Admin tools

Staff permissions, the phoneadmin command and admin menu, the install self-test and item signatures.

## Give your staff access

Admin tools need one permission. Add it to `server.cfg`:

```cfg server.cfg
add_ace group.admin wd_phone.admin allow
```

It grants the `phoneadmin` command, the in-game admin menu and the cell tower editor. The server console always has access. Moderation in some apps has its own permission, so you can give it to moderators without admin rights:

| Permission | Grants |
| --- | --- |
| `wd_phone.admin` | `phoneadmin`, the admin menu, the tower editor, removing any placed speaker and News articles |
| `wd_phone.news.moderate` | **Remove article** in News |
| `wd_phone.shade.moderate` | Shade moderation; see [Shade](#/docs/wd_phone/shade?section=moderation) |
| `wd_phone.clips.moderate` | Clips reports, removing clips and comments, verified badges |
| `wd_phone.social.moderate` | Echo reports, removing posts, verified badges |
| `wd_phone.commerce.moderate` | Marketplace reports and listings |

The command name and the admin permission can be changed with `Config.Operations.adminCommand` and `adminAce` in `config/platform.lua`.

## The phoneadmin command

`phoneadmin` works in the server console and in game. In game, `phoneadmin` on its own opens the [admin menu](#admin-menu) and command output goes to the F8 console. In the console it lists the subcommands, like `phoneadmin help`.

Wherever a command takes a `<deviceId>`, a player's server ID also works: it picks the phone they have open, or the first phone in their inventory.

| Command | What it does |
| --- | --- |
| `lookup <deviceId>` | A phone's status: Nova Account, battery, PIN, holder, lost or stolen, last seen |
| `audit <deviceId> [n]` | Recent admin and security actions on a phone |
| `resetpin <deviceId>` · `unlockpin <deviceId>` | Remove a forgotten PIN (and Face Unlock) · clear a PIN lockout |
| `lost <deviceId> [message]` · `stolen <deviceId>` · `found <deviceId>` | Set or clear lost and stolen status |
| `wipe <deviceId> confirm` | Erase a phone now |
| `battery <deviceId> <0-100>` | Set the battery level. `0` turns the phone off |
| `power <deviceId> on` / `off` | Turn a phone on or off, like its side button |
| `install` / `uninstall <deviceId> <appId>` · `resetapps <deviceId>` | Change one phone's apps, or reset them to a new phone's |
| `account` · `accountpw` · `backups` · `restore` | Nova Accounts and backups; see [Nova Account & recovery](#/docs/wd_phone/device-operations) |
| `towers` · `towerdamage <towerId>` · `towerrepair <towerId>` | The cell tower editor in game, or a list in the console · force a tower down or back up |
| `speakers [radius]` · `removespeaker <speakerId>` | Placed Bluetooth speakers |
| `givecard <serverId> <shade\|blank> [count]` | Give Shade SD cards or blank SD cards |
| `verify` / `unverify <clips\|snapgram\|echo> <handle>` | Give or take a verified badge |
| `relay` | Video call relay status and a test login; see [Video calls](#/docs/wd_phone/video-calls) |
| `apps` | List the apps other resources registered, with their version, resource and permissions |
| `perf [total\|p95\|max\|count\|cpu] [n]` · `perf reset` | The server callback profiler: calls, errors, total, average, p95 and longest time, and Lua CPU time per callback, sorted by the column you name. `reset` starts it over |
| `schema` | Compare the database with `install.sql` |
| `selftest [report\|flows]` | Check the installation; see [below](#check-your-installation) |
| `signitems [serverId]` | Re-sign carried items after a secret change; see [below](#item-signatures) |

Racing has its own commands; see [Racing](#/docs/wd_phone/racing). `phoneadmin help` lists everything.

Every change to a phone is written to its audit log with the admin who made it.

## Admin menu

`phoneadmin` in game opens a menu that does the same without typing IDs:

- **Players:** everyone online, the phones they carry, and each phone's model, battery and status.
- **Find a phone** by device ID or server ID.
- **Phone actions:** details, battery level, charge to full or drain, power on and off, battery health and screen condition, reset PIN, clear a lockout, lost, stolen or found, install, uninstall or reset apps, the audit log, and wipe after a confirmation.
- **Nova Accounts:** look one up, reset a password, list backups and restore one.
- **Cell towers** opens the [tower editor](#/docs/wd_phone/sims?section=cell-towers).
- **Speakers nearby:** teleport to a placed speaker or remove it.
- **External apps** and **Server:** database status, performance, video relay and the self-test.

The profiler behind `perf` is on by default and costs very little. Turn it off with `Config.Perf.enabled = false` in `config/platform.lua`.

Battery, power and condition changes work wherever the phone is: carried, on a charging pad, on the ground or in a stash.

## Check your installation

About five seconds after Wolfden Phone starts, the console prints a short **boot self-check**: how many checks passed, then one line per problem with how to fix it. It covers the selected framework and inventory, the resource name, the database, the server secret, inventory items (including every item a phone store sells), the media host, the video relay, the phone's files and its language files. Turn it off with `Config.Operations.bootSelfTest = false` in `config/platform.lua`.

For the full report, run this in the server console:

```text
phoneadmin selftest report
```

It is read-only. Each line starts with `[PASS]`, `[WARN]` or `[FAIL]` and the last line is the tally. Besides the boot checks, it compares the database with `install.sql`, reports the optional resources pma-voice and ox_target, and counts phones, lost and stolen phones and backups.

`phoneadmin selftest flows` runs real phone features on throwaway `SELFTEST-` phones, then deletes them. No player's data is touched. `phoneadmin selftest` alone runs both. Run it on a test server after every update.

## Item signatures

Phones, SIM cards and accessories carry an ID in their item metadata. To stop players from forging or editing those IDs, Wolfden Phone signs them with a secret key that only the server knows. A phone with a missing or wrong signature refuses to start: "This phone could not be verified and will not start."

**A fresh install needs nothing.** The secret is created on the first start and kept in the database. Items from `/giveitem`, shops or other resources are signed the first time they are opened or used.

To use your own secret instead, set it in `server.cfg` **before the first start**:

```cfg server.cfg
set wd_phone:secret "at-least-32-random-characters"
```

Always use `set`, never `setr`. Changing the secret later, or moving to another server's database, makes every existing signature invalid, so phones, SIMs and accessories already in use are refused. If you have to change it, run this once in the console while players are online:

```text
phoneadmin signitems
```

It re-signs what online players carry. Items on charging pads, placed speakers and routers are signed again when picked up. Items in stashes, on the ground or with offline players are not reached.

**qb-inventory.** qb-inventory stores the item a player's game sends when it is dropped. A player can hand back a phone with its metadata stripped, and it then starts over as a new phone, without its old data or Activation Lock. Every new phone is logged in the console, and each player can set up at most three new phones per ten minutes. ox_inventory keeps metadata on the server and is not affected.
