forked from Hay1tsme/artemis
chuni: fix frontend 500 if no profile is available
This commit is contained in:
@ -919,6 +919,8 @@ class FE_System(FE_Base):
|
||||
serial = serial_dash.replace("-", "")
|
||||
|
||||
cab_id = await self.data.arcade.create_machine(int(shopid), serial, None, game_code if game_code else None)
|
||||
if cab_id is None:
|
||||
return RedirectResponse("/sys/?e=4", 303)
|
||||
|
||||
return Response(template.render(
|
||||
title=f"{self.core_config.server.name} | System",
|
||||
|
@ -1,4 +1,4 @@
|
||||
from typing import List
|
||||
from typing import List, Tuple, Dict
|
||||
from starlette.routing import Route, Mount
|
||||
from starlette.requests import Request
|
||||
from starlette.responses import Response, RedirectResponse
|
||||
@ -123,7 +123,7 @@ class ChuniFrontend(FE_Base):
|
||||
|
||||
if usr_sesh.user_id > 0:
|
||||
versions = await self.data.profile.get_all_profile_versions(usr_sesh.user_id)
|
||||
profile = []
|
||||
profile = None
|
||||
if versions:
|
||||
# chunithm_version is -1 means it is not initialized yet, select a default version from existing.
|
||||
if usr_sesh.chunithm_version < 0:
|
||||
@ -350,7 +350,9 @@ class ChuniFrontend(FE_Base):
|
||||
else:
|
||||
return RedirectResponse("/gate/", 303)
|
||||
|
||||
async def get_available_map_icons(self, version: int, profile: Row) -> (List[dict], int):
|
||||
async def get_available_map_icons(self, version: int, profile: Row) -> Tuple[List[Dict], int]:
|
||||
if profile is None:
|
||||
return ([], 0)
|
||||
items = dict()
|
||||
rows = await self.data.static.get_map_icons(version)
|
||||
if rows is None:
|
||||
@ -373,7 +375,9 @@ class ChuniFrontend(FE_Base):
|
||||
|
||||
return (items, len(rows))
|
||||
|
||||
async def get_available_system_voices(self, version: int, profile: Row) -> (List[dict], int):
|
||||
async def get_available_system_voices(self, version: int, profile: Row) -> Tuple[List[Dict], int]:
|
||||
if profile is None:
|
||||
return ([], 0)
|
||||
items = dict()
|
||||
rows = await self.data.static.get_system_voices(version)
|
||||
if rows is None:
|
||||
@ -396,7 +400,7 @@ class ChuniFrontend(FE_Base):
|
||||
|
||||
return (items, len(rows))
|
||||
|
||||
async def get_available_nameplates(self, version: int, profile: Row) -> (List[dict], int):
|
||||
async def get_available_nameplates(self, version: int, profile: Row) -> Tuple[List[Dict], int]:
|
||||
items = dict()
|
||||
rows = await self.data.static.get_nameplates(version)
|
||||
if rows is None:
|
||||
@ -419,7 +423,7 @@ class ChuniFrontend(FE_Base):
|
||||
|
||||
return (items, len(rows))
|
||||
|
||||
async def get_available_trophies(self, version: int, profile: Row) -> (List[dict], int):
|
||||
async def get_available_trophies(self, version: int, profile: Row) -> Tuple[List[Dict], int]:
|
||||
items = dict()
|
||||
rows = await self.data.static.get_trophies(version)
|
||||
if rows is None:
|
||||
@ -442,7 +446,7 @@ class ChuniFrontend(FE_Base):
|
||||
|
||||
return (items, len(rows))
|
||||
|
||||
async def get_available_characters(self, version: int, profile: Row) -> (List[dict], int):
|
||||
async def get_available_characters(self, version: int, profile: Row) -> Tuple[List[Dict], int]:
|
||||
items = dict()
|
||||
rows = await self.data.static.get_characters(version)
|
||||
if rows is None:
|
||||
@ -465,7 +469,7 @@ class ChuniFrontend(FE_Base):
|
||||
|
||||
return (items, len(rows))
|
||||
|
||||
async def get_available_avatar_items(self, version: int, category: AvatarCategory, user_unlocked_items: List[int]) -> (List[dict], int):
|
||||
async def get_available_avatar_items(self, version: int, category: AvatarCategory, user_unlocked_items: List[int]) -> Tuple[List[Dict], int]:
|
||||
items = dict()
|
||||
rows = await self.data.static.get_avatar_items(version, category.value)
|
||||
if rows is None:
|
||||
|
Reference in New Issue
Block a user