-
Notifications
You must be signed in to change notification settings - Fork 77
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat/vip list overhaul #964
Draft
cemathey
wants to merge
29
commits into
master
Choose a base branch
from
feat/vip_list_overhaul
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Conversation
This file contains 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
…s not already VIP on the game server
… server the profile was fetched from
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.
tl;dr this overhauls the VIP system to be very similar to how blacklists work and handles keeping CRCON in synch with the connected game servers.
VIP Lists
Just like a blacklist; a server can have
1
or more VIP list and players can have0
or more VIP records.A record can be
active
orinactive
, and a record can either have an expiration (expires_at
), or anull
value which will never expire.A VIP list has a
sync
method which is eitherIGNORE_UNKNOWN
(the default) orREMOVE_UNKNOWN
to handle players with VIP on the game server that aren't on any VIP list. Since some communities use BattleMetrics or other external tooling to manage VIP; we don't want to override those unless they specifically choose to.If ANY list on the server is set to
IGNORE_UNKNOWN
then all unknown VIPs on the game server are ignored regardless of the other lists settings because of how we synchronize lists with the game server.There is a
vip_lists
service which runs for each game server that listens (just like the blacklists) forredis
pub/sub commands when lists or records are added/edited/deleted.There is now a new
cron
task that runs every 5-7 minutes (randomized since it will run once per container; but records are global across CRCON, it's probably fine if they run consecutively but this should avoid any potential conflicts) that willinactivate
any expired records.The old expiring VIP service and configuration has been removed because it's redundant.
Old Style VIP Lists
Old style VIP lists can still be imported using the
convert_old_style_vip_records
endpoint which will parse them and add them to the specified VIP list.The endpoints/internal code for uploading/downloading lists have been removed; they're no longer necessary and there are endpoints for adding/removing VIP list records in bulk; lists and their records can be exported through the API.
TODO: the UI needs to be updated to allow importing old style VIP lists
Game Server VIP vs. VIP Lists
Unlike blacklists; VIP is meaningless unless it is active on the game server; the game server and a list should never be out of synch since they are synched on CRCON startup, when records are created/edited/deleted and every 5-7 minutes.
But some communities use external (non CRCON) tools to manage or supplement their VIP such as BattleMetrics, so we still need to indicate if a player has VIP on the game server, but also indicate and distinguish when they have VIP from a VIP list.
/api/get_vip_ids
will still pull VIP status from the game server but will augment it with the VIP records and return the list with anexpires_at
field for each player; if they have VIP on the game server but no VIP records it isnull
or it contains their highest expiration date from all of their VIP records (null
or a string timestamp2025-02-22T19:25:33.186398+00:00
)TODO: the UI needs to be updated to account for this; and the API needs to be updated/tweaked to reflect both of these values
API Endpoint Changes
Modified Endpoints
add_vip
no longer accepts anexpiration
parameter (this should now be handled with the VIP list endpoints) and will validate player IDs (steam/win store formats)get_players_by_appearance
now acceptsis_vip
for searching for players with an active and non-expired VIP list recordget_players_by_appearance
no longer returns thevip_expiration
key/value pairNew Endpoints
add_vip_list_record
bulk_add_vip_list_records
bulk_edit_vip_list_records
bulk_delete_vip_list_records
bulk_add_vips
bulk_remove_vips
convert_old_style_vip_records
create_vip_list
delete_vip_list
delete_vip_list_record
edit_vip_list
edit_vip_list_record
extend_vip_duration
get_active_vip_records
get_all_vip_records_for_server
get_inactive_vip_records
get_player_vip_records
get_vip_list
get_vip_list_records
get_vip_lists
get_vip_lists_for_server
get_vip_record
get_vip_status_for_player_ids
inactivate_expired_vip_records
revoke_all_vip
synchronize_with_game_server
Removed Endpoints
describe_expired_vip_config
download_vips
get_expired_vip_config
set_expired_vip_config
upload_vips
upload_vips_result
validate_expired_vip_config
Permission Changes
New Permissions
can_view_vip_lists
can_create_vip_lists
can_change_vip_lists
can_delete_vip_lists
can_change_vip_list_records
can_add_vip_list_records
can_change_vip_list_records
can_delete_vip_lists_records
Removed Permissions
can_change_expired_vip_config
can_view_expired_vip_config
Database Changes
The database migration that creates the new tables (
vip_list
andvip_list_record
) creates two lists (IDs of0
and1
respectively) for a generic default list; and a Seed VIP list. The list ID of0
cannot be deleted, people can choose to delete the Seed VIP list.The
player_vip
table (previously stored VIP expiration dates for players with VIP on the game server) is deleted and records from it are converted to vip list records and added to the default (ID of0
) VIP list.Since
player_vip
stored entries per game server; records are merged and one record is created per player using the highest expiration date they had amongst all the servers.The
PlayerID
model (steam_id_64
table) now hasemail
anddiscord_id
columns which are used by the VIP list endpoints to allow communities to better manage their VIP records; as well as support communities that use Discord with their external tools.steam_id_64
table (PlayerID
model)email
column addeddiscord_id
column addedvips
renamed tovip_lists
vip
property removedType Changes
PlayerProfileType
vips
removedvip_lists
addedis_vip
addedemail
addeddiscord_id
added.is_vip
added (True
/False
for if the player has VIP (according to VIP list records) on the server the profile was fetched for)VipIdType
This was renamed to
VipIdWithExpirationType
expiration
renamed toexpires_at
Seed VIP
SeedVIPUserConfig
addsvip_list_id
propertySeed VIP uses the new list system and defers game server modifications to the VIP list handler.
The default configuration uses a list ID of
1
(which is created during the database migration).Since VIP is so important; if the configured list does not exist a new one will be created and their config updated.
Players who earn VIP will either have their existing record on the Seed VIP list updated to their new expiration timestamp, or a new record created if they don't have one.
Upgrade Steps
supervisord.conf
If your
supervisord.conf
has local modifications:Remove:
Add:
crontab
If your
crontab
has local modifications, add the following job:*/5 * * * * /code/manage.py inactivate_expired_vip_records
Update
Then perform a standard upgrade
Sample Data
get_player_profile.json
new_endpoints.json