1
0
mirror of synced 2025-02-19 03:24:42 +01:00

116 Commits

Author SHA1 Message Date
beerpsi
58a5177a30 use SQL's limit/offset pagination for nextIndex/maxCount requests (#185)
Instead of retrieving the entire list of items/characters/scores/etc. at once (and even store them in memory), use SQL's `LIMIT ... OFFSET ...` pagination so we only take what we need.

Currently only CHUNITHM uses this, but this will also affect maimai DX and O.N.G.E.K.I. once the PR is ready.

Also snuck in a fix for CHUNITHM/maimai DX's `GetUserRivalMusicApi` to respect the `userRivalMusicLevelList` sent by the client.

### How this works

Say we have a `GetUserCharacterApi` request:

```json
{
    "userId": 10000,
    "maxCount": 700,
    "nextIndex": 0
}
```

Instead of getting the entire character list from the database (which can be very large if the user force unlocked everything), add limit/offset to the query:

```python
select(character)
.where(character.c.user == user_id)
.order_by(character.c.id.asc())
.limit(max_count + 1)
.offset(next_index)
```

The query takes `maxCount + 1` items from the database to determine if there is more items than can be returned:

```python
rows = ...

if len(rows) > max_count:
    # return only max_count rows
    next_index += max_count
else:
    # return everything left
    next_index = -1
```

