mirror of
https://github.com/imayushsaini/Bombsquad-Ballistica-Modded-Server.git
synced 2026-08-15 13:04:30 +00:00
updating ba, bastd
This commit is contained in:
parent
c2ddced5cf
commit
3c43b5661b
169 changed files with 13214 additions and 4232 deletions
103
dist/ba_data/python/bacommon/cloud.py
vendored
Normal file
103
dist/ba_data/python/bacommon/cloud.py
vendored
Normal file
|
|
@ -0,0 +1,103 @@
|
|||
# Released under the MIT License. See LICENSE for details.
|
||||
#
|
||||
"""Functionality related to cloud functionality."""
|
||||
|
||||
from __future__ import annotations
|
||||
from dataclasses import dataclass
|
||||
from typing import TYPE_CHECKING, Annotated, Optional
|
||||
from enum import Enum
|
||||
|
||||
from efro.message import Message, Response
|
||||
from efro.dataclassio import ioprepped, IOAttrs
|
||||
|
||||
if TYPE_CHECKING:
|
||||
pass
|
||||
|
||||
|
||||
@ioprepped
|
||||
@dataclass
|
||||
class LoginProxyRequestMessage(Message):
|
||||
"""Request send to the cloud to ask for a login-proxy."""
|
||||
|
||||
@classmethod
|
||||
def get_response_types(cls) -> list[type[Response]]:
|
||||
return [LoginProxyRequestResponse]
|
||||
|
||||
|
||||
@ioprepped
|
||||
@dataclass
|
||||
class LoginProxyRequestResponse(Response):
|
||||
"""Response to a request for a login proxy."""
|
||||
|
||||
# URL to direct the user to for login.
|
||||
url: Annotated[str, IOAttrs('u')]
|
||||
|
||||
# Proxy-Login id for querying results.
|
||||
proxyid: Annotated[str, IOAttrs('p')]
|
||||
|
||||
# Proxy-Login key for querying results.
|
||||
proxykey: Annotated[str, IOAttrs('k')]
|
||||
|
||||
|
||||
@ioprepped
|
||||
@dataclass
|
||||
class LoginProxyStateQueryMessage(Message):
|
||||
"""Soo.. how is that login proxy going?"""
|
||||
proxyid: Annotated[str, IOAttrs('p')]
|
||||
proxykey: Annotated[str, IOAttrs('k')]
|
||||
|
||||
@classmethod
|
||||
def get_response_types(cls) -> list[type[Response]]:
|
||||
return [LoginProxyStateQueryResponse]
|
||||
|
||||
|
||||
@ioprepped
|
||||
@dataclass
|
||||
class LoginProxyStateQueryResponse(Response):
|
||||
"""Here's the info on that login-proxy you asked about, boss."""
|
||||
|
||||
class State(Enum):
|
||||
"""States a login-proxy can be in."""
|
||||
WAITING = 'waiting'
|
||||
SUCCESS = 'success'
|
||||
FAIL = 'fail'
|
||||
|
||||
state: Annotated[State, IOAttrs('s')]
|
||||
|
||||
# On success, these will be filled out.
|
||||
credentials: Annotated[Optional[str], IOAttrs('tk')]
|
||||
|
||||
|
||||
@ioprepped
|
||||
@dataclass
|
||||
class LoginProxyCompleteMessage(Message):
|
||||
"""Just so you know, we're done with this proxy."""
|
||||
proxyid: Annotated[str, IOAttrs('p')]
|
||||
|
||||
|
||||
@ioprepped
|
||||
@dataclass
|
||||
class AccountSessionReleaseMessage(Message):
|
||||
"""We're done using this particular session."""
|
||||
token: Annotated[str, IOAttrs('tk')]
|
||||
|
||||
|
||||
@ioprepped
|
||||
@dataclass
|
||||
class CredentialsCheckMessage(Message):
|
||||
"""Are our current credentials valid?"""
|
||||
|
||||
@classmethod
|
||||
def get_response_types(cls) -> list[type[Response]]:
|
||||
return [CredentialsCheckResponse]
|
||||
|
||||
|
||||
@ioprepped
|
||||
@dataclass
|
||||
class CredentialsCheckResponse(Response):
|
||||
"""Info returned when checking credentials."""
|
||||
|
||||
verified: Annotated[bool, IOAttrs('v')]
|
||||
|
||||
# Current account tag (good time to check if it has changed).
|
||||
tag: Annotated[str, IOAttrs('t')]
|
||||
Loading…
Add table
Add a link
Reference in a new issue