Skip to content

Commit 215410f

Browse files
Merge branch 'osuAkatsuki:master' into master
2 parents 52f9f0b + eab53cf commit 215410f

File tree

10 files changed

+36
-31
lines changed

10 files changed

+36
-31
lines changed

.env.example

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,9 @@ MIRROR_DOWNLOAD_ENDPOINT=https://catboy.best/d
3535

3636
COMMAND_PREFIX=!
3737

38-
SEASONAL_BGS=https://akatsuki.pw/static/flower.png,https://i.cmyui.xyz/nrMT4V2RR3PR.jpeg
38+
SEASONAL_BGS=https://i.cmyui.xyz/T74WiQG5wVyf.jpg,https://i.cmyui.xyz/nrMT4V2RR3PR.jpeg
3939

40-
MENU_ICON_URL=https://akatsuki.pw/static/logos/logo_ingame.png
40+
MENU_ICON_URL=https://akatsuki.pw/static/images/logos/logo_ingame.png
4141
MENU_ONCLICK_URL=https://akatsuki.pw
4242

4343
DATADOG_API_KEY=

.github/workflows/docker-build.yaml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,21 +19,24 @@ jobs:
1919

2020
- name: Set up QEMU
2121
uses: docker/setup-qemu-action@v3
22+
with:
23+
platforms: linux/amd64, linux/arm64
2224

2325
- name: Set up Docker Buildx
24-
uses: docker/setup-buildx-action@v2
26+
uses: docker/setup-buildx-action@v3
2527

2628
- name: Build
2729
uses: docker/build-push-action@v5
2830
with:
2931
context: .
30-
outputs: type=docker,dest=/tmp/docker.tar
32+
platforms: linux/amd64, linux/arm64
33+
outputs: type=oci,dest=/tmp/docker.tar
3134
tags: bancho.py:${{ github.sha }}
3235
cache-from: type=gha
3336
cache-to: type=gha,mode=max
3437

3538
- name: Upload artifact
36-
uses: actions/upload-artifact@v3.1.3
39+
uses: actions/upload-artifact@v4
3740
with:
3841
name: docker
3942
path: /tmp/docker.tar
@@ -50,7 +53,7 @@ jobs:
5053
if: ${{ github.ref == 'refs/heads/master' }}
5154
with:
5255
context: .
53-
platforms: linux/amd64
56+
platforms: linux/amd64, linux/arm64
5457
push: true
5558
tags: |
5659
${{ secrets.DOCKERHUB_USERNAME }}/bancho.py:latest

.github/workflows/lint.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ jobs:
1212
runs-on: ubuntu-latest
1313
steps:
1414
- name: Checkout
15-
uses: actions/checkout@v3
15+
uses: actions/checkout@v4
1616
- name: Setup Python
17-
uses: actions/setup-python@v4
17+
uses: actions/setup-python@v5
1818
with:
1919
python-version: "3.11"
2020
cache: "pip"

.github/workflows/sync-docs.yaml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,25 +5,25 @@ on:
55
branches:
66
- master
77
paths:
8-
- '.github/docs/wiki/**'
8+
- ".github/docs/wiki/**"
99
repository_dispatch:
1010
types: [docs]
1111
gollum:
1212

1313
env:
14-
REPO_PATH: '.github/docs/wiki'
15-
WIKI_PATH: 'wiki'
16-
GIT_USERNAME: 'github-actions[bot]'
17-
GIT_EMAIL: 'github-actions@github.com'
18-
GIT_COMMIT_MESSAGE: 'docs: Bidirectional sync between docs and wiki'
14+
REPO_PATH: ".github/docs/wiki"
15+
WIKI_PATH: "wiki"
16+
GIT_USERNAME: "github-actions[bot]"
17+
GIT_EMAIL: "github-actions@github.com"
18+
GIT_COMMIT_MESSAGE: "docs: Bidirectional sync between docs and wiki"
1919

2020
jobs:
2121
sync-docs-to-wiki:
2222
if: github.repository == 'osuAkatsuki/bancho.py' && github.event_name != 'gollum'
2323
runs-on: ubuntu-latest
2424
steps:
2525
- name: Checkout repository
26-
uses: actions/checkout@v3
26+
uses: actions/checkout@v4
2727
- name: Push files into wiki repo
2828
uses: newrelic/wiki-sync-action@main
2929
with:
@@ -40,7 +40,7 @@ jobs:
4040
runs-on: ubuntu-latest
4141
steps:
4242
- name: Checkout repository
43-
uses: actions/checkout@v3
43+
uses: actions/checkout@v4
4444
with:
4545
token: ${{ secrets.GITHUB_TOKEN }}
4646
ref: master

