Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

0.17.0 - Replay Minimap Rendering & Display #150

Merged
merged 20 commits into from
Jul 23, 2023
Merged

0.17.0 - Replay Minimap Rendering & Display #150

merged 20 commits into from
Jul 23, 2023

Conversation

SakuraIsayeki
Copy link
Owner

No description provided.

- Updated the API port from 8000 to 80 in the docker-compose.yaml file and default.toml configuration file.
- Added a new project for the Minimap API client
- Implemented the `MinimapApiClient` class with methods for rendering the game minimap and handling authentication
- Added options class `MinimapApiClientOptions` to configure the client
- Created extension methods for dependency injection container to add the Minimap API client
- Implemented `MinimapClientAuthenticationDelegatingHandler` as a delegating handler for OAuth2 password grant flow authentication
- Added `MinimapLoginResponse` class to represent the response from the Minimap API when logging in through OAuth2 password grant flow
- Updated the .NET version to 7.0.x in the setup step.
- Updated the actions/checkout action to v3.
- Removed the matrix strategy for building specific projects.
- Added permissions for reading contents.
- Consolidated restore and build steps into single steps without specifying project names.
- Updated the actions/setup-dotnet action to v2.

These changes ensure that the code is built and tested using the latest versions of .NET and GitHub Actions, while simplifying the workflow configuration.
- Added a new method `RenderPostReplayMinimapAsync` to the `MinimapRenderingService` class.
- The method renders the minimap for the specified post's replay.
- It takes in the ID of the post and an optional targeted player ID to highlight on the minimap.
- If the post does not exist or if its replay has already been rendered, the method skips rendering.
- The method fetches the replay file using the `ReplaysIngestService` and renders the minimap using the `MinimapApiClient`.
- The rendered minimap is stored in an Azure Blob Storage container named "minimaps".
- The status of whether a replay's minimap has been rendered is tracked using a new boolean property called "MinimapRendered" in the `Replay` model.
This commit adds the following changes:
- Added a new endpoint in the `ReplayController` to trigger minimap rendering on a post's replay.
- Created a new method `RenderMinimap` in the `ReplayController` to handle the minimap rendering logic.
- Added a new service called `MinimapRenderingService` to handle the background job for rendering the minimap.
- Updated the `ReplaysIngestService` to include the MiniMapUri property in the ReplayDTO, which contains the URI of the rendered minimap video file.
- Added a reference to `WowsKarma.Api.Minimap.Client` project in `WowsKarma.Api.csproj`.
- Registered `MinimapRenderingService` as a scoped service in Startup.cs.

The new endpoint allows administrators to trigger minimap rendering on a post's replay by providing the postId. The MinimapRenderingService then enqueues a background job to render and save the minimap video file. The MiniMapUri property is added to ReplayDTO, which contains the URI of the rendered minimap video file.
Resolve the dependency for the minimap renderer at runtime by installing it from the specified GitHub repository.
This commit updates the Minimap API workflow to include both the "main" and "develop" branches. Previously, only the "main" branch triggered the workflow. Now, any push event on either branch will trigger the workflow.

Additionally, this commit modifies the metadata action to include a new context parameter for better organization. It also updates the tags parameter to use a more flexible flavor configuration that includes options for latest version and branch-specific tags based on semantic versioning and commit SHA.

These changes improve flexibility and ensure that the Minimap API Docker image is built and pushed correctly for all relevant branches.
The commit removes the unnecessary "context" and "file" paths from the build and push workflow in minimap-api-push.yml. This improves code readability and reduces redundancy.
- Updated the `IMAGE_NAME` environment variable to use the repository owner's name followed by `/wowskarma_api_minimap`
- Removed the unnecessary `prefix=minimap-` from the flavor configuration

These changes ensure that the image name and tags are correctly set for the minimap API.
- Added `SnakeCaseNamingPolicy` class to handle JSON property naming conversion.
- Updated `MinimapApiClient.cs` to use `SnakeCaseNamingPolicy` for JSON serialization.
- Renamed `ReplayId` parameter to `replayId` in the method `RenderReplayMinimapAsync`.
- Renamed properties `Username` and `Password` in `MinimapApiClientOptions.cs` to `Login` and `Password`, respectively.
- Removed unused class `MinimapClientAuthenticationDelegatingHandler`.
- Updated dependencies in the project file.
- Updated the placeholder value for JWT Secret in appsettings.Development.json
- Refactored the configuration of MinimapApiClient in Startup.cs to use Configuration.GetSection("MinimapApi")
- Upgraded Nodsoft.WowsReplaysUnpack.ExtendedData package reference to version 2.0.22-alpha-g89b1099182 in WowsKarma.Api.csproj
- Added a new HTTP PATCH endpoint `RenderMinimap` to the `ReplayController` class.
- The endpoint triggers minimap rendering on a post's replay and is only accessible by administrators.
- It accepts the ID of the post to render the replay's minimap for, as well as an optional parameter `force` to force rendering even if it has already been rendered.
- If no post with the specified GUID is found, it returns a 404 status code.
- The job to render the minimap is enqueued successfully and returns a 202 status code.

fix(UserService): Fix GetUserSeedTokenAsync method

- Fixed an issue in the `GetUserSeedTokenAsync` method of the `UserService` class.
- Replaced `await GetUserAsync(id)` with `await context.Users.FindAsync(id)` to retrieve user information from the database correctly.

feat(MinimapRenderingService): Add force parameter to RenderPostReplayMinimapAsync method

