Commit graph

152 commits

Author SHA1 Message Date
Slendy
f0a1826b85
Only update score timestamps when you get more points 2023-08-28 16:32:58 -05:00
Josh
a316c866c5
Add proper relationships to Comments (#838)
* Add specific foreign keys for comment targets

* Remove inheritdoc tags from migration

* Fix punctuation of deleted comment message and add mod deletion message

* Fix broken merge

* Cleanup comment queries
2023-08-24 18:58:03 +00:00
Josh
70a66e6034
Migrate scores to use proper relationships (#830)
* Initial work for score migration

* Finish score migration

* Implement suggested changes from code review

* Make Score Timestamp default the current time

* Chunk insertions to reduce packet size and give all scores the same Timestamp

* Fix serialization of GameScore

* Break score ties by time then scoreId

* Make lighthouse score migration not dependent on current score implementation
2023-08-19 07:32:38 +00:00
Slendy
1c00db53ae
Fix photo upload timestamp regression 2023-07-18 01:28:31 -05:00
koko
25bb2ecfc1
Add the ability for moderators to forcibly lock levels (#831)
* Add the ability for moderators to forcibly lock levels

* Prevent forcibly locking an already locked level

I had to rollback and re-commit this because I was getting some weird error within Rider.

* Correct moderation notice header styling & remove errant text
2023-07-07 22:44:05 +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
Slendy
3b0c0c9b0e
Fix score parsing for versus scores 2023-06-26 18:50:38 -05: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
Slendy
ab98da42c3
Fix LBP2 recently played for story levels 2023-06-20 02:16:48 -05: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
e5cfeb1e39
Censor filter logging improvements (#804)
* Move censor/msg logging to MessageController & separate LogAreas/config

* Correct LBP character limit to 95

* Log filtered comments as well

* Remove two unnecessary variables from CensorHelper

* Add censor logging to SlotPage/UserPage controllers and improve logging slightly

* Remove accidental dollar sign in log

* Grammatical nitpick in CommentController.cs

* Contextual nitpick in MessageController.cs

* Add escaped quotes in CommentController log to match the rest

* Increase limit to account for descriptions, magic mouth, etc.

* Consolidate LogChatMessages logging into Filter log area to prevent confusion

* Apply code review suggestions
2023-06-18 23:39:39 +00:00
Slendy
91e792aea0
Fix level ordering in busiest slots 2023-06-14 11:16:16 -05:00
Slendy
8b0aed9a61
Fix level photos by author 2023-06-06 23:30:37 -05:00
Slendy
d4b9ca666b
Add ordering to LBP2 search 2023-06-06 23:16:54 -05:00
Josh
a69d94054b
Simplify filters and make cross control slots not show by default (#782)
* Simplify filters and make cross control slots not show by default
Also sort author levels by oldest levels first rather than newest levels first.

* Fix unit test expecting slots to sorted by timestamp descending

* Remove errant whitespace
2023-06-05 22:53:41 +00:00
Slendy
c9784cf8c9
Fix hearted profiles being sorted in reverse order 2023-05-31 21:25:35 -05:00
Slendy
0b936d3e5d
Implement deleting playlists
Also fixes playlists visually not updating in-game when modifying them
2023-05-31 20:37:17 -05:00
Slendy
cd926a8415
Refactor LBP3 text search to use the category system 2023-05-31 20:35:39 -05: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
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
jackcaver
9deff7ce63
Implement basic filters and LBP2 CrossController fixes (#758)
* implement basic filters and lbp2cc fixes

* lbp3 hide lbp2cc slots

* hide lbp2cc levels from hearted and most played categories in lbp3 and basic filters for lbp3

---------

Co-authored-by: jackcaver <jackcaver@users.noreply.github.com>
Co-authored-by: koko <koko@drones.gay>
2023-05-04 14:42:31 +00:00
Slendy
38e97a904a
Make FriendsController return text/xml 2023-05-02 21:05:41 -05:00
Josh
3aa9033b67
Rewrite captcha system (#754)
Rewrite captcha and remove many unused directives
2023-04-29 04:32:42 +00:00
W0lf4llo
aefecc7b12
Make LBP2 lucky dip prefer newer levels and make player count more accurate (#744)
* Lucky Dip, Newest Levels, & Recently Played change

* almost broke prod :disaster:

* Update ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs

I forgor lol

Co-authored-by: koko <koko@drones.gay>

* Remove TimestampMicros and add random slot selection with bias

* playersInPod count filters by platform

* Hope this actually commits now, idk github

* Apply suggestions from code review

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

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

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

* Fix random bias ordering

---------

Co-authored-by: koko <joebiden@kitgaming67.com>
Co-authored-by: koko <koko@drones.gay>
Co-authored-by: Slendy <josh@slendy.pw>
2023-04-29 04:32:36 +00:00
Josh
eb79d7cf48
Optimize slot endpoints (#750)
* Remove AsEnumerable usage in SlotsController

* Remove AsEnumerable usages from LBP3 categories

* Fix typo in OrderBy statement
2023-04-26 20:13:27 +00:00
Slendy
ddee367586
Add more logging to resources and matching
Change uploading to use ReadAllAsync instead of readFromPipeReader
2023-04-20 11:00:55 -05:00
Slendy
f03d1d7c17
Utilize EF 7 bulk delete operations instead of RemoveRange 2023-04-18 20:45:42 -05:00
Slendy
d8c36923d9
Fix deserialized PhotoSubject bounds not being set in database entity 2023-04-11 20:27:43 -05:00
Slendy
5fbaa5df20
Fix level republishing not updating resource or rootLevel 2023-04-11 20:23:43 -05:00
Slendy
4150e44f80
Refactor code for reading the body of a request 2023-04-06 22:23:49 -05:00
Josh
2210541894
Fix memory leak in GameServer (#731)
* Convert entities to serializable after aggregating rather before

* Cache instances of CustomXmlSerializer and create readonly constants for reused settings

* Change CustomXmlSerializer and serializer cache to work with deserializer
2023-04-02 23:45:19 +00:00
Josh
0253864f5e
Add LBP1 level scoreboards (#728)
* Add missing lbp1 scoreboard endpoint

* Allow all score types to be fetched

* Make lbp1 scores start at highest

* Fix query to use ScoreType from options

* Implement multi-type scoreboard response
2023-03-31 21:08:27 +00: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
Slendy
ff470bcb34
Fix certain scores not being uploaded 2023-03-29 23:36:47 -05:00
Slendy
b0858448c8
Fix LBP3 playlist editing 2023-03-29 19:34:16 -05:00
Slendy
8376928a6c
Fix score uploading on story levels 2023-03-29 13:32:48 -05:00
Slendy
6fcc51fca3
Make BackgroundHash not nullable 2023-03-29 13:06:01 -05:00
Slendy
3ebdc03951
Properly serialize slot resources 2023-03-28 15:19:25 -05:00
Slendy
e3843cb8c4
Fix content-type for planetStats 2023-03-28 14:40:05 -05:00
Slendy
90f79d67c4
Fix level publishing 2023-03-28 14:26:09 -05:00
Slendy
deac39ef97
Fix ScoreboardResponse returning points as count 2023-03-28 14:03:35 -05:00
Slendy
1e8ef8c679
Serialization refactor hotfixes
Fixes user heart count
Fixes searches not working
Fixes text/plain content not outputting
2023-03-28 10:33:03 -05: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
Josh
b2a1d3958f
Allow head requests to status endpoints (#717) 2023-03-24 00:31:56 +00:00
Josh
fa5ff0b490
Add a discord webhook for when users join for the first time. (#698)
* Add a discord webhook for when users join for the first time.

* Fix compilation error related to embed colors

* Make config migration backup use the version of the stored file

* Make DiscordConfiguration not halt startup

* Allow the registration message to be configured

* Clean up registration announcement and add userId variable

* Fix userid resolution and convert newline string to actual character
Also make WebhookHelper not fail if all destinations aren't configured
2023-03-23 00:57:28 +00:00
Josh
b87c16ab7c
Make in-game email system not lock after one attempt (#712) 2023-03-18 20:33:37 -05:00
W0lf4llo
9b014fa01c
StasticsHelper + Community Tab Performance Fix (#713)
* Player count shows per game

* Fixed LBP3 categories lagigng & StatisticsHelper

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

* Fixed "planetStats" mmPicksCount

* Hopefully the final update to this PR!
(Bug fixes)

* Update ProjectLighthouse/Types/Entities/Level/Slot.cs

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

* Update ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs

I'm trusting you that nothing breaks here lol

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

* Update ProjectLighthouse.Servers.GameServer/Controllers/Slots/SlotsController.cs

bad slendy >:(

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

---------

Co-authored-by: koko <sudokoko@users.noreply.github.com>
Co-authored-by: koko <68549366+sudokoko@users.noreply.github.com>
Co-authored-by: Josh <josh@slendy.pw>
2023-03-17 03:51:55 +00:00
Slendy
9d25f56e64
Fix hearted and queued levels on LBP Vita 2023-03-04 21:41:49 -06: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
35ea2682b9
Replace Location table with packed 64-bit int (#679)
* Replace Location table with packed 64 bit int

* Remove double Include and fix Slot documentation

* Fix compilation errors from merge

* Fix namespaces and add expected values to unit tests
2023-02-21 14:53:38 -06:00