Skip to content

Commit

Permalink
Thumbnail fix (#20)
Browse files Browse the repository at this point in the history
* do not use current chrome driver to maintain template compatibility

* add few env cases for easier local development
  • Loading branch information
lenforiee authored Dec 24, 2024
1 parent 001b5de commit a1b05a1
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ APP_COMPONENT=bot
APP_PERFORMANCE_URL=https://performance.akatsuki.gg
APP_API_URL=https://akatsuki.gg/api
APP_SCORE_SERVICE_URL=https://akatsuki.gg/web
APP_BEATMAPS_SERVICE_URL=https://beatmaps.akatsuki.gg

DISCORD_TOKEN=

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -134,3 +134,4 @@ thumbnail-data/
.vscode
pgdata/
data/
tmp/
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ FROM python:3.11

ENV PYTHONUNBUFFERED=1

RUN wget https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
RUN wget http://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_127.0.6533.72-1_amd64.deb
RUN apt update && \
apt install ./google-chrome-stable_current_amd64.deb -y && \
rm google-chrome-stable_current_amd64.deb
apt install ./google-chrome-stable_127.0.6533.72-1_amd64.deb -y && \
rm google-chrome-stable_127.0.6533.72-1_amd64.deb

COPY requirements.txt .
RUN pip install -U pip setuptools
Expand Down
2 changes: 2 additions & 0 deletions app/osu_beatmaps.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ async def get_osu_file_contents(beatmap_id: int) -> bytes | None:
response = await beatmaps_service_http_client.get(
f"/api/osu-api/v1/osu-files/{beatmap_id}",
)

if response.status_code == 404:
return None
response.raise_for_status()
Expand Down Expand Up @@ -61,6 +62,7 @@ async def get_beatmap_background_image_contents(beatmap_id: int) -> bytes | None
response = await beatmaps_service_http_client.get(
f"/api/osu-assets/backgrounds/{beatmap_id}",
)

if response.status_code == 404:
logging.warning(
"Failed to retrieve beatmap background image from beatmaps-service",
Expand Down
1 change: 1 addition & 0 deletions app/usecases/scorewatch.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,7 @@ async def generate_score_upload_resources(
thumbnail_image_data = state.webdriver.capture_html_as_jpeg_image(template)

user_id = score_data["user"]["id"]

await aws_s3.save_object_data(
f"/scorewatch/thumbnails/{beatmap_id}_{user_id}_score.jpg",
thumbnail_image_data,
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ services:
- VAULT_ADDR=${VAULT_ADDR}
- VAULT_TOKEN=${VAULT_TOKEN}
- DISCORD_TOKEN=${DISCORD_TOKEN}
- SELENIUM_DRIVER_URL=${SELENIUM_DRIVER_URL}
- READ_DB_SCHEME=${READ_DB_SCHEME}
- READ_DB_HOST=${READ_DB_HOST}
- READ_DB_PORT=${READ_DB_PORT}
Expand Down

0 comments on commit a1b05a1

Please sign in to comment.