From 42451f2cb0a519b57a5286a6bb40cb553a2a25d6 Mon Sep 17 00:00:00 2001 From: isummer Date: Fri, 11 Nov 2022 20:35:23 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=B6=85=E7=BA=A7=E7=AD=BE?= =?UTF-8?q?=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98=20=E4=BF=AE=E5=A4=8Ddocker?= =?UTF-8?q?=E4=B8=8B=E8=B6=85=E7=BA=A7=E7=AD=BE=E5=90=8Dzip=20unzip?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E4=B8=8D=E5=AD=98=E5=9C=A8=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=BA=94=E7=94=A8=E4=B8=93=E5=B1=9E=E5=9F=9F=E5=90=8D?= =?UTF-8?q?=E5=88=A0=E9=99=A4=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- fir_ser/Dockerfile | 2 +- .../management/commands/services/services/base.py | 15 +++++++++++---- fir_ser/api/views/domain.py | 2 +- fir_ser/xsign/views/receiveudids.py | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/fir_ser/Dockerfile b/fir_ser/Dockerfile index 44244d3..0ce3217 100644 --- a/fir_ser/Dockerfile +++ b/fir_ser/Dockerfile @@ -5,7 +5,7 @@ FROM python:3.9.14-slim RUN sed -i 's/deb.debian.org/mirrors.163.com/g' /etc/apt/sources.list \ && sed -i 's/security.debian.org/mirrors.163.com/g' /etc/apt/sources.list \ && apt update \ - && apt-get install g++ wget -y \ + && apt-get install g++ wget zip unzip -y \ && apt-get install libssl-dev openssl libmariadb-dev -y \ && apt-get clean \ && rm -rf /var/lib/apt/lists/* diff --git a/fir_ser/api/management/commands/services/services/base.py b/fir_ser/api/management/commands/services/services/base.py index 269254d..f2d2724 100644 --- a/fir_ser/api/management/commands/services/services/base.py +++ b/fir_ser/api/management/commands/services/services/base.py @@ -20,6 +20,15 @@ def get_user_id(uid): ... +def chown_dir_file(directory, u_gid, recursive=False): + if recursive: + for (dir_path, dir_names, filenames) in os.walk(directory): + for filename in filenames + dir_names: + os.chown(uid=u_gid, gid=u_gid, path=os.path.join(dir_path, filename)) + else: + os.chown(uid=u_gid, gid=u_gid, path=directory) + + class BaseService(object): def __init__(self, **kwargs): @@ -144,12 +153,10 @@ class BaseService(object): if u_gid is None: u_gid = os.getuid() if u_gid is not None: - for (dir_path, dir_names, filenames) in os.walk(LOG_DIR): - for filename in filenames + dir_names: - os.chown(uid=u_gid, gid=u_gid, path=os.path.join(dir_path, filename)) + chown_dir_file(LOG_DIR, u_gid, recursive=True) if self.name == 'uwsgi': for dirs in ['files', 'supersign']: - os.chown(uid=u_gid, gid=u_gid, path=os.path.join(BASE_DIR, dirs)) + chown_dir_file(os.path.join(BASE_DIR, dirs), u_gid, recursive=True) else: logging.error(f'uid: {self.uid} gid:{self.gid} is not exists') diff --git a/fir_ser/api/views/domain.py b/fir_ser/api/views/domain.py index 73ae558..e1b50c1 100644 --- a/fir_ser/api/views/domain.py +++ b/fir_ser/api/views/domain.py @@ -41,7 +41,7 @@ def get_domain_filter(request): def auto_clean_download_cache(user_obj, user_domain_obj, app_obj, delete=False): if user_domain_obj: base_domain_queryset = UserDomainInfo.objects.filter(user_id=user_obj, is_enable=True).all() - if user_domain_obj.domain_type in [0, 1]: + if user_domain_obj.domain_type in [0, 1, 2]: if delete: user_domain_obj.delete() if base_domain_queryset.filter(domain_type__in=[0, 1]).count() == 0: diff --git a/fir_ser/xsign/views/receiveudids.py b/fir_ser/xsign/views/receiveudids.py index 952948e..a77e86d 100644 --- a/fir_ser/xsign/views/receiveudids.py +++ b/fir_ser/xsign/views/receiveudids.py @@ -64,8 +64,8 @@ class IosUDIDView(APIView): if app_obj: user_obj = app_obj.user_id short = get_preview_short_config(user_obj, short) + server_domain = get_app_download_uri(request, user_obj, app_obj, preview=False) if p_token and verify_token(p_token, app_obj.app_id, True): - server_domain = get_app_download_uri(request, user_obj, app_obj, preview=False) if app_obj.issupersign and app_obj.user_id.supersign_active: res = check_app_permission(app_obj, BaseResponse()) if res.code != 1000: