Skip to content

Commit

Permalink
2025-01-26T0447Z
Browse files Browse the repository at this point in the history
  • Loading branch information
Windows81 committed Jan 26, 2025
1 parent ae7cba7 commit 7729c31
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Examples
Submodule Examples updated 141 files
4 changes: 2 additions & 2 deletions Source/assets/serialisers/mesh/rbxmesh.py
Original file line number Diff line number Diff line change
Expand Up @@ -836,8 +836,8 @@ def read_mesh_v3(data: bytes, offset: int) -> FileMeshData:

if offset != len(data):
raise Exception(
"read_mesh_v3: unexpected data at end of file (%d bytes)"
% (len(data) - offset)
"read_mesh_v3: unexpected data at end of file (%d bytes)" %
(len(data) - offset)
)

debug_print(
Expand Down
15 changes: 6 additions & 9 deletions Source/config_type/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,15 @@ def _type_call_dicter(value: list, data: type_call_data) -> Any:
return data.typ(item_list)


def _type_call_with_config(
value,
data: type_call_data,
*args,
**kwargs) -> Any:
def _type_call_with_config(value, data: type_call_data, *args, **kwargs) -> Any:
return data.typ(value, data.config, *args, **kwargs)


def _type_call_path_str(value, data: type_call_data, *args, **kwargs) -> Any:
return data.typ(value, data.config.base_dir, *args, **kwargs)


def _type_call_rōblox_version(
value,
data: type_call_data) -> util.versions.rōblox:
def _type_call_rōblox_version(value, data: type_call_data) -> util.versions.rōblox:
return util.versions.rōblox.from_name(value)


Expand Down Expand Up @@ -93,7 +87,10 @@ def _type_call_dataclass_as_dict(value, data: type_call_data) -> Callable:
should be written as Python `dict` objects in the config file.
This snippet is responsible for casting the `dict` to a `dataclass`.
'''
fields = getattr(data.typ, dataclasses._FIELDS) # type: ignore
fields = getattr(
data.typ,
dataclasses._FIELDS, # type: ignore[reportAttributeAccessIssue]
)
casted_values = {
field_name: get_type_call(field.type)(
value.get(field_name, field.default),
Expand Down
1 change: 0 additions & 1 deletion Source/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
pyOpenSSL==24.0.0
trustme==1.2.0
certifi==2024.8.30
urllib3==2.2.3
Expand Down
4 changes: 2 additions & 2 deletions Source/storage/persistence.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ def query_sorted_data(
params: list[Any] = [scope, key]

int_casted_skeleton = (
"CAST(JSON_EXTRACT(%s, '$') AS INTEGER)"
% (self.field.VALUE.value,)
"CAST(JSON_EXTRACT(%s, '$') AS INTEGER)" %
(self.field.VALUE.value,)
)

value_bound_suffix = ''
Expand Down
6 changes: 5 additions & 1 deletion Source/util/versions.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import typing
import functools
import typing
import enum


Expand Down Expand Up @@ -29,6 +29,10 @@ def from_name(value: int | str) -> "rōblox":
def __lt__(self, other: typing.Self) -> bool:
return self.get_number() < other.get_number()

@classmethod
def get_all_versions(cls) -> set[typing.Self]:
return set(cls)


FIRST_VERSION = min(rōblox)
LAST_VERSION = max(rōblox)
Expand Down
25 changes: 16 additions & 9 deletions Source/web_server/_logic.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
from cryptography.hazmat.backends import default_backend
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import serialization
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.asymmetric import padding

import util.versions as versions
from typing import Callable
import util.const as const
Expand All @@ -10,6 +16,7 @@
import mimetypes
import functools
import util.ssl
import hashlib
import logger
import base64
import socket
Expand Down Expand Up @@ -46,13 +53,15 @@ class server_func_key:


SERVER_FUNCS = dict[server_func_key, Callable]()
DEFAULT_COMMANDS = {'POST', 'GET'}
ALL_VERSIONS = set(versions.rōblox)


def server_path(
path: str,
regex: bool = False,
versions: set[versions.rōblox] = set(versions.rōblox),
commands: set[str] = {'POST', 'GET'}
versions: set[versions.rōblox] = ALL_VERSIONS,
commands: set[str] = DEFAULT_COMMANDS
):
def inner(func):
dict_mode = (
Expand All @@ -77,16 +86,14 @@ def inner(func):


def rbx_sign(data: bytes, key: bytes, prefix: bytes = b'--rbxsig') -> bytes:
import OpenSSL.crypto
data = b'\r\n' + data
key = b"-----BEGIN RSA PRIVATE KEY-----\n%s\n-----END RSA PRIVATE KEY-----" % key
signature = OpenSSL.crypto.sign(
OpenSSL.crypto.load_privatekey(
OpenSSL.crypto.FILETYPE_PEM,
key,
),
private_key = serialization.load_pem_private_key(
key, None, default_backend())
signature = private_key.sign( # type: ignore[reportAttributeAccessIssue]
data,
'sha1',
padding.PKCS1v15(), # type: ignore[reportCallIssue]
hashes.SHA1(), # type: ignore[reportCallIssue]
)
return prefix + b"%" + base64.b64encode(signature) + b'%' + data

Expand Down

0 comments on commit 7729c31

Please sign in to comment.