Skip to content

skip HockeyTech playoff bracket seasons with TBD teams, and dynamically resolve test result JSON in CI#122

Merged
sethwv merged 5 commits into
mainfrom
dev
Apr 28, 2026
Merged

skip HockeyTech playoff bracket seasons with TBD teams, and dynamically resolve test result JSON in CI#122
sethwv merged 5 commits into
mainfrom
dev

Conversation

@sethwv

@sethwv sethwv commented Apr 28, 2026

Copy link
Copy Markdown
Owner

No description provided.

sethwv and others added 5 commits April 27, 2026 20:14
#109)

This pull request introduces significant improvements to caching and
error handling across the codebase, primarily by replacing in-memory
caches with filesystem-backed caches, enhancing cache reliability and
scalability. It also adds a shared error class for better error
reporting, and makes several adjustments to Docker build workflow and
request configuration usage.

**Caching Improvements (Filesystem-backed):**

* Added a new `fsCache.js` utility to provide filesystem-backed caching
for buffers and JSON, replacing in-memory Maps for processed images and
badge overlays. This enables persistent and scalable caching across
sessions.
* Refactored `imageUtils.js` to use `fsCache` for caching white logos,
greyscale logos, and badge overlays, eliminating previous in-memory
cache limits and cleanup logic.
[[1]](diffhunk://#diff-637667f0cdc2a86b112f0208e446a1d29d48ccf7460e6412c7c138c18518a70fL65-R72)
[[2]](diffhunk://#diff-637667f0cdc2a86b112f0208e446a1d29d48ccf7460e6412c7c138c18518a70fL295-R315)
[[3]](diffhunk://#diff-637667f0cdc2a86b112f0208e446a1d29d48ccf7460e6412c7c138c18518a70fL334-R344)
[[4]](diffhunk://#diff-637667f0cdc2a86b112f0208e446a1d29d48ccf7460e6412c7c138c18518a70fL372-R378)
[[5]](diffhunk://#diff-637667f0cdc2a86b112f0208e446a1d29d48ccf7460e6412c7c138c18518a70fL408-R413)
[[6]](diffhunk://#diff-637667f0cdc2a86b112f0208e446a1d29d48ccf7460e6412c7c138c18518a70fL1351-R1355)
* Updated `imageCache.js` to remove in-memory URL-to-checksum mapping
and instead use MD5 hashes of URLs for file naming, with improved cache
expiration and cleanup logic.
[[1]](diffhunk://#diff-f162e26ea020607866b5738c16b3bf4460f2be0d60c71e1c54d984824e6cb561L46-R69)
[[2]](diffhunk://#diff-f162e26ea020607866b5738c16b3bf4460f2be0d60c71e1c54d984824e6cb561L92-L101)
[[3]](diffhunk://#diff-f162e26ea020607866b5738c16b3bf4460f2be0d60c71e1c54d984824e6cb561R116-L133)

**Error Handling Enhancements:**

* Added a new `TeamNotFoundError` class in `errors.js` for consistent
and informative error reporting when a team cannot be found, including
available teams and league context.

**Request Configuration Consistency:**

* Updated `colorUtils.js` and `imageUtils.js` to use a shared
`requestConfig.js` for request timeout values, improving configuration
consistency across helpers.
[[1]](diffhunk://#diff-52cadbff98b297ed0a6cadb774ae36f4793140eca034b8fc328c5d5e210cd803L7-R7)
[[2]](diffhunk://#diff-637667f0cdc2a86b112f0208e446a1d29d48ccf7460e6412c7c138c18518a70fL893-R890)

**Docker Build Workflow Improvements:**

* Modified `.github/workflows/build-docker.yml` to support branch
patterns with wildcards and improved branch name formatting for Docker
image tags, ensuring more robust CI/CD handling.
[[1]](diffhunk://#diff-1d203d2dfb96ccf94b5e0961c7954e3bde73b4539ade27ccc301613e368b944fL5-R5)
[[2]](diffhunk://#diff-1d203d2dfb96ccf94b5e0961c7954e3bde73b4539ade27ccc301613e368b944fL48-R48)

**Provider Initialization Refactoring:**

* Simplified provider initialization in `express.js` by directly
requiring provider modules and removing unnecessary instantiation logic.
## Description

Adds support for adding a title, subtitle and custom icon to generic
league cover/thumb to support generic league events. This is good for
things like motorsports where events are not based on match-ups.

<!-- Describe what this PR does and why -->

## Type of Change

<!-- Check all that apply -->

- [ ] Bug fix
- [x] New feature
- [ ] New league/sport support
- [ ] Team data correction/override
- [x] Documentation update
- [ ] Performance improvement
- [ ] Code refactoring
- [ ] Other (please describe)

## Changes Made

<!-- List the specific changes in this PR -->
### Routes
- Added title query parameter to /:league/thumb and :/league/cover
- Added subtitle query parameter to /:league/thumb and :/league/cover
- Added iconurl query parameter to /:league/thumb and :/league/cover
- Added a new layout for league covers/thumbs that is triggered
automatically when a title/subtitle/custom icon is present
- Updated relevant endpoint documentation to include details on the two
new query params
### Fonts
- Default font files added to assets/fonts
- Added fontkit package to support font metadata parsing
- Added fontRegistry to facilitate the loading and correct tagging of
font files so they get correctly displayed
- Added logic to app initialization to load the default fonts
- Added logic to leagues.js to load in custom league fonts if present
(this works for default and custom leagues so if you want to include
more fonts in the repo in the future, it should be as simple as adding
the files to the default fonts folder and updating the relevant league
definitions)
- Added new docker mount for custom fonts
- Updated relevant documentation to show the new `leagues.json`
parameters and talk about font support

## Testing

<!-- Describe how you tested these changes -->

- [x] Tested locally
- [ ] Added/updated tests
- [x] Verified endpoints work as expected

**Test Details:**

tested :/league/thumb, /:league/thumb.png, /:league/cover, and
/:league/cover.png with and without the new query parameters to ensure
the old layouts are unaffected and that the new layout is activated when
either parameter is present.

## Screenshots/Examples

<!-- If applicable, add screenshots or example API calls showing the
changes -->
```
GET /f1/thumb
```
<img width="1440" height="1080" alt="image"
src="https://github.com/user-attachments/assets/f2dad72b-5261-4a3d-b242-7925a67f94f7"
/>

```
GET /f1/thumb?title=AUSTRALIAN GRAND PRIX&subtitle=Qualifying
```
<img width="1440" height="1080" alt="image"
src="https://github.com/user-attachments/assets/aa7240e8-1f98-4312-bff2-03f99963e6b3"
/>

```
GET /f1/thumb.png?title=AUSTRALIAN%20GRAND%20PRIX&subtitle=Qualifying&iconurl=https://media.formula1.com/image/upload/c_fit,h_704/q_auto/v1740000001/common/f1/2026/track/2026trackmelbournedetailed.png
```
<img width="1440" height="1080" alt="image"
src="https://github.com/user-attachments/assets/04988010-bbb1-47e7-af10-ce8c8859d5c8"
/>


```
GET /f1/cover
```
<img width="1080" height="1440" alt="image"
src="https://github.com/user-attachments/assets/2aaaeda0-c1be-4a94-8246-7c08359aabc3"
/>

```
GET /f1/cover?title=AUSTRALIAN GRAND PRIX&subtitle=Qualifying
```
<img width="1080" height="1440" alt="image"
src="https://github.com/user-attachments/assets/9bd4dc01-c621-481a-9239-e98338472663"
/>


```
GET /f1/cover.png?title=AUSTRALIAN%20GRAND%20PRIX&subtitle=Qualifying&iconurl=https://media.formula1.com/image/upload/c_fit,h_704/q_auto/v1740000001/common/f1/2026/track/2026trackmelbournedetailed.png
```
<img width="1080" height="1440" alt="image"
src="https://github.com/user-attachments/assets/97e7f7b4-bb99-486c-b269-84b15fb24987"
/>


## Checklist

- [x] My code follows the project's coding style
- [x] I have updated documentation if needed
- [x] My changes generate no new warnings or errors
- [x] I have tested my changes thoroughly

## Additional Notes

The included default fonts are both from the Saira Stencil font family.
They were acquired from Google Fonts:
https://fonts.google.com/specimen/Saira+Stencil?preview.script=Latn

The Saira Stencil font family is licensed under OFL v1.1, which grants
users authorization to use, modify and redistribute them as they please.
More information can be found on OFL's website:
https://openfontlicense.org/
<!-- Any other context or information reviewers should know -->

---------

Co-authored-by: sethwv <seth@swvn.io>
@sethwv sethwv merged commit 60ed232 into main Apr 28, 2026
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants