Skip to content
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

Allow configuring center_projectiles clientpref from site settings #536

Merged
merged 3 commits into from
Jun 2, 2024

Conversation

Gcommer
Copy link
Contributor

@Gcommer Gcommer commented May 26, 2024

Part of #373

Allows configuring tf2centerprojectiles from the user settings page.

The visual UI changes and new DB queries are both gated behind a new config flag, as this requires some annoying sourcemod setup... we may need some amendments to this if you are segmenting your sourcemod tables in a different db schema.

The queries are a bit icky but are intended to be easy to add support for more clientprefs down the line (ie #520)

Tested: with the new config flag disabled, the settings page looks the same as on master. With the new config flag, there is a new accordion+checkbox which reads/updates the sm_cookie_cache table correctly. Updating the setting then joining a server results in the client getting the new setting.


Clientprefs sql init does create an SQL function for updating cookies. I avoided it because A) my query seems simpler and maybe faster when updating multiple cookies and B) there is no similar function for reading cookie values, so we have to interact with the tables directly anyways.

My biggest annoyance with this feature is that sourcemod caches cookies locally and delays writing updates to cookies. So a user who is ingame won't see a change to the website take effect right away. And trying to change the same setting ingame+on the website at the same time will be full of race conditions.

@Gcommer Gcommer mentioned this pull request May 26, 2024
@leighmacdonald
Copy link
Owner

Presumably you ran into the same issue i did yesterday, which is that the pgsql sourcemod driver is built against pg v9 which does not support the newer SCRAM based authentication method that basically everybody uses at this point, as it was introduced in v10. Did you downgrade your authentication method to md5? Or did you somehow get this working some other way?

I was thinking about going through the trouble of updating the sourcemod driver to v12, as its the newest version available in ubuntu 20.04, which i think is the oldest platform they target, though its statically linked, so it really shouldn't matter.

@Gcommer
Copy link
Contributor Author

Gcommer commented May 27, 2024

Yeah I downgraded to md5, mostly a matter of touching pg_hba.conf, postgres.conf, and resetting passwords. Also had to grant the gbans server's db user permissions on the sm_cookies and sm_cookie_cache tables.

@leighmacdonald
Copy link
Owner

These looks good, ill wait to merge this and the motd one until the next version so i have a bit more time to deal with the pg changes. Don't worry about fixing the conflicts since there is a fair amount of them introduced, ill take care of them before merging.

@leighmacdonald
Copy link
Owner

Added the create tables calls to the migrations so they are always available and do not require the database role accessing those tables to have the create table privilege.

Updated settings page for new layout.

@leighmacdonald leighmacdonald merged commit e0ae2f5 into leighmacdonald:master Jun 2, 2024
8 checks passed
@Gcommer Gcommer deleted the clientprefs branch June 3, 2024 22:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants