Commit graph

179 commits

Author SHA1 Message Date
Slendy
4098a710c3
Fix a kokoism
Move autocorrect attribute to correct input
2023-06-29 00:39:13 -05:00
koko
88f8eec8a0
Do not autocomplete admin command form values (#822) 2023-06-28 22:49:31 +00:00
Slendy
5c66b0f713
Improve input validation for story level moderation 2023-06-26 23:41:30 -05:00
koko
f965be88b7
Website announcements fixes and additions (#818)
* Render line breaks in announcement content

* Track announcement publisher

* Change paragraph tag to a div for consistency

* Fix bottom padding for announcement content

* Track publisher user entity rather than just the username

* Potentially fix a migration failure

* Final code cleanup

* Fix linq statement chaining style

---------

Co-authored-by: Dagg <daggintosh@outlook.com>
2023-06-27 03:02:11 +00:00
Josh
14ebad07f3
Allow moderators to moderate story levels (#809)
* Allow moderators to view story levels on website
Show comments to moderators on in-game story levels that show the levels id

* Only show LH ID comment on the first page
2023-06-26 23:52:15 +00:00
koko
689ebd3791
Optimize GameServer /announce and add website announcements (#810)
* Improve game server announce by using StringBuilder

* Implement web announcements (condensed commit)

* Implement discord webhook support

* Display a separate message if there are no announcements

* Fix announcement string unit tests

* Fix header admin button unit test

* Clarify announcement id variable name

* Increase webhook truncation limit to 250 chars

* Convert announce text to string when returning 200

* Fix announcement unit tests ... again

* Make announcement text input a textarea rather than a simple input

* Fix styling discrepancy

* Clarify submission button

* Improve announcement webhook & set default textarea row amount
2023-06-23 03:49:22 +00:00
Josh
e43397ac6a
Implement property dependency injection for the website (#806)
* Remove most non DI usages of DbContext

* Optimize website queries and refactor startup to use top level statements

* Remove unused functions in UserEntity and SlotEntity

* Optimize LBP1 LevelTags
2023-06-20 05:02:24 +00:00
koko
bf2e36e8a4
Handle edge case bug in banned page (#801) 2023-06-17 04:12:46 +00:00
koko
77e46a0721
Refactor error modal into its own partial (#785)
* Refactor error modal into its own partial

* Fix unresolved error string in TwoFactorPartial

* Use tuple model instead of ViewData for error title and message

* Apply suggestions from code review
2023-06-08 04:01:59 +00:00
koko
2a85b6a136
Disallow moderators/administrators from issuing cases against each other (#781)
* Disallow moderators/administrators from issuing cases against each other

* Resolve suggestions from reviewers

* Only request user from db if id is valid
2023-06-05 21:45:25 +00:00
koko
572c942ee8
Implement pride logo & necessary configuration options (#780)
* Implement pride logo as well as needed configuration option

* Potentially fix issue with icons not rendering

* Fix login form icon and remove unused image from PasswordResetPage
2023-06-02 14:21:56 +00:00
Josh
0c1e350fa3
Rewrite gameserver slot filter system (#763)
* Initial implementation of new slot sorting and filtering system

* Initial implementation of filtering for lbp3 community tab

* Add support for organization on lbp3

* Add playlist and user categories

* Implement unit tests for all filters
Refactor more systems to use PaginationData

* Fix PlayerCountFilter test

* Add more unit tests and integration tests for the filter system

* Fix LBP2 move filter and gameFilterType

* Fix sort by likes in LBP3 category

* Add sort for total plays

* Remove extra whitespace and make styling more consistent

* Order hearted and queued levels by primary key ID

* Fix query without order warnings
2023-05-31 21:33:39 +00:00
Slendy
de228cb242
Fix client side query in BannedPage 2023-05-31 15:12:40 -05:00
koko
b4efba7f14
Patch account suspended page display issues (#777)
Remove excess heading and fix incorrect mod case display
2023-05-31 18:40:58 +00:00
koko
21dbdff20a
Add proper ban page when logging in (#773)
* Add proper ban page upon logging in

* Remove two extra line break tags that don't need to be there

* Fix timestamp formatting

* Properly display timestamps in correct timezone

* Fix formatting issues with ban page

* Remove extra parenthesis which would be rendered on-page

* Add to redirect middleware to prevent navigating to other pages

* Small nitpick, renaming UserBannedPage to BannedUserPage

* Resolve nitpicks from reviewers

* Remove un-necessary log message in LoginForm

* Fix ban reason translatable string argument

* Word choice nitpick ("Ban Created" -> "Ban Issued")

* Final adjustments and nitpicks, visual and grammatical

* Resolve requested changes from reviewers
2023-05-30 19:25:31 +00:00
Slendy
2c69644beb
Allow moderators to access individual reports. 2023-05-26 02:27:11 -05:00
koko
9646dea44a
Fix mod reason/notes overflow issue & show expiration time if applicable (#765)
* Fix mod reason/notes overflow issue & show expiration time if applicable

* Remove extra whitespace

* Wrap using line break instead of overflow scroll bar

* Remove un-required overflow inline style
2023-05-22 01:40:34 +00:00
Josh
1bf4ed6218
Add more unit tests (#757)
* Reorganize tests into unit/integration pattern

* Make DbSets virtual so they can be overridden by tests

* Add MessageControllerTests

* Implement DigestMiddlewareTests

* Refactor SMTPHelper to follow DI pattern which allows for mocking in unit tests.

* Fix MailQueueService service registration and shutdown

* Implement tests for Status and StatisticsController and reorganize tests

* Start working on UserControllerTests

* Start refactoring tests to use In-Memory EF provider

* Refactor integration tests to reset the database every time
Change default unit testing database credentials

* Update credentials to use default root with different passwords

* Throw exception when integration db is not available instead of falling back to in-memory

* Evaluate DbConnected every time

* Remove default DbContext constructor

* Setup DbContexts with options builder

* Convert remaining Moq DbContexts to InMemory ones

* Add more tests and use Assert.IsType for testing status code

* Add collection attribute to LighthouseServerTest

* Remove unused directives and calculate digest in tests

* Fix digest calculation in tests

* Add test database call

* Clear rooms after each test

* Fix CommentControllerTests.cs

* Disable test parallelization for gameserver tests

* Fix failing tests

Fix SlotTests

Make CreateUser actually add user to database

Fix dbConnected Lazy and change expected status codes

Properly Remove fragment from url for digest calculation

Fix digest calculation for regular requests

[skip ci] Remove unused directive

Don't use Database CreateUser function

Get rid of userId argument for generating random user

Rewrite logic for generating random users

Fix integration tests

* Implement changes from self-code review

* Fix registration tests

* Replace MailQueueService usages with IMailService
2023-05-15 15:00:33 -05:00
Josh
3aa9033b67
Rewrite captcha system (#754)
Rewrite captcha and remove many unused directives
2023-04-29 04:32:42 +00:00
koko
586c161c71
String fix with login/register button (#755)
* Display "Login" only when registration is off, remove unused BaseLayoutStrings

* Remove un-used strings from BaseLayout
2023-04-29 03:44:33 +00:00
koko
6f55ce3226
Add basic ability to flag duplicate levels (#753)
* Add the basics for duplicate level flagging

* Use this.BadRequest instead of StatusCode(500)

* Remove redundant slot creator check

* Include creator entity

* Redirect back to slot page for unauthenticated reqs

* Check if reporter = level creator on server side

* A few formatting nitpicks with the webhook

* Move external url config to a shorter var

* Change duplicate flag button icon to a flag

* Remove accidental dollar sign

Co-authored-by: Josh <josh@slendy.pw>

* Remove another accidental dollar sign

Co-authored-by: Josh <josh@slendy.pw>

* Three dollar signs... I'm blind

Co-authored-by: Josh <josh@slendy.pw>

* Update ProjectLighthouse.Servers.Website/Controllers/Moderator/ModerationSlotController.cs

Co-authored-by: Josh <josh@slendy.pw>

---------

Co-authored-by: Josh <josh@slendy.pw>
2023-04-27 02:48:19 +00:00
koko
c50e53ad9a
Display a lock icon next to locked levels (#738)
* Display a lock icon next to locked levels

* C# Return Switch shenanigans

* No clue where that line break came from

* Don't render a semicolon

* Move permission level color/lock icon to website extension

* Simplify GetLevelLockIcon

---------

Co-authored-by: Josh <josh@slendy.pw>
2023-04-11 02:16:03 +00:00
Slendy
d6788f0965
Prevent null values from being censored 2023-04-03 01:02:41 -05:00
Slendy
c34b7f3e79
Revert website Forbid and Unauthorized method usage to StatusCode
This is because by default ASP.NET expects an authentication scheme to be registered when using these methods.
2023-03-30 19:23:11 -05:00
Josh
50d1d9c7e5
Fix doubly sanitized strings (#727)
* Add migration to de-sanitize database strings

* Remove SanitizationHelper functions related to XML sanitization

* Remove sanitization usage from website

* Implement suggested changes
2023-03-30 23:03:08 +00:00
koko
89877d359f
Add comment form max char limit validation (#722)
* Add comment form max char limit validation, minor visual nitpick

* Italicize banned/disabled/etc messages within comments
2023-03-30 06:03:12 +00:00
Josh
329ab66043
Refactor serialization system (#702)
* Initial work for serialization refactor

* Experiment with new naming conventions

* Mostly implement user and slot serialization.
Still needs to be fine tuned to match original implementation
Many things are left in a broken state like website features/api endpoints/lbp3 categories

* Fix release building

* Migrate scores, reviews, and more to new serialization system.
Many things are still broken but progress is steadily being made

* Fix Api responses and migrate serialization for most types

* Make serialization better and fix bugs
Fix recursive PrepareSerialization when recursive item is set during root item's PrepareSerialization, items, should be properly indexed in order but it's only tested to 1 level of recursion

* Fix review serialization

* Fix user serialization producing malformed SQL query

* Remove DefaultIfEmpty query

* MariaDB doesn't like double nested queries

* Fix LBP1 tag counter

* Implement lbp3 categories and add better deserialization handling

* Implement expression tree caching to speed up reflection and write new serializer tests

* Remove Game column from UserEntity and rename DatabaseContextModelSnapshot.cs back to DatabaseModelSnapshot.cs

* Make UserEntity username not required

* Fix recursive serialization of lists and add relevant unit tests

* Actually commit the migration

* Fix LocationTests to use new deserialization class

* Fix comments not serializing the right author username

* Replace all occurrences of StatusCode with their respective ASP.NET named result
instead of StatusCode(403) everything is now in the form of Forbid()

* Fix SlotBase.ConvertToEntity and LocationTests

* Fix compilation error

* Give Location a default value in GameUserSlot and GameUser

* Reimplement stubbed website functions

* Convert grief reports to new serialization system

* Update DatabaseModelSnapshot and bump dotnet tool version

* Remove unused directives

* Fix broken type reference

* Fix rated comments on website

* Don't include banned users in website comments

* Optimize score submission

* Fix slot id calculating in in-game comment posting

* Move serialization interfaces to types folder and add more documentation

* Allow uploading of versus scores
2023-03-28 00:39:54 +00:00
Dagg
307b2135a3
Potentially fix score sorting issue (#721)
Update SlotPage.cshtml.cs

lel
2023-03-27 23:34:12 +00:00
koko
05b71b0d22
Add admin/mod badges on UserCardPartial (#697)
* Add admin/mod badges to UserCardPartial

* Correct vertical alignment of badges

* Move most of styling to stylesheet, lazy but it works

* Implement more modular role coloring for UserLinkPartial and UserCardPartial

---------

Co-authored-by: Slendy <josh@slendy.pw>
2023-03-10 21:17:44 +00:00
Josh
017dcd6888
Make PhotoSubjects use a one to many relationship (#687)
* Attempt to remodel PhotoSubject and Photo relationship

* Fix migration name

* Use exactName for migration lock

* Revert "Use exactName for migration lock"

This reverts commit 76cee6a3ff.

* Set command timeout to 5 minutes for database migrations

* Delete unused PhotoSubjects in migration

* Clean up website queries and finalize subject refactor

* Add migration to remove PhotoSubjectCollection

* Add grace period for container startup and optimize startup

* Make config backup copy original file

* Allow docker entrypoint to fix data permissions
2023-02-24 04:20:55 +00:00
Josh
64b95e807d
Refactor Database class (#616)
Refactor Database into DatabaseContext
Moved into separate folder so it actually has a namespace instead sitting in the root
2023-02-15 23:54:30 -06:00
Josh
f1c5ad4002
Major refactor and reorganization of types (#652)
* Start of reorganization and cleanup

* Remove duplicate title id

* Refactor types

* Fix Release building

* Move classes in /Types to a Types namespace

* Fix compilation error (RoomVisualizerPage strikes again)

* Fix bugs created from auto merge

* Fix auto-merge compilation error

* Changes from review/fix failed merge
2023-02-13 22:02:58 -06:00
Slendy
e93aea1977
Trim empty entries in string split calls 2023-02-11 21:12:10 -06:00
koko
30cffef2f2
Highlight moderator/administrator user account links (#670) 2023-02-12 01:32:01 +00:00
Zaprit
96c34c83a7
Feature/user blocking hotfix 1 (#668)
* Changed CommentController to use an AsyncEnumerable to attempt to fix the current issue

* Made comments & reviews from blocked users on levels not appear
2023-02-11 17:30:27 -05:00
Zaprit
3fcfaaf5cc
Profile Blocking (#662)
* Added blocked user DB object

* Added user blocking functions

* Fixed DB Migration

* Updated DB Functions

* Added blocked user support to website

* Fixed DB Migration

* I forgot to save 🫠

* More migration pain

* Fixed Unblock label

* Update ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml

sounds cool

Co-authored-by: koko <68549366+sudokoko@users.noreply.github.com>

* Removed unnecessary imports in database

* Removed unnecessary  imports in UserPage.cshtml.cs

* Made comments in-game respect blocked users

* Update ProjectLighthouse/Database.cs

Co-authored-by: Josh <josh@slendy.pw>

* Update ProjectLighthouse/Database.cs

Co-authored-by: Josh <josh@slendy.pw>

* DB Code cleanup

* Cleaned up userPage block detection code

* Get only the creator id in lieu of the whole object

* Fixed null condition when not logged in

* Fixed null condition when not logged in

* Potential DB Optimisation

* Apply suggestions from code review

Co-authored-by: Josh <josh@slendy.pw>

* Fix errors and null warning

* Use explicit type in lieu of var

* changed block icons

* Optimize blocked user check and save changes when unblocking

---------

Co-authored-by: koko <68549366+sudokoko@users.noreply.github.com>
Co-authored-by: Josh <josh@slendy.pw>
2023-02-11 08:25:06 +00:00
koko
b4326d4798
Link to reviewer in card and pad labels (#657)
* Link to reviewer in card and pad labels

* Update LICENSE to fill in placeholders

The licensor placeholders at the bottom were left untouched so I filled in the information.

* Revert LICENSE change

* Update LICENSE
2023-02-08 15:34:49 -06:00
Josh
4559d26a54
Fix bug where users can't be deleted (#648)
* Add username to mod cases if user is deleted

* Add timezone package to docker container

* Remove extra space in migration sql statement

* Changes from self-review
2023-01-29 22:10:36 -06:00
koko
2c2f31ad38
Website visual QOL changes (#651)
* Website visual QOL changes

* Remove resource wording from 404

Co-authored-by: Josh <josh@slendy.pw>

* Moderation case type clarity change

* Re-arrange how comments are hidden if banned

* Revert CommentsPartial change

* 404 changes

* Change public ban "reason" message to be more generic

* Update ProjectLighthouse.Servers.Website/Pages/UserPage.cshtml

Co-authored-by: Josh <josh@slendy.pw>

* Remove duplicated elements

---------

Co-authored-by: Josh <josh@slendy.pw>
2023-01-29 18:58:05 -06:00
Slendy
0e98dd4390
Fix broken redirects in website login 2023-01-29 01:13:16 -06:00
Slendy
e061987165
Revert PRs #646 and #647 2023-01-26 19:45:20 -06:00
koko
d119bacd77
Fix >50 comments message 2023-01-26 19:58:30 -05:00
koko
d44fb89b03
Fix comments not being disabled if banned 2023-01-26 19:42:59 -05:00
koko
141d955f52
Website QOL Changes (#646)
so Mike stops complaining about the neglected mod menu - sudokoko

Co-authored-by: Dagg <daggintosh@outlook.com>
2023-01-26 23:29:54 +00:00
HomicidalChicken
326b9e5529
Move filter to separate config and add more scanning (#603)
* Create .gitattributes

Added a .gitattributes file that excludes the local customWordFilter.txt file from merged updates, allowing server operators to maintain their own word filter list and not have it overwritten.

* Update .gitignore

Added chatCensoredList to gitignore

* Update .gitignore

* Dynamic censor list file changes

Removed .gitattributes file, attempted to make chatCensoredList.txt into a dynamic file loaded at runtime instead.

* Added additional censorship coverage

Censorship now covers:
Level titles
Level descriptions
Reviews
Comments

* Delete chatCensoredList.txt

* Update .gitignore

Co-authored-by: Josh <josh@slendy.pw>

* Update filter verbiage

* Update ProjectLighthouse.Servers.GameServer/Controllers/CommentController.cs

Co-authored-by: Josh <josh@slendy.pw>

* Update ProjectLighthouse/Helpers/CensorHelper.cs

Co-authored-by: Josh <josh@slendy.pw>

* Add CensorConfiguration and add more filters

Co-authored-by: Josh <josh@slendy.pw>
2023-01-19 21:24:45 -06:00
Slendy
7358a7ac45
Fix password reset page 2023-01-10 21:17:46 -06:00
Josh
b5877bc10c
Remove duplicate scores (#622)
* Remove duplicate scores

* Optimize score migration
2023-01-10 17:36:43 -06:00
Josh
7d187ee982
Change login UI and improve email setup flow (#619)
* Rework login UI design and change email setup flow

* Remove unused middleware

* Fix button not lining up with input fields
2023-01-09 19:43:56 -06:00
Slendy
337124690d
Order hearted and queued levels by most recent first 2023-01-04 20:17:26 -06:00
Slendy
cf1769ca77
Rework the flow of setting email from the website 2023-01-02 02:23:14 -06:00