diff --git a/new_server_7003/api/batch.py b/new_server_7003/api/batch.py index 4baec9f..31fc408 100644 --- a/new_server_7003/api/batch.py +++ b/new_server_7003/api/batch.py @@ -19,29 +19,27 @@ async def batch_handler(request: Request): if platform not in ["Android", "iOS"]: return HTMLResponse(content="Invalid platform", status_code=400) - query = batch_tokens.select().where(batch_tokens.c.token == token) + query = batch_tokens.select().where(batch_tokens.c.batch_token == token) result = await player_database.fetch_one(query) if not result: return HTMLResponse(content="Invalid token", status_code=400) - if result['expire_at'] < int(time.time()): + if result['expire_at'] < datetime.utcnow(): return HTMLResponse(content="Token expired", status_code=400) uses_left = result['uses_left'] if uses_left > 0: uses_left -= 1 - + update_query = batch_tokens.update().where(batch_tokens.c.batch_token == token).values( + uses_left=uses_left, + updated_at=datetime.utcnow() + ) + await player_database.execute(update_query) + else: - uses_left = -1 return HTMLResponse(content="No uses left", status_code=400) - update_query = batch_tokens.update().where(batch_tokens.c.token == token).values( - uses_left=uses_left, - updated_at=datetime.utcnow() - ) - await player_database.execute(update_query) - with open(os.path.join('api/config/', 'download_manifest.json'), 'r', encoding='utf-8') as f: stage_manifest = json.load(f) diff --git a/new_server_7003/api/file.py b/new_server_7003/api/file.py index 41b1874..e34fb62 100644 --- a/new_server_7003/api/file.py +++ b/new_server_7003/api/file.py @@ -58,7 +58,7 @@ async def serve_file(request: Request): if os.path.isfile(file_path): # get size of file - if AUTHORIZATION_MODE != 0: + if AUTHORIZATION_MODE != 0 and not batch_result: file_size = os.path.getsize(file_path) await log_download(bind_result['user_id'], filename, file_size) return FileResponse(file_path) diff --git a/various-tools/Asset preloading flutter app/server_checker/README.md b/various-tools/Asset preloading flutter app/server_checker/README.md index e7875dd..c0a6da8 100644 --- a/various-tools/Asset preloading flutter app/server_checker/README.md +++ b/various-tools/Asset preloading flutter app/server_checker/README.md @@ -14,13 +14,15 @@ To use it, you need to 4) Generate a `batch_token` in the database through some means (database edit, discord bot, etc.). The schema of the table is as follows: -- id: auto generated primary key, ignore +- `id`: auto generated primary key, simply ignore -- token: The key string itself. Required field +- `batch_token`: The key string itself. Required field, String value -- expire_at: Unix timestamp integer of the expiration time. Required field. +- `expire_at`: Datetime string of when the token expires. Required field, String value (e.g. 2026-11-27 06:37:48.170791) -- sid, verification_name, verification_id: Not required in the public version. Fields for bots to link with 3rd party accounts. +- `uses_left`: Amount of uses the token can accrude before it stops working. Each time it queries the `/batch` api, this count will decrease by 1. Required field, Integer value. + +- `auth_id`, `created_at`, `updated_at`: Simply left blank for local uses. 5) Open the app and enter the server base URL and token, click download and wait! diff --git a/various-tools/Asset preloading flutter app/server_checker/pre-built/server_checker.ver.1.0.18.build.76_clone.apk b/various-tools/Asset preloading flutter app/server_checker/pre-built/7002.apk similarity index 100% rename from various-tools/Asset preloading flutter app/server_checker/pre-built/server_checker.ver.1.0.18.build.76_clone.apk rename to various-tools/Asset preloading flutter app/server_checker/pre-built/7002.apk diff --git a/various-tools/Asset preloading flutter app/server_checker/pre-built/7003.apk b/various-tools/Asset preloading flutter app/server_checker/pre-built/7003.apk new file mode 100644 index 0000000..ec5820a Binary files /dev/null and b/various-tools/Asset preloading flutter app/server_checker/pre-built/7003.apk differ diff --git a/various-tools/full unlocked save/readme.txt b/various-tools/full unlocked save/readme.txt index ec5fa1e..9fb4586 100644 --- a/various-tools/full unlocked save/readme.txt +++ b/various-tools/full unlocked save/readme.txt @@ -1,3 +1,23 @@ -This is a base64 string for the server to deliver the save data to the client (user table, data field) +This is a base64 string for the server to deliver the save data to the client. + +It unlocks all the songs and difficulties. Avatars and items are not unlocked. + +For 7002 and prior: + +Paste the B64 string into `player.db`'s `user` table. + +Find the row of your user and paste the content into the `data` field. + +Save the database. + + +For 7003: + +Open `player.db` and go to `accounts` table. Find the `id` of your account. + +Create a `save` folder at the server root directory if it is not already there. + +Create a new text file called `{YOUR_ACCOUNT_ID}.dat`, for example, `1.dat`. + +Open that file and paste the B64 string in, and save. -It unlocks all the songs and difficulties. \ No newline at end of file