This has the benefit of not needing to load everything into memory (and also having to store server state, as seen in the [`SCORE_BUFFER` list](2274b42358/titles/chuni/base.py (L13)).)

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/185
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-11-16 19:10:29 +00:00
SoulGateKey
f4dff9b4c1 fix: mai2 photos cant be merged 2024-11-11 21:16:19 +08:00
SoulGateKey
8a6250bebd Formatted log print
Change log level
2024-11-11 21:11:33 +08:00
SoulGateKey
f272e97eae Formatted log print
Change log level
2024-11-06 02:44:07 +08:00
SoulGateKey
aa7ae6cb51 Formatted log print 2024-11-06 02:38:18 +08:00
SoulGateKey
221517e310 TODO: GetUserScoreRankingApi 2024-10-30 12:37:18 +08:00
SoulGateKey
598e4aad76 Update mai2/schema/score.py to support new handle_get_game_ranking 2024-10-11 16:16:40 +00:00
SoulGateKey
a673d9dabd Delete unused dependency 2024-10-11 16:12:53 +00:00
SoulGateKey
398fa9059d Update mai2/base.py using the ORM 2024-10-11 16:09:53 +00:00
SoulGateKey
29f4a6a696 revert 033c1aa776b7874b6e534efd664f0b7010271e68
revert Update 卖
2024-10-11 16:08:15 +00:00
SoulGateKey
033c1aa776 Update 卖 2024-10-11 16:06:17 +00:00
SoulGateKey
bbf41ac83f Merge branch 'develop' into mai2_handle_get_game_ranking 2024-10-11 15:56:05 +00:00
Kevin Trocolli
0cef797a8a mai2: rework photo uploads, relates to #67 2024-10-06 03:47:10 -04:00
SoulGateKey
3843ac6eb1 mai2: calc GetGameRanking result 2024-10-03 19:32:17 +00:00
ppc
f47175a144 [mai2] add buddies plus support (#177)
Adds favorite music support (there's an option in the results screen to star a song), handlers for new methods and fixes upsert failures for `userFavoriteList`.
The `UserIntimateApi` has been added but didn't seem to add any data during testing, and `CreateTokenApi`/`RemoveTokenApi` have also been added but I think they're only used during guest play.

---
Tested on 1.45 with no errors/game crashes (see logs). Card Maker hasn't been tested as I don't have a setup to play with.

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/177
Co-authored-by: ppc <albie@ppc.moe>
Co-committed-by: ppc <albie@ppc.moe>
2024-09-23 17:21:29 +00:00
Hay1tsme
e85728f33c chuni/mai2: remove upsert from put_playlog 2024-09-20 17:10:48 -04:00
Hay1tsme
73dda06413 mai2: add warning about portrait uploading not being supported. #67 2024-09-05 11:37:52 -04:00
Hay1tsme
9b5283d389 mai2: add event editing for sysops 2024-07-01 18:26:39 -04:00
Kevin Trocolli
ecb2e9ec75 mai2: properly add present items 2024-06-28 23:55:23 -04:00
Kevin Trocolli
af8bd1d1c0 mai2: fix presents 2024-06-28 23:29:31 -04:00
Hay1tsme
4446ff1f21 mai2: add present support 2024-06-28 15:48:27 -04:00
Kevin Trocolli
e69922d91b ongeki: fix frontend versions 2024-06-09 03:14:43 -04:00
Kevin Trocolli
b4b8650acc mai2: add basic webui 2024-06-09 03:05:57 -04:00
Kevin Trocolli
e7ddfcda2e mai2: oops, forgot version 2024-06-08 22:29:49 -04:00
Kevin Trocolli
319aea098f dx: fix GetUserRivalMusicApi list index out of range 2024-06-08 22:19:59 -04:00
Kevin Trocolli
8b03f1a4f1 mai2: fix rival data load failing due to inheritance 2024-06-08 22:02:31 -04:00
Kevin Trocolli
eccbd1ad81 mai2: add rivals support 2024-06-08 21:25:48 -04:00
Kevin Trocolli
123ec99a97 mai2: fix aggressive find and replace 2024-06-08 20:55:41 -04:00
Kevin Trocolli
f94d22ab0d mai2: add tables for rivals and favorite music 2024-06-08 19:04:27 -04:00
Kevin Trocolli
efd249d808 maimai: some housekeeping 2024-06-08 17:26:51 -04:00
zaphkito
08891d0851 mai2: some improve for DX earlier version and return game code in uri (#125)
Attention: There are all talking about maimai DX and newer version, not Pre-DX

dx and newer version request these but no used, they are just exist in game code, only found `oldServerUrl` used in SDEZ 1.00, this should also fix SDGA and SDGB try to visit `ServerUrl + movieServerUrl` although that just because of SEGA shit code
tested work

![image](/attachments/f2c79134-4651-4976-8278-bbcf268f424a)

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/125
Co-authored-by: zaphkito <zaphkito@noreply.gitea.tendokyu.moe>
Co-committed-by: zaphkito <zaphkito@noreply.gitea.tendokyu.moe>
2024-05-05 05:41:14 +00:00
beerpsi
d5c80cfb0f [mai2/chuni/ongeki] Properly ignore guest plays (#132)
For all three games, guest plays are created using:
```python
0x1000000000001 | ((allnet_place_id & 65535) << 32)
```

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/132
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-04-24 17:00:01 +00:00
beerpsi
a8daa0344a [mai2] Support encryption (#130)
Similar to O.N.G.E.K.I. and CHUNITHM, with the caveat that the obfuscated endpoint is created using `md5(endpoint + salt)` instead of using PBKDF2 like other games.

Tested and confirmed working on FESTiVAL+.

The current implementation is also affected by #129, so I'm open to ideas.

Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/130
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-04-24 16:59:33 +00:00
beerpsi
d939755574 [mai2] Support maimai DX International (#118)
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/118
Co-authored-by: beerpsi <beerpsi@duck.com>
Co-committed-by: beerpsi <beerpsi@duck.com>
2024-04-07 19:12:12 +00:00
topty
0c1c24148d fix: mai2 DX reboot time from config (#120)
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/120
Co-authored-by: topty <topty@noreply.gitea.tendokyu.moe>
Co-committed-by: topty <topty@noreply.gitea.tendokyu.moe>
2024-04-07 19:11:35 +00:00
Dniel97
3613f4dbd2
mai2: BUDDiES support added 2024-03-20 21:42:38 +01:00
Kevin Trocolli
6f654f8ba9 mai2: remove redundant method (fixes #103) 2024-03-02 18:00:14 -05:00
Kevin Trocolli
3559d56ccf cm: add awaits (fixes #104) 2024-03-02 17:55:41 -05:00
Hay1tsme
05586df08a move to async database 2024-01-09 14:42:17 -05:00
Hay1tsme
edd3ce8ead move to alembic 2024-01-09 13:57:59 -05:00
Kevin Trocolli
14fa0f5e8e begin move 2024-01-09 03:07:04 -05:00
Kevin Trocolli
26cdc6c10f maidx: ignore guest upserts, fixes #74 2023-12-10 17:36:29 -05:00
Kevin Trocolli
104a483f4c maimai: fixes for finale 2023-12-02 22:30:55 -05:00
Kevin Trocolli
8c0ebbd21b mai: fix pre-dx 2023-12-02 21:01:55 -05:00
Hay1tsme
e7fb9ce07d mai2: fix get_allnet_info 2023-11-29 11:39:19 -05:00
Kevin Trocolli
ad61bb3d9b mai2: fis issue with saving and loading charges 2023-11-24 10:36:46 -05:00
Kevin Trocolli
cb8eaae2c0 Per-version URI/Host (#66)
Allows setting allnet uri/host response based on things like version, config files, and other factors to accommodate a wider range of potential setups under the same roof. This DOES require all titles to adopt a new structure but it's documented and should hopefully be somewhat intuitive.

Co-authored-by: Hay1tsme <kevin@hay1ts.me>
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/66
Co-authored-by: Kevin Trocolli <pitok236@gmail.com>
Co-committed-by: Kevin Trocolli <pitok236@gmail.com>
2023-11-09 02:17:48 +00:00
Midorica
eaa2652647 Merge pull request 'Chunithm Fixes and Maintenance for all!' (#46) from EmmyHeart/artemis:develop into develop
Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/46
2023-10-17 17:00:08 +00:00
Dniel97
862907b82a
mai2: Fixed cards not showing up 2023-10-16 21:36:26 +02:00
EmmyHeart
9cff321857 Added reboot time support 2023-10-16 13:21:07 +00:00