.github/workflows/test.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,23 @@ jobs:
5252
runs-on: ubuntu-latest
5353
steps:
5454
- name: Checkout repository
55-
uses: actions/checkout@v3
55+
uses: actions/checkout@v4
5656

5757
- name: Build application image
5858
run: docker build -t bancho:latest .
5959

6060
- name: Start containers
61-
run: docker-compose -f docker-compose.test.yml up -d bancho-test mysql-test redis-test
61+
run: docker compose -f docker-compose.test.yml up --detach --wait --wait-timeout 30 bancho-test mysql-test redis-test
6262

6363
- name: Run tests
64-
run: docker-compose -f docker-compose.test.yml exec -T bancho-test /srv/root/scripts/run-tests.sh
64+
run: docker compose -f docker-compose.test.yml exec -T bancho-test /srv/root/scripts/run-tests.sh
6565

6666
- name: Stop containers
6767
if: always()
6868
run: docker-compose down
6969

7070
- name: Archive code coverage results
71-
uses: actions/upload-artifact@v2
71+
uses: actions/upload-artifact@v4
7272
with:
7373
name: code-coverage-report
7474
path: coverage/

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# See https://pre-commit.com/hooks.html for more hooks
33
repos:
44
- repo: https://github.com/pre-commit/pre-commit-hooks
5-
rev: v4.5.0
5+
rev: v4.6.0
66
hooks:
77
- id: check-added-large-files
88
- id: check-ast
@@ -12,11 +12,11 @@ repos:
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414
- repo: https://github.com/psf/black
15-
rev: 24.2.0
15+
rev: 24.4.0
1616
hooks:
1717
- id: black
1818
- repo: https://github.com/asottile/pyupgrade
19-
rev: v3.15.1
19+
rev: v3.15.2
2020
hooks:
2121
- id: pyupgrade
2222
args: [--py311-plus, --keep-runtime-typing]

app/api/domains/osu.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,15 +454,19 @@ async def osuSearchSetHandler(
454454
player: Player = Depends(authenticate_player_session(Query, "u", "h")),
455455
map_set_id: int | None = Query(None, alias="s"),
456456
map_id: int | None = Query(None, alias="b"),
457+
checksum: str | None = Query(None, alias="c"),
457458
) -> Response:
458459
# Since we only need set-specific data, we can basically
459460
# just do same query with either bid or bsid.
460461

462+
v: int | str
461463
if map_set_id is not None:
462464
# this is just a normal request
463465
k, v = ("set_id", map_set_id)
464466
elif map_id is not None:
465467
k, v = ("id", map_id)
468+
elif checksum is not None:
469+
k, v = ("md5", checksum)
466470
else:
467471
return Response(b"") # invalid args
468472

app/api/v1/api.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -755,13 +755,11 @@ async def api_get_map_scores(
755755
else:
756756
mods = None
757757

758-
# NOTE: userid will eventually become player_id,
759-
# along with everywhere else in the codebase.
760758
query = [
761759
"SELECT s.map_md5, s.score, s.pp, s.acc, s.max_combo, s.mods, "
762760
"s.n300, s.n100, s.n50, s.nmiss, s.ngeki, s.nkatu, s.grade, s.status, "
763761
"s.mode, s.play_time, s.time_elapsed, s.userid, s.perfect, "
764-
"u.name player_name, "
762+
"u.name player_name, u.country player_country, "
765763
"c.id clan_id, c.name clan_name, c.tag clan_tag "
766764
"FROM scores s "
767765
"INNER JOIN users u ON u.id = s.userid "

app/repositories/users.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ async def fetch_count(
155155
play_style: int | None = None,
156156
) -> int:
157157
"""Fetch the number of users in the database."""
158-
select_stmt = select(func.count().label("count"))
158+
select_stmt = select(func.count().label("count")).select_from(UsersTable)
159159
if priv is not None:
160160
select_stmt = select_stmt.where(UsersTable.priv == priv)
161161
if country is not None:

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)