├── .config └── dotnet-tools.json ├── .dockerignore ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── api-issue.md │ ├── config.yml │ ├── gameserver-bug-report.md │ └── website-bug-report.md ├── dependabot.yml └── workflows │ ├── ci.yml │ ├── crowdin-pull.yml │ ├── crowdin-push.yml │ ├── docker-publish.yml │ └── qodana_code_quality.yml ├── .gitignore ├── .idea └── .idea.ProjectLighthouse │ └── .idea │ ├── discord.xml │ ├── encodings.xml │ ├── git_toolbox_prj.xml │ ├── indexLayout.xml │ ├── jsLibraryMappings.xml │ ├── misc.xml │ ├── projectSettingsUpdater.xml │ ├── sqldialects.xml │ └── vcs.xml ├── .run ├── Lighthouse API.run.xml ├── Lighthouse Gameserver.run.xml └── Lighthouse Website.run.xml ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── Dockerfile ├── Documentation ├── Errors.md ├── Images │ ├── Localization-manager-created.png │ ├── Localization-manager-example.png │ └── Localization-manager-new.png ├── Localization.md ├── RPC.md ├── Theming.md └── Tickets.md ├── LICENSE ├── ProjectLighthouse.Localization ├── BaseLayout.lang-ar-SA.resx ├── BaseLayout.lang-da-DK.resx ├── BaseLayout.lang-de-DE.resx ├── BaseLayout.lang-en-GB.resx ├── BaseLayout.lang-en-PT.resx ├── BaseLayout.lang-en-UD.resx ├── BaseLayout.lang-eo-UY.resx ├── BaseLayout.lang-es-ES.resx ├── BaseLayout.lang-es-MX.resx ├── BaseLayout.lang-et-EE.resx ├── BaseLayout.lang-fi-FI.resx ├── BaseLayout.lang-fil-PH.resx ├── BaseLayout.lang-fr-CA.resx ├── BaseLayout.lang-fr-FR.resx ├── BaseLayout.lang-ga-IE.resx ├── BaseLayout.lang-he-IL.resx ├── BaseLayout.lang-hi-IN.resx ├── BaseLayout.lang-id-ID.resx ├── BaseLayout.lang-ingsoc.resx ├── BaseLayout.lang-it-IT.resx ├── BaseLayout.lang-ja-JP.resx ├── BaseLayout.lang-ko-KR.resx ├── BaseLayout.lang-nl-NL.resx ├── BaseLayout.lang-nn-NO.resx ├── BaseLayout.lang-no-NO.resx ├── BaseLayout.lang-pl-PL.resx ├── BaseLayout.lang-pt-BR.resx ├── BaseLayout.lang-pt-PT.resx ├── BaseLayout.lang-ru-RU.resx ├── BaseLayout.lang-sv-SE.resx ├── BaseLayout.lang-th-TH.resx ├── BaseLayout.lang-toki.resx ├── BaseLayout.lang-tr-TR.resx ├── BaseLayout.lang-uk-UA.resx ├── BaseLayout.lang-zh-CN.resx ├── BaseLayout.lang-zh-TW.resx ├── BaseLayout.resx ├── Error.lang-ar-SA.resx ├── Error.lang-da-DK.resx ├── Error.lang-de-DE.resx ├── Error.lang-en-GB.resx ├── Error.lang-en-PT.resx ├── Error.lang-en-UD.resx ├── Error.lang-eo-UY.resx ├── Error.lang-es-ES.resx ├── Error.lang-es-MX.resx ├── Error.lang-et-EE.resx ├── Error.lang-fi-FI.resx ├── Error.lang-fil-PH.resx ├── Error.lang-fr-CA.resx ├── Error.lang-fr-FR.resx ├── Error.lang-ga-IE.resx ├── Error.lang-he-IL.resx ├── Error.lang-hi-IN.resx ├── Error.lang-id-ID.resx ├── Error.lang-ingsoc.resx ├── Error.lang-it-IT.resx ├── Error.lang-ja-JP.resx ├── Error.lang-ko-KR.resx ├── Error.lang-nl-NL.resx ├── Error.lang-nn-NO.resx ├── Error.lang-no-NO.resx ├── Error.lang-pl-PL.resx ├── Error.lang-pt-BR.resx ├── Error.lang-pt-PT.resx ├── Error.lang-ru-RU.resx ├── Error.lang-sv-SE.resx ├── Error.lang-th-TH.resx ├── Error.lang-toki.resx ├── Error.lang-tr-TR.resx ├── Error.lang-uk-UA.resx ├── Error.lang-zh-CN.resx ├── Error.lang-zh-TW.resx ├── Error.resx ├── General.lang-ar-SA.resx ├── General.lang-da-DK.resx ├── General.lang-de-DE.resx ├── General.lang-en-GB.resx ├── General.lang-en-PT.resx ├── General.lang-en-UD.resx ├── General.lang-eo-UY.resx ├── General.lang-es-ES.resx ├── General.lang-es-MX.resx ├── General.lang-et-EE.resx ├── General.lang-fi-FI.resx ├── General.lang-fil-PH.resx ├── General.lang-fr-CA.resx ├── General.lang-fr-FR.resx ├── General.lang-ga-IE.resx ├── General.lang-he-IL.resx ├── General.lang-hi-IN.resx ├── General.lang-id-ID.resx ├── General.lang-ingsoc.resx ├── General.lang-it-IT.resx ├── General.lang-ja-JP.resx ├── General.lang-ko-KR.resx ├── General.lang-nl-NL.resx ├── General.lang-nn-NO.resx ├── General.lang-no-NO.resx ├── General.lang-pl-PL.resx ├── General.lang-pt-BR.resx ├── General.lang-pt-PT.resx ├── General.lang-ru-RU.resx ├── General.lang-sv-SE.resx ├── General.lang-th-TH.resx ├── General.lang-toki.resx ├── General.lang-tr-TR.resx ├── General.lang-uk-UA.resx ├── General.lang-zh-CN.resx ├── General.lang-zh-TW.resx ├── General.resx ├── LandingPage.lang-ar-SA.resx ├── LandingPage.lang-da-DK.resx ├── LandingPage.lang-de-DE.resx ├── LandingPage.lang-en-GB.resx ├── LandingPage.lang-en-PT.resx ├── LandingPage.lang-en-UD.resx ├── LandingPage.lang-eo-UY.resx ├── LandingPage.lang-es-ES.resx ├── LandingPage.lang-es-MX.resx ├── LandingPage.lang-et-EE.resx ├── LandingPage.lang-fi-FI.resx ├── LandingPage.lang-fil-PH.resx ├── LandingPage.lang-fr-CA.resx ├── LandingPage.lang-fr-FR.resx ├── LandingPage.lang-ga-IE.resx ├── LandingPage.lang-gd-GB.resx ├── LandingPage.lang-he-IL.resx ├── LandingPage.lang-hi-IN.resx ├── LandingPage.lang-id-ID.resx ├── LandingPage.lang-ingsoc.resx ├── LandingPage.lang-it-IT.resx ├── LandingPage.lang-ja-JP.resx ├── LandingPage.lang-ko-KR.resx ├── LandingPage.lang-nl-NL.resx ├── LandingPage.lang-nn-NO.resx ├── LandingPage.lang-no-NO.resx ├── LandingPage.lang-pl-PL.resx ├── LandingPage.lang-pt-BR.resx ├── LandingPage.lang-pt-PT.resx ├── LandingPage.lang-ru-RU.resx ├── LandingPage.lang-sv-SE.resx ├── LandingPage.lang-th-TH.resx ├── LandingPage.lang-toki.resx ├── LandingPage.lang-tr-TR.resx ├── LandingPage.lang-uk-UA.resx ├── LandingPage.lang-zh-CN.resx ├── LandingPage.lang-zh-TW.resx ├── LandingPage.resx ├── LocalizationManager.cs ├── LoggedOut.lang-ar-SA.resx ├── LoggedOut.lang-da-DK.resx ├── LoggedOut.lang-de-DE.resx ├── LoggedOut.lang-en-GB.resx ├── LoggedOut.lang-en-PT.resx ├── LoggedOut.lang-en-UD.resx ├── LoggedOut.lang-eo-UY.resx ├── LoggedOut.lang-es-ES.resx ├── LoggedOut.lang-es-MX.resx ├── LoggedOut.lang-et-EE.resx ├── LoggedOut.lang-fi-FI.resx ├── LoggedOut.lang-fil-PH.resx ├── LoggedOut.lang-fr-CA.resx ├── LoggedOut.lang-fr-FR.resx ├── LoggedOut.lang-ga-IE.resx ├── LoggedOut.lang-he-IL.resx ├── LoggedOut.lang-hi-IN.resx ├── LoggedOut.lang-id-ID.resx ├── LoggedOut.lang-ingsoc.resx ├── LoggedOut.lang-it-IT.resx ├── LoggedOut.lang-ja-JP.resx ├── LoggedOut.lang-ko-KR.resx ├── LoggedOut.lang-nl-NL.resx ├── LoggedOut.lang-nn-NO.resx ├── LoggedOut.lang-no-NO.resx ├── LoggedOut.lang-pl-PL.resx ├── LoggedOut.lang-pt-BR.resx ├── LoggedOut.lang-pt-PT.resx ├── LoggedOut.lang-ru-RU.resx ├── LoggedOut.lang-sv-SE.resx ├── LoggedOut.lang-th-TH.resx ├── LoggedOut.lang-toki.resx ├── LoggedOut.lang-tr-TR.resx ├── LoggedOut.lang-uk-UA.resx ├── LoggedOut.lang-zh-CN.resx ├── LoggedOut.lang-zh-TW.resx ├── LoggedOut.resx ├── ModPanel.lang-ar-SA.resx ├── ModPanel.lang-da-DK.resx ├── ModPanel.lang-de-DE.resx ├── ModPanel.lang-en-GB.resx ├── ModPanel.lang-en-PT.resx ├── ModPanel.lang-en-UD.resx ├── ModPanel.lang-eo-UY.resx ├── ModPanel.lang-es-ES.resx ├── ModPanel.lang-es-MX.resx ├── ModPanel.lang-et-EE.resx ├── ModPanel.lang-fi-FI.resx ├── ModPanel.lang-fil-PH.resx ├── ModPanel.lang-fr-CA.resx ├── ModPanel.lang-fr-FR.resx ├── ModPanel.lang-ga-IE.resx ├── ModPanel.lang-he-IL.resx ├── ModPanel.lang-hi-IN.resx ├── ModPanel.lang-id-ID.resx ├── ModPanel.lang-ingsoc.resx ├── ModPanel.lang-it-IT.resx ├── ModPanel.lang-ja-JP.resx ├── ModPanel.lang-ko-KR.resx ├── ModPanel.lang-nl-NL.resx ├── ModPanel.lang-nn-NO.resx ├── ModPanel.lang-no-NO.resx ├── ModPanel.lang-pl-PL.resx ├── ModPanel.lang-pt-BR.resx ├── ModPanel.lang-pt-PT.resx ├── ModPanel.lang-ru-RU.resx ├── ModPanel.lang-sv-SE.resx ├── ModPanel.lang-th-TH.resx ├── ModPanel.lang-toki.resx ├── ModPanel.lang-tr-TR.resx ├── ModPanel.lang-uk-UA.resx ├── ModPanel.lang-zh-CN.resx ├── ModPanel.lang-zh-TW.resx ├── ModPanel.resx ├── Moderation.lang-ar-SA.resx ├── Moderation.lang-da-DK.resx ├── Moderation.lang-de-DE.resx ├── Moderation.lang-en-GB.resx ├── Moderation.lang-en-PT.resx ├── Moderation.lang-en-UD.resx ├── Moderation.lang-eo-UY.resx ├── Moderation.lang-es-ES.resx ├── Moderation.lang-es-MX.resx ├── Moderation.lang-et-EE.resx ├── Moderation.lang-fi-FI.resx ├── Moderation.lang-fil-PH.resx ├── Moderation.lang-fr-CA.resx ├── Moderation.lang-fr-FR.resx ├── Moderation.lang-ga-IE.resx ├── Moderation.lang-he-IL.resx ├── Moderation.lang-hi-IN.resx ├── Moderation.lang-id-ID.resx ├── Moderation.lang-ingsoc.resx ├── Moderation.lang-it-IT.resx ├── Moderation.lang-ja-JP.resx ├── Moderation.lang-ko-KR.resx ├── Moderation.lang-nl-NL.resx ├── Moderation.lang-nn-NO.resx ├── Moderation.lang-no-NO.resx ├── Moderation.lang-pl-PL.resx ├── Moderation.lang-pt-BR.resx ├── Moderation.lang-pt-PT.resx ├── Moderation.lang-ru-RU.resx ├── Moderation.lang-sv-SE.resx ├── Moderation.lang-th-TH.resx ├── Moderation.lang-toki.resx ├── Moderation.lang-tr-TR.resx ├── Moderation.lang-uk-UA.resx ├── Moderation.lang-zh-CN.resx ├── Moderation.lang-zh-TW.resx ├── Moderation.resx ├── Privacy.lang-ar-SA.resx ├── Privacy.lang-da-DK.resx ├── Privacy.lang-de-DE.resx ├── Privacy.lang-en-GB.resx ├── Privacy.lang-en-PT.resx ├── Privacy.lang-en-UD.resx ├── Privacy.lang-eo-UY.resx ├── Privacy.lang-es-ES.resx ├── Privacy.lang-es-MX.resx ├── Privacy.lang-et-EE.resx ├── Privacy.lang-fi-FI.resx ├── Privacy.lang-fil-PH.resx ├── Privacy.lang-fr-CA.resx ├── Privacy.lang-fr-FR.resx ├── Privacy.lang-ga-IE.resx ├── Privacy.lang-he-IL.resx ├── Privacy.lang-hi-IN.resx ├── Privacy.lang-id-ID.resx ├── Privacy.lang-ingsoc.resx ├── Privacy.lang-it-IT.resx ├── Privacy.lang-ja-JP.resx ├── Privacy.lang-ko-KR.resx ├── Privacy.lang-nl-NL.resx ├── Privacy.lang-nn-NO.resx ├── Privacy.lang-no-NO.resx ├── Privacy.lang-pl-PL.resx ├── Privacy.lang-pt-BR.resx ├── Privacy.lang-pt-PT.resx ├── Privacy.lang-ru-RU.resx ├── Privacy.lang-sv-SE.resx ├── Privacy.lang-th-TH.resx ├── Privacy.lang-toki.resx ├── Privacy.lang-tr-TR.resx ├── Privacy.lang-uk-UA.resx ├── Privacy.lang-zh-CN.resx ├── Privacy.lang-zh-TW.resx ├── Privacy.resx ├── Profile.lang-ar-SA.resx ├── Profile.lang-da-DK.resx ├── Profile.lang-de-DE.resx ├── Profile.lang-en-GB.resx ├── Profile.lang-en-PT.resx ├── Profile.lang-en-UD.resx ├── Profile.lang-eo-UY.resx ├── Profile.lang-es-ES.resx ├── Profile.lang-es-MX.resx ├── Profile.lang-et-EE.resx ├── Profile.lang-fi-FI.resx ├── Profile.lang-fil-PH.resx ├── Profile.lang-fr-CA.resx ├── Profile.lang-fr-FR.resx ├── Profile.lang-ga-IE.resx ├── Profile.lang-he-IL.resx ├── Profile.lang-hi-IN.resx ├── Profile.lang-id-ID.resx ├── Profile.lang-ingsoc.resx ├── Profile.lang-it-IT.resx ├── Profile.lang-ja-JP.resx ├── Profile.lang-ko-KR.resx ├── Profile.lang-nl-NL.resx ├── Profile.lang-nn-NO.resx ├── Profile.lang-no-NO.resx ├── Profile.lang-pl-PL.resx ├── Profile.lang-pt-BR.resx ├── Profile.lang-pt-PT.resx ├── Profile.lang-ru-RU.resx ├── Profile.lang-sv-SE.resx ├── Profile.lang-th-TH.resx ├── Profile.lang-toki.resx ├── Profile.lang-tr-TR.resx ├── Profile.lang-uk-UA.resx ├── Profile.lang-zh-CN.resx ├── Profile.lang-zh-TW.resx ├── Profile.resx ├── ProjectLighthouse.Localization.csproj ├── Register.lang-ar-SA.resx ├── Register.lang-da-DK.resx ├── Register.lang-de-DE.resx ├── Register.lang-en-GB.resx ├── Register.lang-en-PT.resx ├── Register.lang-en-UD.resx ├── Register.lang-eo-UY.resx ├── Register.lang-es-ES.resx ├── Register.lang-es-MX.resx ├── Register.lang-et-EE.resx ├── Register.lang-fi-FI.resx ├── Register.lang-fil-PH.resx ├── Register.lang-fr-CA.resx ├── Register.lang-fr-FR.resx ├── Register.lang-ga-IE.resx ├── Register.lang-he-IL.resx ├── Register.lang-hi-IN.resx ├── Register.lang-id-ID.resx ├── Register.lang-ingsoc.resx ├── Register.lang-it-IT.resx ├── Register.lang-ja-JP.resx ├── Register.lang-ko-KR.resx ├── Register.lang-nl-NL.resx ├── Register.lang-nn-NO.resx ├── Register.lang-no-NO.resx ├── Register.lang-pl-PL.resx ├── Register.lang-pt-BR.resx ├── Register.lang-pt-PT.resx ├── Register.lang-ru-RU.resx ├── Register.lang-sv-SE.resx ├── Register.lang-th-TH.resx ├── Register.lang-toki.resx ├── Register.lang-tr-TR.resx ├── Register.lang-uk-UA.resx ├── Register.lang-zh-CN.resx ├── Register.lang-zh-TW.resx ├── Register.resx ├── Status.lang-ar-SA.resx ├── Status.lang-da-DK.resx ├── Status.lang-de-DE.resx ├── Status.lang-en-GB.resx ├── Status.lang-en-PT.resx ├── Status.lang-en-UD.resx ├── Status.lang-eo-UY.resx ├── Status.lang-es-ES.resx ├── Status.lang-es-MX.resx ├── Status.lang-et-EE.resx ├── Status.lang-fi-FI.resx ├── Status.lang-fil-PH.resx ├── Status.lang-fr-CA.resx ├── Status.lang-fr-FR.resx ├── Status.lang-ga-IE.resx ├── Status.lang-he-IL.resx ├── Status.lang-hi-IN.resx ├── Status.lang-id-ID.resx ├── Status.lang-ingsoc.resx ├── Status.lang-it-IT.resx ├── Status.lang-ja-JP.resx ├── Status.lang-ko-KR.resx ├── Status.lang-nl-NL.resx ├── Status.lang-nn-NO.resx ├── Status.lang-no-NO.resx ├── Status.lang-pl-PL.resx ├── Status.lang-pt-BR.resx ├── Status.lang-pt-PT.resx ├── Status.lang-ru-RU.resx ├── Status.lang-sv-SE.resx ├── Status.lang-th-TH.resx ├── Status.lang-toki.resx ├── Status.lang-tr-TR.resx ├── Status.lang-uk-UA.resx ├── Status.lang-zh-CN.resx ├── Status.lang-zh-TW.resx ├── Status.resx ├── StringLists │ ├── BaseLayoutStrings.cs │ ├── ErrorStrings.cs │ ├── GeneralStrings.cs │ ├── LandingPageStrings.cs │ ├── LoggedOutStrings.cs │ ├── ModPanelStrings.cs │ ├── ModerationStrings.cs │ ├── PrivacyStrings.cs │ ├── ProfileStrings.cs │ ├── RegisterStrings.cs │ ├── StatusStrings.cs │ └── TwoFactorStrings.cs ├── TranslatableString.cs ├── TranslationAreas.cs ├── TwoFactor.lang-ar-SA.resx ├── TwoFactor.lang-da-DK.resx ├── TwoFactor.lang-de-DE.resx ├── TwoFactor.lang-en-GB.resx ├── TwoFactor.lang-en-PT.resx ├── TwoFactor.lang-en-UD.resx ├── TwoFactor.lang-eo-UY.resx ├── TwoFactor.lang-es-ES.resx ├── TwoFactor.lang-es-MX.resx ├── TwoFactor.lang-et-EE.resx ├── TwoFactor.lang-fi-FI.resx ├── TwoFactor.lang-fil-PH.resx ├── TwoFactor.lang-fr-CA.resx ├── TwoFactor.lang-fr-FR.resx ├── TwoFactor.lang-ga-IE.resx ├── TwoFactor.lang-he-IL.resx ├── TwoFactor.lang-hi-IN.resx ├── TwoFactor.lang-id-ID.resx ├── TwoFactor.lang-ingsoc.resx ├── TwoFactor.lang-it-IT.resx ├── TwoFactor.lang-ja-JP.resx ├── TwoFactor.lang-ko-KR.resx ├── TwoFactor.lang-nl-NL.resx ├── TwoFactor.lang-nn-NO.resx ├── TwoFactor.lang-no-NO.resx ├── TwoFactor.lang-pl-PL.resx ├── TwoFactor.lang-pt-BR.resx ├── TwoFactor.lang-pt-PT.resx ├── TwoFactor.lang-ru-RU.resx ├── TwoFactor.lang-sv-SE.resx ├── TwoFactor.lang-th-TH.resx ├── TwoFactor.lang-toki.resx ├── TwoFactor.lang-tr-TR.resx ├── TwoFactor.lang-uk-UA.resx ├── TwoFactor.lang-zh-CN.resx ├── TwoFactor.lang-zh-TW.resx └── TwoFactor.resx ├── ProjectLighthouse.Servers.API ├── ApiEndpointController.cs ├── Controllers │ ├── RpcController.cs │ ├── SlotEndpoints.cs │ ├── StatisticsEndpoints.cs │ ├── StatusController.cs │ └── UserEndpoints.cs ├── Program.cs ├── ProjectLighthouse.Servers.API.csproj ├── Responses │ ├── ApiSlot.cs │ ├── ApiUser.cs │ ├── MinimalApiSlot.cs │ ├── PlayerCountResponse.cs │ ├── PlayerListResponse.cs │ ├── RpcResponse.cs │ └── StatisticsResponse.cs ├── Startup │ ├── ApiStartup.cs │ ├── ApiTestStartup.cs │ └── SwaggerFilter.cs ├── appsettings.Development.json └── appsettings.json ├── ProjectLighthouse.Servers.GameServer ├── Controllers │ ├── CommentController.cs │ ├── DeveloperController.cs │ ├── FriendsController.cs │ ├── Login │ │ ├── ClientConfigurationController.cs │ │ ├── LoginController.cs │ │ └── LogoutController.cs │ ├── Matching │ │ ├── EnterLevelController.cs │ │ └── MatchController.cs │ ├── MessageController.cs │ ├── ReportController.cs │ ├── Resources │ │ ├── PhotosController.cs │ │ └── ResourcesController.cs │ ├── Slots │ │ ├── CategoryController.cs │ │ ├── LevelTagsController.cs │ │ ├── ListController.cs │ │ ├── PlaylistController.cs │ │ ├── PublishController.cs │ │ ├── ReviewController.cs │ │ ├── ScoreController.cs │ │ ├── SearchController.cs │ │ └── SlotsController.cs │ ├── StatisticsController.cs │ ├── StatusController.cs │ ├── StoreController.cs │ └── UserController.cs ├── Extensions │ ├── ControllerExtensions.cs │ └── DatabaseContextExtensions.cs ├── Helpers │ ├── GameResourceHelper.cs │ └── PatchworkHelper.cs ├── Middlewares │ ├── DigestMiddleware.cs │ └── SetLastContactMiddleware.cs ├── Program.cs ├── ProjectLighthouse.Servers.GameServer.csproj ├── Startup │ ├── GameServerStartup.cs │ ├── GameServerTestStartup.cs │ └── TokenAuthHandler.cs ├── Types │ ├── Categories │ │ ├── CategoryHelper.cs │ │ ├── CustomCategory.cs │ │ ├── HeartedCategory.cs │ │ ├── HighestRatedCategory.cs │ │ ├── LuckyDipCategory.cs │ │ ├── MostHeartedCategory.cs │ │ ├── MostPlayedCategory.cs │ │ ├── MyHeartedCreatorsCategory.cs │ │ ├── NewestLevelsCategory.cs │ │ ├── PlaylistCategory.cs │ │ ├── QueueCategory.cs │ │ ├── SlotCategory.cs │ │ ├── TeamPicksCategory.cs │ │ ├── TextSearchCategory.cs │ │ └── UserCategory.cs │ ├── Misc │ │ └── ResourceList.cs │ ├── MyPlaylistsCategory.cs │ └── Users │ │ ├── NPData.cs │ │ ├── Pins.cs │ │ ├── PrivacySettings.cs │ │ └── UserUpdate.cs ├── appsettings.Development.json ├── appsettings.json └── textureGuids.txt ├── ProjectLighthouse.Servers.Website ├── Captcha │ ├── CaptchaService.cs │ └── ICaptchaService.cs ├── Controllers │ ├── Admin │ │ ├── AdminPanelController.cs │ │ ├── AdminReportController.cs │ │ └── AdminUserController.cs │ ├── Debug │ │ └── RoomVisualizerController.cs │ ├── ExternalAuth │ │ └── AuthenticationController.cs │ ├── Moderator │ │ ├── ModerationCaseController.cs │ │ ├── ModerationPageController.cs │ │ ├── ModerationRemovalController.cs │ │ └── ModerationSlotController.cs │ ├── ResourcesController.cs │ ├── SlotPageController.cs │ ├── StatusController.cs │ └── UserPageController.cs ├── Extensions │ ├── FormattingExtensions.cs │ ├── PartialExtensions.cs │ └── SlugExtensions.cs ├── Middlewares │ └── UserRequiredRedirectMiddleware.cs ├── Pages │ ├── Admin │ │ ├── AdminApiKeyPage.cshtml │ │ ├── AdminApiKeyPage.cshtml.cs │ │ ├── AdminPanelPage.cshtml │ │ ├── AdminPanelPage.cshtml.cs │ │ ├── AdminPanelUsersPage.cshtml │ │ ├── AdminPanelUsersPage.cshtml.cs │ │ ├── AdminSendNotificationPage.cshtml │ │ ├── AdminSendNotificationPage.cshtml.cs │ │ ├── AdminSetGrantedSlotsPage.cshtml │ │ └── AdminSetGrantedSlotsPage.cshtml.cs │ ├── Debug │ │ ├── FilterTestPage.cshtml │ │ ├── FilterTestPage.cshtml.cs │ │ ├── RoomVisualizerPage.cshtml │ │ ├── RoomVisualizerPage.cshtml.cs │ │ ├── VersionInfoPage.cshtml │ │ └── VersionInfoPage.cshtml.cs │ ├── Email │ │ ├── CompleteEmailVerificationPage.cshtml │ │ ├── CompleteEmailVerificationPage.cshtml.cs │ │ ├── SendVerificationEmailPage.cshtml │ │ ├── SendVerificationEmailPage.cshtml.cs │ │ ├── SetEmailForm.cshtml │ │ └── SetEmailForm.cshtml.cs │ ├── Errors │ │ ├── NotFoundPage.cshtml │ │ └── NotFoundPage.cshtml.cs │ ├── ExternalAuth │ │ ├── AuthenticationPage.cshtml │ │ └── AuthenticationPage.cshtml.cs │ ├── LandingPage.cshtml │ ├── LandingPage.cshtml.cs │ ├── Layouts │ │ ├── BaseLayout.cshtml │ │ └── BaseLayout.cshtml.cs │ ├── Login │ │ ├── BannedUserPage.cshtml │ │ ├── BannedUserPage.cshtml.cs │ │ ├── LoginForm.cshtml │ │ ├── LoginForm.cshtml.cs │ │ ├── LogoutPage.cshtml │ │ ├── LogoutPage.cshtml.cs │ │ ├── PasswordResetPage.cshtml │ │ ├── PasswordResetPage.cshtml.cs │ │ ├── PasswordResetRequestForm.cshtml │ │ ├── PasswordResetRequestForm.cshtml.cs │ │ ├── PasswordResetRequiredPage.cshtml │ │ ├── PasswordResetRequiredPage.cshtml.cs │ │ ├── PirateSignupPage.cshtml │ │ ├── PirateSignupPage.cshtml.cs │ │ ├── RegisterForm.cshtml │ │ └── RegisterForm.cshtml.cs │ ├── Moderation │ │ ├── BannedUsersPage.cshtml │ │ ├── BannedUsersPage.cshtml.cs │ │ ├── CasePage.cshtml │ │ ├── CasePage.cshtml.cs │ │ ├── HiddenLevelsPage.cshtml │ │ ├── HiddenLevelsPage.cshtml.cs │ │ ├── ModPanelPage.cshtml │ │ ├── ModPanelPage.cshtml.cs │ │ ├── NewCasePage.cshtml │ │ ├── NewCasePage.cshtml.cs │ │ ├── ReportPage.cshtml │ │ ├── ReportPage.cshtml.cs │ │ ├── ReportsPage.cshtml │ │ └── ReportsPage.cshtml.cs │ ├── NotificationsPage.cshtml │ ├── NotificationsPage.cshtml.cs │ ├── Partials │ │ ├── AdminPanelStatisticPartial.cshtml │ │ ├── AdminSendNotificationPartial.cshtml │ │ ├── AdminSetGrantedSlotsFormPartial.cshtml │ │ ├── CaptchaPartial.cshtml │ │ ├── CommentsPartial.cshtml │ │ ├── ErrorModalPartial.cshtml │ │ ├── LeaderboardPartial.cshtml │ │ ├── Links │ │ │ └── UserLinkPartial.cshtml │ │ ├── ModerationCasePartial.cshtml │ │ ├── PhotoPartial.cshtml │ │ ├── RenderReportBoundsPartial.cshtml │ │ ├── ReportPartial.cshtml │ │ ├── ReviewPartial.cshtml │ │ ├── SlotCardPartial.cshtml │ │ ├── TwoFactorPartial.cshtml │ │ └── UserCardPartial.cshtml │ ├── PhotosPage.cshtml │ ├── PhotosPage.cshtml.cs │ ├── SlotPage.cshtml │ ├── SlotPage.cshtml.cs │ ├── SlotSettingsPage.cshtml │ ├── SlotSettingsPage.cshtml.cs │ ├── SlotsPage.cshtml │ ├── SlotsPage.cshtml.cs │ ├── TwoFactor │ │ ├── DisableTwoFactorPage.cshtml │ │ ├── DisableTwoFactorPage.cshtml.cs │ │ ├── SetupTwoFactorPage.cshtml │ │ ├── SetupTwoFactorPage.cshtml.cs │ │ ├── TwoFactorLoginPage.cshtml │ │ └── TwoFactorLoginPage.cshtml.cs │ ├── UserPage.cshtml │ ├── UserPage.cshtml.cs │ ├── UserPrivacyPage.cshtml │ ├── UserPrivacyPage.cshtml.cs │ ├── UserSettingsPage.cshtml │ ├── UserSettingsPage.cshtml.cs │ ├── UsersPage.cshtml │ └── UsersPage.cshtml.cs ├── Program.cs ├── ProjectLighthouse.Servers.Website.csproj ├── ProjectLighthouse.Servers.Website.csproj.DotSettings.user ├── Startup │ ├── WebsiteStartup.cs │ └── WebsiteTestStartup.cs ├── Types │ ├── AdminPanelStatistic.cs │ └── PageNavigationItem.cs ├── appsettings.Development.json └── appsettings.json ├── ProjectLighthouse.Tests.GameApiTests ├── AssemblyInfo.cs ├── Integration │ ├── AuthenticationTests.cs │ ├── DatabaseTests.cs │ ├── LoginTests.cs │ ├── MatchTests.cs │ ├── SlotFilterTests.cs │ ├── SlotTests.cs │ └── UploadTests.cs ├── ProjectLighthouse.Tests.GameApiTests.csproj └── Unit │ ├── Controllers │ ├── CommentControllerTests.cs │ ├── ControllerExtensionTests.cs │ ├── MessageControllerTests.cs │ ├── ReviewControllerTests.cs │ ├── ScoreControllerTests.cs │ ├── SlotControllerTests.cs │ ├── StatisticsControllerTests.cs │ ├── StatusControllerTests.cs │ └── UserControllerTests.cs │ ├── Middlewares │ ├── DigestMiddlewareTests.cs │ └── SetLastContactMiddlewareTests.cs │ └── PatchworkUserAgentTests.cs ├── ProjectLighthouse.Tests.WebsiteTests ├── AssemblyInfo.cs ├── Extensions │ └── WebDriverExtensions.cs ├── Integration │ ├── AdminTests.cs │ ├── AuthenticationTests.cs │ ├── LighthouseWebTest.cs │ └── RegisterTests.cs └── ProjectLighthouse.Tests.WebsiteTests.csproj ├── ProjectLighthouse.Tests ├── ExampleFiles │ ├── TestFarc.farc │ ├── TestGarbage.bin │ ├── TestLevel.lvl │ ├── TestScript.ff │ └── TestTexture.tex ├── Helpers │ ├── IntegrationHelper.cs │ └── MockHelper.cs ├── Integration │ ├── LighthouseServerTest.cs │ └── Serialization │ │ ├── SerializationDependencyTests.cs │ │ └── SerializationTests.cs ├── ProjectLighthouse.Tests.csproj ├── ProjectLighthouse.Tests.csproj.DotSettings └── Unit │ ├── EmailCooldownTests.cs │ ├── FileTypeTests.cs │ ├── FilterTests.cs │ ├── LocationTests.cs │ ├── ModerationTests.cs │ ├── PaginationTests.cs │ ├── RepeatingTaskTests.cs │ ├── ResourceTests.cs │ └── TicketTests.cs ├── ProjectLighthouse.sln ├── ProjectLighthouse.sln.DotSettings ├── ProjectLighthouse ├── Administration │ └── Maintenance │ │ ├── Commands │ │ ├── CreateAPIKeyCommand.cs │ │ ├── CreateUserCommand.cs │ │ ├── DeleteUserCommand.cs │ │ ├── FlushRedisCommand.cs │ │ ├── RenameUserCommand.cs │ │ ├── ResetPasswordCommand.cs │ │ ├── TestWebhookCommand.cs │ │ └── WipeTokensForUserCommand.cs │ │ ├── MaintenanceHelper.cs │ │ ├── MaintenanceJobs │ │ ├── CleanupBrokenPhotosMaintenanceJob.cs │ │ └── DeleteAllTokensMaintenanceJob.cs │ │ ├── MigrationTasks │ │ ├── CleanupSanitizedStrings.cs │ │ ├── CleanupSlotVersionMismatchMigration.cs │ │ └── SwitchScoreToUserIdMigration.cs │ │ └── RepeatingTasks │ │ ├── CleanupRoomsTask.cs │ │ ├── DismissExpiredCasesTask.cs │ │ ├── PerformCaseActionsTask.cs │ │ └── RemoveExpiredTokensTask.cs ├── Configuration │ ├── CensorConfiguration.cs │ ├── ConfigurationBase.cs │ ├── ConfigurationCategories │ │ ├── AuthenticationConfiguration.cs │ │ ├── CaptchaConfiguration.cs │ │ ├── CustomizationConfiguration.cs │ │ ├── DigestKeyConfiguration.cs │ │ ├── GoogleAnalyticsConfiguration.cs │ │ ├── MailConfiguration.cs │ │ ├── MatchmakingConfiguration.cs │ │ ├── NotificationConfiguration.cs │ │ ├── RateLimitConfiguration.cs │ │ ├── RichPresenceConfiguration.cs │ │ ├── TwoFactorConfiguration.cs │ │ ├── UserGeneratedContentLimitConfiguration.cs │ │ └── WebsiteConfiguration.cs │ ├── DiscordConfiguration.cs │ ├── ServerConfiguration.cs │ └── ServerStatics.cs ├── Database │ ├── DatabaseContext.ApiTokens.cs │ ├── DatabaseContext.Comments.cs │ ├── DatabaseContext.GameTokens.cs │ ├── DatabaseContext.Notifications.cs │ ├── DatabaseContext.Slots.cs │ ├── DatabaseContext.Utils.cs │ ├── DatabaseContext.WebTokens.cs │ ├── DatabaseContext.cs │ └── DatabaseContextFactory.cs ├── Extensions │ ├── BinaryReaderExtensions.cs │ ├── ControllerExtensions.cs │ ├── DatabaseExtensions.cs │ ├── ExceptionExtensions.cs │ ├── LoggingExtensions.cs │ ├── PipeExtensions.cs │ ├── PredicateExtensions.cs │ ├── QueryExtensions.cs │ ├── RedisConnectionExtensions.cs │ ├── RequestExtensions.cs │ └── RoomExtensions.cs ├── Files │ ├── FileHelper.cs │ ├── LbpFileParser.cs │ └── LbpImageHelper.cs ├── Filter │ ├── Filters │ │ ├── AdventureFilter.cs │ │ ├── AuthorLabelFilter.cs │ │ ├── CreatorFilter.cs │ │ ├── CrossControlFilter.cs │ │ ├── ExcludeAdventureFilter.cs │ │ ├── ExcludeCrossControlFilter.cs │ │ ├── ExcludeLBP1OnlyFilter.cs │ │ ├── ExcludeMovePackFilter.cs │ │ ├── FirstUploadedFilter.cs │ │ ├── GameVersionFilter.cs │ │ ├── GameVersionListFilter.cs │ │ ├── HiddenSlotFilter.cs │ │ ├── LockedSlotFilter.cs │ │ ├── MovePackFilter.cs │ │ ├── PlayerCountFilter.cs │ │ ├── ResultTypeFilter.cs │ │ ├── SlotIdFilter.cs │ │ ├── SlotTypeFilter.cs │ │ ├── SubLevelFilter.cs │ │ ├── TeamPickFilter.cs │ │ └── TextFilter.cs │ ├── SlotQueryBuilder.cs │ ├── SlotSortBuilder.cs │ └── Sorts │ │ ├── FirstUploadedSort.cs │ │ ├── LastUpdatedSort.cs │ │ ├── Metadata │ │ ├── HeartsSort.cs │ │ ├── RatingLBP1Sort.cs │ │ └── ThumbsUpSort.cs │ │ ├── PlaysForGameSort.cs │ │ ├── RandomFirstUploadedSort.cs │ │ ├── RandomSort.cs │ │ ├── SlotIdSort.cs │ │ ├── TeamPickSort.cs │ │ ├── TotalPlaysSort.cs │ │ ├── UniquePlaysForGameSort.cs │ │ └── UniquePlaysTotalSort.cs ├── Helpers │ ├── Base32Helper.cs │ ├── CensorHelper.cs │ ├── CryptoHelper.cs │ ├── EmailHelper.cs │ ├── LabelHelper.cs │ ├── LastContactHelper.cs │ ├── MatchHelper.cs │ ├── MigrationHelper.cs │ ├── ReflectionHelper.cs │ ├── RoomHelper.cs │ ├── SanitizationHelper.cs │ ├── SlotHelper.cs │ ├── StatisticsHelper.cs │ ├── TimeHelper.cs │ ├── VersionHelper.cs │ └── WebhookHelper.cs ├── Logging │ ├── Logger.cs │ ├── Loggers │ │ ├── AspNet │ │ │ ├── AspNetToLighthouseLogger.cs │ │ │ └── AspNetToLighthouseLoggerProvider.cs │ │ ├── ConsoleLogger.cs │ │ ├── FileLogger.cs │ │ └── InMemoryLogger.cs │ └── NullScope.cs ├── Mail │ ├── MailQueueService.cs │ ├── NullMailService.cs │ └── SmtpMailSender.cs ├── Middlewares │ ├── FakeRemoteIPAddressMiddleware.cs │ ├── Middleware.cs │ ├── MiddlewareDBContext.cs │ ├── RateLimitMiddleware.cs │ └── RequestLogMiddleware.cs ├── Migrations │ ├── 20211019021627_InitialCreate.cs │ ├── 20211019031221_HeartedLevels.cs │ ├── 20211019203627_LastMatches.cs │ ├── 20211020220840_ResourceList.cs │ ├── 20211026010814_FavouriteUsers.cs │ ├── 20211028015915_AddSlotTimestamp.cs │ ├── 20211028021513_AddSlotFirstUploadedAndLastUpdated.cs │ ├── 20211029213334_RemoveUsedSlotsFromDb.cs │ ├── 20211030203837_AddMMPickToSlot.cs │ ├── 20211031234245_AddScoresTable.cs │ ├── 20211102215859_RenameTeamPick.cs │ ├── 20211103194917_RemoveStartupMigrations.cs │ ├── 20211104031327_AddGameVersionToToken.cs │ ├── 20211104040509_AddGameVersionToSlots.cs │ ├── 20211104195812_AddPhotoSupport.cs │ ├── 20211105205010_UpdatePhotoAndPhotoSubjectToDoStuffWeirdName.cs │ ├── 20211105205239_DropPhotoSubjectParentPhoto.cs │ ├── 20211105205749_DropPhotoSlot.cs │ ├── 20211106010424_AddCreatorToPhoto.cs │ ├── 20211107023452_NoPhotosByMeOrWithMeInUser.cs │ ├── 20211108013443_RemoveCommentsEnabled.cs │ ├── 20211108015422_AddPlaysToSlot.cs │ ├── 20211108054552_RemoveCountsFromDatabase.cs │ ├── 20211108093616_GameSpecificPlayCounts.cs │ ├── 20211108114052_VisitedLevelsTable.cs │ ├── 20211108212022_BooYayRateLevels.cs │ ├── 20211109225543_AddLevelTypeToSlot.cs │ ├── 20211113091631_AddUserLocationToToken.cs │ ├── 20211113215128_VisitedLevelPlayCounts.cs │ ├── 20211113220306_VisitedLevelDropGameVersion.cs │ ├── 20211114231343_UserRefactor.cs │ ├── 20211115050553_UserAddDefaultsToNullableStrings.cs │ ├── 20211115052941_SlotAddLbpVitaPlays.cs │ ├── 20211120045239_AddPasswordToUser.cs │ ├── 20211120052549_RenameTokensToGameTokens.cs │ ├── 20211120053654_AddWebTokens.cs │ ├── 20211122002000_AddAuthenticationAttempts.cs │ ├── 20211123224001_AddIsAdminToUser.cs │ ├── 20211125052035_AddGameVersionToLastMatch.cs │ ├── 20211127201738_AddPasswordResetRequiredToUser.cs │ ├── 20211130190200_AddYayBooMehHashesToUser.cs │ ├── 20211202235932_RenameLastMatchesToLastContacts.cs │ ├── 20211211045823_AddLevelReviews.cs │ ├── 20211213195540_AddUserApprovedIpAddresses.cs │ ├── 20211214005427_AddUsedBoolToGameToken.cs │ ├── 20211217000749_AddBannedPropertiesToUser.cs │ ├── 20220113125615_AddDatabaseCustomCategories.cs │ ├── 20220121024607_AddVitaCrossControlRequiredToSlot.cs │ ├── 20220205132152_CommentRefactor.cs │ ├── 20220212041106_AddGriefReports.cs │ ├── 20220212091645_RemoveVisiblePlayersFromReport.cs │ ├── 20220216230824_AddEarthHashesForAllGames.cs │ ├── 20220217045519_AddPlatformForLastContactsAndGameTokens.cs │ ├── 20220301195426_AddEmailAddressToUser.cs │ ├── 20220301204930_AddEmailVerificationTokens.cs │ ├── 20220301212120_SplitSetAndVerificationTokenTypes.cs │ ├── 20220302003658_AddEmailVerifiedToUser.cs │ ├── 20220402212909_AddAdminGrantedSlotsToUser.cs │ ├── 20220413192851_AddUserForeignKeyToLastContacts.cs │ ├── 20220522192158_SwitchToPermissionLevels.cs │ ├── 20220610061641_AddCompletedMigrations.cs │ ├── 20220610230341_AddModerationCases.cs │ ├── 20220610230647_AddExpirationDateToCases.cs │ ├── 20220611012037_AddAffectedIdToCases.cs │ ├── 20220611221819_OnlyAllowSingleApprovedIP.cs │ ├── 20220624210701_AddedPasswordResetTokens.cs │ ├── 20220715222906_UserInvite.cs │ ├── 20220716234844_RemovedAPIKeyEnabled.cs │ ├── 20220729002704_DeveloperSlots.cs │ ├── 20220729182709_AddExpiryTimesToTokens.cs │ ├── 20220801055525_AddPrivacySettingsToUser.cs │ ├── 20220802150408_Arrrrrr.cs │ ├── 20220805213150_RenameCaseProperties.cs │ ├── 20220805234507_AddModNotesToCase.cs │ ├── 20220806013840_AddHiddenSlots.cs │ ├── 20220806181028_AddCommentsEnabledToSlotsAndUsers.cs │ ├── 20220808053519_RemoveVitaPlayCount.cs │ ├── 20220825212051_AddLevelTagToRatedLevel.cs │ ├── 20220826001101_AddLoginTimestampsToUser.cs │ ├── 20220910190711_AddUserLanguageAndTimezone.cs │ ├── 20220910190824_RemoveUserIsAPirate.cs │ ├── 20220916141401_ScoreboardAdvSlot.cs │ ├── 20220918154500_AddIsAdventureColumn.cs │ ├── 20220923042831_AddPlaylists.cs │ ├── 20221016234831_AddUsernameToRegistrationToken.cs │ ├── 20221105212037_AddTwoFactorToUser.cs │ ├── 20221117165700_AddCrossControlPlanet.cs │ ├── 20221118162114_AddVerifiedToWebToken.cs │ ├── 20221217002014_ReworkGameTokens.cs │ ├── 20221217043015_AddPlatformLinkAttempts.cs │ ├── 20221217044751_AddForeignKeyToLinkAttempts.cs │ ├── 20230127021453_AddUsernameToCaseTable.cs │ ├── 20230208165011_AddedUserBlocking.cs │ ├── 20230215195324_ChangeLocationStorage.cs │ ├── 20230221215252_FixPhotoAndSubjectRelation.cs │ ├── 20230222065412_RemovePhotoSubjectCollection.cs │ ├── 20230310075648_RemoveGameFromUser.cs │ ├── 20230319024330_AddCommentForeignKeyToReactions.cs │ ├── 20230319024424_RenameReactionsTableToRatedComments.cs │ ├── 20230620211613_AddWebAnnouncementsToDb.cs │ ├── 20230624203015_AddPostedByToWebAnnouncements.cs │ ├── 20230628043618_AddUserIdAndTimestampToScore.cs │ ├── 20230706020914_DropPlayerIdCollectionAndAddUserForeignKey.cs │ ├── 20230707125059_AddModerationLevelLocks.cs │ ├── 20230714212153_AddUserIdAndSlotIdToComment.cs │ ├── 20230714212234_AddForeignKeyConstraintToComment.cs │ ├── 20230827004014_AddProfileVanityTagsToUsers.cs │ ├── 20231027215257_AddNotificationEntity.cs │ ├── 20240214031744_UpdateTeamPickBoolToTimestamp.cs │ ├── 20240317231145_RemoveUserLocationFromGameTokens.cs │ ├── 20240625004457_AddLocationHashToGameToken.cs │ └── DatabaseContextModelSnapshot.cs ├── ProjectLighthouse.csproj ├── Properties │ └── launchSettings.json ├── Serialization │ ├── CustomXmlSerializer.cs │ ├── ExcludeNamespaceXmlWriter.cs │ ├── JsonOutputFormatter.cs │ ├── LbpOutputFormatter.cs │ ├── LighthouseSerializer.cs │ ├── WriteFullClosingTagXmlWriter.cs │ └── XmlWriterWrapper.cs ├── Services │ └── RepeatingTaskService.cs ├── Startup │ └── DebugWarmupLifetime.cs ├── StartupTasks.cs ├── StaticFiles │ ├── android-chrome-192x192.png │ ├── android-chrome-512x512.png │ ├── apple-touch-icon.png │ ├── assets │ │ ├── advSlotCardMask.png │ │ ├── advSlotCardOverlay.png │ │ ├── slotCardBackground.png │ │ └── slotCardOverlay.png │ ├── browserconfig.xml │ ├── css │ │ ├── semantic.min.css │ │ ├── styles.css │ │ └── themes │ │ │ └── default │ │ │ └── assets │ │ │ ├── fonts │ │ │ ├── brand-icons.eot │ │ │ ├── brand-icons.svg │ │ │ ├── brand-icons.ttf │ │ │ ├── brand-icons.woff │ │ │ ├── brand-icons.woff2 │ │ │ ├── icons.eot │ │ │ ├── icons.svg │ │ │ ├── icons.ttf │ │ │ ├── icons.woff │ │ │ ├── icons.woff2 │ │ │ ├── outline-icons.eot │ │ │ ├── outline-icons.svg │ │ │ ├── outline-icons.ttf │ │ │ ├── outline-icons.woff │ │ │ └── outline-icons.woff2 │ │ │ └── images │ │ │ └── flags.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ ├── favicon.ico │ ├── logo-color.png │ ├── logo-mono.png │ ├── logo-pride.png │ ├── logo.svg │ ├── mstile-150x150.png │ ├── safari-pinned-tab.svg │ └── site.webmanifest ├── StorableLists │ ├── NormalStorableList.cs │ ├── RedisDatabase.cs │ ├── RedisStorableList.cs │ ├── StorableList.cs │ └── Stores │ │ ├── RoomStore.cs │ │ └── UserFriendStore.cs ├── Tickets │ ├── NPTicket.cs │ ├── Parser │ │ ├── ITicketParser.cs │ │ ├── TicketParseException.cs │ │ ├── TicketParser21.cs │ │ └── TicketParser30.cs │ ├── Signature │ │ ├── NullSignatureVerifier.cs │ │ ├── PsnSignatureVerifier.cs │ │ ├── RpcnSignatureVerifier.cs │ │ ├── TicketSignatureVerifier.cs │ │ └── UnitTestSignatureVerifier.cs │ ├── TicketBuilder.cs │ ├── TicketReader.cs │ ├── TicketTypes.cs │ └── TicketVersion.cs ├── Types │ ├── Entities │ │ ├── Interaction │ │ │ ├── HeartedLevelEntity.cs │ │ │ ├── HeartedPlaylistEntity.cs │ │ │ ├── HeartedProfileEntity.cs │ │ │ ├── QueuedLevelEntity.cs │ │ │ ├── RatedCommentEntity.cs │ │ │ ├── RatedLevelEntity.cs │ │ │ ├── RatedReviewEntity.cs │ │ │ └── VisitedLevelEntity.cs │ │ ├── Level │ │ │ ├── DatabaseCategoryEntity.cs │ │ │ ├── PlaylistEntity.cs │ │ │ ├── ReviewEntity.cs │ │ │ ├── ScoreEntity.cs │ │ │ └── SlotEntity.cs │ │ ├── Maintenance │ │ │ └── CompletedMigrationEntity.cs │ │ ├── Moderation │ │ │ ├── GriefReportEntity.cs │ │ │ └── ModerationCaseEntity.cs │ │ ├── Notifications │ │ │ └── NotificationEntity.cs │ │ ├── Profile │ │ │ ├── BlockedProfileEntity.cs │ │ │ ├── CommentEntity.cs │ │ │ ├── LastContactEntity.cs │ │ │ ├── PhotoEntity.cs │ │ │ ├── PhotoSubjectEntity.cs │ │ │ ├── PlatformLinkAttemptEntity.cs │ │ │ └── UserEntity.cs │ │ ├── Token │ │ │ ├── ApiKeyEntity.cs │ │ │ ├── EmailSetTokenEntity.cs │ │ │ ├── EmailVerificationTokenEntity.cs │ │ │ ├── GameTokenEntity.cs │ │ │ ├── PasswordResetTokenEntity.cs │ │ │ ├── RegistrationTokenEntity.cs │ │ │ └── WebTokenEntity.cs │ │ └── Website │ │ │ └── WebsiteAnnouncementEntity.cs │ ├── Filter │ │ ├── FilterLocation.cs │ │ ├── IFilter.cs │ │ ├── IQueryBuilder.cs │ │ ├── ISlotFilter.cs │ │ ├── PaginationData.cs │ │ └── Sorts │ │ │ ├── ISlotSort.cs │ │ │ ├── ISort.cs │ │ │ └── ISortBuilder.cs │ ├── Levels │ │ ├── Category.cs │ │ ├── LevelLabels.cs │ │ ├── LevelTags.cs │ │ └── SlotType.cs │ ├── Logging │ │ ├── ILogger.cs │ │ ├── LogArea.cs │ │ ├── LogLevel.cs │ │ ├── LogLine.cs │ │ └── LogTrace.cs │ ├── Mail │ │ ├── IMailSender.cs │ │ └── IMailService.cs │ ├── Maintenance │ │ ├── ICommand.cs │ │ ├── IMaintenanceJob.cs │ │ ├── IRepeatingTask.cs │ │ └── MigrationTask.cs │ ├── Matchmaking │ │ ├── MatchCommands │ │ │ ├── CreateRoom.cs │ │ │ ├── FindBestRoom.cs │ │ │ ├── IMatchCommand.cs │ │ │ ├── UpdateMyPlayerData.cs │ │ │ └── UpdatePlayersInRoom.cs │ │ ├── NatType.cs │ │ ├── Player.cs │ │ └── Rooms │ │ │ ├── FindBestRoomResponse.cs │ │ │ ├── Room.cs │ │ │ ├── RoomSlot.cs │ │ │ └── RoomState.cs │ ├── Misc │ │ ├── Location.cs │ │ ├── ServerType.cs │ │ └── SlotMetadata.cs │ ├── Moderation │ │ ├── Cases │ │ │ └── CaseType.cs │ │ └── Reports │ │ │ ├── GriefType.cs │ │ │ ├── Marqee.cs │ │ │ ├── Rectangle.cs │ │ │ ├── ReportPlayer.cs │ │ │ └── VisiblePlayer.cs │ ├── Notifications │ │ └── NotificationType.cs │ ├── Resources │ │ ├── LbpFile.cs │ │ └── LbpFileType.cs │ ├── Serialization │ │ ├── Author.cs │ │ ├── CategoryListResponse.cs │ │ ├── CommentListResponse.cs │ │ ├── FriendResponse.cs │ │ ├── GameCategory.cs │ │ ├── GameChallenge.cs │ │ ├── GameComment.cs │ │ ├── GameDeveloperSlot.cs │ │ ├── GameDeveloperVideos.cs │ │ ├── GameGriefReport.cs │ │ ├── GameNotification.cs │ │ ├── GamePhoto.cs │ │ ├── GamePhotoSubject.cs │ │ ├── GamePlaylist.cs │ │ ├── GameReview.cs │ │ ├── GameScore.cs │ │ ├── GameUser.cs │ │ ├── GameUserSlot.cs │ │ ├── GenericPlaylistResponse.cs │ │ ├── GenericSerializableList.cs │ │ ├── GenericSlotResponse.cs │ │ ├── GenericUserResponse.cs │ │ ├── IHasCustomRoot.cs │ │ ├── ILbpSerializable.cs │ │ ├── INeedsPreparationForSerialization.cs │ │ ├── IconList.cs │ │ ├── LbpCustomXml.cs │ │ ├── MinimalUserListResponse.cs │ │ ├── MultiScoreboardResponse.cs │ │ ├── NpHandle.cs │ │ ├── PhotoListResponse.cs │ │ ├── PhotoSlot.cs │ │ ├── PlanetStatsResponse.cs │ │ ├── PlaylistResponse.cs │ │ ├── ReviewResponse.cs │ │ ├── ReviewSlot.cs │ │ ├── ScoreboardResponse.cs │ │ ├── SerializableList.cs │ │ ├── SlotBase.cs │ │ ├── SlotResourceResponse.cs │ │ ├── TelemetryConfigResponse.cs │ │ └── UserListResponse.cs │ └── Users │ │ ├── GameVersion.cs │ │ ├── LoginResult.cs │ │ ├── PermissionLevel.cs │ │ ├── Platform.cs │ │ ├── PrivacyType.cs │ │ ├── UserFriendData.cs │ │ └── UserStatus.cs ├── appsettings.Development.json └── appsettings.json ├── README.md ├── crowdin.yml ├── docker-compose.yml ├── global.json ├── qodana.yaml └── scripts-and-tools ├── build.sh ├── create-migration.sh ├── docker-entrypoint.sh ├── example-nginx-lighthouse.conf ├── project-lighthouse-api.service ├── project-lighthouse-gameserver.service ├── project-lighthouse-website.service ├── start.sh └── update.sh /.config/dotnet-tools.json: -------------------------------------------------------------------------------- 1 | { 2 | "version": 1, 3 | "isRoot": true, 4 | "tools": { 5 | "dotnet-ef": { 6 | "version": "8.0.6", 7 | "commands": [ 8 | "dotnet-ef" 9 | ] 10 | }, 11 | "dotnet-trace": { 12 | "version": "8.0.452401", 13 | "commands": [ 14 | "dotnet-trace" 15 | ] 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /.dockerignore: -------------------------------------------------------------------------------- 1 | **/data 2 | **/bin 3 | **/obj 4 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Normalize shell scripts to have LF line endings 2 | *.sh text eol=lf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/api-issue.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: API issue 3 | about: An issue relating to the API. 4 | title: '' 5 | labels: server:api 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the problem** 11 | A clear and concise description of what the problem is. 12 | 13 | **To Reproduce (if applicable)** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **API Version(s)** 27 | - [e.g. /api/v1] 28 | 29 | **Affected endpoint(s)** 30 | - [e.g. /status] 31 | 32 | **Additional context** 33 | Add any other context about the problem here. 34 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: true 2 | contact_links: 3 | - name: Feature Request/Idea 4 | url: https://github.com/LBPUnion/ProjectLighthouse/discussions/new?category=ideas 5 | about: Ideas and feature requests are kept in GitHub Discussions. 6 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/gameserver-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Gameserver bug report 3 | about: An issue inside or relating to a supported game. 4 | title: '' 5 | labels: bug, server:gameserver 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Game(s) affected** 27 | - Platform [e.g. PS Vita, PS3, RPCS3, Vita3k, etc.] 28 | - Game [e.g. LBP2, LBP Vita] 29 | 30 | **Additional context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/website-bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Website bug report 3 | about: An issue with the website. 4 | title: '' 5 | labels: bug, website 6 | assignees: '' 7 | 8 | --- 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Expected behavior** 21 | A clear and concise description of what you expected to happen. 22 | 23 | **Screenshots** 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | **Environment Details** 27 | - OS: [e.g. iOS 15, Windows 10] 28 | - Browser and Version [e.g. Google Chrome v91, Safari v15] 29 | 30 | **Additional context** 31 | Add any other context about the problem here. 32 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | # To get started with Dependabot version updates, you'll need to specify which 2 | # package ecosystems to update and where the package manifests are located. 3 | # Please see the documentation for all configuration options: 4 | # https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates 5 | 6 | version: 2 7 | updates: 8 | - package-ecosystem: "nuget" # See documentation for possible values 9 | directory: "/" # Location of package manifests 10 | schedule: 11 | interval: "daily" 12 | -------------------------------------------------------------------------------- /.github/workflows/crowdin-push.yml: -------------------------------------------------------------------------------- 1 | on: 2 | push: 3 | branches: [main] 4 | 5 | name: Upload Translations to Crowdin 6 | 7 | jobs: 8 | crowdin-sync: 9 | if: github.repository_owner == 'LBPUnion' 10 | runs-on: ubuntu-latest 11 | 12 | steps: 13 | - name: Checkout 14 | uses: actions/checkout@v3 15 | 16 | - name: crowdin-action 17 | uses: crowdin/github-action@v1.9.0 18 | with: 19 | upload_translations: true 20 | download_translations: false 21 | env: 22 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 23 | CROWDIN_PROJECT_ID: ${{ secrets.CROWDIN_PROJECT_ID }} 24 | CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_PERSONAL_TOKEN }} 25 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Jetbrains Rider / Visual Studio junk 2 | .idea/ 3 | /_ReSharper.Caches/ 4 | /.idea/.idea.ProjectLighthouse/.idea/workspace.xml 5 | /.idea/.idea.ProjectLighthouse/.idea/dataSources/ 6 | /.idea/.idea.ProjectLighthouse/.idea/dataSources.xml 7 | /.idea/.idea.ProjectLighthouse/.idea/dataSources.local.xml 8 | /ProjectLighthouse/ProjectLighthouse.csproj.user 9 | *.sln.DotSettings.user 10 | .vs/ 11 | 12 | # Visual Studio Code junk 13 | ProjectLighthouse/.vscode/tasks.json 14 | ProjectLighthouse/.vscode/launch.json 15 | .vscode/tasks.json 16 | .vscode/launch.json 17 | .editorconfig 18 | launchSettings.json 19 | 20 | # macOS Junk 21 | .DS_Store 22 | 23 | # Lighthouse junk 24 | riderModule.iml 25 | r/ 26 | png/ 27 | /ProjectLighthouse/r/* 28 | /ProjectLighthouse/logs/* 29 | lighthouse.config.json 30 | **.yml* 31 | **/logs 32 | npTicket* 33 | r.tar.gz 34 | 35 | # MSBuild stuff 36 | bin/ 37 | obj/ 38 | /packages/ 39 | 40 | # Misc 41 | *.bak 42 | *.old 43 | BACKUP* 44 | backup* 45 | 46 | *.tmp 47 | *.bin 48 | -------------------------------------------------------------------------------- /.idea/.idea.ProjectLighthouse/.idea/discord.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | -------------------------------------------------------------------------------- /.idea/.idea.ProjectLighthouse/.idea/encodings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/.idea.ProjectLighthouse/.idea/git_toolbox_prj.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 9 | 14 | 19 | 20 | -------------------------------------------------------------------------------- /.idea/.idea.ProjectLighthouse/.idea/jsLibraryMappings.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/.idea.ProjectLighthouse/.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 6 | -------------------------------------------------------------------------------- /.idea/.idea.ProjectLighthouse/.idea/projectSettingsUpdater.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | -------------------------------------------------------------------------------- /.idea/.idea.ProjectLighthouse/.idea/sqldialects.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/.idea.ProjectLighthouse/.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /Documentation/Images/Localization-manager-created.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/Documentation/Images/Localization-manager-created.png -------------------------------------------------------------------------------- /Documentation/Images/Localization-manager-example.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/Documentation/Images/Localization-manager-example.png -------------------------------------------------------------------------------- /Documentation/Images/Localization-manager-new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/Documentation/Images/Localization-manager-new.png -------------------------------------------------------------------------------- /Documentation/Theming.md: -------------------------------------------------------------------------------- 1 | # Theming 2 | 3 | Theming in Project Lighthouse is done under [Fomantic UI](https://fomantic-ui.com). 4 | 5 | We use a custom theme for Lighthouse. This can be accessed [here](https://github.com/LBPUnion/LighthouseFomantic). 6 | 7 | Further instructions and documentation are included inside this repository, and Fomantic UI's documentation. 8 | -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/Register.lang-ingsoc.resx: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | text/microsoft-resx 10 | 11 | 12 | 1.3 13 | 14 | 15 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 16 | 17 | 18 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 19 | 20 | 21 | Warning: Username must match PSN/RPCN username to sign in from in-game. 22 | 23 | -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/StringLists/ErrorStrings.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization.StringLists; 2 | 3 | public static class ErrorStrings 4 | { 5 | public static readonly TranslatableString UsernameInvalid = create("username_invalid"); 6 | public static readonly TranslatableString UsernameTaken = create("username_taken"); 7 | public static readonly TranslatableString PasswordInvalid = create("password_invalid"); 8 | public static readonly TranslatableString PasswordDoesntMatch = create("password_doesnt_match"); 9 | public static readonly TranslatableString EmailInvalid = create("email_invalid"); 10 | public static readonly TranslatableString EmailTaken = create("email_taken"); 11 | public static readonly TranslatableString CaptchaFailed = create("captcha_failed"); 12 | public static readonly TranslatableString ActionNoPermission = create("action_no_permission"); 13 | 14 | private static TranslatableString create(string key) => new(TranslationAreas.Error, key); 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/StringLists/LandingPageStrings.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization.StringLists; 2 | 3 | public static class LandingPageStrings 4 | { 5 | public static readonly TranslatableString Welcome = create("welcome"); 6 | public static readonly TranslatableString LoggedInAs = create("loggedInAs"); 7 | 8 | public static readonly TranslatableString UsersNone = create("users_none"); 9 | public static readonly TranslatableString UsersSingle = create("users_single"); 10 | public static readonly TranslatableString UsersMultiple = create("users_multiple"); 11 | 12 | public static readonly TranslatableString LatestTeamPicks = create("latest_team_picks"); 13 | public static readonly TranslatableString NewestLevels = create("newest_levels"); 14 | 15 | public static readonly TranslatableString AuthAttemptsPending = create("authAttemptsPending"); 16 | 17 | private static TranslatableString create(string key) => new(TranslationAreas.LandingPage, key); 18 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/StringLists/LoggedOutStrings.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization.StringLists; 2 | 3 | public static class LoggedOutStrings 4 | { 5 | public static readonly TranslatableString LoggedOut = create("logged_out"); 6 | public static readonly TranslatableString LoggedOutInfo = create("logged_out_info"); 7 | public static readonly TranslatableString Redirect = create("redirect"); 8 | 9 | private static TranslatableString create(string key) => new(TranslationAreas.LoggedOut, key); 10 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/StringLists/ModPanelStrings.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization.StringLists; 2 | 3 | public static class ModPanelStrings 4 | { 5 | public static readonly TranslatableString ModPanelTitle = create("mod_panel_title"); 6 | public static readonly TranslatableString Greeting = create("greeting"); 7 | public static readonly TranslatableString BannedUsers = create("banned_users"); 8 | public static readonly TranslatableString HiddenLevels = create("hidden_levels"); 9 | 10 | private static TranslatableString create(string key) => new(TranslationAreas.ModPanel, key); 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/StringLists/PrivacyStrings.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization.StringLists; 2 | 3 | public static class PrivacyStrings 4 | { 5 | public static readonly TranslatableString BlockedUsers = create("blocked_users"); 6 | public static readonly TranslatableString NoBlockedUsers = create("no_blocked_users"); 7 | 8 | public static readonly TranslatableString EnableComments = create("enable_comments"); 9 | public static readonly TranslatableString DisableComments = create("disable_comments"); 10 | 11 | public static readonly TranslatableString PrivacyAll = create("privacy_all"); 12 | public static readonly TranslatableString PrivacyPSN = create("privacy_psn"); 13 | public static readonly TranslatableString PrivacyGame = create("privacy_game"); 14 | 15 | private static TranslatableString create(string key) => new(TranslationAreas.Privacy, key); 16 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/StringLists/ProfileStrings.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization.StringLists; 2 | 3 | public static class ProfileStrings 4 | { 5 | public static readonly TranslatableString Title = create("title"); 6 | public static readonly TranslatableString Biography = create("biography"); 7 | public static readonly TranslatableString NoBiography = create("no_biography"); 8 | public static readonly TranslatableString ProfileTag = create("profile_tag"); 9 | 10 | private static TranslatableString create(string key) => new(TranslationAreas.Profile, key); 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/StringLists/RegisterStrings.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization.StringLists; 2 | 3 | public static class RegisterStrings 4 | { 5 | public static readonly TranslatableString UsernameNotice = create("username_notice"); 6 | 7 | private static TranslatableString create(string key) => new(TranslationAreas.Register, key); 8 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/StringLists/StatusStrings.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization.StringLists; 2 | 3 | public static class StatusStrings 4 | { 5 | public static readonly TranslatableString CurrentlyOnline = create("currently_online"); 6 | public static readonly TranslatableString LastOnline = create("last_online"); 7 | public static readonly TranslatableString Offline = create("offline"); 8 | 9 | private static TranslatableString create(string key) => new(TranslationAreas.Status, key); 10 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Localization/TranslationAreas.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Localization; 2 | 3 | public enum TranslationAreas 4 | { 5 | BaseLayout, 6 | LandingPage, 7 | General, 8 | LoggedOut, 9 | Status, 10 | Register, 11 | Error, 12 | Profile, 13 | ModPanel, 14 | TwoFactor, 15 | Moderation, 16 | Privacy, 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/ApiEndpointController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.API; 4 | 5 | [ApiController] 6 | [Route("/api/v1")] 7 | [Produces("application/json")] 8 | public class ApiEndpointController : ControllerBase 9 | { } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/Controllers/RpcController.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Configuration; 2 | using LBPUnion.ProjectLighthouse.Servers.API.Responses; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Servers.API.Controllers; 6 | 7 | public class RpcController : ApiEndpointController 8 | { 9 | /// 10 | /// Returns basic information that Discord RPC clients can use for self-configuration. 11 | /// 12 | /// RpcResponse 13 | /// The RPC configuration. 14 | [HttpGet("rpc")] 15 | [ProducesResponseType(typeof(RpcResponse), StatusCodes.Status200OK)] 16 | public IActionResult GetRpcConfiguration() => 17 | this.Ok(RpcResponse.CreateFromConfiguration(ServerConfiguration.Instance.RichPresenceConfiguration)); 18 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/Controllers/StatusController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.API.Controllers; 4 | 5 | public class StatusController : ApiEndpointController 6 | { 7 | [AcceptVerbs("GET", "HEAD", Route = "status")] 8 | public IActionResult GetStatus() => this.Ok(); 9 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/Program.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse; 2 | using LBPUnion.ProjectLighthouse.Configuration; 3 | using LBPUnion.ProjectLighthouse.Logging.Loggers.AspNet; 4 | using LBPUnion.ProjectLighthouse.Servers.API.Startup; 5 | using LBPUnion.ProjectLighthouse.Types.Misc; 6 | 7 | await StartupTasks.Run(ServerType.Api); 8 | 9 | IHostBuilder builder = Host.CreateDefaultBuilder(); 10 | builder.ConfigureWebHostDefaults(webBuilder => 11 | { 12 | webBuilder.UseStartup(); 13 | webBuilder.UseUrls(ServerConfiguration.Instance.ApiListenUrl); 14 | }); 15 | 16 | builder.ConfigureLogging(logging => 17 | { 18 | logging.ClearProviders(); 19 | logging.AddProvider(new AspNetToLighthouseLoggerProvider()); 20 | }); 21 | 22 | await builder.Build().RunAsync(); -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/ProjectLighthouse.Servers.API.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | LBPUnion.ProjectLighthouse.Servers.API 8 | LBPUnion.ProjectLighthouse.Servers.API 9 | false 10 | 11 | 12 | 13 | true 14 | $(NoWarn);1591 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/Responses/PlayerListResponse.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Servers.API.Responses; 2 | 3 | public class PlayerListResponse 4 | { 5 | public required List Players { get; set; } 6 | } 7 | 8 | public class PlayerListObject 9 | { 10 | public required string Username { get; set; } 11 | public required string Game { get; set; } 12 | public required string Platform { get; set; } 13 | } 14 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/Responses/StatisticsResponse.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Servers.API.Responses; 2 | 3 | public class StatisticsResponse 4 | { 5 | public int RecentMatches { get; set; } 6 | public int Slots { get; set; } 7 | public int Users { get; set; } 8 | public int TeamPicks { get; set; } 9 | public int Photos { get; set; } 10 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/Startup/ApiTestStartup.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Middlewares; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.API.Startup; 4 | 5 | public class ApiTestStartup : ApiStartup 6 | { 7 | public ApiTestStartup(IConfiguration configuration) : base(configuration) 8 | {} 9 | 10 | public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) 11 | { 12 | app.UseMiddleware(); 13 | base.Configure(app, env); 14 | } 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/Startup/SwaggerFilter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.OpenApi.Models; 2 | using Swashbuckle.AspNetCore.SwaggerGen; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Servers.API.Startup; 5 | 6 | /// 7 | /// 8 | /// A filter for the swagger documentation endpoint. 9 | /// 10 | /// 11 | /// Makes sure that only endpoints under /api/v1 show up. 12 | /// 13 | /// 14 | public class SwaggerFilter : IDocumentFilter 15 | { 16 | public void Apply(OpenApiDocument swaggerDoc, DocumentFilterContext context) 17 | { 18 | List> nonApiRoutes = swaggerDoc.Paths.Where(x => !x.Key.ToLower().StartsWith("/api/v1")).ToList(); 19 | nonApiRoutes.ForEach(x => swaggerDoc.Paths.Remove(x.Key)); 20 | } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.API/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Controllers/DeveloperController.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Types.Serialization; 2 | using Microsoft.AspNetCore.Authorization; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers; 6 | 7 | [ApiController] 8 | [Authorize] 9 | [Route("LITTLEBIGPLANETPS3_XML/")] 10 | [Produces("text/xml")] 11 | public class DeveloperController : Controller 12 | { 13 | [HttpGet("developer_videos")] 14 | public IActionResult DeveloperVideos() => this.Ok(new GameDeveloperVideos()); 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Controllers/StatusController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers; 4 | 5 | [ApiController] 6 | [Route("/LITTLEBIGPLANETPS3_XML")] 7 | [Produces("application/json")] 8 | public class StatusController : ControllerBase 9 | { 10 | [AcceptVerbs("GET", "HEAD", Route = "status")] 11 | public IActionResult GetStatus() => this.Ok(); 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Controllers/StoreController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Authorization; 2 | using Microsoft.AspNetCore.Mvc; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers; 5 | 6 | [ApiController] 7 | [Authorize] 8 | [Route("LITTLEBIGPLANETPS3_XML/")] 9 | [Produces("text/xml")] 10 | public class StoreController : Controller 11 | { 12 | [HttpGet("promotions")] 13 | public IActionResult Promotions() => this.Ok(); 14 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Program.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse; 2 | using LBPUnion.ProjectLighthouse.Configuration; 3 | using LBPUnion.ProjectLighthouse.Logging.Loggers.AspNet; 4 | using LBPUnion.ProjectLighthouse.Servers.GameServer.Startup; 5 | using LBPUnion.ProjectLighthouse.Types.Misc; 6 | 7 | await StartupTasks.Run(ServerType.GameServer); 8 | 9 | IHostBuilder builder = Host.CreateDefaultBuilder(); 10 | builder.ConfigureWebHostDefaults(webBuilder => 11 | { 12 | webBuilder.UseStartup(); 13 | webBuilder.UseUrls(ServerConfiguration.Instance.GameApiListenUrl); 14 | }); 15 | 16 | builder.ConfigureLogging(logging => 17 | { 18 | logging.ClearProviders(); 19 | logging.AddProvider(new AspNetToLighthouseLoggerProvider()); 20 | }); 21 | 22 | await builder.Build().RunAsync(); -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/ProjectLighthouse.Servers.GameServer.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | net8.0 5 | enable 6 | enable 7 | LBPUnion.ProjectLighthouse.Servers.GameServer 8 | LBPUnion.ProjectLighthouse.Servers.GameServer 9 | false 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Startup/GameServerTestStartup.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Middlewares; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Startup; 4 | 5 | public class GameServerTestStartup : GameServerStartup 6 | { 7 | public GameServerTestStartup(IConfiguration configuration) : base(configuration) 8 | {} 9 | 10 | public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) 11 | { 12 | app.UseMiddleware(); 13 | base.Configure(app, env); 14 | } 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Types/Categories/QueueCategory.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using LBPUnion.ProjectLighthouse.Database; 3 | using LBPUnion.ProjectLighthouse.Filter; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 5 | using LBPUnion.ProjectLighthouse.Types.Entities.Token; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; 8 | 9 | public class QueueCategory : SlotCategory 10 | { 11 | public override string Name { get; set; } = "My Queue"; 12 | public override string Description { get; set; } = "Your queued content"; 13 | public override string IconHash { get; set; } = "g820614"; 14 | public override string Endpoint { get; set; } = "queue"; 15 | public override string Tag => "my_queue"; 16 | 17 | public override IQueryable GetItems(DatabaseContext database, GameTokenEntity token, SlotQueryBuilder queryBuilder) => 18 | database.QueuedLevels.Where(q => q.UserId == token.UserId) 19 | .OrderByDescending(q => q.QueuedLevelId) 20 | .Select(q => q.Slot) 21 | .Where(queryBuilder.Build()); 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Types/Categories/TextSearchCategory.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Database; 2 | using LBPUnion.ProjectLighthouse.Extensions; 3 | using LBPUnion.ProjectLighthouse.Filter; 4 | using LBPUnion.ProjectLighthouse.Filter.Sorts; 5 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 6 | using LBPUnion.ProjectLighthouse.Types.Entities.Token; 7 | 8 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; 9 | 10 | public class TextSearchCategory : SlotCategory 11 | { 12 | public override string Name { get; set; } = ""; 13 | public override string Description { get; set; } = ""; 14 | public override string IconHash { get; set; } = ""; 15 | public override string Endpoint { get; set; } = "text"; 16 | public override string Tag => "text"; 17 | 18 | public override IQueryable GetItems 19 | (DatabaseContext database, GameTokenEntity token, SlotQueryBuilder queryBuilder) => 20 | database.Slots.Where(queryBuilder.Build()) 21 | .ApplyOrdering(new SlotSortBuilder().AddSort(new TotalPlaysSort())); 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Types/Misc/ResourceList.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | using LBPUnion.ProjectLighthouse.Types.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Misc; 5 | 6 | /// 7 | /// Used by the game to send a list of hashed resources 8 | /// Use cases include requesting which resources are filtered 9 | /// or what resources aren't currently uploaded to the server 10 | /// 11 | [XmlRoot("resources")] 12 | [XmlType("resources")] 13 | public class ResourceList : ILbpSerializable 14 | { 15 | [XmlElement("resource")] 16 | public string[]? Resources; 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Types/MyPlaylistsCategory.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Database; 2 | using LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Categories; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Token; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types; 7 | 8 | public class MyPlaylistsCategory : PlaylistCategory 9 | { 10 | public override string Name { get; set; } = "My Playlists"; 11 | public override string Description { get; set; } = "Your playlists"; 12 | public override string IconHash { get; set; } = "g820613"; 13 | public override string Endpoint { get; set; } = "my_playlists"; 14 | public override string Tag => "my_playlists"; 15 | public override string[] Types { get; } = { "playlist", }; 16 | 17 | public override IQueryable GetItems(DatabaseContext database, GameTokenEntity token) => 18 | database.Playlists.Where(p => p.CreatorId == token.UserId).OrderByDescending(p => p.PlaylistId); 19 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Types/Users/NPData.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Users; 4 | 5 | /// 6 | /// Sent by the game client to inform the server 7 | /// of the user's friend list 8 | /// Used to filter activities from friends 9 | /// 10 | [XmlRoot("npdata")] 11 | [XmlType("npdata")] 12 | public class NPData 13 | { 14 | [XmlArray("friends")] 15 | [XmlArrayItem("npHandle")] 16 | public List? Friends { get; set; } 17 | 18 | [XmlArray("blocked")] 19 | [XmlArrayItem("npHandle")] 20 | public List? BlockedUsers { get; set; } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Types/Users/Pins.cs: -------------------------------------------------------------------------------- 1 | using System.Text.Json.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Users; 4 | 5 | public class Pins 6 | { 7 | [JsonPropertyName("progress")] 8 | public long[]? Progress { get; set; } 9 | 10 | [JsonPropertyName("awards")] 11 | public long[]? Awards { get; set; } 12 | 13 | [JsonPropertyName("profile_pins")] 14 | public long[]? ProfilePins { get; set; } 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/Types/Users/PrivacySettings.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | using LBPUnion.ProjectLighthouse.Types.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Servers.GameServer.Types.Users; 5 | 6 | [XmlRoot("privacySettings")] 7 | [XmlType("privacySettings")] 8 | public class PrivacySettings : ILbpSerializable 9 | { 10 | [XmlElement("levelVisibility")] 11 | public string? LevelVisibility { get; set; } 12 | 13 | [XmlElement("profileVisibility")] 14 | public string? ProfileVisibility { get; set; } 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.GameServer/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Captcha/ICaptchaService.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Captcha; 2 | 3 | public interface ICaptchaService 4 | { 5 | Task VerifyCaptcha(HttpRequest request); 6 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Controllers/Admin/AdminPanelController.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using LBPUnion.ProjectLighthouse.Database; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers.Admin; 6 | 7 | [ApiController] 8 | [Route("/admin")] 9 | public class AdminPanelController : ControllerBase 10 | { 11 | private readonly DatabaseContext database; 12 | 13 | public AdminPanelController(DatabaseContext database) 14 | { 15 | this.database = database; 16 | } 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Controllers/StatusController.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Controllers; 4 | 5 | [ApiController] 6 | [Route("/")] 7 | [Produces("application/json")] 8 | public class StatusController : ControllerBase 9 | { 10 | [AcceptVerbs("GET", "HEAD", Route = "status")] 11 | public IActionResult GetStatus() => this.Ok(); 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Admin/AdminSendNotificationPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/admin/user/{id:int}/sendNotification" 2 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.AdminSendNotificationPage 3 | 4 | @{ 5 | Layout = "Layouts/BaseLayout"; 6 | Model.Title = $"Send notification to {Model.TargetedUser!.Username}"; 7 | } 8 | 9 | @await Html.PartialAsync("Partials/AdminSendNotificationPartial", Model.TargetedUser) -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Admin/AdminSetGrantedSlotsPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/admin/user/{id:int}/setGrantedSlots" 2 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Admin.AdminSetGrantedSlotsPage 3 | 4 | @{ 5 | Layout = "Layouts/BaseLayout"; 6 | Model.Title = $"Set granted slots for {Model.TargetedUser!.Username}"; 7 | } 8 | 9 | @await Html.PartialAsync("Partials/AdminSetGrantedSlotsFormPartial", Model.TargetedUser) -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Debug/FilterTestPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/debug/filter" 2 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug.FilterTestPage 3 | 4 | @{ 5 | Layout = "Layouts/BaseLayout"; 6 | Model.Title = "Debug - Filter Test"; 7 | } 8 | 9 | @if (Model.FilteredText != null) 10 | { 11 |

@Model.FilteredText

12 | } 13 | 14 |
15 |
16 | 17 | 21 |
22 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Debug/FilterTestPage.cshtml.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | #if DEBUG 3 | using LBPUnion.ProjectLighthouse.Helpers; 4 | #endif 5 | using LBPUnion.ProjectLighthouse.Database; 6 | using LBPUnion.ProjectLighthouse.Types.Filter; 7 | using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; 8 | using Microsoft.AspNetCore.Mvc; 9 | 10 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug; 11 | 12 | public class FilterTestPage : BaseLayout 13 | { 14 | public FilterTestPage(DatabaseContext database) : base(database) 15 | {} 16 | 17 | public string? FilteredText; 18 | public string? Text; 19 | 20 | public IActionResult OnGet(string? text = null) 21 | { 22 | #if DEBUG 23 | if (text != null) this.FilteredText = CensorHelper.FilterMessage(text, FilterLocation.Test); 24 | this.Text = text; 25 | 26 | return this.Page(); 27 | #else 28 | return this.NotFound(); 29 | #endif 30 | } 31 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Debug/RoomVisualizerPage.cshtml.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; 5 | using Microsoft.AspNetCore.Mvc; 6 | #if !DEBUG 7 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 8 | #endif 9 | 10 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug; 11 | 12 | public class RoomVisualizerPage : BaseLayout 13 | { 14 | public RoomVisualizerPage(DatabaseContext database) : base(database) 15 | {} 16 | 17 | public IActionResult OnGet() 18 | { 19 | #if !DEBUG 20 | UserEntity? user = this.Database.UserFromWebRequest(this.Request); 21 | if (user == null || !user.IsAdmin) return this.NotFound(); 22 | #endif 23 | 24 | return this.Page(); 25 | } 26 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Debug/VersionInfoPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/debug/version" 2 | @using LBPUnion.ProjectLighthouse.Helpers 3 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug.VersionInfoPage 4 | 5 | @{ 6 | Layout = "Layouts/BaseLayout"; 7 | Model.Title = "Debug - Version Information"; 8 | Model.Description = VersionHelper.FullVersion; 9 | } 10 | 11 |

Build specific information

12 |

FullVersion: @VersionHelper.FullVersion

13 |
14 |

Branch: @VersionHelper.Branch

15 |

Build: @VersionHelper.Build

16 |

CommitHash: @VersionHelper.CommitHash

17 |

RepositoryUrl: @VersionHelper.RepositoryUrl

-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Debug/VersionInfoPage.cshtml.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Database; 2 | using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Debug; 6 | 7 | public class VersionInfoPage : BaseLayout 8 | { 9 | public VersionInfoPage(DatabaseContext database) : base(database) 10 | {} 11 | public IActionResult OnGet() => this.Page(); 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Email/CompleteEmailVerificationPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/verifyEmail" 2 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Email.CompleteEmailVerificationPage 3 | 4 | @{ 5 | Layout = "Layouts/BaseLayout"; 6 | 7 | if (Model.Error == null) 8 | { 9 | Model.Title = "Email Address Verified"; 10 | } 11 | else 12 | { 13 | Model.Title = "Couldn't verify email address"; 14 | } 15 | } 16 | 17 | @if (Model.Error != null) 18 | { 19 |

20 | Reason: @Model.Error 21 |

22 |

Please try again. If the error persists, please contact the instance administrator.

23 | 24 |
Resend email
25 |
26 | } 27 | else 28 | { 29 |

Your email has been successfully verified. You may now close this tab.

30 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Email/SendVerificationEmailPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/login/sendVerificationEmail" 2 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Email.SendVerificationEmailPage 3 | 4 | @{ 5 | Layout = "Layouts/BaseLayout"; 6 | Model.Title = "Verify Email Address"; 7 | } 8 | 9 | @if (Model.Success) 10 | { 11 |

An email address on your account has been set, but hasn't been verified yet.

12 |

To verify it, check the email sent to @Model.User?.EmailAddress and click the link in the email.

13 | } 14 | else 15 | { 16 |

Failed to send email, please try again later.

17 |

If this issue persists please contact an Administrator

18 | } 19 | 20 | 21 |
Resend email
22 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Errors/NotFoundPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/404" 2 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Errors.NotFoundPage 3 | 4 | @{ 5 | Layout = "Layouts/BaseLayout"; 6 | Model.Title = "Not Found"; 7 | Model.Description = "Sorry, but the page you requested could not be found."; 8 | } 9 | 10 |

@Model.Description

11 |

Take a peek at the homepage to see if you can find what you were looking for.

12 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Errors/NotFoundPage.cshtml.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Database; 2 | using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; 3 | using Microsoft.AspNetCore.Mvc; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Errors; 6 | 7 | public class NotFoundPage : BaseLayout 8 | { 9 | public NotFoundPage(DatabaseContext database) : base(database) 10 | {} 11 | 12 | public IActionResult OnGet() => this.Page(); 13 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Login/LogoutPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/logout" 2 | @using LBPUnion.ProjectLighthouse.Localization.StringLists 3 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login.LogoutPage 4 | 5 | @{ 6 | Layout = "Layouts/BaseLayout"; 7 | Model.Title = Model.Translate(LoggedOutStrings.LoggedOut); 8 | } 9 | 10 |

@Model.Translate(LoggedOutStrings.LoggedOutInfo)

11 | 12 | 13 | @Model.Translate(LoggedOutStrings.Redirect) 14 | 15 | 16 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Login/LogoutPage.cshtml.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using LBPUnion.ProjectLighthouse.Database; 3 | using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Token; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login; 8 | 9 | public class LogoutPage : BaseLayout 10 | { 11 | public LogoutPage(DatabaseContext database) : base(database) 12 | {} 13 | public async Task OnGet() 14 | { 15 | WebTokenEntity? token = this.Database.WebTokenFromRequest(this.Request); 16 | if (token == null) return this.Redirect("~/"); 17 | 18 | this.Database.WebTokens.Remove(token); 19 | await this.Database.SaveChangesAsync(); 20 | 21 | this.Response.Cookies.Delete("LighthouseToken"); 22 | 23 | return this.Page(); 24 | } 25 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Login/PasswordResetRequiredPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/passwordResetRequired" 2 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login.PasswordResetRequiredPage 3 | 4 | @{ 5 | Layout = "Layouts/BaseLayout"; 6 | Model.Title = "Password Reset Required"; 7 | } 8 | 9 | 10 |

An administrator has deemed it necessary that you reset your password. Please do so.

11 | 12 | 13 |
Reset Password
14 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Login/PasswordResetRequiredPage.cshtml.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using LBPUnion.ProjectLighthouse.Database; 3 | using LBPUnion.ProjectLighthouse.Servers.Website.Pages.Layouts; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | using Microsoft.AspNetCore.Mvc; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login; 8 | 9 | public class PasswordResetRequiredPage : BaseLayout 10 | { 11 | public PasswordResetRequiredPage(DatabaseContext database) : base(database) 12 | {} 13 | 14 | public bool WasResetRequest { get; private set; } 15 | 16 | public IActionResult OnGet() 17 | { 18 | UserEntity? user = this.Database.UserFromWebRequest(this.Request); 19 | if (user == null) return this.Redirect("~/login"); 20 | if (!user.PasswordResetRequired) return this.Redirect("~/passwordReset"); 21 | 22 | return this.Page(); 23 | } 24 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Login/PirateSignupPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/pirate" 2 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Login.PirateSignupPage 3 | 4 | @{ 5 | Layout = "Layouts/BaseLayout"; 6 | Model.Title = "ARRRRRRRRRR!"; 7 | } 8 | 9 | 10 | @if (Model.User!.Language != "en-PT") 11 | { 12 |

So, ye wanna be a pirate? Well, ye came to the right place!

13 |

Just click this 'ere button, and welcome aboard!

14 |

If you ever wanna walk the plank, come back 'ere.

15 | 16 |
17 | @Html.AntiForgeryToken() 18 | 19 |
20 | } 21 | else 22 | { 23 |

Back so soon, aye?

24 |

If you're gonna walk the plank, then do it!

25 | 26 |
27 | @Html.AntiForgeryToken() 28 | 29 |
30 | } 31 | 32 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Moderation/ReportPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/moderation/report/{reportId:int}" 2 | @using LBPUnion.ProjectLighthouse.Servers.Website.Extensions 3 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.Moderation.ReportPage 4 | 5 | @{ 6 | Layout = "Layouts/BaseLayout"; 7 | Model.Title = $"Report {Model.Report.ReportId}"; 8 | string timeZone = Model.GetTimeZone(); 9 | } 10 | 11 | 18 | 19 | @await Html.PartialAsync("Partials/ReportPartial", Model.Report, ViewData.WithTime(timeZone)) 20 | @await Html.PartialAsync("Partials/RenderReportBoundsPartial") -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Partials/AdminPanelStatisticPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model LBPUnion.ProjectLighthouse.Servers.Website.Types.AdminPanelStatistic 2 | 3 |
4 |
5 | @if (Model.ViewAllEndpoint != null) 6 | { 7 |

8 | @Model.StatisticNamePlural 9 |

10 | } 11 | else 12 | { 13 |

@Model.StatisticNamePlural

14 | } 15 | @if (Model.SecondStatistic == null) 16 | { 17 |

@Model.Count

18 | } 19 | else 20 | { 21 |

@Model.Count / @Model.SecondStatistic

22 | } 23 |
24 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Partials/AdminSendNotificationPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model LBPUnion.ProjectLighthouse.Types.Entities.Profile.UserEntity 2 | 3 |
4 | @Html.AntiForgeryToken() 5 | 6 | 10 | 11 | 12 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Partials/AdminSetGrantedSlotsFormPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model LBPUnion.ProjectLighthouse.Types.Entities.Profile.UserEntity 2 | 3 |
4 | @Html.AntiForgeryToken() 5 | 6 | 10 | 11 | 12 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Partials/CaptchaPartial.cshtml: -------------------------------------------------------------------------------- 1 | @using LBPUnion.ProjectLighthouse.Configuration 2 | @using LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories 3 | @if (ServerConfiguration.Instance.Captcha.CaptchaEnabled) 4 | { 5 | @switch (ServerConfiguration.Instance.Captcha.Type) 6 | { 7 | case CaptchaType.HCaptcha: 8 |
9 | 10 | break; 11 | case CaptchaType.ReCaptcha: 12 |
13 | 14 | break; 15 | default: 16 | throw new ArgumentOutOfRangeException(); 17 | } 18 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/Partials/ErrorModalPartial.cshtml: -------------------------------------------------------------------------------- 1 | @model (string Title, string Message) 2 | 3 |
4 |
5 | @Model.Title 6 |
7 |

@Model.Message

8 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/TwoFactor/DisableTwoFactorPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/remove2fa" 2 | @using LBPUnion.ProjectLighthouse.Localization.StringLists 3 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.TwoFactor.DisableTwoFactorPage 4 | 5 | @{ 6 | Layout = "Layouts/BaseLayout"; 7 | Model.Title = Model.Translate(TwoFactorStrings.DisableTwoFactor); 8 | Model.ShowTitleInPage = false; 9 | } 10 | 11 | 12 |
13 |

@Model.Translate(TwoFactorStrings.DisableTwoFactor)

14 |

@Model.Translate(TwoFactorStrings.DisableTwoFactorDescription)

15 | @await Html.PartialAsync("Partials/TwoFactorPartial", new ViewDataDictionary(ViewData) 16 | { 17 | { 18 | "SubmitUrl", "/remove2fa" 19 | }, 20 | { 21 | "Error", Model.Error 22 | }, 23 | }) 24 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Pages/TwoFactor/TwoFactorLoginPage.cshtml: -------------------------------------------------------------------------------- 1 | @page "/2fa" 2 | @using LBPUnion.ProjectLighthouse.Localization.StringLists 3 | @model LBPUnion.ProjectLighthouse.Servers.Website.Pages.TwoFactor.TwoFactorLoginPage 4 | 5 | @{ 6 | Layout = "Layouts/BaseLayout"; 7 | Model.Title = Model.Translate(TwoFactorStrings.TwoFactor); 8 | Model.ShowTitleInPage = false; 9 | } 10 | 11 | 12 |
13 |

@Model.Translate(TwoFactorStrings.TwoFactor)

14 |

@Model.Translate(TwoFactorStrings.TwoFactorDescription)

15 | @await Html.PartialAsync("Partials/TwoFactorPartial", new ViewDataDictionary(ViewData) 16 | { 17 | { 18 | "SubmitUrl", "/2fa" 19 | }, 20 | { 21 | "Error", Model.Error 22 | }, 23 | { 24 | "CallbackUrl", Model.RedirectUrl 25 | } 26 | }) 27 |
-------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Program.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse; 2 | using LBPUnion.ProjectLighthouse.Configuration; 3 | using LBPUnion.ProjectLighthouse.Logging.Loggers.AspNet; 4 | using LBPUnion.ProjectLighthouse.Servers.Website.Startup; 5 | using LBPUnion.ProjectLighthouse.Types.Misc; 6 | 7 | await StartupTasks.Run(ServerType.Website); 8 | 9 | IHostBuilder builder = Host.CreateDefaultBuilder(); 10 | builder.ConfigureWebHostDefaults(webBuilder => 11 | { 12 | webBuilder.UseStartup(); 13 | webBuilder.UseUrls(ServerConfiguration.Instance.WebsiteListenUrl); 14 | webBuilder.UseWebRoot("StaticFiles"); 15 | }); 16 | 17 | builder.ConfigureLogging(logging => 18 | { 19 | logging.ClearProviders(); 20 | logging.AddProvider(new AspNetToLighthouseLoggerProvider()); 21 | }); 22 | await builder.Build().RunAsync(); -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj: -------------------------------------------------------------------------------- 1 | 2 | 3 | net8.0 4 | enable 5 | enable 6 | LBPUnion.ProjectLighthouse.Servers.Website 7 | LBPUnion.ProjectLighthouse.Servers.Website 8 | false 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/ProjectLighthouse.Servers.Website.csproj.DotSettings.user: -------------------------------------------------------------------------------- 1 |  2 | ..\ProjectLighthouse\StaticFiles\css 3 | css -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Startup/WebsiteTestStartup.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Middlewares; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Startup; 4 | 5 | public class WebsiteTestStartup : WebsiteStartup 6 | { 7 | public WebsiteTestStartup(IConfiguration configuration) : base(configuration) 8 | {} 9 | 10 | public override void Configure(IApplicationBuilder app, IWebHostEnvironment env) 11 | { 12 | app.UseMiddleware(); 13 | base.Configure(app, env); 14 | } 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Types/AdminPanelStatistic.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Types; 4 | 5 | public struct AdminPanelStatistic 6 | { 7 | public AdminPanelStatistic(string statisticNamePlural, int count, string? viewAllEndpoint = null, int? secondStatistic = null) 8 | { 9 | this.StatisticNamePlural = statisticNamePlural; 10 | this.Count = count; 11 | this.SecondStatistic = secondStatistic; 12 | this.ViewAllEndpoint = viewAllEndpoint; 13 | } 14 | 15 | public readonly string StatisticNamePlural; 16 | public readonly int Count; 17 | public readonly int? SecondStatistic; 18 | 19 | public readonly string? ViewAllEndpoint; 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/Types/PageNavigationItem.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | 3 | using LBPUnion.ProjectLighthouse.Localization; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Servers.Website.Types; 6 | 7 | public class PageNavigationItem 8 | { 9 | public PageNavigationItem(TranslatableString name, string url, string? icon = null, string? customColor = null) 10 | { 11 | this.Name = name; 12 | this.Url = url; 13 | this.Icon = icon; 14 | this.CustomColor = customColor; 15 | } 16 | 17 | public TranslatableString Name { get; set; } 18 | public string Url { get; set; } 19 | public string? Icon { get; set; } 20 | public string? CustomColor { get; set; } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /ProjectLighthouse.Servers.Website/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft.AspNetCore": "Warning" 6 | } 7 | }, 8 | "AllowedHosts": "*" 9 | } 10 | -------------------------------------------------------------------------------- /ProjectLighthouse.Tests.GameApiTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /ProjectLighthouse.Tests.GameApiTests/Unit/Controllers/StatusControllerTests.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Servers.GameServer.Controllers; 2 | using LBPUnion.ProjectLighthouse.Tests.Helpers; 3 | using Microsoft.AspNetCore.Mvc; 4 | using Xunit; 5 | 6 | namespace ProjectLighthouse.Tests.GameApiTests.Unit.Controllers; 7 | 8 | [Trait("Category", "Unit")] 9 | public class StatusControllerTests 10 | { 11 | [Fact] 12 | public void Status_ShouldReturnOk() 13 | { 14 | StatusController statusController = new() 15 | { 16 | ControllerContext = MockHelper.GetMockControllerContext(), 17 | }; 18 | 19 | IActionResult result = statusController.GetStatus(); 20 | 21 | Assert.IsType(result); 22 | } 23 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Tests.WebsiteTests/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using Xunit; 2 | 3 | [assembly: CollectionBehavior(DisableTestParallelization = true)] -------------------------------------------------------------------------------- /ProjectLighthouse.Tests.WebsiteTests/Extensions/WebDriverExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using OpenQA.Selenium; 3 | 4 | namespace ProjectLighthouse.Tests.WebsiteTests.Extensions; 5 | 6 | public static class WebDriverExtensions 7 | { 8 | private static Uri GetUri(this IWebDriver driver) => new(driver.Url); 9 | 10 | public static string GetPath(this IWebDriver driver) => driver.GetUri().AbsolutePath; 11 | 12 | public static string GetErrorMessage(this IWebDriver driver) => driver.FindElement(By.CssSelector("#error-message > p")).Text; 13 | } -------------------------------------------------------------------------------- /ProjectLighthouse.Tests/ExampleFiles/TestFarc.farc: -------------------------------------------------------------------------------- 1 | FSHbFARC -------------------------------------------------------------------------------- /ProjectLighthouse.Tests/ExampleFiles/TestScript.ff: -------------------------------------------------------------------------------- 1 | FSHb 2 | 3 | this is not my stuff to upload so its just gonna be a file like this for now :/ -------------------------------------------------------------------------------- /ProjectLighthouse.Tests/ExampleFiles/TestTexture.tex: -------------------------------------------------------------------------------- 1 | TEX vqh��ʱ �0�/Zf����@ �p�q4�VV��xp\)S�"�K}\ձ�8���\�֖e^�9��~�$I�$I�$I�$I�$I�$I�$I�$I�$I�$I�$I�$I�$I�$�{N�7Q -------------------------------------------------------------------------------- /ProjectLighthouse.Tests/ProjectLighthouse.Tests.csproj.DotSettings: -------------------------------------------------------------------------------- 1 |  2 | True -------------------------------------------------------------------------------- /ProjectLighthouse/Administration/Maintenance/Commands/FlushRedisCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using LBPUnion.ProjectLighthouse.Logging; 4 | using LBPUnion.ProjectLighthouse.StorableLists; 5 | using LBPUnion.ProjectLighthouse.Types.Maintenance; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Administration.Maintenance.Commands; 8 | 9 | public class FlushRedisCommand : ICommand 10 | { 11 | public string Name() => "Flush Redis"; 12 | public string[] Aliases() => 13 | new[] 14 | { 15 | "flush", "flush-redis", 16 | }; 17 | public string Arguments() => ""; 18 | public int RequiredArgs() => 0; 19 | 20 | public async Task Run(IServiceProvider provider, string[] args, Logger logger) => await RedisDatabase.FlushAll(); 21 | 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Administration/Maintenance/Commands/TestWebhookCommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using LBPUnion.ProjectLighthouse.Helpers; 4 | using LBPUnion.ProjectLighthouse.Logging; 5 | using LBPUnion.ProjectLighthouse.Types.Maintenance; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Administration.Maintenance.Commands; 8 | 9 | public class TestWebhookCommand : ICommand 10 | { 11 | public string Name() => "Test Discord Webhook"; 12 | public string[] Aliases() 13 | => new[] 14 | { 15 | "testWebhook", "testDiscordWebhook", 16 | }; 17 | public string Arguments() => ""; 18 | public int RequiredArgs() => 0; 19 | 20 | public async Task Run(IServiceProvider provider, string[] args, Logger logger) => 21 | await WebhookHelper.SendWebhook("Testing 123", "Someone is testing the Discord webhook from the admin panel."); 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Administration/Maintenance/MaintenanceJobs/DeleteAllTokensMaintenanceJob.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using LBPUnion.ProjectLighthouse.Extensions; 5 | using LBPUnion.ProjectLighthouse.Types.Maintenance; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Administration.Maintenance.MaintenanceJobs; 8 | 9 | public class DeleteAllTokensMaintenanceJob : IMaintenanceJob 10 | { 11 | public string Name() => "Delete ALL Tokens"; 12 | public string Description() => "Deletes ALL game tokens and web tokens."; 13 | 14 | public async Task Run() 15 | { 16 | await using DatabaseContext database = DatabaseContext.CreateNewInstance(); 17 | await database.GameTokens.RemoveWhere(t => true); 18 | await database.WebTokens.RemoveWhere(t => true); 19 | Console.WriteLine(@"Deleted ALL tokens."); 20 | } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Administration/Maintenance/RepeatingTasks/CleanupRoomsTask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using LBPUnion.ProjectLighthouse.Helpers; 5 | using LBPUnion.ProjectLighthouse.Types.Maintenance; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Administration.Maintenance.RepeatingTasks; 8 | 9 | public class CleanupRoomsTask : IRepeatingTask 10 | { 11 | public string Name => "Cleanup Rooms"; 12 | public TimeSpan RepeatInterval => TimeSpan.FromSeconds(10); 13 | public DateTime LastRan { get; set; } 14 | public Task Run(DatabaseContext database) => RoomHelper.CleanupRooms(database); 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Administration/Maintenance/RepeatingTasks/RemoveExpiredTokensTask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using LBPUnion.ProjectLighthouse.Types.Maintenance; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Administration.Maintenance.RepeatingTasks; 7 | 8 | public class RemoveExpiredTokensTask : IRepeatingTask 9 | { 10 | public string Name => "Remove Expired Tokens"; 11 | public TimeSpan RepeatInterval => TimeSpan.FromHours(1); 12 | public DateTime LastRan { get; set; } 13 | 14 | public async Task Run(DatabaseContext database) => await database.RemoveExpiredTokens(); 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/AuthenticationConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class AuthenticationConfiguration 4 | { 5 | public bool RegistrationEnabled { get; set; } = true; 6 | public bool AutomaticAccountCreation { get; set; } = true; 7 | public bool VerifyTickets { get; set; } = true; 8 | 9 | public bool AllowRPCNSignup { get; set; } = true; 10 | 11 | public bool AllowPSNSignup { get; set; } = true; 12 | 13 | // Require use of Zaprit's "Patchwork" prx plugin's user agent when connecting to the server 14 | // Major and minor version minimums can be left alone if patchwork is not required 15 | public bool RequirePatchworkUserAgent { get; set; } = false; 16 | public int PatchworkMajorVersionMinimum { get; set; } = 1; 17 | public int PatchworkMinorVersionMinimum { get; set; } = 0; 18 | 19 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/CaptchaConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | /// 4 | /// The service to be used for presenting captchas to the user. 5 | /// 6 | public enum CaptchaType 7 | { 8 | /// 9 | /// A privacy-first captcha. https://www.hcaptcha.com/ 10 | /// 11 | HCaptcha, 12 | 13 | /// 14 | /// A captcha service by Google. https://developers.google.com/recaptcha/ 15 | /// 16 | ReCaptcha, 17 | } 18 | 19 | public class CaptchaConfiguration 20 | { 21 | public bool CaptchaEnabled { get; set; } 22 | 23 | public CaptchaType Type { get; set; } = CaptchaType.HCaptcha; 24 | 25 | public string SiteKey { get; set; } = ""; 26 | 27 | public string Secret { get; set; } = ""; 28 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/CustomizationConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class CustomizationConfiguration 4 | { 5 | public string ServerName { get; set; } = "Project Lighthouse"; 6 | public string EnvironmentName { get; set; } = "project-lighthouse"; 7 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/DigestKeyConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class DigestKeyConfiguration 4 | { 5 | // todo: move to list? 6 | public string PrimaryDigestKey { get; set; } = ""; 7 | public string AlternateDigestKey { get; set; } = ""; 8 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/GoogleAnalyticsConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class GoogleAnalyticsConfiguration 4 | { 5 | public bool AnalyticsEnabled { get; set; } 6 | 7 | public string Id { get; set; } = ""; 8 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/MailConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class MailConfiguration 4 | { 5 | public bool MailEnabled { get; set; } 6 | 7 | public string Host { get; set; } = ""; 8 | 9 | public int Port { get; set; } = 587; 10 | 11 | public string FromAddress { get; set; } = "lighthouse@example.com"; 12 | 13 | public string FromName { get; set; } = "Project Lighthouse"; 14 | 15 | public string Username { get; set; } = ""; 16 | 17 | public string Password { get; set; } = ""; 18 | 19 | public bool UseSSL { get; set; } = true; 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/MatchmakingConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class MatchmakingConfiguration 4 | { 5 | public bool MatchmakingEnabled { get; set; } = true; 6 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/NotificationConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class NotificationConfiguration 4 | { 5 | public bool ShowServerNameInText { get; set; } = true; 6 | public bool ShowTimestampInText { get; set; } = false; 7 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/RateLimitConfiguration.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 4 | 5 | public class RateLimitOptions 6 | { 7 | public bool Enabled; 8 | public int RequestsPerInterval { get; set; } = 5; 9 | public int RequestInterval { get; set; } = 15; 10 | } 11 | 12 | public class RateLimitConfiguration 13 | { 14 | public RateLimitOptions GlobalOptions { get; set; } = new(); 15 | 16 | public Dictionary OverrideOptions { get; set; } = new() 17 | { 18 | { 19 | "/example/*/wildcard", new RateLimitOptions 20 | { 21 | RequestInterval = 5, 22 | RequestsPerInterval = 10, 23 | Enabled = true, 24 | } 25 | }, 26 | }; 27 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/TwoFactorConfiguration.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Types.Users; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 4 | 5 | public class TwoFactorConfiguration 6 | { 7 | public bool TwoFactorEnabled { get; set; } = true; 8 | public bool RequireTwoFactor { get; set; } = true; 9 | public PermissionLevel RequiredTwoFactorLevel { get; set; } = PermissionLevel.Moderator; 10 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/UserGeneratedContentLimitConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class UserGeneratedContentLimitConfiguration 4 | { 5 | /// 6 | /// The maximum amount of slots allowed on users' earth 7 | /// 8 | public int EntitledSlots { get; set; } = 50; 9 | 10 | public int ListsQuota { get; set; } = 50; 11 | 12 | public int PhotosQuota { get; set; } = 500; 13 | 14 | /// 15 | /// When enabled, all UGC uploads are disabled. This includes levels, photos, reviews, 16 | /// comments, and certain profile settings. 17 | /// 18 | public bool ReadOnlyMode { get; set; } = false; 19 | 20 | public bool ProfileCommentsEnabled { get; set; } = true; 21 | 22 | public bool LevelCommentsEnabled { get; set; } = true; 23 | 24 | public bool LevelReviewsEnabled { get; set; } = true; 25 | 26 | public bool BooingEnabled { get; set; } = true; 27 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ConfigurationCategories/WebsiteConfiguration.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Configuration.ConfigurationCategories; 2 | 3 | public class WebsiteConfiguration 4 | { 5 | public string MissingIconHash { get; set; } = ""; 6 | 7 | public bool ConvertAssetsOnStartup { get; set; } = true; 8 | 9 | /* 10 | * Decides whether or not to display the Lighthouse Pride logo 11 | * during the month of June if enabled. 12 | */ 13 | public bool PrideEventEnabled { get; set; } = true; 14 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Configuration/ServerStatics.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System; 3 | using System.Linq; 4 | using LBPUnion.ProjectLighthouse.Types.Misc; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Configuration; 7 | 8 | public static class ServerStatics 9 | { 10 | public const int PageSize = 20; 11 | 12 | // FIXME: This needs to go at some point. 13 | public static bool IsUnitTesting => AppDomain.CurrentDomain.GetAssemblies().Any(assembly => assembly.FullName!.StartsWith("xunit")); 14 | 15 | public static bool IsDebug() 16 | { 17 | #if DEBUG 18 | return true; 19 | #else 20 | return false; 21 | #endif 22 | } 23 | 24 | /// 25 | /// The server type, determined on startup. Shouldn't be null unless very very early in startup. 26 | /// 27 | // The way of doing this is kinda weird, but it works. 28 | public static ServerType ServerType; 29 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Database/DatabaseContext.ApiTokens.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Linq; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Token; 4 | using Microsoft.AspNetCore.Http; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Database; 7 | 8 | public partial class DatabaseContext 9 | { 10 | public ApiKeyEntity? ApiKeyFromWebRequest(HttpRequest request) 11 | { 12 | string? authHeader = request.Headers["Authorization"]; 13 | if (string.IsNullOrWhiteSpace(authHeader)) return null; 14 | 15 | string authToken = authHeader[(authHeader.IndexOf(' ') + 1)..]; 16 | 17 | ApiKeyEntity? apiKey = this.APIKeys.FirstOrDefault(k => k.Key == authToken); 18 | return apiKey ?? null; 19 | } 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Database/DatabaseContextFactory.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Design; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Database; 4 | 5 | /// 6 | /// This class is only used for the code-first migration builder to detect the DbContext 7 | /// 8 | // ReSharper disable once UnusedType.Global 9 | public class DatabaseContextFactory : IDesignTimeDbContextFactory 10 | { 11 | public DatabaseContext CreateDbContext(string[] args) => DatabaseContext.CreateNewInstance(); 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Extensions/ExceptionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Reflection; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Extensions; 7 | 8 | // https://stackoverflow.com/a/8039737 9 | public static class ExceptionExtensions 10 | { 11 | public static string ToDetailedException(this Exception exception) 12 | { 13 | PropertyInfo[] properties = exception.GetType().GetProperties(); 14 | 15 | IEnumerable fields = properties.Select 16 | ( 17 | property => new 18 | { 19 | property.Name, 20 | Value = property.GetValue(exception, null), 21 | } 22 | ) 23 | .Select(x => $"{x.Name} = {(x.Value != null ? x.Value.ToString() : string.Empty)}"); 24 | 25 | return string.Join("\n", fields); 26 | } 27 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Extensions/PipeExtensions.cs: -------------------------------------------------------------------------------- 1 | using System.Buffers; 2 | using System.IO.Pipelines; 3 | using System.Threading.Tasks; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Extensions; 6 | 7 | public static class PipeExtensions 8 | { 9 | 10 | public static async Task ReadAllAsync(this PipeReader reader) 11 | { 12 | do 13 | { 14 | ReadResult readResult = await reader.ReadAsync(); 15 | if (readResult.IsCompleted || readResult.IsCanceled) 16 | { 17 | return readResult.Buffer.ToArray(); 18 | } 19 | 20 | // consume nothing, keep reading from the pipe reader until all data is there 21 | reader.AdvanceTo(readResult.Buffer.Start, readResult.Buffer.End); 22 | } 23 | while (true); 24 | } 25 | 26 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Extensions/RedisConnectionExtensions.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using LBPUnion.ProjectLighthouse.Logging; 4 | using LBPUnion.ProjectLighthouse.Types.Logging; 5 | using Redis.OM; 6 | using Redis.OM.Contracts; 7 | 8 | namespace LBPUnion.ProjectLighthouse.Extensions; 9 | 10 | public static class RedisConnectionExtensions 11 | { 12 | public static async Task RecreateIndexAsync(this IRedisConnection connection, Type type) 13 | { 14 | Logger.Debug("Recreating index for " + type.Name, LogArea.Redis); 15 | 16 | // TODO: use `await connection.DropIndexAndAssociatedRecordsAsync(type);` here instead when that becomes a thing 17 | bool dropped = await connection.DropIndexAsync(type); 18 | Logger.Debug("Dropped index: " + dropped, LogArea.Redis); 19 | 20 | bool created = await connection.CreateIndexAsync(type); 21 | Logger.Debug("Created index: " + created, LogArea.Redis); 22 | } 23 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Extensions/RoomExtensions.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using System.Diagnostics; 4 | using System.Linq; 5 | using LBPUnion.ProjectLighthouse.Database; 6 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 7 | using LBPUnion.ProjectLighthouse.Types.Matchmaking.Rooms; 8 | 9 | namespace LBPUnion.ProjectLighthouse.Extensions; 10 | 11 | public static class RoomExtensions 12 | { 13 | public static List GetPlayers(this Room room, DatabaseContext database) 14 | { 15 | List players = new(); 16 | foreach (int playerId in room.PlayerIds) 17 | { 18 | UserEntity? player = database.Users.FirstOrDefault(p => p.UserId == playerId); 19 | Debug.Assert(player != null, "RoomExtensions: player == null"); 20 | 21 | players.Add(player); 22 | } 23 | 24 | return players; 25 | } 26 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/AdventureFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class AdventureFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => s.IsAdventurePlanet; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/AuthorLabelFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Linq.Expressions; 4 | using LBPUnion.ProjectLighthouse.Extensions; 5 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 6 | using LBPUnion.ProjectLighthouse.Types.Filter; 7 | 8 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 9 | 10 | public class AuthorLabelFilter : ISlotFilter 11 | { 12 | private readonly string[] labels; 13 | 14 | public AuthorLabelFilter(params string[] labels) 15 | { 16 | this.labels = labels; 17 | } 18 | 19 | public Expression> GetPredicate() 20 | { 21 | Expression> predicate = PredicateExtensions.True(); 22 | predicate = this.labels.Aggregate(predicate, 23 | (current, label) => current.And(s => s.AuthorLabels.Contains(label))); 24 | return predicate; 25 | } 26 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/CreatorFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class CreatorFilter : ISlotFilter 9 | { 10 | private readonly int creatorId; 11 | 12 | public CreatorFilter(int creatorId) 13 | { 14 | this.creatorId = creatorId; 15 | } 16 | 17 | public Expression> GetPredicate() => s => s.CreatorId == this.creatorId; 18 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/CrossControlFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class CrossControlFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => s.CrossControllerRequired; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/ExcludeAdventureFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class ExcludeAdventureFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => !s.IsAdventurePlanet; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/ExcludeCrossControlFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class ExcludeCrossControlFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => !s.CrossControllerRequired; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/ExcludeLBP1OnlyFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | using LBPUnion.ProjectLighthouse.Types.Users; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 8 | 9 | public class ExcludeLBP1OnlyFilter : ISlotFilter 10 | { 11 | private readonly int userId; 12 | private readonly GameVersion targetGameVersion; 13 | 14 | public ExcludeLBP1OnlyFilter(int userId, GameVersion targetGameVersion) 15 | { 16 | this.userId = userId; 17 | this.targetGameVersion = targetGameVersion; 18 | } 19 | 20 | public Expression> GetPredicate() => 21 | s => !s.Lbp1Only || s.CreatorId == this.userId || this.targetGameVersion == GameVersion.LittleBigPlanet1; 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/ExcludeMovePackFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class ExcludeMovePackFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => !s.MoveRequired; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/FirstUploadedFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Extensions; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 5 | using LBPUnion.ProjectLighthouse.Types.Filter; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 8 | 9 | public class FirstUploadedFilter : ISlotFilter 10 | { 11 | private readonly long start; 12 | private readonly long end; 13 | 14 | public FirstUploadedFilter(long start, long end = long.MaxValue) 15 | { 16 | this.start = start; 17 | this.end = end; 18 | } 19 | 20 | public Expression> GetPredicate() 21 | { 22 | Expression> predicate = PredicateExtensions.True(); 23 | predicate = predicate.And(s => s.FirstUploaded > this.start); 24 | 25 | // Exclude to optimize query 26 | if (this.end != long.MaxValue) predicate = predicate.And(s => s.FirstUploaded < this.end); 27 | 28 | return predicate; 29 | } 30 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/GameVersionFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | using LBPUnion.ProjectLighthouse.Types.Users; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 8 | 9 | public class GameVersionFilter : ISlotFilter 10 | { 11 | private readonly GameVersion targetVersion; 12 | private readonly bool matchExactly; 13 | 14 | public GameVersionFilter(GameVersion targetVersion, bool matchExactly = false) 15 | { 16 | this.targetVersion = targetVersion; 17 | this.matchExactly = matchExactly; 18 | } 19 | 20 | public Expression> GetPredicate() => 21 | this.matchExactly || 22 | this.targetVersion is GameVersion.LittleBigPlanetVita or GameVersion.LittleBigPlanetPSP or GameVersion.Unknown 23 | ? s => s.GameVersion == this.targetVersion 24 | : s => s.GameVersion <= this.targetVersion; 25 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/GameVersionListFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Linq.Expressions; 4 | using LBPUnion.ProjectLighthouse.Extensions; 5 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 6 | using LBPUnion.ProjectLighthouse.Types.Filter; 7 | using LBPUnion.ProjectLighthouse.Types.Users; 8 | 9 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 10 | 11 | public class GameVersionListFilter : ISlotFilter 12 | { 13 | private readonly GameVersion[] versions; 14 | 15 | public GameVersionListFilter(params GameVersion[] versions) 16 | { 17 | this.versions = versions; 18 | } 19 | 20 | public Expression> GetPredicate() => 21 | this.versions.Aggregate(PredicateExtensions.False(), 22 | (current, version) => current.Or(s => s.GameVersion == version)); 23 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/HiddenSlotFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class HiddenSlotFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => !s.Hidden; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/LockedSlotFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class LockedSlotFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => !s.InitiallyLocked; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/MovePackFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class MovePackFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => s.MoveRequired; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/PlayerCountFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Extensions; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 5 | using LBPUnion.ProjectLighthouse.Types.Filter; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 8 | 9 | public class PlayerCountFilter : ISlotFilter 10 | { 11 | private readonly int minPlayers; 12 | private readonly int maxPlayers; 13 | 14 | public PlayerCountFilter(int minPlayers = 1, int maxPlayers = 4) 15 | { 16 | this.minPlayers = minPlayers; 17 | this.maxPlayers = maxPlayers; 18 | } 19 | 20 | public Expression> GetPredicate() 21 | { 22 | Expression> predicate = PredicateExtensions.True(); 23 | predicate = predicate.And(s => s.MinimumPlayers >= this.minPlayers); 24 | predicate = predicate.And(s => s.MaximumPlayers <= this.maxPlayers); 25 | 26 | return predicate; 27 | } 28 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/ResultTypeFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq; 3 | using System.Linq.Expressions; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 5 | using LBPUnion.ProjectLighthouse.Types.Filter; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 8 | 9 | public class ResultTypeFilter : ISlotFilter 10 | { 11 | private readonly string[] results; 12 | 13 | public ResultTypeFilter(params string[] results) 14 | { 15 | this.results = results; 16 | } 17 | 18 | public Expression> GetPredicate() => this.results.Contains("slot") ? s => true : s => false; 19 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/SlotIdFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Linq; 4 | using System.Linq.Expressions; 5 | using LBPUnion.ProjectLighthouse.Extensions; 6 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 7 | using LBPUnion.ProjectLighthouse.Types.Filter; 8 | 9 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 10 | 11 | public class SlotIdFilter : ISlotFilter 12 | { 13 | private readonly List slotIds; 14 | 15 | public SlotIdFilter(List slotIds) 16 | { 17 | this.slotIds = slotIds; 18 | } 19 | 20 | public Expression> GetPredicate() 21 | { 22 | Expression> predicate = PredicateExtensions.False(); 23 | predicate = this.slotIds.Aggregate(predicate, (current, slotId) => current.Or(s => s.SlotId == slotId)); 24 | return predicate; 25 | } 26 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/SlotTypeFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | using LBPUnion.ProjectLighthouse.Types.Levels; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 8 | 9 | public class SlotTypeFilter : ISlotFilter 10 | { 11 | private readonly SlotType slotType; 12 | 13 | public SlotTypeFilter(SlotType slotType) 14 | { 15 | this.slotType = slotType; 16 | } 17 | 18 | public Expression> GetPredicate() => s => s.Type == this.slotType; 19 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/SubLevelFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class SubLevelFilter : ISlotFilter 9 | { 10 | private readonly int userId; 11 | 12 | public SubLevelFilter(int userId) 13 | { 14 | this.userId = userId; 15 | } 16 | 17 | public Expression> GetPredicate() => s => !s.SubLevel || s.CreatorId == this.userId; 18 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Filters/TeamPickFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Filters; 7 | 8 | public class TeamPickFilter : ISlotFilter 9 | { 10 | public Expression> GetPredicate() => s => s.TeamPickTime != 0; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/FirstUploadedSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 7 | 8 | public class FirstUploadedSort : ISlotSort 9 | { 10 | public Expression> GetExpression() => s => s.FirstUploaded; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/LastUpdatedSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 7 | 8 | public class LastUpdatedSort : ISlotSort 9 | { 10 | public Expression> GetExpression() => s => s.LastUpdated; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/Metadata/HeartsSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 4 | using LBPUnion.ProjectLighthouse.Types.Misc; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts.Metadata; 7 | 8 | public class HeartsSort : ISort 9 | { 10 | public Expression> GetExpression() => s => s.Hearts; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/Metadata/RatingLBP1Sort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 4 | using LBPUnion.ProjectLighthouse.Types.Misc; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts.Metadata; 7 | 8 | public class RatingLBP1Sort : ISort 9 | { 10 | public Expression> GetExpression() => s => s.RatingLbp1; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/Metadata/ThumbsUpSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 4 | using LBPUnion.ProjectLighthouse.Types.Misc; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts.Metadata; 7 | 8 | public class ThumbsUpSort : ISort 9 | { 10 | public Expression> GetExpression() => s => s.ThumbsUp; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/PlaysForGameSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | using LBPUnion.ProjectLighthouse.Types.Users; 6 | using Microsoft.EntityFrameworkCore; 7 | 8 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 9 | 10 | public class PlaysForGameSort : ISlotSort 11 | { 12 | private readonly GameVersion targetVersion; 13 | 14 | public PlaysForGameSort(GameVersion targetVersion) 15 | { 16 | this.targetVersion = targetVersion; 17 | } 18 | 19 | private string GetColName() => 20 | this.targetVersion switch 21 | { 22 | GameVersion.LittleBigPlanet1 => "LBP1", 23 | GameVersion.LittleBigPlanet2 => "LBP2", 24 | GameVersion.LittleBigPlanet3 => "LBP3", 25 | GameVersion.LittleBigPlanetVita => "LBP2", 26 | _ => "", 27 | }; 28 | 29 | public Expression> GetExpression() => s => EF.Property(s, $"Plays{this.GetColName()}"); 30 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/RandomFirstUploadedSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | using Microsoft.EntityFrameworkCore; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 8 | 9 | public class RandomFirstUploadedSort : ISlotSort 10 | { 11 | private const double biasFactor = .8f; 12 | 13 | public Expression> GetExpression() => 14 | s => EF.Functions.Random() * (s.FirstUploaded * biasFactor); 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/RandomSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | using Microsoft.EntityFrameworkCore; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 8 | 9 | public class RandomSort : ISlotSort 10 | { 11 | public Expression> GetExpression() => _ => EF.Functions.Random(); 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/SlotIdSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 7 | 8 | public class SlotIdSort : ISlotSort 9 | { 10 | public Expression> GetExpression() => s => s.SlotId; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/TeamPickSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 7 | 8 | public class TeamPickSort : ISlotSort 9 | { 10 | public Expression> GetExpression() => s => s.TeamPickTime; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/TotalPlaysSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 7 | 8 | public class TotalPlaysSort : ISlotSort 9 | { 10 | public Expression> GetExpression() => s => s.PlaysLBP1 + s.PlaysLBP2 + s.PlaysLBP3; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Filter/Sorts/UniquePlaysTotalSort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Filter.Sorts; 7 | 8 | public class UniquePlaysTotalSort : ISlotSort 9 | { 10 | public Expression> GetExpression() => 11 | s => s.PlaysLBP1Unique + s.PlaysLBP2Unique + s.PlaysLBP3Unique; 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Helpers/SanitizationHelper.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Helpers; 5 | 6 | public static class SanitizationHelper 7 | { 8 | public static bool IsValidEmail(string? email) => !string.IsNullOrWhiteSpace(email) && new EmailAddressAttribute().IsValid(email); 9 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Helpers/TimeHelper.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Helpers; 4 | 5 | public static class TimeHelper 6 | { 7 | public static long Timestamp => DateTimeOffset.UtcNow.ToUnixTimeSeconds(); 8 | 9 | public static long TimestampMillis => DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(); 10 | } 11 | 12 | // 1397109686193 13 | // 1635389749454 -------------------------------------------------------------------------------- /ProjectLighthouse/Logging/Loggers/AspNet/AspNetToLighthouseLoggerProvider.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using Microsoft.Extensions.Logging; 3 | using IAspLogger = Microsoft.Extensions.Logging.ILogger; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Logging.Loggers.AspNet; 6 | 7 | [ProviderAlias("Kettu")] 8 | public class AspNetToLighthouseLoggerProvider : ILoggerProvider 9 | { 10 | public void Dispose() 11 | { 12 | GC.SuppressFinalize(this); 13 | } 14 | 15 | public IAspLogger CreateLogger(string category) => new AspNetToLighthouseLogger(category); 16 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Logging/Loggers/InMemoryLogger.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using LBPUnion.ProjectLighthouse.Types.Logging; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Logging.Loggers; 5 | 6 | public class InMemoryLogger : ILogger 7 | { 8 | public readonly List Lines = new(); 9 | 10 | public void Log(LogLine line) 11 | { 12 | lock(this.Lines) 13 | { 14 | this.Lines.Add(line); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Logging/NullScope.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Logging; 4 | 5 | public class NullScope : IDisposable 6 | { 7 | 8 | private NullScope() 9 | {} 10 | public static NullScope Instance { get; } = new(); 11 | 12 | public void Dispose() 13 | { 14 | GC.SuppressFinalize(this); 15 | } 16 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Mail/NullMailService.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using LBPUnion.ProjectLighthouse.Types.Mail; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Mail; 6 | 7 | public class NullMailService : IMailService, IDisposable 8 | { 9 | public void SendEmail(string recipientAddress, string subject, string body) { } 10 | public Task SendEmailAsync(string recipientAddress, string subject, string body) => Task.FromResult(true); 11 | public void Dispose() => GC.SuppressFinalize(this); 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Mail/SmtpMailSender.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using System.Net.Mail; 3 | using LBPUnion.ProjectLighthouse.Configuration; 4 | using LBPUnion.ProjectLighthouse.Types.Mail; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Mail; 7 | 8 | public class SmtpMailSender : IMailSender 9 | { 10 | public async void SendEmail(MailMessage message) 11 | { 12 | using SmtpClient client = new(ServerConfiguration.Instance.Mail.Host, ServerConfiguration.Instance.Mail.Port) 13 | { 14 | EnableSsl = ServerConfiguration.Instance.Mail.UseSSL, 15 | Credentials = new NetworkCredential(ServerConfiguration.Instance.Mail.Username, 16 | ServerConfiguration.Instance.Mail.Password), 17 | }; 18 | await client.SendMailAsync(message); 19 | } 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Middlewares/FakeRemoteIPAddressMiddleware.cs: -------------------------------------------------------------------------------- 1 | using System.Net; 2 | using System.Threading.Tasks; 3 | using Microsoft.AspNetCore.Http; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Middlewares; 6 | 7 | public class FakeRemoteIPAddressMiddleware : Middleware 8 | { 9 | private readonly IPAddress fakeIpAddress = IPAddress.Parse("127.0.0.1"); 10 | 11 | public FakeRemoteIPAddressMiddleware(RequestDelegate next) : base(next) 12 | {} 13 | 14 | public override async Task InvokeAsync(HttpContext ctx) 15 | { 16 | ctx.Connection.RemoteIpAddress = this.fakeIpAddress; 17 | 18 | await this.next(ctx); 19 | } 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Middlewares/Middleware.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Threading.Tasks; 3 | using JetBrains.Annotations; 4 | using Microsoft.AspNetCore.Http; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Middlewares; 7 | 8 | public abstract class Middleware 9 | { 10 | // this makes it consistent with typical middleware usage 11 | [SuppressMessage("ReSharper", "InconsistentNaming")] 12 | protected internal RequestDelegate next { get; init; } 13 | 14 | protected Middleware(RequestDelegate next) 15 | { 16 | this.next = next; 17 | } 18 | 19 | [UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)] 20 | public abstract Task InvokeAsync(HttpContext ctx); 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Middlewares/MiddlewareDBContext.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | using System.Threading.Tasks; 3 | using JetBrains.Annotations; 4 | using LBPUnion.ProjectLighthouse.Database; 5 | using Microsoft.AspNetCore.Http; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Middlewares; 8 | 9 | public abstract class MiddlewareDBContext 10 | { 11 | // this makes it consistent with typical middleware usage 12 | [SuppressMessage("ReSharper", "InconsistentNaming")] 13 | protected RequestDelegate next { get; } 14 | 15 | protected MiddlewareDBContext(RequestDelegate next) 16 | { 17 | this.next = next; 18 | } 19 | 20 | [UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)] 21 | public abstract Task InvokeAsync(HttpContext ctx, DatabaseContext db); 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211020220840_ResourceList.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211020220840_ResourceList")] 9 | public partial class ResourceList : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.RenameColumn( 14 | name: "Resource", 15 | table: "Slots", 16 | newName: "ResourceCollection"); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.RenameColumn( 22 | name: "ResourceCollection", 23 | table: "Slots", 24 | newName: "Resource"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211029213334_RemoveUsedSlotsFromDb.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211029213334_RemoveUsedSlotsFromDb")] 9 | public partial class RemoveUsedSlotsFromDb : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.DropColumn( 14 | name: "UsedSlots", 15 | table: "Users"); 16 | } 17 | 18 | protected override void Down(MigrationBuilder migrationBuilder) 19 | { 20 | migrationBuilder.AddColumn( 21 | name: "UsedSlots", 22 | table: "Users", 23 | type: "int", 24 | nullable: false, 25 | defaultValue: 0); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211030203837_AddMMPickToSlot.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211030203837_AddMMPickToSlot")] 9 | public partial class AddMMPickToSlot : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "MMPick", 15 | table: "Slots", 16 | type: "tinyint(1)", 17 | nullable: false, 18 | defaultValue: false); 19 | } 20 | 21 | protected override void Down(MigrationBuilder migrationBuilder) 22 | { 23 | migrationBuilder.DropColumn( 24 | name: "MMPick", 25 | table: "Slots"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211102215859_RenameTeamPick.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211102215859_RenameTeamPick")] 9 | public partial class RenameTeamPick : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.RenameColumn( 14 | name: "MMPick", 15 | table: "Slots", 16 | newName: "TeamPick"); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | migrationBuilder.RenameColumn( 22 | name: "TeamPick", 23 | table: "Slots", 24 | newName: "MMPick"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211108013443_RemoveCommentsEnabled.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211108013443_RemoveCommentsEnabled")] 9 | public partial class RemoveCommentsEnabled : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.DropColumn( 14 | name: "CommentsEnabled", 15 | table: "Users"); 16 | } 17 | 18 | protected override void Down(MigrationBuilder migrationBuilder) 19 | { 20 | migrationBuilder.AddColumn( 21 | name: "CommentsEnabled", 22 | table: "Users", 23 | type: "tinyint(1)", 24 | nullable: false, 25 | defaultValue: false); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211108015422_AddPlaysToSlot.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211108015422_AddPlaysToSlot")] 9 | public partial class AddPlaysToSlot : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "Plays", 15 | table: "Slots", 16 | type: "int", 17 | nullable: false, 18 | defaultValue: 0); 19 | } 20 | 21 | protected override void Down(MigrationBuilder migrationBuilder) 22 | { 23 | migrationBuilder.DropColumn( 24 | name: "Plays", 25 | table: "Slots"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211109225543_AddLevelTypeToSlot.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211109225543_AddLevelTypeToSlot")] 9 | public partial class AddLevelTypeToSlot : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "LevelType", 15 | table: "Slots", 16 | type: "longtext", 17 | nullable: true) 18 | .Annotation("MySql:CharSet", "utf8mb4"); 19 | } 20 | 21 | protected override void Down(MigrationBuilder migrationBuilder) 22 | { 23 | migrationBuilder.DropColumn( 24 | name: "LevelType", 25 | table: "Slots"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211113091631_AddUserLocationToToken.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211113091631_AddUserLocationToToken")] 9 | public partial class AddUserLocationToToken : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.AddColumn( 14 | name: "UserLocation", 15 | table: "Tokens", 16 | type: "longtext", 17 | nullable: true) 18 | .Annotation("MySql:CharSet", "utf8mb4"); 19 | } 20 | 21 | protected override void Down(MigrationBuilder migrationBuilder) 22 | { 23 | migrationBuilder.DropColumn( 24 | name: "UserLocation", 25 | table: "Tokens"); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211113220306_VisitedLevelDropGameVersion.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | namespace ProjectLighthouse.Migrations 6 | { 7 | [DbContext(typeof(DatabaseContext))] 8 | [Migration("20211113220306_VisitedLevelDropGameVersion")] 9 | public partial class VisitedLevelDropGameVersion : Migration 10 | { 11 | protected override void Up(MigrationBuilder migrationBuilder) 12 | { 13 | migrationBuilder.DropColumn( 14 | name: "GameVersion", 15 | table: "VisitedLevels"); 16 | } 17 | 18 | protected override void Down(MigrationBuilder migrationBuilder) 19 | { 20 | migrationBuilder.AddColumn( 21 | name: "GameVersion", 22 | table: "VisitedLevels", 23 | type: "int", 24 | nullable: false, 25 | defaultValue: 0); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211115050553_UserAddDefaultsToNullableStrings.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | #nullable disable 6 | 7 | namespace ProjectLighthouse.Migrations 8 | { 9 | [DbContext(typeof(DatabaseContext))] 10 | [Migration("20211115050553_UserAddDefaultsToNullableStrings")] 11 | public partial class UserAddDefaultsToNullableStrings : Migration 12 | { 13 | protected override void Up(MigrationBuilder migrationBuilder) 14 | { 15 | migrationBuilder.Sql("UPDATE Slots SET AuthorLabels = \"\" WHERE AuthorLabels IS NULL"); 16 | migrationBuilder.Sql("UPDATE Slots SET LevelType = \"\" WHERE LevelType IS NULL"); 17 | } 18 | 19 | protected override void Down(MigrationBuilder migrationBuilder) 20 | { 21 | 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211123224001_AddIsAdminToUser.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | 6 | #nullable disable 7 | 8 | namespace ProjectLighthouse.Migrations 9 | { 10 | [DbContext(typeof(DatabaseContext))] 11 | [Migration("20211123224001_AddIsAdminToUser")] 12 | public partial class AddIsAdminToUser : Migration 13 | { 14 | protected override void Up(MigrationBuilder migrationBuilder) 15 | { 16 | migrationBuilder.AddColumn( 17 | name: "IsAdmin", 18 | table: "Users", 19 | type: "tinyint(1)", 20 | nullable: false, 21 | defaultValue: false); 22 | } 23 | 24 | protected override void Down(MigrationBuilder migrationBuilder) 25 | { 26 | migrationBuilder.DropColumn( 27 | name: "IsAdmin", 28 | table: "Users"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20211202235932_RenameLastMatchesToLastContacts.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Metadata; 2 | using Microsoft.EntityFrameworkCore.Migrations; 3 | using LBPUnion.ProjectLighthouse; 4 | using LBPUnion.ProjectLighthouse.Database; 5 | using Microsoft.EntityFrameworkCore.Infrastructure; 6 | 7 | #nullable disable 8 | 9 | namespace ProjectLighthouse.Migrations 10 | { 11 | [DbContext(typeof(DatabaseContext))] 12 | [Migration("20211202235932_RenameLastMatchesToLastContacts")] 13 | public partial class RenameLastMatchesToLastContacts : Migration 14 | { 15 | protected override void Up(MigrationBuilder migrationBuilder) 16 | { 17 | migrationBuilder.RenameTable(name: "LastMatches", newName: "LastContacts"); 18 | } 19 | 20 | protected override void Down(MigrationBuilder migrationBuilder) 21 | { 22 | migrationBuilder.RenameTable(name: "LastContacts", newName: "LastMatches"); 23 | } 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20220610230647_AddExpirationDateToCases.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Migrations; 6 | 7 | #nullable disable 8 | 9 | namespace ProjectLighthouse.Migrations 10 | { 11 | [DbContext(typeof(DatabaseContext))] 12 | [Migration("20220610230647_AddExpirationDateToCases")] 13 | public class AddExpirationDateToCases : Migration 14 | { 15 | protected override void Up(MigrationBuilder migrationBuilder) 16 | { 17 | migrationBuilder.AddColumn( 18 | name: "CaseExpires", 19 | table: "Cases", 20 | type: "datetime(6)", 21 | nullable: true); 22 | } 23 | 24 | protected override void Down(MigrationBuilder migrationBuilder) 25 | { 26 | migrationBuilder.DropColumn( 27 | name: "CaseExpires", 28 | table: "Cases"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20220611012037_AddAffectedIdToCases.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse; 2 | using LBPUnion.ProjectLighthouse.Database; 3 | using Microsoft.EntityFrameworkCore.Infrastructure; 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace ProjectLighthouse.Migrations 9 | { 10 | [DbContext(typeof(DatabaseContext))] 11 | [Migration("20220611012037_AddAffectedIdToCases")] 12 | public class AddAffectedIdToCases : Migration 13 | { 14 | protected override void Up(MigrationBuilder migrationBuilder) 15 | { 16 | migrationBuilder.AddColumn( 17 | name: "AffectedId", 18 | table: "Cases", 19 | type: "int", 20 | nullable: false, 21 | defaultValue: 0); 22 | } 23 | 24 | protected override void Down(MigrationBuilder migrationBuilder) 25 | { 26 | migrationBuilder.DropColumn( 27 | name: "AffectedId", 28 | table: "Cases"); 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20220716234844_RemovedAPIKeyEnabled.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.EntityFrameworkCore.Migrations; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | #nullable disable 6 | 7 | namespace ProjectLighthouse.Migrations 8 | { 9 | [DbContext(typeof(DatabaseContext))] 10 | [Migration("20220716234844_RemovedAPIKeyEnabled")] 11 | public partial class RemovedAPIKeyEnabled : Migration 12 | { 13 | protected override void Up(MigrationBuilder migrationBuilder) 14 | { 15 | migrationBuilder.DropColumn( 16 | name: "Enabled", 17 | table: "APIKeys"); 18 | } 19 | 20 | protected override void Down(MigrationBuilder migrationBuilder) 21 | { 22 | migrationBuilder.AddColumn( 23 | name: "Enabled", 24 | table: "APIKeys", 25 | type: "tinyint(1)", 26 | nullable: false, 27 | defaultValue: false); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20220802150408_Arrrrrr.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using LBPUnion.ProjectLighthouse; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | using Microsoft.EntityFrameworkCore.Infrastructure; 5 | using Microsoft.EntityFrameworkCore.Migrations; 6 | 7 | #nullable disable 8 | 9 | namespace ProjectLighthouse.Migrations 10 | { 11 | [DbContext(typeof(DatabaseContext))] 12 | [Migration("20220802150408_Arrrrrr")] 13 | public partial class Arrrrrr : Migration 14 | { 15 | protected override void Up(MigrationBuilder migrationBuilder) 16 | { 17 | migrationBuilder.AddColumn( 18 | name: "IsAPirate", 19 | table: "Users", 20 | type: "tinyint(1)", 21 | nullable: false, 22 | defaultValue: false); 23 | } 24 | 25 | protected override void Down(MigrationBuilder migrationBuilder) 26 | { 27 | migrationBuilder.DropColumn( 28 | name: "IsAPirate", 29 | table: "Users"); 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20220916141401_ScoreboardAdvSlot.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse; 2 | using LBPUnion.ProjectLighthouse.Database; 3 | using Microsoft.EntityFrameworkCore.Infrastructure; 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace ProjectLighthouse.Migrations 9 | { 10 | [DbContext(typeof(DatabaseContext))] 11 | [Migration("20220916141401_ScoreboardAdvSlot")] 12 | public partial class CreateScoreboardAdvSlot : Migration 13 | { 14 | protected override void Up(MigrationBuilder migrationBuilder) 15 | { 16 | migrationBuilder.AddColumn( 17 | name: "ChildSlotId", 18 | table: "Scores", 19 | type: "int", 20 | nullable: false, 21 | defaultValue: 0); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20220918154500_AddIsAdventureColumn.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse; 2 | using LBPUnion.ProjectLighthouse.Database; 3 | using Microsoft.EntityFrameworkCore.Infrastructure; 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace ProjectLighthouse.Migrations 9 | { 10 | [DbContext(typeof(DatabaseContext))] 11 | [Migration("20220918154500_AddIsAdventureColumn")] 12 | public partial class AddisAdventureColumn : Migration 13 | { 14 | protected override void Up(MigrationBuilder migrationBuilder) 15 | { 16 | migrationBuilder.AddColumn( 17 | name: "IsAdventurePlanet", 18 | table: "Slots", 19 | type: "bool", 20 | nullable: false, 21 | defaultValue: false); 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20221118162114_AddVerifiedToWebToken.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse; 2 | using LBPUnion.ProjectLighthouse.Database; 3 | using Microsoft.EntityFrameworkCore.Infrastructure; 4 | using Microsoft.EntityFrameworkCore.Migrations; 5 | 6 | #nullable disable 7 | 8 | namespace ProjectLighthouse.Migrations 9 | { 10 | [DbContext(typeof(DatabaseContext))] 11 | [Migration("20221118162114_AddVerifiedToWebToken")] 12 | public partial class AddVerifiedToWebToken : Migration 13 | { 14 | protected override void Up(MigrationBuilder migrationBuilder) 15 | { 16 | migrationBuilder.AddColumn( 17 | name: "Verified", 18 | table: "WebTokens", 19 | type: "tinyint(1)", 20 | nullable: false, 21 | defaultValue: false); 22 | } 23 | 24 | protected override void Down(MigrationBuilder migrationBuilder) 25 | { 26 | migrationBuilder.DropColumn( 27 | name: "Verified", 28 | table: "WebTokens"); 29 | } 30 | } 31 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20230310075648_RemoveGameFromUser.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Database; 2 | using Microsoft.EntityFrameworkCore.Infrastructure; 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | #nullable disable 6 | 7 | namespace ProjectLighthouse.Migrations 8 | { 9 | [DbContext(typeof(DatabaseContext))] 10 | [Migration("20230310075648_RemoveGameFromUser")] 11 | public partial class RemoveGameFromUser : Migration 12 | { 13 | protected override void Up(MigrationBuilder migrationBuilder) 14 | { 15 | migrationBuilder.DropColumn( 16 | name: "Game", 17 | table: "Users"); 18 | } 19 | 20 | protected override void Down(MigrationBuilder migrationBuilder) 21 | { 22 | migrationBuilder.AddColumn( 23 | name: "Game", 24 | table: "Users", 25 | type: "int", 26 | nullable: false, 27 | defaultValue: 0); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ProjectLighthouse/Migrations/20230827004014_AddProfileVanityTagsToUsers.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Database; 2 | using Microsoft.EntityFrameworkCore.Infrastructure; 3 | using Microsoft.EntityFrameworkCore.Migrations; 4 | 5 | #nullable disable 6 | 7 | namespace ProjectLighthouse.Migrations 8 | { 9 | [DbContext(typeof(DatabaseContext))] 10 | [Migration("20230827004014_AddProfileVanityTagsToUsers")] 11 | public partial class AddProfileVanityTagsToUsers : Migration 12 | { 13 | protected override void Up(MigrationBuilder migrationBuilder) 14 | { 15 | migrationBuilder.AddColumn( 16 | name: "ProfileTag", 17 | table: "Users", 18 | type: "longtext", 19 | nullable: true) 20 | .Annotation("MySql:CharSet", "utf8mb4"); 21 | } 22 | 23 | protected override void Down(MigrationBuilder migrationBuilder) 24 | { 25 | migrationBuilder.DropColumn( 26 | name: "ProfileTag", 27 | table: "Users"); 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /ProjectLighthouse/Properties/launchSettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "$schema": "http://json.schemastore.org/launchsettings.json", 3 | "iisSettings": { 4 | "windowsAuthentication": false, 5 | "anonymousAuthentication": true, 6 | "iisExpress": { 7 | "applicationUrl": "http://localhost:43904", 8 | "sslPort": 44364 9 | } 10 | }, 11 | "profiles": { 12 | "IIS Express": { 13 | "commandName": "IISExpress", 14 | "environmentVariables": { 15 | "ASPNETCORE_ENVIRONMENT": "Development" 16 | } 17 | }, 18 | "ProjectLighthouse": { 19 | "commandName": "Project", 20 | "dotnetRunMessages": "true", 21 | "applicationUrl": "http://localhost:10060", 22 | "environmentVariables": { 23 | "ASPNETCORE_ENVIRONMENT": "Development", 24 | "LIGHTHOUSE_DB_CONNECTION_STRING": "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse" 25 | } 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /ProjectLighthouse/Serialization/JsonOutputFormatter.cs: -------------------------------------------------------------------------------- 1 | using Microsoft.AspNetCore.Mvc.Formatters; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Serialization; 4 | 5 | public class JsonOutputFormatter : StringOutputFormatter 6 | { 7 | public JsonOutputFormatter() 8 | { 9 | this.SupportedMediaTypes.Add("text/json"); 10 | this.SupportedMediaTypes.Add("application/json"); 11 | } 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Serialization/WriteFullClosingTagXmlWriter.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Xml; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Serialization; 5 | 6 | public class WriteFullClosingTagXmlWriter : ExcludeNamespaceXmlWriter 7 | { 8 | public WriteFullClosingTagXmlWriter(TextWriter stringWriter, XmlWriterSettings settings) : base(stringWriter, settings) { } 9 | 10 | public override void WriteEndElement() 11 | { 12 | base.WriteFullEndElement(); 13 | } 14 | } -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/android-chrome-192x192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/android-chrome-192x192.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/android-chrome-512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/android-chrome-512x512.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/apple-touch-icon.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/assets/advSlotCardMask.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/assets/advSlotCardMask.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/assets/advSlotCardOverlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/assets/advSlotCardOverlay.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/assets/slotCardBackground.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/assets/slotCardBackground.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/assets/slotCardOverlay.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/assets/slotCardOverlay.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/browserconfig.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | #008cff 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/brand-icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/brand-icons.eot -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/brand-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/brand-icons.ttf -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/brand-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/brand-icons.woff -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/brand-icons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/brand-icons.woff2 -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/icons.eot -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/icons.ttf -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/icons.woff -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/icons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/icons.woff2 -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/outline-icons.eot: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/outline-icons.eot -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/outline-icons.ttf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/outline-icons.ttf -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/outline-icons.woff: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/outline-icons.woff -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/outline-icons.woff2: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/fonts/outline-icons.woff2 -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/css/themes/default/assets/images/flags.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/css/themes/default/assets/images/flags.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/favicon-16x16.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/favicon-32x32.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/favicon.ico -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/logo-color.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/logo-color.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/logo-mono.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/logo-mono.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/logo-pride.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/logo-pride.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/mstile-150x150.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/LBPUnion/ProjectLighthouse/aeba706391746f1516b19d1ba0122b12664fe7e9/ProjectLighthouse/StaticFiles/mstile-150x150.png -------------------------------------------------------------------------------- /ProjectLighthouse/StaticFiles/site.webmanifest: -------------------------------------------------------------------------------- 1 | { 2 | "name": "Project Lighthouse", 3 | "short_name": "Lighthouse", 4 | "icons": [ 5 | { 6 | "src": "/android-chrome-192x192.png", 7 | "sizes": "192x192", 8 | "type": "image/png" 9 | }, 10 | { 11 | "src": "/android-chrome-512x512.png", 12 | "sizes": "512x512", 13 | "type": "image/png" 14 | } 15 | ], 16 | "theme_color": "#008cff", 17 | "background_color": "#008cff", 18 | "display": "standalone" 19 | } 20 | -------------------------------------------------------------------------------- /ProjectLighthouse/StorableLists/Stores/RoomStore.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.Collections.Generic; 3 | using LBPUnion.ProjectLighthouse.Types.Matchmaking.Rooms; 4 | 5 | namespace LBPUnion.ProjectLighthouse.StorableLists.Stores; 6 | 7 | public static class RoomStore 8 | { 9 | private static List? rooms; 10 | 11 | public static StorableList GetRooms() 12 | { 13 | if (RedisDatabase.Initialized) 14 | { 15 | return new RedisStorableList(RedisDatabase.GetRooms()); 16 | } 17 | 18 | rooms ??= new List(); 19 | return new NormalStorableList(rooms); 20 | } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Tickets/Parser/ITicketParser.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Tickets.Parser; 2 | 3 | public interface ITicketParser 4 | { 5 | public bool ParseTicket(); 6 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Tickets/Parser/TicketParseException.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Tickets.Parser; 4 | 5 | public class TicketParseException : Exception 6 | { 7 | public TicketParseException(string message) 8 | { 9 | this.Message = message; 10 | } 11 | 12 | public override string Message { get; } 13 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Tickets/Signature/NullSignatureVerifier.cs: -------------------------------------------------------------------------------- 1 | using Org.BouncyCastle.Crypto; 2 | using Org.BouncyCastle.Crypto.Parameters; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Tickets.Signature; 5 | 6 | public class NullSignatureVerifier : TicketSignatureVerifier 7 | { 8 | protected override ECPublicKeyParameters PublicKey => null; 9 | protected override string HashAlgorithm => null; 10 | protected override bool VerifySignature(ISigner signer) => false; 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Tickets/TicketVersion.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Tickets; 2 | 3 | public enum TicketVersion : ushort 4 | { 5 | V21 = 0x2101, 6 | V30 = 0x3100, 7 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Interaction/HeartedLevelEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Interaction; 7 | 8 | public class HeartedLevelEntity 9 | { 10 | // ReSharper disable once UnusedMember.Global 11 | [Key] 12 | public int HeartedLevelId { get; set; } 13 | 14 | public int UserId { get; set; } 15 | 16 | [ForeignKey(nameof(UserId))] 17 | public UserEntity User { get; set; } 18 | 19 | public int SlotId { get; set; } 20 | 21 | [ForeignKey(nameof(SlotId))] 22 | public SlotEntity Slot { get; set; } 23 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Interaction/HeartedPlaylistEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Interaction; 7 | 8 | public class HeartedPlaylistEntity 9 | { 10 | [Key] 11 | public int HeartedPlaylistId { get; set; } 12 | 13 | public int UserId { get; set; } 14 | 15 | [ForeignKey(nameof(UserId))] 16 | public UserEntity User { get; set; } 17 | 18 | public int PlaylistId { get; set; } 19 | 20 | [ForeignKey(nameof(PlaylistId))] 21 | public PlaylistEntity Playlist { get; set; } 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Interaction/HeartedProfileEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Interaction; 6 | 7 | public class HeartedProfileEntity 8 | { 9 | [Key] 10 | public int HeartedProfileId { get; set; } 11 | 12 | public int UserId { get; set; } 13 | 14 | [ForeignKey(nameof(UserId))] 15 | public UserEntity User { get; set; } 16 | 17 | public int HeartedUserId { get; set; } 18 | 19 | [ForeignKey(nameof(HeartedUserId))] 20 | public UserEntity HeartedUser { get; set; } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Interaction/QueuedLevelEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Interaction; 7 | 8 | public class QueuedLevelEntity 9 | { 10 | // ReSharper disable once UnusedMember.Global 11 | [Key] 12 | public int QueuedLevelId { get; set; } 13 | 14 | public int UserId { get; set; } 15 | 16 | [ForeignKey(nameof(UserId))] 17 | public UserEntity User { get; set; } 18 | 19 | public int SlotId { get; set; } 20 | 21 | [ForeignKey(nameof(SlotId))] 22 | public SlotEntity Slot { get; set; } 23 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Interaction/RatedCommentEntity.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Interaction; 7 | 8 | public class RatedCommentEntity 9 | { 10 | // ReSharper disable once UnusedMember.Global 11 | [Key] 12 | public int RatingId { get; set; } 13 | 14 | public int UserId { get; set; } 15 | 16 | [ForeignKey(nameof(UserId))] 17 | public UserEntity? User { get; set; } 18 | 19 | [ForeignKey(nameof(CommentId))] 20 | public CommentEntity? Comment { get; set; } 21 | 22 | public int CommentId { get; set; } 23 | 24 | public int Rating { get; set; } 25 | 26 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Interaction/RatedLevelEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Interaction; 7 | 8 | public class RatedLevelEntity 9 | { 10 | // ReSharper disable once UnusedMember.Global 11 | [Key] 12 | public int RatedLevelId { get; set; } 13 | 14 | public int UserId { get; set; } 15 | 16 | [ForeignKey(nameof(UserId))] 17 | public UserEntity User { get; set; } 18 | 19 | public int SlotId { get; set; } 20 | 21 | [ForeignKey(nameof(SlotId))] 22 | public SlotEntity Slot { get; set; } 23 | 24 | public int Rating { get; set; } 25 | 26 | public double RatingLBP1 { get; set; } 27 | 28 | public string TagLBP1 { get; set; } 29 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Interaction/RatedReviewEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Interaction; 7 | 8 | public class RatedReviewEntity 9 | { 10 | // ReSharper disable once UnusedMember.Global 11 | [Key] 12 | public int RatedReviewId { get; set; } 13 | 14 | public int UserId { get; set; } 15 | 16 | [ForeignKey(nameof(UserId))] 17 | public UserEntity User { get; set; } 18 | 19 | public int ReviewId { get; set; } 20 | 21 | [ForeignKey(nameof(ReviewId))] 22 | public ReviewEntity Review { get; set; } 23 | 24 | public int Thumb { get; set; } 25 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Interaction/VisitedLevelEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Interaction; 7 | 8 | public class VisitedLevelEntity 9 | { 10 | // ReSharper disable once UnusedMember.Global 11 | [Key] 12 | public int VisitedLevelId { get; set; } 13 | 14 | public int UserId { get; set; } 15 | 16 | [ForeignKey(nameof(UserId))] 17 | public UserEntity User { get; set; } 18 | 19 | public int SlotId { get; set; } 20 | 21 | [ForeignKey(nameof(SlotId))] 22 | public SlotEntity Slot { get; set; } 23 | 24 | public int PlaysLBP1 { get; set; } 25 | public int PlaysLBP2 { get; set; } 26 | public int PlaysLBP3 { get; set; } 27 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Level/DatabaseCategoryEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using System.Linq; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Level; 6 | 7 | public class DatabaseCategoryEntity 8 | { 9 | [Key] 10 | public int CategoryId { get; set; } 11 | 12 | public string Name { get; set; } 13 | public string Description { get; set; } 14 | public string IconHash { get; set; } 15 | public string Endpoint { get; set; } 16 | 17 | public string SlotIdsCollection { get; set; } 18 | 19 | [NotMapped] 20 | public int[] SlotIds { 21 | get => this.SlotIdsCollection.Split(",").Select(int.Parse).ToArray(); 22 | set => this.SlotIdsCollection = string.Join(",", value); 23 | } 24 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Level/PlaylistEntity.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using System.Linq; 5 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Level; 8 | 9 | public class PlaylistEntity 10 | { 11 | [Key] 12 | public int PlaylistId { get; set; } 13 | 14 | public string Name { get; set; } = ""; 15 | 16 | public string Description { get; set; } = ""; 17 | 18 | public int CreatorId { get; set; } 19 | 20 | [ForeignKey(nameof(CreatorId))] 21 | public UserEntity? Creator { get; set; } 22 | 23 | public string SlotCollection { get; set; } = ""; 24 | 25 | [NotMapped] 26 | public int[] SlotIds 27 | { 28 | get => this.SlotCollection.Split(",").Where(x => int.TryParse(x, out _)).Select(int.Parse).ToArray(); 29 | set => this.SlotCollection = string.Join(",", value); 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Level/ScoreEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Level; 6 | 7 | public class ScoreEntity 8 | { 9 | [Key] 10 | public int ScoreId { get; set; } 11 | 12 | public int SlotId { get; set; } 13 | 14 | [ForeignKey(nameof(SlotId))] 15 | public SlotEntity Slot { get; set; } 16 | 17 | public int ChildSlotId { get; set; } 18 | 19 | public int Type { get; set; } 20 | 21 | public int UserId { get; set; } 22 | 23 | [ForeignKey(nameof(UserId))] 24 | public UserEntity User { get; set; } 25 | 26 | public int Points { get; set; } 27 | 28 | public long Timestamp { get; set; } 29 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Maintenance/CompletedMigrationEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using LBPUnion.ProjectLighthouse.Types.Maintenance; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Maintenance; 6 | 7 | /// 8 | /// A record of the completion of a . 9 | /// 10 | public class CompletedMigrationEntity 11 | { 12 | /// 13 | /// The name of the migration. 14 | /// 15 | /// 16 | /// Do not use the user-friendly name when setting this. 17 | /// 18 | [Key] 19 | public string MigrationName { get; set; } 20 | 21 | /// 22 | /// The moment the migration was ran. 23 | /// 24 | public DateTime RanAt { get; set; } 25 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Notifications/NotificationEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 4 | using LBPUnion.ProjectLighthouse.Types.Notifications; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Notifications; 7 | 8 | public class NotificationEntity 9 | { 10 | [Key] 11 | public int Id { get; set; } 12 | 13 | public int UserId { get; set; } 14 | 15 | #nullable enable 16 | 17 | [ForeignKey(nameof (UserId))] 18 | public UserEntity? User { get; set; } 19 | 20 | #nullable disable 21 | 22 | public NotificationType Type { get; set; } = NotificationType.ModerationNotification; 23 | 24 | public string Text { get; set; } = ""; 25 | 26 | public bool IsDismissed { get; set; } 27 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Profile/BlockedProfileEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | public class BlockedProfileEntity 7 | { 8 | // ReSharper disable once UnusedMember.Global 9 | [Key] 10 | public int BlockedProfileId { get; set; } 11 | 12 | public int UserId { get; set; } 13 | 14 | [ForeignKey(nameof(UserId))] 15 | public UserEntity User { get; set; } 16 | 17 | public int BlockedUserId { get; set; } 18 | 19 | [ForeignKey(nameof(BlockedUserId))] 20 | public UserEntity BlockedUser { get; set; } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Profile/LastContactEntity.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using LBPUnion.ProjectLighthouse.Types.Users; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Profile; 7 | 8 | public class LastContactEntity 9 | { 10 | [Key] 11 | public int UserId { get; set; } 12 | 13 | [ForeignKey(nameof(UserId))] 14 | public UserEntity? User { get; set; } 15 | 16 | public long Timestamp { get; set; } 17 | 18 | public GameVersion GameVersion { get; set; } = GameVersion.Unknown; 19 | 20 | public Platform Platform { get; set; } = Platform.Unknown; 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Profile/PhotoSubjectEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | public class PhotoSubjectEntity 7 | { 8 | [Key] 9 | public int PhotoSubjectId { get; set; } 10 | 11 | public int UserId { get; set; } 12 | 13 | [ForeignKey(nameof(UserId))] 14 | public UserEntity User { get; set; } 15 | 16 | public int PhotoId { get; set; } 17 | 18 | [ForeignKey(nameof(PhotoId))] 19 | public PhotoEntity Photo { get; set; } 20 | 21 | public string Bounds { get; set; } 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Profile/PlatformLinkAttemptEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Users; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Profile; 6 | 7 | public class PlatformLinkAttemptEntity 8 | { 9 | [Key] 10 | public int PlatformLinkAttemptId { get; set; } 11 | 12 | [ForeignKey(nameof(UserId))] 13 | public UserEntity User { get; set; } 14 | 15 | public int UserId { get; set; } 16 | 17 | public ulong PlatformId { get; set; } 18 | 19 | public Platform Platform { get; set; } 20 | 21 | public long Timestamp { get; set; } 22 | 23 | public string IPAddress { get; set; } = ""; 24 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Token/ApiKeyEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Token; 5 | 6 | public class ApiKeyEntity 7 | { 8 | [Key] 9 | public int Id { get; set; } 10 | 11 | public string Description { get; set; } 12 | 13 | public string Key { get; set; } 14 | 15 | public DateTime Created { get; set; } 16 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Token/EmailSetTokenEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Token; 7 | 8 | public class EmailSetTokenEntity 9 | { 10 | // ReSharper disable once UnusedMember.Global 11 | [Key] 12 | public int EmailSetTokenId { get; set; } 13 | 14 | public int UserId { get; set; } 15 | 16 | [ForeignKey(nameof(UserId))] 17 | public UserEntity User { get; set; } 18 | 19 | public string EmailToken { get; set; } 20 | 21 | public DateTime ExpiresAt { get; set; } 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Token/EmailVerificationTokenEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Token; 7 | 8 | public class EmailVerificationTokenEntity 9 | { 10 | // ReSharper disable once UnusedMember.Global 11 | [Key] 12 | public int EmailVerificationTokenId { get; set; } 13 | 14 | public int UserId { get; set; } 15 | 16 | [ForeignKey(nameof(UserId))] 17 | public UserEntity User { get; set; } 18 | 19 | public string EmailToken { get; set; } 20 | 21 | public DateTime ExpiresAt { get; set; } 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Token/GameTokenEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | using System.ComponentModel.DataAnnotations.Schema; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | using LBPUnion.ProjectLighthouse.Types.Users; 6 | 7 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Token; 8 | 9 | public class GameTokenEntity 10 | { 11 | // ReSharper disable once UnusedMember.Global 12 | [Key] 13 | public int TokenId { get; set; } 14 | 15 | public int UserId { get; set; } 16 | 17 | [ForeignKey(nameof(UserId))] 18 | public UserEntity User { get; set; } 19 | 20 | public string UserToken { get; set; } 21 | 22 | public GameVersion GameVersion { get; set; } 23 | 24 | public Platform Platform { get; set; } 25 | 26 | [StringLength(64)] 27 | public string TicketHash { get; set; } 28 | 29 | [StringLength(64)] 30 | public string LocationHash { get; set; } 31 | 32 | public DateTime ExpiresAt { get; set; } 33 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Token/PasswordResetTokenEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Token; 5 | 6 | public class PasswordResetTokenEntity 7 | { 8 | // ReSharper disable once UnusedMember.Global 9 | [Key] 10 | public int TokenId { get; set; } 11 | 12 | public int UserId { get; set; } 13 | 14 | public string ResetToken { get; set; } 15 | 16 | public DateTime Created { get; set; } 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Token/RegistrationTokenEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Token; 5 | 6 | public class RegistrationTokenEntity 7 | { 8 | // ReSharper disable once UnusedMember.Global 9 | [Key] 10 | public int TokenId { get; set; } 11 | 12 | public string Token { get; set; } 13 | 14 | public DateTime Created { get; set; } 15 | 16 | public string Username { get; set; } 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Token/WebTokenEntity.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.ComponentModel.DataAnnotations; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Token; 5 | 6 | public class WebTokenEntity 7 | { 8 | // ReSharper disable once UnusedMember.Global 9 | [Key] 10 | public int TokenId { get; set; } 11 | 12 | public int UserId { get; set; } 13 | 14 | public string UserToken { get; set; } 15 | 16 | public DateTime ExpiresAt { get; set; } 17 | 18 | public bool Verified { get; set; } 19 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Entities/Website/WebsiteAnnouncementEntity.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel.DataAnnotations; 2 | using System.ComponentModel.DataAnnotations.Schema; 3 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Entities.Website; 6 | 7 | public class WebsiteAnnouncementEntity 8 | { 9 | [Key] 10 | public int AnnouncementId { get; set; } 11 | 12 | public string Title { get; set; } 13 | 14 | public string Content { get; set; } 15 | 16 | #nullable enable 17 | 18 | public int? PublisherId { get; set; } 19 | 20 | [ForeignKey(nameof(PublisherId))] 21 | public UserEntity? Publisher { get; set; } 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Filter/FilterLocation.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Filter; 2 | 3 | public enum FilterLocation 4 | { 5 | SlotName = 0, 6 | SlotDescription = 1, 7 | SlotReview = 2, 8 | UserBiography = 3, 9 | UserComment = 4, 10 | ChatMessage = 5, 11 | Test = 6, 12 | None = 7, 13 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Filter/IFilter.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | public interface IFilter 7 | { 8 | public Expression> GetPredicate(); 9 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Filter/IQueryBuilder.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | public interface IQueryBuilder 7 | { 8 | public Expression> Build(); 9 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Filter/ISlotFilter.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Filter; 4 | 5 | public interface ISlotFilter : IFilter 6 | { } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Filter/PaginationData.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using LBPUnion.ProjectLighthouse.Configuration; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Filter; 5 | 6 | public struct PaginationData 7 | { 8 | public PaginationData() 9 | { } 10 | 11 | public int PageStart { get; init; } = 0; 12 | public int PageSize { get; init; } = 0; 13 | public int TotalElements { get; set; } = 0; 14 | public int MaxElements { get; set; } = ServerConfiguration.Instance.UserGeneratedContentLimits.EntitledSlots; 15 | 16 | public int HintStart => this.PageStart + Math.Min(this.PageSize, this.MaxElements); 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Filter/Sorts/ISlotSort.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 4 | 5 | public interface ISlotSort : ISort 6 | { } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Filter/Sorts/ISort.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Linq.Expressions; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 5 | 6 | public interface ISort 7 | { 8 | public Expression> GetExpression(); 9 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Filter/Sorts/ISortBuilder.cs: -------------------------------------------------------------------------------- 1 | using System.Linq; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Filter.Sorts; 4 | 5 | public interface ISortBuilder 6 | { 7 | public IOrderedQueryable Build(IQueryable queryable); 8 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Levels/SlotType.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Levels; 4 | 5 | public enum SlotType 6 | { 7 | [XmlEnum("developer")] 8 | Developer = 0, 9 | [XmlEnum("user")] 10 | User = 1, 11 | [XmlEnum("moon")] 12 | Moon = 2, 13 | Unknown = 3, 14 | Unknown2 = 4, 15 | [XmlEnum("pod")] 16 | Pod = 5, 17 | [XmlEnum("local")] 18 | Local = 6, 19 | DLC = 8, 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Logging/ILogger.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Logging; 2 | 3 | public interface ILogger 4 | { 5 | public void Log(LogLine line); 6 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Logging/LogArea.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Logging; 4 | 5 | [SuppressMessage("ReSharper", "InconsistentNaming")] 6 | public enum LogArea 7 | { 8 | Login, 9 | Startup, 10 | Category, 11 | Comments, 12 | Config, 13 | Database, 14 | Filter, 15 | HTTP, 16 | Match, 17 | Photos, 18 | Resources, 19 | Logger, 20 | Redis, 21 | Command, 22 | Admin, 23 | Publish, 24 | Maintenance, 25 | Score, 26 | RateLimit, 27 | Deserialization, 28 | Email, 29 | Serialization, 30 | Synchronization, 31 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Logging/LogLevel.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Logging; 2 | 3 | public enum LogLevel 4 | { 5 | Success = 0, 6 | Info = 1, 7 | Warning = 2, 8 | Error = 3, 9 | Debug = 4, 10 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Logging/LogLine.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Logging; 2 | 3 | public struct LogLine 4 | { 5 | public LogTrace Trace; 6 | public LogLevel Level; 7 | public string Area; 8 | public string Message; 9 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Logging/LogTrace.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | namespace LBPUnion.ProjectLighthouse.Types.Logging; 3 | 4 | public struct LogTrace 5 | { 6 | public string? Name; 7 | public string? Section; 8 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Mail/IMailSender.cs: -------------------------------------------------------------------------------- 1 | using System.Net.Mail; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Mail; 4 | 5 | public interface IMailSender 6 | { 7 | public void SendEmail(MailMessage message); 8 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Mail/IMailService.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Mail; 4 | 5 | public interface IMailService 6 | { 7 | public void SendEmail(string recipientAddress, string subject, string body); 8 | public Task SendEmailAsync(string recipientAddress, string subject, string body); 9 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Maintenance/ICommand.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using JetBrains.Annotations; 4 | using LBPUnion.ProjectLighthouse.Logging; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Maintenance; 7 | 8 | [UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)] 9 | public interface ICommand 10 | { 11 | public string FirstAlias => this.Aliases()[0]; 12 | public Task Run(IServiceProvider provider, string[] args, Logger logger); 13 | 14 | public string Name(); 15 | 16 | public string[] Aliases(); 17 | 18 | public string Arguments(); 19 | 20 | public int RequiredArgs(); 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Maintenance/IMaintenanceJob.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using JetBrains.Annotations; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Maintenance; 5 | 6 | [UsedImplicitly(ImplicitUseTargetFlags.WithInheritors)] 7 | public interface IMaintenanceJob 8 | { 9 | public Task Run(); 10 | 11 | public string Name(); 12 | 13 | public string Description(); 14 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Maintenance/IRepeatingTask.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Threading.Tasks; 3 | using LBPUnion.ProjectLighthouse.Database; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Maintenance; 6 | 7 | public interface IRepeatingTask 8 | { 9 | public string Name { get; } 10 | public TimeSpan RepeatInterval { get; } 11 | public DateTime LastRan { get; set; } 12 | 13 | public Task Run(DatabaseContext database); 14 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Maintenance/MigrationTask.cs: -------------------------------------------------------------------------------- 1 | using System.Threading.Tasks; 2 | using LBPUnion.ProjectLighthouse.Database; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Maintenance; 5 | 6 | public enum MigrationHook 7 | { 8 | Before, 9 | None, 10 | } 11 | 12 | public abstract class MigrationTask 13 | { 14 | /// 15 | /// The user-friendly name of a migration. 16 | /// 17 | public abstract string Name(); 18 | 19 | public virtual MigrationHook HookType() => MigrationHook.None; 20 | 21 | /// 22 | /// Performs the migration. 23 | /// 24 | /// The Lighthouse database. 25 | /// True if successful, false if not. 26 | public abstract Task Run(DatabaseContext database); 27 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Matchmaking/MatchCommands/IMatchCommand.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Matchmaking.MatchCommands; 2 | 3 | public interface IMatchCommand 4 | {} -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Matchmaking/MatchCommands/UpdateMyPlayerData.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using LBPUnion.ProjectLighthouse.Types.Matchmaking.Rooms; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Matchmaking.MatchCommands; 5 | 6 | public class UpdateMyPlayerData : IMatchCommand 7 | { 8 | public string Player { get; set; } = null!; 9 | 10 | public RoomState? RoomState { get; set; } 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Matchmaking/MatchCommands/UpdatePlayersInRoom.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Diagnostics.CodeAnalysis; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Matchmaking.MatchCommands; 5 | 6 | [SuppressMessage("ReSharper", "CollectionNeverUpdated.Global")] 7 | public class UpdatePlayersInRoom : IMatchCommand 8 | { 9 | public List Players { get; set; } 10 | public List Reservations { get; set; } 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Matchmaking/NatType.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Matchmaking; 2 | 3 | public enum NatType 4 | { 5 | Open = 1, 6 | Moderate = 2, 7 | Strict = 3, 8 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Matchmaking/Player.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Diagnostics.CodeAnalysis; 3 | using System.Text.Json.Serialization; 4 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Matchmaking; 7 | 8 | [Serializable] 9 | public class Player 10 | { 11 | [JsonIgnore] 12 | public UserEntity User { get; set; } 13 | 14 | [SuppressMessage("ReSharper", "UnusedMember.Global")] 15 | public string PlayerId => this.User.Username; 16 | 17 | [JsonPropertyName("matching_res")] 18 | public int MatchingRes { get; set; } 19 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Matchmaking/Rooms/FindBestRoomResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Text.Json.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Matchmaking.Rooms; 5 | 6 | public class FindBestRoomResponse 7 | { 8 | public int RoomId; 9 | 10 | public List Players { get; set; } 11 | 12 | public List> Slots { get; set; } 13 | 14 | [JsonIgnore] 15 | public IEnumerable FirstSlot => this.Slots[0]; 16 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Matchmaking/Rooms/RoomSlot.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Types.Levels; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Matchmaking.Rooms; 4 | 5 | public class RoomSlot 6 | { 7 | public int SlotId { get; set; } 8 | public SlotType SlotType { get; set; } 9 | 10 | public static readonly RoomSlot PodSlot = new() 11 | { 12 | SlotType = SlotType.Pod, 13 | SlotId = 0, 14 | }; 15 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Matchmaking/Rooms/RoomState.cs: -------------------------------------------------------------------------------- 1 | using System.Diagnostics.CodeAnalysis; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Matchmaking.Rooms; 4 | 5 | [SuppressMessage("ReSharper", "UnusedMember.Global")] 6 | public enum RoomState 7 | { 8 | /// 9 | /// The room isn't doing anything in particular. 10 | /// 11 | Idle = 0, 12 | 13 | /// 14 | /// The room is hosting a room on a slot for others to join. 15 | /// 16 | PlayingLevel = 1, 17 | 18 | /// 19 | /// ??? 20 | /// 21 | Unknown = 2, 22 | 23 | /// 24 | /// The room is looking for other rooms to join. 25 | /// 26 | DivingIn = 3, 27 | 28 | /// 29 | /// The room is waiting for players to join their room. 30 | /// 31 | DivingInWaiting = 4, 32 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Misc/Location.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Misc; 4 | 5 | /// 6 | /// The location of a slot on a planet. 7 | /// 8 | [XmlRoot("location")] 9 | [XmlType("location")] 10 | public class Location 11 | { 12 | [XmlElement("x")] 13 | public int X { get; set; } 14 | 15 | [XmlElement("y")] 16 | public int Y { get; set; } 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Misc/ServerType.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Misc; 2 | 3 | public enum ServerType 4 | { 5 | GameServer = 0, 6 | Website = 1, 7 | Api = 2, 8 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Misc/SlotMetadata.cs: -------------------------------------------------------------------------------- 1 | using LBPUnion.ProjectLighthouse.Types.Entities.Level; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Misc; 4 | 5 | public class SlotMetadata 6 | { 7 | public required SlotEntity Slot { get; init; } 8 | public double RatingLbp1 { get; init; } 9 | public int ThumbsUp { get; init; } 10 | public int Hearts { get; init; } 11 | public bool Played { get; set; } 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Moderation/Reports/GriefType.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Moderation.Reports; 4 | 5 | public enum GriefType 6 | { 7 | [XmlEnum("1")] 8 | Obscene = 1, 9 | 10 | [XmlEnum("2")] 11 | Mature = 2, 12 | 13 | [XmlEnum("3")] 14 | Offensive = 3, 15 | 16 | [XmlEnum("4")] 17 | Violence = 4, 18 | 19 | [XmlEnum("5")] 20 | Illegal = 5, 21 | 22 | [XmlEnum("6")] 23 | Unknown = 6, 24 | 25 | [XmlEnum("7")] 26 | Tos = 7, 27 | 28 | [XmlEnum("8")] 29 | Other = 8, 30 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Moderation/Reports/Marqee.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Moderation.Reports; 4 | 5 | [XmlRoot("marqee")] 6 | public class Marqee 7 | { 8 | [XmlElement("rect")] 9 | public Rectangle Rect { get; set; } 10 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Moderation/Reports/Rectangle.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Moderation.Reports; 4 | 5 | public class Rectangle 6 | { 7 | [XmlAttribute("t")] 8 | public int Top { get; set; } 9 | 10 | [XmlAttribute("l")] 11 | public int Left { get; set; } 12 | 13 | [XmlAttribute("b")] 14 | public int Bottom { get; set; } 15 | 16 | [XmlAttribute("r")] 17 | public int Right { get; set; } 18 | 19 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Moderation/Reports/ReportPlayer.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Moderation.Reports; 4 | 5 | [XmlRoot("player")] 6 | public class ReportPlayer 7 | { 8 | [XmlElement("id")] 9 | public string Name { get; set; } 10 | 11 | [XmlElement("rect")] 12 | public Rectangle Location { get; set; } 13 | 14 | [XmlAttribute("reporter")] 15 | public bool Reporter { get; set; } 16 | 17 | [XmlAttribute("ingamenow")] 18 | public bool InGame { get; set; } 19 | 20 | [XmlAttribute("playerNumber")] 21 | public int PlayerNum { get; set; } 22 | 23 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Moderation/Reports/VisiblePlayer.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Moderation.Reports; 5 | 6 | [XmlRoot("visibleBadge")] 7 | [Serializable] 8 | public class VisiblePlayer 9 | { 10 | [XmlElement("id")] 11 | public string Name { get; set; } 12 | 13 | [XmlElement("hash")] 14 | public string Hash { get; set; } 15 | 16 | [XmlElement("rect")] 17 | public Rectangle Bounds { get; set; } 18 | 19 | [XmlAttribute("type")] 20 | public string Type { get; set; } 21 | 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Resources/LbpFileType.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Resources; 2 | 3 | public enum LbpFileType 4 | { 5 | Script, // .ff, FSH 6 | Texture, // TEX 7 | Level, // LVL 8 | Adventure, // ADC, ADS 9 | CrossLevel, // PRF, Cross controller level 10 | FileArchive, // .farc, (ends with FARC) 11 | Plan, // PLN, uploaded with levels 12 | Voice, // VOP, voice data 13 | MotionRecording, // used in LBP2+/V for the motion recorder 14 | Painting, // PTG, paintings 15 | Jpeg, // JFIF / FIF, used in sticker switches, 16 | Png, // used in LBP Vita 17 | Quest, // A LBP3 quest, used in the organizertron 18 | StreamingChunk, // used in LBP3 dynamic thermo levels 19 | Unknown, 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/Author.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 4 | 5 | [XmlRoot("author")] 6 | public struct Author : ILbpSerializable 7 | { 8 | public Author() { } 9 | 10 | public Author(string username) 11 | { 12 | this.Username = username; 13 | } 14 | 15 | [XmlElement("npHandle")] 16 | public string Username { get; set; } 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/CategoryListResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlRoot("categories")] 7 | public class CategoryListResponse : ILbpSerializable 8 | { 9 | public CategoryListResponse() { } 10 | 11 | public CategoryListResponse(List categories, GameCategory textSearch, int total, string hint, int hintStart) 12 | { 13 | this.Categories = categories; 14 | this.Search = textSearch; 15 | this.Total = total; 16 | this.Hint = hint; 17 | this.HintStart = hintStart; 18 | } 19 | 20 | [XmlAttribute("total")] 21 | public int Total { get; set; } 22 | 23 | [XmlAttribute("hint")] 24 | public string Hint { get; set; } = ""; 25 | 26 | [XmlAttribute("hint_start")] 27 | public int HintStart { get; set; } 28 | 29 | [XmlElement("text_search")] 30 | public GameCategory Search { get; set; } 31 | 32 | [XmlElement("category")] 33 | public List Categories { get; set; } 34 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/CommentListResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlRoot("comments")] 7 | public struct CommentListResponse : ILbpSerializable 8 | { 9 | public CommentListResponse(List comments) 10 | { 11 | this.Comments = comments; 12 | } 13 | 14 | [XmlElement("comment")] 15 | public List Comments { get; set; } 16 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/FriendResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlRoot("npdata")] 7 | public struct FriendResponse : ILbpSerializable 8 | { 9 | 10 | public FriendResponse(List friends) 11 | { 12 | this.Friends = friends; 13 | } 14 | 15 | [XmlArray("friends")] 16 | [XmlArrayItem("npHandle")] 17 | public List Friends { get; set; } 18 | 19 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/GameDeveloperVideos.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 4 | 5 | [XmlRoot("videos")] 6 | public class GameDeveloperVideos : ILbpSerializable { } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/GameNotification.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | using LBPUnion.ProjectLighthouse.Types.Entities.Notifications; 3 | using LBPUnion.ProjectLighthouse.Types.Notifications; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 6 | 7 | [XmlRoot("notification")] 8 | public class GameNotification : ILbpSerializable 9 | { 10 | [XmlAttribute("type")] 11 | public NotificationType Type { get; set; } 12 | 13 | [XmlElement("text")] 14 | public string Text { get; set; } = ""; 15 | 16 | public static GameNotification CreateFromEntity(NotificationEntity notification) => new() 17 | { 18 | Type = notification.Type, 19 | Text = notification.Text, 20 | }; 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/GamePhotoSubject.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | using LBPUnion.ProjectLighthouse.Types.Entities.Profile; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlType("subject")] 7 | [XmlRoot("subject")] 8 | public class GamePhotoSubject : ILbpSerializable 9 | { 10 | 11 | [XmlIgnore] 12 | public int UserId { get; set; } 13 | 14 | [XmlElement("npHandle")] 15 | public string Username { get; set; } 16 | 17 | [XmlElement("displayName")] 18 | public string DisplayName => this.Username; 19 | 20 | [XmlElement("bounds")] 21 | public string Bounds { get; set; } 22 | 23 | public static GamePhotoSubject CreateFromEntity(PhotoSubjectEntity entity) => 24 | new() 25 | { 26 | UserId = entity.UserId, 27 | Bounds = entity.Bounds, 28 | }; 29 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/IHasCustomRoot.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 2 | 3 | /// 4 | /// Used for serializable classes that benefit from having a custom root 5 | /// For example: If the underlying properties of a type don't change but the root tag does 6 | /// 7 | public interface IHasCustomRoot 8 | { 9 | public string GetRoot(); 10 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/ILbpSerializable.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 2 | 3 | /// 4 | /// Used to indicate that a class can be serialized 5 | /// 6 | public interface ILbpSerializable { } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/INeedsPreparationForSerialization.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 2 | 3 | /// 4 | /// Allows serializable classes to fetch other data using DI services 5 | /// Function is called using reflection so there is no required methods. 6 | /// Method signature: public async Task PrepareSerialization(list of services) 7 | /// 8 | public interface INeedsPreparationForSerialization { } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/IconList.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | public struct IconList : ILbpSerializable 7 | { 8 | public IconList() { } 9 | 10 | public IconList(List iconHashList) 11 | { 12 | this.IconHashList = iconHashList; 13 | } 14 | 15 | [XmlElement("icon")] 16 | public List IconHashList { get; set; } 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/LbpCustomXml.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 2 | 3 | public class LbpCustomXml : ILbpSerializable 4 | { 5 | public required string Content { get; init; } 6 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/MinimalUserListResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlRoot("users")] 7 | public struct MinimalUserListResponse : ILbpSerializable 8 | { 9 | public MinimalUserListResponse() { } 10 | 11 | public MinimalUserListResponse(List users) 12 | { 13 | this.Users = users; 14 | } 15 | 16 | [XmlElement("user")] 17 | public List Users { get; set; } 18 | } 19 | 20 | public class MinimalUserProfile : ILbpSerializable 21 | { 22 | 23 | [XmlElement("npHandle")] 24 | public NpHandle UserHandle { get; set; } = new(); 25 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/NpHandle.cs: -------------------------------------------------------------------------------- 1 | using System.ComponentModel; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | public class NpHandle : ILbpSerializable 7 | { 8 | public NpHandle() { } 9 | 10 | public NpHandle(string username, string iconHash) 11 | { 12 | this.Username = username; 13 | this.IconHash = iconHash; 14 | } 15 | 16 | [XmlText] 17 | public string Username { get; set; } 18 | 19 | [DefaultValue("")] 20 | [XmlAttribute("icon")] 21 | public string IconHash { get; set; } 22 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/PhotoListResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlRoot("photos")] 7 | public struct PhotoListResponse : ILbpSerializable 8 | { 9 | public PhotoListResponse(List photos) 10 | { 11 | this.Photos = photos; 12 | } 13 | 14 | [XmlElement("photo")] 15 | public List Photos { get; set; } 16 | 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/PhotoSlot.cs: -------------------------------------------------------------------------------- 1 | #nullable enable 2 | using System.ComponentModel; 3 | using System.Xml.Serialization; 4 | using LBPUnion.ProjectLighthouse.Types.Levels; 5 | 6 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 7 | 8 | [XmlRoot("slot")] 9 | public class PhotoSlot : ILbpSerializable 10 | { 11 | [XmlAttribute("type")] 12 | public SlotType SlotType { get; set; } 13 | 14 | [XmlElement("id")] 15 | public int SlotId { get; set; } 16 | 17 | [DefaultValue("")] 18 | [XmlElement("rootLevel")] 19 | public string? RootLevel { get; set; } 20 | 21 | [DefaultValue("")] 22 | [XmlElement("name")] 23 | public string? LevelName { get; set; } 24 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/PlanetStatsResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 4 | 5 | [XmlRoot("planetStats")] 6 | public class PlanetStatsResponse : ILbpSerializable 7 | { 8 | public PlanetStatsResponse() { } 9 | 10 | public PlanetStatsResponse(int totalSlots, int teamPicks) 11 | { 12 | this.TotalSlotCount = totalSlots; 13 | this.TeamPickCount = teamPicks; 14 | } 15 | 16 | [XmlElement("totalSlotCount")] 17 | public int TotalSlotCount { get; set; } 18 | 19 | [XmlElement("mmPicksCount")] 20 | public int TeamPickCount { get; set; } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/PlaylistResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlRoot("playlists")] 7 | public struct PlaylistResponse : ILbpSerializable 8 | { 9 | [XmlElement("playlist")] 10 | public required List Playlists { get; set; } 11 | 12 | [XmlAttribute("total")] 13 | public required int Total { get; set; } 14 | 15 | [XmlAttribute("hint_start")] 16 | public required int HintStart { get; set; } 17 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/ReviewResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.ComponentModel; 3 | using System.Xml.Serialization; 4 | 5 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 6 | 7 | [XmlRoot("reviews")] 8 | public struct ReviewResponse : ILbpSerializable 9 | { 10 | public ReviewResponse(List reviews, long hint, int hintStart) 11 | { 12 | this.Reviews = reviews; 13 | this.Hint = hint; 14 | this.HintStart = hintStart; 15 | } 16 | 17 | [XmlElement("review")] 18 | public List Reviews { get; set; } 19 | 20 | [DefaultValue(0)] 21 | [XmlAttribute("hint")] 22 | public long Hint { get; set; } 23 | 24 | [DefaultValue(0)] 25 | [XmlAttribute("hint_start")] 26 | public int HintStart { get; set; } 27 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/ReviewSlot.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | using LBPUnion.ProjectLighthouse.Types.Levels; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlRoot("slot")] 7 | public class ReviewSlot : ILbpSerializable 8 | { 9 | [XmlAttribute("type")] 10 | public SlotType SlotType { get; set; } 11 | 12 | [XmlText] 13 | public int SlotId { get; set; } 14 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/SlotResourceResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using System.Xml.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 5 | 6 | [XmlRoot("slot")] 7 | public struct SlotResourceResponse : ILbpSerializable 8 | { 9 | public SlotResourceResponse(List resources) 10 | { 11 | this.Resources = resources; 12 | } 13 | 14 | [XmlAttribute("type")] 15 | public string Type { get; set; } = "user"; 16 | 17 | [XmlElement("resource")] 18 | public List Resources { get; set; } 19 | 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Serialization/TelemetryConfigResponse.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | 3 | namespace LBPUnion.ProjectLighthouse.Types.Serialization; 4 | 5 | //TODO what is the format for telemetry 6 | [XmlRoot("t_enable")] 7 | public class TelemetryConfigResponse : ILbpSerializable 8 | { 9 | [XmlText] 10 | public bool TelemetryEnabled { get; set; } 11 | 12 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Users/LoginResult.cs: -------------------------------------------------------------------------------- 1 | using System.Xml.Serialization; 2 | using LBPUnion.ProjectLighthouse.Types.Serialization; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Users; 5 | 6 | /// 7 | /// Response to POST /login 8 | /// 9 | [XmlRoot("loginResult")] 10 | [XmlType("loginResult")] 11 | public class LoginResult : ILbpSerializable 12 | { 13 | [XmlElement("authTicket")] 14 | public string AuthTicket { get; set; } 15 | 16 | [XmlElement("lbpEnvVer")] 17 | public string ServerBrand { get; set; } 18 | 19 | [XmlElement("titleStorageURL")] 20 | public string TitleStorageUrl { get; set; } 21 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Users/PermissionLevel.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Users; 2 | 3 | public enum PermissionLevel 4 | { 5 | Banned = -3, 6 | Restricted = -2, 7 | Silenced = -1, 8 | Default = 0, 9 | Moderator = 1, 10 | Administrator = 2, 11 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Users/Platform.cs: -------------------------------------------------------------------------------- 1 | namespace LBPUnion.ProjectLighthouse.Types.Users; 2 | 3 | public static class PlatformExtensions 4 | { 5 | 6 | public static bool IsPSN(this Platform platform) 7 | { 8 | return platform == Platform.PS3 || platform == Platform.PSP || platform == Platform.Vita; 9 | } 10 | } 11 | 12 | public enum Platform 13 | { 14 | PS3 = 0, 15 | RPCS3 = 1, 16 | Vita = 2, 17 | PSP = 3, 18 | UnitTest = 4, 19 | Unknown = -1, 20 | } -------------------------------------------------------------------------------- /ProjectLighthouse/Types/Users/UserFriendData.cs: -------------------------------------------------------------------------------- 1 | using System.Collections.Generic; 2 | using Redis.OM.Modeling; 3 | 4 | namespace LBPUnion.ProjectLighthouse.Types.Users; 5 | 6 | [Document(StorageType = StorageType.Json, Prefixes = new[] {"UserFriendData",})] 7 | public class UserFriendData 8 | { 9 | private int userId; 10 | 11 | [Indexed] 12 | public int UserId { 13 | get => this.userId; 14 | set { 15 | this.RedisId = value.ToString(); 16 | this.userId = value; 17 | } 18 | } 19 | 20 | [RedisIdField] 21 | public string RedisId { get; set; } 22 | 23 | [Indexed] 24 | public List FriendIds { get; set; } 25 | 26 | [Indexed] 27 | public List BlockedIds { get; set; } 28 | } -------------------------------------------------------------------------------- /ProjectLighthouse/appsettings.Development.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /ProjectLighthouse/appsettings.json: -------------------------------------------------------------------------------- 1 | { 2 | "Logging": { 3 | "LogLevel": { 4 | "Default": "Information", 5 | "Microsoft": "Warning", 6 | "Microsoft.Hosting.Lifetime": "Information" 7 | } 8 | }, 9 | "AllowedHosts": "*" 10 | } 11 | -------------------------------------------------------------------------------- /crowdin.yml: -------------------------------------------------------------------------------- 1 | project_id_env: CROWDIN_PROJECT_ID 2 | api_token_env: CROWDIN_PERSONAL_TOKEN 3 | 4 | preserve_hierarchy: true 5 | files: 6 | - source: /ProjectLighthouse.Localization/*.resx 7 | translation: /ProjectLighthouse.Localization/%file_name%.lang-%locale%.%file_extension% 8 | ignore: 9 | - /ProjectLighthouse.Localization/%file_name%.*.%file_extension% 10 | -------------------------------------------------------------------------------- /global.json: -------------------------------------------------------------------------------- 1 | { 2 | "sdk": { 3 | "version": "8.0.0", 4 | "rollForward": "latestMajor", 5 | "allowPrerelease": true 6 | } 7 | } -------------------------------------------------------------------------------- /qodana.yaml: -------------------------------------------------------------------------------- 1 | version: "1.0" 2 | linter: jetbrains/qodana-dotnet:2024.1 3 | profile: 4 | name: qodana.recommended 5 | include: 6 | - name: CheckDependencyLicenses 7 | exclude: 8 | - name: All 9 | paths: 10 | - ProjectLighthouse.Localization 11 | - ProjectLighthouse/Migrations 12 | -------------------------------------------------------------------------------- /scripts-and-tools/build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Build script for production 3 | # 4 | # No arguments 5 | # Called manually 6 | 7 | cd project-lighthouse || (echo "Source directory not found, pls clone properly~" && exit 1) 8 | 9 | echo "Pulling latest changes..." 10 | git pull 11 | 12 | echo "Building..." 13 | dotnet build -c Release 14 | 15 | exit $? # Expose error code from build command -------------------------------------------------------------------------------- /scripts-and-tools/create-migration.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Developer script to create EntityFramework database migrations 4 | # 5 | # $1: Name of the migration, e.g. SwitchToPermissionLevels 6 | # Invoked manually 7 | 8 | export LIGHTHOUSE_DB_CONNECTION_STRING='server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse' 9 | dotnet ef migrations add "$1" --project ../ProjectLighthouse -------------------------------------------------------------------------------- /scripts-and-tools/docker-entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | log() { 4 | type="$1"; shift 5 | printf '%s [%s] [Entrypoint]: %s\n' "$(date -Iseconds)" "$type" "$*" 6 | } 7 | 8 | log Note "Entrypoint script for Lighthouse $SERVER started" 9 | 10 | if [ ! -d "/lighthouse/data" ]; then 11 | log Note "Creating data directory" 12 | mkdir -p "/lighthouse/data" 13 | fi 14 | 15 | owner=$(stat -c "%U %G" /lighthouse/data) 16 | if [ "$owner" != "lighthouse lighthouse" ]; then 17 | log Note "Changing ownership of data directory" 18 | chown -R lighthouse:lighthouse /lighthouse/data 19 | fi 20 | 21 | if [ -d "/lighthouse/temp" ]; then 22 | log Note "Copying temp directory to data" 23 | cp -rn /lighthouse/temp/* /lighthouse/data 24 | rm -rf /lighthouse/temp 25 | fi 26 | 27 | # Start server 28 | 29 | log Note "Startup tasks finished, starting $SERVER..." 30 | cd /lighthouse/data || exit 31 | exec su-exec lighthouse:lighthouse dotnet /lighthouse/app/LBPUnion.ProjectLighthouse.Servers."$SERVER".dll 32 | 33 | exit $? # Expose error code from dotnet command -------------------------------------------------------------------------------- /scripts-and-tools/project-lighthouse-api.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Project Lighthouse API - a clean-room, open-source custom server for LBP 3 | Documentation=https://github.com/LBPUnion/ProjectLighthouse 4 | 5 | [Service] 6 | Type=simple 7 | ExecStart=bash -c "/srv/lighthouse/start.sh API" 8 | TimeoutStopSec=15 9 | User=lighthouse 10 | Restart=on-failure 11 | 12 | [Install] 13 | Alias=lighthouse-api 14 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /scripts-and-tools/project-lighthouse-gameserver.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Project Lighthouse GameServer - a clean-room, open-source custom server for LBP 3 | Documentation=https://github.com/LBPUnion/ProjectLighthouse 4 | 5 | [Service] 6 | Type=simple 7 | ExecStart=bash -c "/srv/lighthouse/start.sh GameServer" 8 | TimeoutStopSec=15 9 | User=lighthouse 10 | Restart=on-failure 11 | 12 | [Install] 13 | Alias=lighthouse-website 14 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /scripts-and-tools/project-lighthouse-website.service: -------------------------------------------------------------------------------- 1 | [Unit] 2 | Description=Project Lighthouse Website - a clean-room, open-source custom server for LBP 3 | Documentation=https://github.com/LBPUnion/ProjectLighthouse 4 | 5 | [Service] 6 | Type=simple 7 | ExecStart=bash -c "/srv/lighthouse/start.sh Website" 8 | TimeoutStopSec=15 9 | User=lighthouse 10 | Restart=on-failure 11 | 12 | [Install] 13 | Alias=lighthouse-website 14 | WantedBy=multi-user.target -------------------------------------------------------------------------------- /scripts-and-tools/start.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Startup script for production 3 | # 4 | # $1: Server to start; case sensitive!!!!! 5 | # Called from systemd units 6 | 7 | cd "$HOME"/data || (echo "Data directory not found, pls create one~" && exit 1) 8 | 9 | echo "Running..." 10 | 11 | # Normally this requires ASPNETCORE_URLS but we override that in the configuration 12 | dotnet ../project-lighthouse/ProjectLighthouse.Servers."$1"/bin/Release/net8.0/LBPUnion.ProjectLighthouse.Servers."$1".dll 13 | 14 | exit $? # Expose error code from dotnet command -------------------------------------------------------------------------------- /scripts-and-tools/update.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | # Update script for production 3 | # 4 | # No arguments 5 | # Called manually 6 | 7 | sudo systemctl stop project-lighthouse* 8 | 9 | cd /srv/lighthouse || return 10 | sudo -u lighthouse -i /srv/lighthouse/build.sh 11 | 12 | sudo systemctl start project-lighthouse* --------------------------------------------------------------------------------