Repository navigation
Let in approved players only, and close the server for maintenance to all but a list, under another name in the server list, in contract 6 - #60
Merged
Conversation
…nce to all but a list, under another name in the server list
# Conflicts: # crates/fake-fxserver/tests/runtime.rs
# Conflicts: # crates/observer-domain/src/audit.rs # crates/observer-domain/src/live.rs # crates/observer-domain/src/permissions.rs # crates/observer-web/src/error.rs # crates/observer-web/src/live/topics.rs # web/src/api/generated/AuditAction.ts # web/src/api/generated/ErrorCode.ts # web/src/api/generated/Permission.ts # web/src/api/generated/Topic.ts # web/src/api/generated/TopicEvent.ts # web/src/api/generated/TopicSnapshot.ts # web/src/i18n/en.ts # web/src/live/messages.ts
# Conflicts: # crates/fake-fxserver/tests/runtime.rs # crates/observer-domain/src/audit.rs # crates/observer-domain/src/live.rs # crates/observer-domain/src/permissions.rs # crates/observer-fxserver/src/bridge.rs # crates/observer-web/src/lib.rs # crates/observer-web/src/live/topics.rs # crates/observer-web/src/tests.rs # crates/observer/src/run.rs # resource/observer/server.lua # web/src/api/generated/AuditAction.ts # web/src/api/generated/ErrorCode.ts # web/src/api/generated/Permission.ts # web/src/api/generated/Topic.ts # web/src/api/generated/TopicEvent.ts # web/src/api/generated/TopicSnapshot.ts # web/src/i18n/en.ts # web/src/live/messages.ts
# Conflicts: # README.md # crates/fake-fxserver/src/main.rs # crates/fake-fxserver/tests/runtime.rs # crates/observer-app/src/bans.rs # crates/observer-domain/src/audit.rs # crates/observer-domain/src/bans.rs # crates/observer-domain/src/error.rs # crates/observer-domain/src/permissions.rs # crates/observer-fxserver/src/bridge.rs # crates/observer-fxserver/src/stdin.rs # crates/observer-web/src/api.rs # crates/observer-web/src/error.rs # crates/observer-web/src/lib.rs # crates/observer-web/src/tests.rs # crates/observer/src/run.rs # resource/CONTRACT.md # resource/observer/server.lua # resource/observer_example/server.lua # web/src/api/generated/AuditAction.ts # web/src/api/generated/ErrorCode.ts # web/src/api/generated/Permission.ts # web/src/i18n/en.ts # web/src/live/messages.ts # web/src/settings/Bans.tsx # web/src/settings/catalog.ts
# Conflicts: # crates/observer-domain/src/audit.rs # crates/observer-domain/src/permissions.rs # crates/observer-store/src/migrations.rs # web/src/api/generated/AuditAction.ts # web/src/api/generated/Permission.ts # web/src/audit/details.ts # web/src/i18n/en.ts # web/src/settings/Bans.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
One commit, then six merges of
main: #56; #57, after whichALLOWLIST_MANAGEmoved from bit 26 to bit 27; #59; #61, after which it moved to bit 29; #58, after which it moved to bit 32 and contract 6 follows the kick's 5; #62, which took bit 32 and migration0019first, after which it moved to bit 33 and the migrations to0020and0021. In between,500603fopened the topics kept in a watch through one helper, so thatopen()inlive/topics.rsstayed within clippy's 100 lines; #61 brought a helper of its own for the same,followed, which the merge keeps in its place. Last,1dc1b89writes every message the owner writes for players in the editor #58 brought, filled by one helper,0cc30bcstops the bans' refusal message from calling itself, with the kick's, all the text players read, and2ff56fbgives Maintenance a row of its own in the status card on phones, where it no longer fits beside Restart, Stop and the kick's menu. Who gets in is now decided at connection by one service: a ban first, then maintenance mode, then the allowlist. The allowlist lets in only the players the staff approved, and a refused player reads the owner's message with the ID of their request. Maintenance mode closes the server to all but a list of players, holds through restarts of FXServer and of Observer, and gives the server another name in FiveM's server list meanwhile. The bridge's contract goes to 6.What changed
Admission (
021f3a1)observer-app(admission): one service answers each player the bridge holds atplayerConnecting: a ban first, then maintenance mode, then the allowlist. The bans' task no longer answersconnecting; it still checks players again once they joined. Inbans.rs, only that path changed (Seenandrefusalare nowpub(crate)).server.admission:{ allowlist: { enabled, waiting, approved }, maintenance: { on, since, by, passes } }, forDASHBOARD_VIEW,PLAYERS_VIEWorSERVER_CONTROL.Allowlist
observer-domain(allowlist): the settings (on or off, and the refusal message, with{id}and{name}), request IDs such as7KQ-2XPfrom the bans' alphabet, the search. Migration0020_allowlist.sql: approvals, and requests, one per licence, the 2,000 tried last kept.observer-web:GET /servers/default/allowlist/requestsandGET …/approved(PLAYERS_VIEW);POST …/requests/{code}/approve,DELETE …/requests/{code},POST …/requests/deny,POST …/approvedandDELETE …/approved/{id}(ALLOWLIST_MANAGE, permission bit 33, sensitive, impliesPLAYERS_VIEW);GETandPUT …/allowlist/settings(SETTINGS_VIEW,SETTINGS_MANAGEwith the password again). Audit actionsallowlist_request_approved,allowlist_request_denied,allowlist_requests_denied,allowlist_licence_approved,allowlist_approval_removed,allowlist_settings_changed. Error codesallowlist_request_not_found,approval_not_found,already_approved,invalid_approval,invalid_allowlist_settings.Maintenance mode
observer-domain(maintenance): the message, with{name}. Whether it is on, since when and by whom live insettings, so it holds through restarts of FXServer and of Observer. Migration0021_maintenance.sql: the players who still get in, 200 at most, by licence.observer-web:GETandPUT /servers/default/maintenance(SERVER_CONTROL: the message players will read, and the switch);GETandPUT …/maintenance/settings,GETandPOST …/maintenance/passes,DELETE …/maintenance/passes/{id}(SETTINGS_VIEW,SETTINGS_MANAGEwith the password again). Audit actionsmaintenance_started,maintenance_ended,maintenance_pass_added,maintenance_pass_removed,maintenance_settings_changed. Error codespass_not_found,pass_exists,invalid_pass,too_many_passes,invalid_maintenance_settings.The server's name in FiveM's server list
observer-fxserver:BridgeAction::ServerName. While maintenance is on, the bridge setssv_hostname, andsv_projectNamewhen the server has one, to the name the owner chose, keeps what they held in three server convars of its own (observer_name_kept,observer_name_hostname,observer_name_project), and gives both back when it ends. The name travels hex-encoded inobserver_cmd, as every bridge action: no text the owner typed reaches FXServer's console. After a start during maintenance, it is sent again once the server is online, the cfg having given the server its own names.observer-fxserver(supervisor):/info.jsonis read once a run; the name the bridge gave for maintenance is not taken for the server's own name in the panel.Contract 6 (
resource/)observer:playerRefusedsays what refused the player, incause:ban,maintenanceorallowlist.ban,reason,endsAtandbycome with a ban only,requestwith the allowlist.observer:maintenance(on,at,by), raised at each switch and again at each start of FXServer while maintenance is on.CONTRACT.md,observer_exampleand the README follow.Shared pieces of the panel
settings/MessageEditor.tsx, which Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58 brought for the bans' and the kick's messages, now writes the allowlist's and maintenance's too (1dc1b89). It takes what goes between the placeholders and the preview, the allowlist's warning when its message lacks{id}, and shows the preview withcomponents/MessagePreview.tsx, which the maintenance dialog shows too. This branch's own field for the same,MessageField, is gone.lib/fill.tsfills every owner message, in place of the bans'fillMessageand the kick'sfillKickMessage.Noticetakes an icon.Notes for review
0020and0021, contract 6. Follow the server's resources on a Resources page, and start, stop, restart or rescan them #57 took bit 26, List the server's entities, draw them on the live map and delete them a hundred at a time #61 bits 27 and 28, Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58 bits 29 to 31 and contract 5, Keep ban templates for the ban dialog, and edit an active ban under a permission of its own #62 bit 32 and migration0019first, so this branch moved to bit 33 and migrations0020and0021, and contract 6 follows 5. Let server resources hold a stop until they have saved, in contract 7 #55 (contract 7, migration0019) took some of the same: it renumbers its own once this one is merged, to migration0022.b7b8380): the admission answers at connection in place of the bans, so Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58's two tests inruntime.rsthat connect a player throughplayerConnectingstart it too (admission_over).BridgeAction::fitted()keeps Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58's order, tokens and then identifiers first, and cuts what each refusal's event holds of typed text. The allowlist's and maintenance's settings take Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58'sclean_message(text, max)andfill(…, max_bytes).7e61e7a): the migrations are renamed0020_allowlist.sqland0021_maintenance.sql, unchanged, after Keep ban templates for the ban dialog, and edit an active ban under a permission of its own #62's0019;ALLOWLIST_MANAGEtakes bit 33. Settings → Bans and kicks keeps Keep ban templates for the ban dialog, and edit an active ban under a permission of its own #62's ban templates beside the shared message editor.2ff56fb,shell.cssand one class); wider, nothing changed.observer-app/src/admission.rsis best read besidebans.rs, whose verdict at connection it took over.main: disconnecting, when maintenance turns on, the connected players who are not on the list, and checking players again atjoinagainst maintenance and the allowlist. Until then, a player let in because Observer did not answer within 5 seconds stays, and turning the allowlist or maintenance on drops no one; the README and the contract say so.5c3065c2, build 38435): the list drawsprojectName, or elsehostname;SET_CONVARandSET_CONVAR_SERVER_INFOrunsetandsets; the heartbeat goes every 3 minutes, and 15 seconds after a player connects or leaves.Verified
cargo xtask checkin one run on2ff56fb: fmt, icons, clippy with and withouttest-catalog, every test, bindings, then the panel (format, lint, typecheck, 950 tests, build). It also passed in one run on the merge7e61e7aand on0cc30bc, before Keep ban templates for the ban dialog, and edit an active ban under a permission of its own #62 (930 panel tests), and the panel's checks passed on the mergeb7b8380alone.cargo xtask e2e's flows on7e61e7aand on0cc30bc: 12 passed each time, Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58's kick flow among them, the 2 Linux ones skipped;2ff56fbchanges nothing above 760 px, the flows' width being 1440. Run with the Chromium 1248 already on this host instead of the one Playwright 1.65 downloads.0cc30bc, in the lab at 1440 px: Settings → Bans and kicks and Allowlist in the dark theme, Maintenance mode in the light one. Each message editor inserts its placeholders at the caret and fills its preview, and the allowlist's warning for a message without{id}shows between the two. No error in the console.7e61e7a, in a lab set up afresh, its migrations0019to0021applied in order: Settings → Bans and kicks with two ban templates, at 1440 px in the dark theme and at 375 px in the light one, which showed the status card overflowing. With2ff56fb's panel, its buttons measured within it at 375 px (317 px of 317), and on one row at 1440.a_start_is_followed_through_the_commands_of_its_cfg(a resource measured at 1798 ms against its 1800; its binary passed twice onmainalone, then twice on this branch once the load fell),a_restart_never_waits_past_its_limit_and_the_dump_still_ends(3.9 s against its 3),markup_that_never_closes_is_read_quickly(7.5 s against its 5), anda_check_that_reaches_nothing_says_so_rather_than_fail, which expects nothing on port 41977 while a release server answered there. On2ff56fb, one panel test failed in one of three runs ofnpm testwhile other sessions loaded the host, its output not kept; the next two runs passed 950 of 950, and so didcargo xtask check's.crates/fake-fxserver/tests/runtime.rs: a player refused by the allowlist gets in once approved; maintenance refuses all but its list and is raised again at the next start; the server carries its maintenance name in/info.jsonand/dynamic.json, again after a restart, and gets its own back; a banned player is refused at connection through the admission, and Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58's kicks, announcements, messages and txAdmin events pass beside it.021f3a1, an Observer with the fake FXServer, in both themes at 1440 and 375 px: refusals with the request ID, the same ID on each try, entry after approval; maintenance turned on and off from the panel, the banner, the list, the audit entries; the names during maintenance, after a restart and after it ends; the rail keeping the server's own name.lua-language-server --check) after the merge with Kick a player or everyone, and raise announcements and direct messages for the server's resources, in contract 5 #58, which runs none of it.main): everything above ran locally.Not verified
deferrals.done(message)for the three refusals,observer:maintenance,SetConvarandSetConvarServerInfoon the names.