From 1072a9d63b52871bae1a3ae15e386c2c3f77d51d Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Tue, 2 Apr 2024 16:43:13 -0400 Subject: [PATCH 1/6] database: fix create_revision_auto --- core/data/database.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/core/data/database.py b/core/data/database.py index cb60886..bd6c4f2 100644 --- a/core/data/database.py +++ b/core/data/database.py @@ -241,6 +241,10 @@ class Data: self.logger.info("Message is required for create-revision") return + for _, mod in Utils.get_all_titles().items(): + if hasattr(mod, "database"): + mod.database(self.config) + self.__alembic_cmd( "revision", "--autogenerate", From 0c1c24148d67b7853eb51b2811386b6fdc2939d0 Mon Sep 17 00:00:00 2001 From: topty Date: Sun, 7 Apr 2024 19:11:35 +0000 Subject: [PATCH 2/6] fix: mai2 DX reboot time from config (#120) Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/120 Co-authored-by: topty Co-committed-by: topty --- titles/mai2/dx.py | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/titles/mai2/dx.py b/titles/mai2/dx.py index 837fb8f..0d3bddd 100644 --- a/titles/mai2/dx.py +++ b/titles/mai2/dx.py @@ -16,12 +16,36 @@ class Mai2DX(Mai2Base): self.version = Mai2Constants.VER_MAIMAI_DX async def handle_get_game_setting_api_request(self, data: Dict): + # if reboot start/end time is not defined use the default behavior of being a few hours ago + if self.core_config.title.reboot_start_time == "" or self.core_config.title.reboot_end_time == "": + reboot_start = datetime.strftime( + datetime.utcnow() + timedelta(hours=6), self.date_time_format + ) + reboot_end = datetime.strftime( + datetime.utcnow() + timedelta(hours=7), self.date_time_format + ) + else: + # get current datetime in JST + current_jst = datetime.now(pytz.timezone('Asia/Tokyo')).date() + + # parse config start/end times into datetime + reboot_start_time = datetime.strptime(self.core_config.title.reboot_start_time, "%H:%M") + reboot_end_time = datetime.strptime(self.core_config.title.reboot_end_time, "%H:%M") + + # offset datetimes with current date/time + reboot_start_time = reboot_start_time.replace(year=current_jst.year, month=current_jst.month, day=current_jst.day, tzinfo=pytz.timezone('Asia/Tokyo')) + reboot_end_time = reboot_end_time.replace(year=current_jst.year, month=current_jst.month, day=current_jst.day, tzinfo=pytz.timezone('Asia/Tokyo')) + + # create strings for use in gameSetting + reboot_start = reboot_start_time.strftime(self.date_time_format) + reboot_end = reboot_end_time.strftime(self.date_time_format) + return { "gameSetting": { "isMaintenance": False, "requestInterval": 1800, - "rebootStartTime": "2020-01-01 07:00:00.0", - "rebootEndTime": "2020-01-01 07:59:59.0", + "rebootStartTime": reboot_start, + "rebootEndTime": reboot_end, "movieUploadLimit": 100, "movieStatus": 1, "movieServerUri": self.old_server + "movie/", From d9397555743aad16f4c1425b325dfc6bffff4bad Mon Sep 17 00:00:00 2001 From: beerpsi Date: Sun, 7 Apr 2024 19:12:12 +0000 Subject: [PATCH 3/6] [mai2] Support maimai DX International (#118) Reviewed-on: https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/118 Co-authored-by: beerpsi Co-committed-by: beerpsi --- titles/mai2/__init__.py | 1 + titles/mai2/const.py | 1 + titles/mai2/index.py | 20 ++++++++++++++++---- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/titles/mai2/__init__.py b/titles/mai2/__init__.py index 962423b..74cfddf 100644 --- a/titles/mai2/__init__.py +++ b/titles/mai2/__init__.py @@ -15,4 +15,5 @@ game_codes = [ Mai2Constants.GAME_CODE_ORANGE, Mai2Constants.GAME_CODE_GREEN, Mai2Constants.GAME_CODE, + Mai2Constants.GAME_CODE_DX_INT, ] diff --git a/titles/mai2/const.py b/titles/mai2/const.py index 92e00e7..4dc10ce 100644 --- a/titles/mai2/const.py +++ b/titles/mai2/const.py @@ -28,6 +28,7 @@ class Mai2Constants: GAME_CODE_MILK = "SDDZ" GAME_CODE_FINALE = "SDEY" GAME_CODE_DX = "SDEZ" + GAME_CODE_DX_INT = "SDGA" CONFIG_NAME = "mai2.yaml" diff --git a/titles/mai2/index.py b/titles/mai2/index.py index df167f0..a1cd7b1 100644 --- a/titles/mai2/index.py +++ b/titles/mai2/index.py @@ -113,18 +113,23 @@ class Mai2Servlet(BaseServlet): Route("/{version:int}/MaimaiServlet/usbdl/{endpoint:str}", self.handle_usbdl), Route("/{version:int}/MaimaiServlet/deliver/{endpoint:str}", self.handle_deliver), Route("/{version:int}/MaimaiServlet/{endpoint:str}", self.handle_mai, methods=['POST']), - Route("/{version:int}/Maimai2Servlet/{endpoint:str}", self.handle_mai2, methods=['POST']), + Route("/{game:str}/{version:int}/Maimai2Servlet/{endpoint:str}", self.handle_mai2, methods=['POST']), ] - def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]: + def get_allnet_info(self, game_code: str, game_ver: int, keychip: str) -> Tuple[str, str]: + if game_code in {Mai2Constants.GAME_CODE_DX, Mai2Constants.GAME_CODE_DX_INT}: + path = f"{game_code}/{game_ver}" + else: + path = game_ver + if not self.core_cfg.server.is_using_proxy and Utils.get_title_port(self.core_cfg) != 80: return ( - f"http://{self.core_cfg.server.hostname}:{Utils.get_title_port(self.core_cfg)}/{game_ver}/", + f"http://{self.core_cfg.server.hostname}:{Utils.get_title_port(self.core_cfg)}/{path}/", f"{self.core_cfg.server.hostname}", ) return ( - f"http://{self.core_cfg.server.hostname}/{game_ver}/", + f"http://{self.core_cfg.server.hostname}/{path}/", f"{self.core_cfg.server.hostname}", ) @@ -239,6 +244,8 @@ class Mai2Servlet(BaseServlet): async def handle_mai2(self, request: Request) -> bytes: endpoint: str = request.path_params.get('endpoint') version: int = request.path_params.get('version') + game_code = request.path_params.get('game') + if endpoint.lower() == "ping": return Response(zlib.compress(b'{"returnCode": "1"}')) @@ -292,6 +299,11 @@ class Mai2Servlet(BaseServlet): self.logger.info(f"v{version} {endpoint} request from {client_ip}") self.logger.debug(req_data) + endpoint = ( + endpoint.replace("MaimaiExp", "") + if game_code == Mai2Constants.GAME_CODE_DX_INT + else endpoint + ) func_to_find = "handle_" + inflection.underscore(endpoint) + "_request" handler_cls = self.versions[internal_ver](self.core_cfg, self.game_cfg) From 8b5825bec415107101506b880c89af77526a1cf6 Mon Sep 17 00:00:00 2001 From: Midorica Date: Mon, 8 Apr 2024 09:47:56 -0400 Subject: [PATCH 4/6] fixed documentation revision for alembic changes & changelog update --- changelog.md | 9 +++++++++ docs/game_specific_info.md | 12 ++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/changelog.md b/changelog.md index 437a3b2..42c7cfe 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,15 @@ # Changelog Documenting updates to ARTEMiS, to be updated every time the master branch is pushed to. +## 20240408 +### System ++ Modified the game specific documentation + +## 20240407 +### Maimai ++ Support maimai DX International [#118](https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/118) (Thanks beerpsi!) ++ Fixed the maimai DX reboot time from config [#120](https://gitea.tendokyu.moe/Hay1tsme/artemis/pulls/120) (Thanks topty!) + ## 20240318 ### CXB + Fixing handle_data_shop_list_detail_request for Sunrise S1 diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 8b04697..30281a9 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -9,7 +9,15 @@ using the megaime database. Clean installations always create the latest databas To upgrade the core database and the database for every game, execute: ```shell -python dbutils.py autoupgrade +python dbutils.py upgrade +``` + +If you are using the old master branch that was not setup with alembic, make sure to do the following steps in order: +- Pull down latest master/develop +- Update core.yaml +- Back up your existing database +```shell +python dbutils.py migrate ``` # Table of content @@ -22,7 +30,7 @@ python dbutils.py autoupgrade - [Card Maker](#card-maker) - [WACCA](#wacca) - [Sword Art Online Arcade](#sao) - - [Initial D THE ARCADE](#initial-d-the-arcade) + - [Initial D THE ARCADE](#initial-d-the-arcade) # Supported Games From ed4031fecab638ce3086c6c9c2bbf0872a43b4d3 Mon Sep 17 00:00:00 2001 From: Hay1tsme Date: Mon, 8 Apr 2024 17:07:18 -0400 Subject: [PATCH 5/6] wacca: block unregistered serials if set --- titles/wacca/index.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/titles/wacca/index.py b/titles/wacca/index.py index 9a87d7c..97a3fd4 100644 --- a/titles/wacca/index.py +++ b/titles/wacca/index.py @@ -13,6 +13,7 @@ import traceback import sys from core import CoreConfig, Utils +from core.data import Data from core.title import BaseServlet from .config import WaccaConfig from .config import WaccaConfig @@ -33,6 +34,7 @@ class WaccaServlet(BaseServlet): self.game_cfg.update( yaml.safe_load(open(f"{cfg_dir}/{WaccaConstants.CONFIG_NAME}")) ) + self.data = Data(core_cfg) self.versions = [ WaccaBase(core_cfg, self.game_cfg), @@ -136,6 +138,15 @@ class WaccaServlet(BaseServlet): resp.status = 1 resp.message = "不正なリクエスト エラーです" return end(resp.make()) + + if not self.core_cfg.server.allow_unregistered_serials: + mech = await self.data.arcade.get_machine(req.chipId) + if not mech: + self.logger.error(f"Blocked request from unregistered serial {req.chipId} to {url_path}") + resp = BaseResponse() + resp.status = 1 + resp.message = "機械エラーです" + return end(resp.make()) ver_search = int(version_full) From 201630f1d5e4a25af5329487ee6a1ce680500758 Mon Sep 17 00:00:00 2001 From: Vanilla Date: Thu, 11 Apr 2024 17:26:14 +0800 Subject: [PATCH 6/6] chore[docs/game_specific_info.md]: Remove --game flag from dbutils.py lines. --- docs/game_specific_info.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/docs/game_specific_info.md b/docs/game_specific_info.md index 30281a9..a8e63c5 100644 --- a/docs/game_specific_info.md +++ b/docs/game_specific_info.md @@ -101,7 +101,7 @@ crypto: Always make sure your database (tables) are up-to-date: ```shell -python dbutils.py --game SDBT upgrade +python dbutils.py upgrade ``` ### Online Battle @@ -224,7 +224,7 @@ The importer for maimai Pre-DX will import Events and Music. Not all games will Always make sure your database (tables) are up-to-date: ```shell -python dbutils.py --game SDEZ upgrade +python dbutils.py upgrade ``` Pre-Dx uses the same database as DX, so only upgrade using the SDEZ game code! @@ -268,7 +268,7 @@ In order to use custom PV Lists, simply drop in your .dat files inside of /title Always make sure your database (tables) are up-to-date: ```shell -python dbutils.py --game SBZV upgrade +python dbutils.py upgrade ``` ## O.N.G.E.K.I. @@ -324,7 +324,7 @@ crypto: Always make sure your database (tables) are up-to-date: ```shell -python dbutils.py --game SDDT upgrade +python dbutils.py upgrade ``` ### Controlling Events (Ranking Event, Technical Challenge Event, Mission Event) @@ -552,7 +552,7 @@ Config file is located in `config/wacca.yaml`. Always make sure your database (tables) are up-to-date: ```shell -python dbutils.py --game SDFE upgrade +python dbutils.py upgrade ``` ### VIP Rewards @@ -625,7 +625,7 @@ Config file is located in `config/sao.yaml`. Always make sure your database (tables) are up-to-date: ```shell -python dbutils.py --game SDEW upgrade +python dbutils.py upgrade ``` ### Notes @@ -690,7 +690,7 @@ Config file is located in `config/idac.yaml`. Always make sure your database (tables) are up-to-date: ```shell -python dbutils.py --game SDGT upgrade +python dbutils.py upgrade ``` ### Notes