- Added a new optional parameter `force` to the `RenderPostReplayMinimapAsync` method of the `MinimapRenderingService` class.
- This parameter allows forcing rendering of the minimap even if it has already been rendered before.
- If not forced and either no post or a post with already rendered minimap is found, skipping minimap rendering occurs and logs are updated accordingly.

feat(MinimapRenderingService): Add force parameter to UploadReplayMinimapAsync method

- Added a new optional parameter `force` to the private method `_UploadReplayMinimapAsync`.
- This parameter allows forcing upload of the minimap even if it has already been uploaded before.
- Removed the `targetedPlayerId` parameter from the `RenderPostReplayMinimapAsync` method call in the `ReplayController`.
- Updated the method call to pass only the necessary parameters.

fix(MinimapRenderingService): Remove unnecessary namespace declaration

- Removed the unnecessary namespace declaration for `WowsKarma.Api.Services.Minimap`.

refactor(NotificationService): Remove unused code

- Removed the inclusion of `PostDeletedNotification` in the query.
- Cleaned up unused code related to `PostDeletedNotification`.

refactor(PostUpdatesBroadcastService): Add minimap rendering job on post creation

- Added a background job to render the minimap for a newly created post.
- The job is enqueued when a new post is created.

refactor(PostUpdatesBroadcastService): Comment out unused code

- Commented out unused code related to notifying post deletion.
This commit adds a new HTTP PATCH endpoint in the ReplayController class that allows administrators to trigger minimap rendering on all posts' replays within a specified date/time range. The endpoint accepts start and end parameters for the date/time range, as well as an optional force parameter to force rendering even if the minimap has already been rendered. The job is enqueued using Hangfire's BackgroundJob.Enqueue method, which calls the ReprocessAllMinimapsAsync method in the MinimapRenderingService class. The commit also removes an unused return statement from another method in the same controller.

---

fix(Program): Remove unnecessary code

This commit removes commented out code related to logging configuration from the Program class.

---

feat(MinimapRenderingService): Add batch rendering of replay minimaps

This commit adds a new public method, ReprocessAllMinimapsAsync, to the MinimapRenderingService class. This method triggers minimap rendering on all replays between two specified dates. It accepts start and end parameters for the date range, as well as an optional force parameter to force rendering even if the minimap has already been rendered. The job is logged and enqueued using Hangfire's BackgroundJob.Enqueue method.

---

refactor(Startup): Remove unused constants and services

This commit removes an unused constant (CommonAuthenticationScheme) from the Startup class. It also removes unnecessary usings related to services that are no longer used (MinimapRenderingService) or have been moved elsewhere (ReplaysIngestService).
- Added `Microsoft.EntityFrameworkCore` namespace to the `PostController.cs` file.
- Included the `Replay` navigation property in the query for posts.
- Trimmed the replay data to only include the State elements.
- Updated the mapping configuration in `Conversions.cs` to map the `ReplayState` property of `PlayerPostDTO`.
- Added a new enum, `ReplayState`, to represent different states of a replay.
- Updated the `PlayerPostDto` interface and its corresponding TypeScript definition file (`player-post-dto.ts`) to include the new `replayState` property.
- Modified the HTML template of the post component (`post.component.html`) to conditionally display icons based on the value of `replayState`.

This commit enhances the functionality of retrieving posts by including relevant replay data and displaying appropriate icons based on their processing state.
The `MinimapApiClient` now includes query string parameters in the render request. The `replayId` and `targetedPlayerId` are added to the query string if they are provided.

fix(api): Create public access container in MinimapRenderingService

The `MinimapRenderingService` now creates a container with public access when it doesn't exist. This ensures that the rendered minimap videos can be accessed by external clients.

refactor(api): Update logging message in MinimapRenderingService

The logging message in the `MinimapRenderingService` has been updated to include the target player ID when rendering a minimap for a replay post.

fix(api): Upload minimap using Azure Blob Storage SDK

The minimap is now uploaded using the Azure Blob Storage SDK instead of directly calling the upload method on the container client. This provides better control over overwrite behavior and allows for cancellation of the upload operation.

fix(app): Display minimap video in view post component

The view post component now displays the minimap video if it is available for a post. The video is displayed using an HTML5 `<video>` element with controls, autoplay, and loop attributes.

style(theme): Update body background color

The body background color has been updated from `#1a1a1a` to `#111111`. This change improves contrast and enhances readability.
- Updated the `ReplayDTO` model to change the property name from `miniMapUri` to `minimapUri`.
- Modified the `ReplaysIngestService` class to conditionally set the `MinimapUri` property based on whether the replay has been rendered.
- Updated the `view-post.component.html` template to handle the changes in the `post.replay.minimapUri` property.
- Added a processing message when rendering the replay minimap.

These changes improve consistency and enhance the display of replays in posts.
- Updated the `dotnet-build.yml` workflow to include an environment variable for the solution file.
- Modified the `dotnet restore`, `dotnet build`, and `dotnet test` steps in the workflow to use the solution file specified in the environment variable.
- Removed the `wowskarma.app.esproj` file from the project.
This commit updates the project version in the API to 0.17.0, reflecting new changes and improvements made to the codebase.
@SakuraIsayeki SakuraIsayeki self-assigned this Jul 23, 2023
@SakuraIsayeki SakuraIsayeki added API Related to API development Web Related to Web App development labels Jul 23, 2023
@SakuraIsayeki SakuraIsayeki merged commit ca1b4ac into main Jul 23, 2023
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to API development Web Related to Web App development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant