osuTitanic / deck

Client API server for osu! stable clients
MIT License
4 stars 3 forks source link

Add support for modern beatmap submission requests #322

Open ThaNightHawk opened 2 months ago

ThaNightHawk commented 2 months ago

Hi there!

I stumpled upon the Titanic project a few days ago, and decided to set up an instance myself to play around with. I ended up trying to upload/submit a beatmap from in-game, but it errors out with "no" being the reponse I get, when trying to upload.

I've followed the setup-instructions in osuTitanic/titanic, but end up with this error when being hit with the "no" response while uploading:

[2024-09-12 03:24:19,135] - <storage> ERROR: Failed to file "osz2/1000000005": "[Errno 2] No such file or directory: '/deck/.data/osz2/1000000005'"
[2024-09-12 03:24:19,135] - <storage> ERROR: Failed to file "osz/1000000005": "[Errno 2] No such file or directory: '/deck/.data/osz/1000000005'"
[2024-09-12 03:24:19,135] - <storage> ERROR: Failed to file "thumbnails/1000000005": "[Errno 2] No such file or directory: '/deck/.data/thumbnails/1000000005'"
[2024-09-12 03:24:19,136] - <storage> ERROR: Failed to file "audio/1000000005": "[Errno 2] No such file or directory: '/deck/.data/audio/1000000005'"
[2024-09-12 03:24:19,163] - <storage> ERROR: Failed to file "beatmaps/1000000009": "[Errno 2] No such file or directory: '/deck/.data/beatmaps/1000000009'"
[2024-09-12 03:24:19,164] - <storage> ERROR: Failed to file "beatmaps/1000000010": "[Errno 2] No such file or directory: '/deck/.data/beatmaps/1000000010'"
[2024-09-12 03:24:19,248] - <deck> INFO: Created new beatmapset (1000000006) for user Hawk
[2024-09-12 03:24:19,249] - <uvicorn.access> INFO: 172.24.0.10:47536 - "GET /web/osu-osz2-bmsubmit-getid.php?u=Hawk&h=7ef36e0bcb20a328ce46705b4eb6eb46&s=1000000005&b=1000000009,1000000010&z=&vv=2 HTTP/1.0" 200
[2024-09-12 03:24:21,064] - <deck> WARNING: Failed to fetch beatmapset topic: Topic not found
[2024-09-12 03:24:21,065] - <uvicorn.access> INFO: 172.24.0.10:47542 - "GET /web/osu-get-beatmap-topic.php?u=Hawk&h=7ef36e0bcb20a328ce46705b4eb6eb46&s=1000000006&vv=2 HTTP/1.0" 200
[2024-09-12 03:24:22,510] - <deck> ERROR: Validation error: [{'type': 'missing', 'loc': ('query', 'z'), 'msg': 'Field required', 'input': None}, {'type': 'missing', 'loc': ('query', 'u'), 'msg': 'Field required', 'input': None}, {'type': 'missing', 'loc': ('query', 'h'), 'msg': 'Field required', 'input': None}, {'type': 'missing', 'loc': ('query', 's'), 'msg': 'Field required', 'input': None}, {'type': 'missing', 'loc': ('body', '0'), 'msg': 'Field required', 'input': None}]
[2024-09-12 03:24:22,511] - <uvicorn.access> INFO: 172.24.0.10:49836 - "POST /web/osu-osz2-bmsubmit-upload.php HTTP/1.0" 500
[2024-09-12 03:24:22,511] - <uvicorn.error> ERROR: Exception in ASGI application
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 73, in app
    response = await f(request)
               ^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/routing.py", line 346, in app
    raise validation_error
fastapi.exceptions.RequestValidationError: [{'type': 'missing', 'loc': ('query', 'z'), 'msg': 'Field required', 'input': None}, {'type': 'missing', 'loc': ('query', 'u'), 'msg': 'Field required', 'input': None}, {'type': 'missing', 'loc': ('query', 'h'), 'msg': 'Field required', 'input': None}, {'type': 'missing', 'loc': ('query', 's'), 'msg': 'Field required', 'input': None}, {'type': 'missing', 'loc': ('body', '0'), 'msg': 'Field required', 'input': None}]

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/uvicorn/protocols/http/h11_impl.py", line 406, in run_asgi
    result = await app(  # type: ignore[func-returns-value]
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/uvicorn/middleware/proxy_headers.py", line 70, in __call__
    return await self.app(scope, receive, send)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/fastapi/applications.py", line 1054, in __call__
    await super().__call__(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/applications.py", line 113, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 187, in __call__
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/errors.py", line 165, in __call__
    await self.app(scope, receive, _send)
  File "/usr/local/lib/python3.11/site-packages/starlette/middleware/exceptions.py", line 62, in __call__
    await wrap_app_handling_exceptions(self.app, conn)(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 62, in wrapped_app
    raise exc
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 51, in wrapped_app
    await app(scope, receive, sender)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 715, in __call__
    await self.middleware_stack(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 735, in app
    await route.handle(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 288, in handle
    await self.app(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/routing.py", line 76, in app
    await wrap_app_handling_exceptions(app, request)(scope, receive, send)
  File "/usr/local/lib/python3.11/site-packages/starlette/_exception_handler.py", line 75, in wrapped_app
    response = await run_in_threadpool(handler, conn, exc)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 2177, in run_sync_in_worker_thread
    return await future
           ^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/anyio/_backends/_asyncio.py", line 859, in run
    result = context.run(func, *args)
             ^^^^^^^^^^^^^^^^^^^^^^^^
  File "/deck/app/__init__.py", line 68, in validation_error
    return Response(
           ^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/responses.py", line 41, in __init__
    self.body = self.render(content)
                ^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/starlette/responses.py", line 49, in render
    return content.encode(self.charset)  # type: ignore
           ^^^^^^^^^^^^^^
AttributeError: 'dict' object has no attribute 'encode'

I'm not sure what info to provide here, and if you'd even want provide help 😛 In case you do want to try and help out, let me know what you'd need from me, to narrow down the potential issues.

Lekuruu commented 2 months ago

I think this may be, because we don't support all varieties of beatmap submission requests. What client are you using?

ascenttree commented 2 months ago

this looks like a modern client, using form instead of query titanic doesn't support that yet afaik so that's probably the error you're getting

ThaNightHawk commented 1 month ago

I think this may be, because we don't support all varieties of beatmap submission requests. What client are you using?

Latest stable version ^^

this looks like a modern client, using form instead of query titanic doesn't support that yet afaik so that's probably the error you're getting

I am indeed on the latest client version. You wouldn't happen to know, when it got changed from query to form?

Lekuruu commented 1 month ago

You wouldn't happen to know, when it got changed from query to form?

I don't know exactly when it was changed, but any ~2013-2015 client should work fine. I will try to make an implementation for modern stable clients soon.