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

Minimap API v0.1 - Initial release #148

Merged
merged 20 commits into from
Jul 21, 2023
Merged

Minimap API v0.1 - Initial release #148

merged 20 commits into from
Jul 21, 2023

Conversation

SakuraIsayeki
Copy link
Owner

Related to #85.

The method for querying a player's full karma has been optimized by compiling the EF query. Compiling the query improves the performance as it removes the overhead of query compilation at runtime. This change ensures that the application is more performant and responsive to the end user.

Moreover, the AccountFullKarmaDTO model was updated to better reflect the structure of the Karma system, enhancing readability and maintainability of the code.

Signed-off-by: Sakura Akeno Isayeki <sakura.isayeki@nodsoft.net>
This commit adds a new GitHub Actions workflow file, `minimap-main.yml`, which sets up continuous integration (CI) for the Minimap API. The workflow is triggered on push or pull request events for the main or develop branches. It also allows manual execution from the Actions tab.

The workflow consists of two jobs:
1. "linter" job runs linter checks using Python 3.10 on Ubuntu latest.
2. "tests_linux" job installs project dependencies and runs tests on Ubuntu latest.
3. "tests_win" job installs Pip, then installs and tests the project on Windows latest.

These changes ensure that code quality is maintained and tests are run automatically during development.
The commit renames several files and directories in the project to adhere to a new naming convention. The changes include renaming the project directory, source files, configuration files, and documentation files. This refactor improves consistency and readability of the codebase.
- Updated the `docker-compose.yaml` file to use environment variables with a new prefix for dynamic configuration.
- Modified the `app.py` file to change the title of the FastAPI application.

This commit improves the configuration and naming conventions in the project.
- Updated the description of the app in the FastAPI configuration.
- Changed the algorithm used for security from HS256 to HS384.
This commit removes the content routes from the application and adds functionality to create new users. The `content.py` file has been deleted, along with its associated model classes and route handlers. The `user.py` file now includes a new route handler for creating users, which checks if the username already exists and only allows superusers to create other superuser accounts. Additionally, if this is the first user being created in the database, they are automatically assigned as a superuser.

The changes made in this commit simplify the codebase by removing unused functionality and enhance user management capabilities by allowing for easy creation of new accounts.
- Added a new route `/render` in the `render.py` file to handle replay rendering.
- The route accepts a replay file and an optional replay ID.
- Checks if the uploaded file is a valid replay file with the `.wowsreplay` extension.
- Validates the size of the uploaded file against the maximum allowed size defined in the configuration.
- Writes the replay data to a temporary file in `/tmp/wows-karma/minimap/`.
- Uses the `Renderer` class from `renderer.render` module to start rendering based on provided options (enable chat, team tracers).
- Returns the rendered video file as a response with media type "video/mp4" and filename based on either provided or default replay ID.
- Updated the `requirements.txt` file to use an in-house repository for the minimap renderer.
- Added support for specifying a target player ID in the `render_replay` function.
The python-version matrix in the minimap-main.yml file has been updated to use the string representation of the Python version "3.10" instead of the previous array representation [3.10]. This change ensures compatibility with the CI workflow configuration.
The commit updates the directory name from "wowskarma.api.minimap" to "wowskarma_api_minimap" in the minimap-main.yml file. This change ensures consistency and improves readability.
- Added a new workflow file `minimap-api-build.yml` to build the Minimap API Docker image.
- Added a new workflow file `minimap-api-push.yml` to push the Minimap API Docker image to DockerHub and GHCR.
- Deleted the old workflow file `minimap-main.yml` which was used for CI testing.

These changes enable automated building and pushing of the Minimap API Docker image.
- Removed unnecessary path restriction in the build workflow
- Updated DockerHub login action to v2
- Added setup for QEMU and Docker Buildx in the build workflow
- Replaced GHCR login action with DockerHub login action in the push workflow
- Modified push step to use docker/build-push-action@v4 for building and pushing images with updated tags
The `get_current_user` function in the `security.py` file has been improved. The `fresh` parameter has been removed from the function signature, as it was not being used. Additionally, a commented out block of code that raised a credentials exception based on the freshness of the token and user's superuser status has been temporarily disabled.
This commit adds a new parameter `background_tasks` to the `render_replay` function in the `render.py` file. The purpose of this parameter is to allow for the addition of a background task that removes the temporary file after it has been rendered and returned as a response. This helps to clean up any leftover files and improve overall system efficiency.
The commit removes an unused import and variable in the `cli.py` file. The import for `Content` from the models module is removed, as it is not being used in the code.

fix(config): Add temporary work directory for replay processing

This commit adds a new configuration option to the `default.toml` file. The `temp_workdir` setting specifies the temporary directory path for replay processing. The default value is set to "/tmp/wowskarma/minimap".

refactor(routes): Update filepath handling in render_replay function

In this commit, the filepath handling in the `render_replay` function of the `render.py` file is updated. Instead of using a hardcoded path, it now uses the configured temporary work directory from settings. Additionally, pathlib.Path is used to concatenate filepaths and ensure platform compatibility.
This commit adds logging functionality to the render_replay function in the `render.py` file. Now, when a new render job is started, a log message will be generated with details such as the Job ID, Replay ID (if available), and Filename. This helps in tracking and monitoring render jobs.

Additionally, the commit also updates the filepath generation logic to use the newly generated Job ID instead of generating a random filename each time. This improves consistency and makes it easier to identify rendered files.

The rendering process has also been updated to include quality settings (quality=9) and frame rate settings (fps=30) for better output results.

Closes #123
- Added `fps` option to control the frames per second for replay processing.
- Added `quality` option to specify the quality of the output video.
- Updated temporary work directory path for replay processing.
@SakuraIsayeki SakuraIsayeki self-assigned this Jul 21, 2023
@SakuraIsayeki SakuraIsayeki added the API Related to API development label Jul 21, 2023
@SakuraIsayeki SakuraIsayeki merged commit 2fa755a into main Jul 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API Related to API development
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant