From dcca449235e2b9294b30aa09af527234991d2d35 Mon Sep 17 00:00:00 2001 From: KimigaiiWuyi <444835641@qq.com> Date: Sun, 3 Sep 2023 15:46:46 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D`=E7=BB=91?= =?UTF-8?q?=E5=AE=9Auid`=E5=8F=AF=E4=BB=A5=E4=B8=BA=E7=A9=BA=E7=9A=84BUG?= =?UTF-8?q?=20(KimigaiiWuyi/GenshinUID#579)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- gsuid_core/help/draw_plugin_help.py | 18 ++++++++++-------- gsuid_core/utils/database/dal.py | 2 ++ poetry.lock | 14 +++++++------- requirements.txt | 4 ++-- 4 files changed, 21 insertions(+), 17 deletions(-) diff --git a/gsuid_core/help/draw_plugin_help.py b/gsuid_core/help/draw_plugin_help.py index e8b8714..1d29529 100644 --- a/gsuid_core/help/draw_plugin_help.py +++ b/gsuid_core/help/draw_plugin_help.py @@ -67,10 +67,11 @@ async def get_help( is_icon: bool = True, ICON_PATH: Optional[Path] = None, extra_message: Optional[List[str]] = None, + enable_cache: bool = True, ) -> bytes: help_path = get_res_path('help') / f'{name}.jpg' - if help_path.exists() and name in cache and cache[name]: + if help_path.exists() and name in cache and cache[name] and enable_cache: return await convert_img(Image.open(help_path)) if sub_color is None and is_dark: @@ -194,12 +195,13 @@ async def get_help( img = img.convert('RGB') help_path = get_res_path('help') / f'{name}.jpg' - img.save( - help_path, - 'JPEG', - quality=89, - subsampling=0, - ) - cache[name] = 1 + if enable_cache: + img.save( + help_path, + 'JPEG', + quality=89, + subsampling=0, + ) + cache[name] = 1 return await convert_img(img) diff --git a/gsuid_core/utils/database/dal.py b/gsuid_core/utils/database/dal.py index e1a7725..0102f73 100644 --- a/gsuid_core/utils/database/dal.py +++ b/gsuid_core/utils/database/dal.py @@ -61,6 +61,8 @@ class SQLA: new_uid = new_uid.strip() new_sr_uid: str = data['sr_uid'] if 'sr_uid' in data else '' new_sr_uid = new_sr_uid.strip() + if not new_sr_uid and not new_uid: + return -3 if new_uid: retcode = await GsBind.insert_uid( user_id, self.bot_id, new_uid, group_id, 9, True diff --git a/poetry.lock b/poetry.lock index 1326a90..cc8feb6 100644 --- a/poetry.lock +++ b/poetry.lock @@ -941,13 +941,13 @@ reference = "mirrors" [[package]] name = "gitpython" -version = "3.1.32" +version = "3.1.34" description = "GitPython is a Python library used to interact with Git repositories" optional = false python-versions = ">=3.7" files = [ - {file = "GitPython-3.1.32-py3-none-any.whl", hash = "sha256:e3d59b1c2c6ebb9dfa7a184daf3b6dd4914237e7488a1730a6d8f6f5d0b4187f"}, - {file = "GitPython-3.1.32.tar.gz", hash = "sha256:8d9b8cb1e80b9735e8717c9362079d3ce4c6e5ddeebedd0361b228c3a67a62f6"}, + {file = "GitPython-3.1.34-py3-none-any.whl", hash = "sha256:5d3802b98a3bae1c2b8ae0e1ff2e4aa16bcdf02c145da34d092324f599f01395"}, + {file = "GitPython-3.1.34.tar.gz", hash = "sha256:85f7d365d1f6bf677ae51039c1ef67ca59091c7ebd5a3509aa399d4eda02d6dd"}, ] [package.dependencies] @@ -2098,13 +2098,13 @@ reference = "mirrors" [[package]] name = "soupsieve" -version = "2.4.1" +version = "2.5" description = "A modern CSS selector implementation for Beautiful Soup." optional = false -python-versions = ">=3.7" +python-versions = ">=3.8" files = [ - {file = "soupsieve-2.4.1-py3-none-any.whl", hash = "sha256:1c1bfee6819544a3447586c889157365a27e10d88cde3ad3da0cf0ddf646feb8"}, - {file = "soupsieve-2.4.1.tar.gz", hash = "sha256:89d12b2d5dfcd2c9e8c22326da9d9aa9cb3dfab0a83a024f05704076ee8d35ea"}, + {file = "soupsieve-2.5-py3-none-any.whl", hash = "sha256:eaa337ff55a1579b6549dc679565eac1e3d000563bcb1c8ab0d0fefbc0c2cdc7"}, + {file = "soupsieve-2.5.tar.gz", hash = "sha256:5663d5a7b3bfaeee0bc4372e7fc48f9cff4940b3eec54a6451cc5299f1097690"}, ] [package.source] diff --git a/requirements.txt b/requirements.txt index 2f41983..7a001b1 100644 --- a/requirements.txt +++ b/requirements.txt @@ -24,7 +24,7 @@ fastapi-user-auth==0.5.0 ; python_full_version >= "3.8.1" and python_full_versio fastapi==0.97.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" frozenlist==1.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" gitdb==4.0.10 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" -gitpython==3.1.32 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" +gitpython==3.1.34 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" greenlet==2.0.2 ; python_full_version >= "3.8.1" and (platform_machine == "win32" or platform_machine == "WIN32" or platform_machine == "AMD64" or platform_machine == "amd64" or platform_machine == "x86_64" or platform_machine == "ppc64le" or platform_machine == "aarch64") and python_full_version < "4.0.0" h11==0.14.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" httpcore==0.17.3 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" @@ -48,7 +48,7 @@ six==1.16.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" smmap==5.0.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" sniffio==1.3.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" sortedcontainers==2.4.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" -soupsieve==2.4.1 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" +soupsieve==2.5 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" sqlalchemy-database==0.1.0 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" sqlalchemy2-stubs==0.0.2a35 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0" sqlalchemy==1.4.41 ; python_full_version >= "3.8.1" and python_full_version < "4.0.0"