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

feat: custom ban deferral cards with images/customisation supported #821

Merged
merged 11 commits into from
Mar 11, 2024

Conversation

Gravxd
Copy link
Contributor

@Gravxd Gravxd commented Jan 29, 2024

NEW Ban Deferral Cards

This update brings more customisation, improved UI/branding for server owners as well as just an overall nice addition for EasyAdmin's branding.

Before:
FiveM_b2699_GTAProcess_C5RjUjyJ2p

After:
FiveM_b2699_GTAProcess_zau36aBGjT

This change also solves or at least contributes some functionality to an original idea/"to-do" item from #419

New Convars
On the documentation for installation, we have sections such as Administration Configuration & Bot Configuration, I would suggest a new section for Ban Message Configuration or something similar - just a food for thought for ease of use.

set ea_banMessageTitleColour "#ff0000"
This allows you to change the server name title colour, defaults to "#354557" (easyadmin colour)

ea_banMessageServerName "EasyAdmin Roleplay"
Pretty self explanatory, you can add your server name here as an owner to show at the top. Defaults to "sv_projectName"

Replaced with pulling the server name from the sv_projectName convar.

ea_banMessageShowStaff "true/false"
Whether or not to show a banned player who they are banned by - simply added because some servers may not want to open that staff member up to harassment or whatever it may be - again, another customisation option for server owners. Defaults to true.

ea_banMessageFooter "You can appeal this ban by visiting example.com"
Defaults to "You can appeal this by ban by visiting our discord." - server owners can change this to their forums, website, discord whatever they want, as it's HTML markdown, it's also clickable which gives nice ease of access straight to a ban appeal form. (direct reference to #419)

ea_banMessageSubHeader "You Have Been Expelled From This City"
Defaults to "You have been banned from this server." - Some servers may want this message to fit their branding etc, something to make it easier as people that want to change these messages will try to hardcode change which makes updating more complicated and annoying.

With this change, normally the ban reason would be test ( Nickname: ~u~Player ), Banned by: Grav however i used a simple function to remove the suffix (end of string) so that we can display the staff member in a separate row to clean it up (with the added option to hide staff names) - this change is only on this deferral card and does not change any other logic in the easyadmin ban system.

Thank you for reading - hopefully this can be another good addition and improvement to this resource. :)

Copy link
Owner

@Blumlaut Blumlaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks great! some code changes i'd like to see though, currently it would break on non-english locales which is kind of a big deal

server/admin_server.lua Outdated Show resolved Hide resolved
server/admin_server.lua Outdated Show resolved Hide resolved
server/admin_server.lua Outdated Show resolved Hide resolved
server/admin_server.lua Outdated Show resolved Hide resolved
Copy link
Contributor Author

@Gravxd Gravxd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a third party url isn't really much of a chance, most server owners will (or should ) use the new convars to form better server branding - larger applications such as txadmin (bundled with fxserver) pull user-display images through FIveM's deferral system in IMGUR//external PNG host formats as i'm not actually sure you can reference a local SVG/PNG file. - if you can, welcome to change obviously.

@Gravxd
Copy link
Contributor Author

Gravxd commented Jan 29, 2024

Convar added in above commit:
ea_banMessageWatermark "logo-url-here" - defaults to an easyadmin banner.

@Gravxd
Copy link
Contributor Author

Gravxd commented Jan 30, 2024

The changes above should solve the code breaking aspect as it will now with each language - i honestly spent a lot of time looking for a better way to achieve the desired result but ended up settling on this so if there's a better way any suggestions are welcome.

server/admin_server.lua Outdated Show resolved Hide resolved
language/en.json Outdated Show resolved Hide resolved
@github-actions github-actions bot added the Stale label Feb 7, 2024
@Gravxd
Copy link
Contributor Author

Gravxd commented Feb 10, 2024

Apologies for delay - practically had to overhaul entire setup with new computer//internet and had to wait to get back a lot of files etc - changes have been corrected using regex to be compatible with all languages - thanks for your patience

@github-actions github-actions bot removed the Stale label Feb 12, 2024
@github-actions github-actions bot added the Stale label Feb 20, 2024
@github-actions github-actions bot closed this Mar 5, 2024
@Gravxd
Copy link
Contributor Author

Gravxd commented Mar 5, 2024

Any chance of this being merged or should we close out?

@Blumlaut Blumlaut reopened this Mar 5, 2024
@Blumlaut
Copy link
Owner

Blumlaut commented Mar 5, 2024

haven't been near a fivem compatible computer for a while, can I merge this blindly? if so I might just do that..

@github-actions github-actions bot removed the Stale label Mar 6, 2024
Copy link
Owner

@Blumlaut Blumlaut left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good apart from that function that seemingly never gets referenced, i'll merge it once thats addressed

shared/util_shared.lua Outdated Show resolved Hide resolved
@Gravxd
Copy link
Contributor Author

Gravxd commented Mar 11, 2024

Unused function removed - should be all good

@Blumlaut
Copy link
Owner

perfect! merging this then.

@Blumlaut Blumlaut merged commit 7307623 into Blumlaut:master Mar 11, 2024
1 check failed
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.

2 participants