From e6f8b2f62888e80f16e9db60f2935538c4f22879 Mon Sep 17 00:00:00 2001 From: youngS Date: Thu, 24 Jun 2021 15:45:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E8=B6=85=E7=BA=A7=E7=AD=BE?= =?UTF-8?q?=E6=96=B9=E5=BC=8F=EF=BC=8Cisign=20=E9=83=A8=E5=88=86=E5=8C=85?= =?UTF-8?q?=E6=97=A0=E6=B3=95=E7=AD=BE=E5=90=8D=EF=BC=8C=E4=BD=BF=E7=94=A8?= =?UTF-8?q?zsign=20=E8=BF=9B=E8=A1=8C=E7=AD=BE=E5=90=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/components/apps/FirAppInfosBase.vue | 9 ++++++- .../components/apps/FirAppInfossupersign.vue | 26 ++++++++++++++++--- .../migrations/0003_apps_new_bundle_name.py | 18 +++++++++++++ fir_ser/api/models.py | 2 ++ fir_ser/api/utils/app/iossignapi.py | 8 +++--- fir_ser/api/utils/app/supersignutils.py | 4 ++- fir_ser/api/views/apps.py | 10 +++++++ fir_ser/cli.py | 8 ++++++ 8 files changed, 75 insertions(+), 10 deletions(-) create mode 100644 fir_ser/api/migrations/0003_apps_new_bundle_name.py diff --git a/fir_client/src/components/apps/FirAppInfosBase.vue b/fir_client/src/components/apps/FirAppInfosBase.vue index cc83046..6aa2c15 100644 --- a/fir_client/src/components/apps/FirAppInfosBase.vue +++ b/fir_client/src/components/apps/FirAppInfosBase.vue @@ -17,7 +17,14 @@ {{ appinfos.count_hits }} - BundleID  {{ appinfos.bundle_id }} + BundleID + +  {{appinfos.bundle_id }} + + {{ master_release.minimum_os_version }}  或者高版本 超级签 diff --git a/fir_client/src/components/apps/FirAppInfossupersign.vue b/fir_client/src/components/apps/FirAppInfossupersign.vue index 0e8d6a2..161bb91 100644 --- a/fir_client/src/components/apps/FirAppInfossupersign.vue +++ b/fir_client/src/components/apps/FirAppInfossupersign.vue @@ -29,8 +29,7 @@ - @@ -72,6 +71,16 @@ + + + 保存 + + + 该用户暂未开通超级签权限,请联系管理员申请开通 @@ -94,7 +103,8 @@ supersign_disable: true, sign_type_list: [], sign_type: 0, - defualt_dtitle: '' + defualt_dtitle: '', + defualt_dtitle_name: '' } }, methods: { @@ -170,6 +180,11 @@ } else { this.defualt_dtitle = currentapp.bundle_id } + if (this.currentapp.new_bundle_name && currentapp.new_bundle_name.length > 0) { + this.defualt_dtitle_name = currentapp.new_bundle_name + } else { + this.defualt_dtitle_name = currentapp.name + } }, appinit() { this.currentapp = this.$store.state.currentapp; @@ -193,6 +208,11 @@ if (!this.currentapp.new_bundle_id || this.currentapp.new_bundle_id.length === 0) { this.defualt_dtitle = this.currentapp.bundle_id } + }, + 'currentapp.new_bundle_name': function () { + if (!this.currentapp.new_bundle_name || this.currentapp.new_bundle_name.length === 0) { + this.defualt_dtitle_name = this.currentapp.name + } } }, computed: {} } diff --git a/fir_ser/api/migrations/0003_apps_new_bundle_name.py b/fir_ser/api/migrations/0003_apps_new_bundle_name.py new file mode 100644 index 0000000..72d10d5 --- /dev/null +++ b/fir_ser/api/migrations/0003_apps_new_bundle_name.py @@ -0,0 +1,18 @@ +# Generated by Django 3.2.3 on 2021-06-24 11:04 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + dependencies = [ + ('api', '0002_auto_20210607_1743'), + ] + + operations = [ + migrations.AddField( + model_name='apps', + name='new_bundle_name', + field=models.CharField(blank=True, help_text='应用新名称', max_length=64, null=True, + verbose_name='new_bundle_name'), + ), + ] diff --git a/fir_ser/api/models.py b/fir_ser/api/models.py index 7388009..b42b1ce 100644 --- a/fir_ser/api/models.py +++ b/fir_ser/api/models.py @@ -119,6 +119,8 @@ class Apps(models.Model): supersign_type = models.SmallIntegerField(choices=supersign_type_choices, default=1, verbose_name="签名类型") new_bundle_id = models.CharField(max_length=64, blank=True, null=True, verbose_name="new_bundle_id", help_text="用于超级签某些因素下需要修改包名") + new_bundle_name = models.CharField(max_length=64, blank=True, null=True, verbose_name="new_bundle_name", + help_text="应用新名称") supersign_limit_number = models.IntegerField(verbose_name="签名使用限额", default=0) wxredirect = models.BooleanField(verbose_name="微信内第三方链接自动跳转", default=True) wxeasytype = models.BooleanField(verbose_name="微信内简易模式,避免微信封停", default=True) diff --git a/fir_ser/api/utils/app/iossignapi.py b/fir_ser/api/utils/app/iossignapi.py index 32dcd82..4a29c46 100644 --- a/fir_ser/api/utils/app/iossignapi.py +++ b/fir_ser/api/utils/app/iossignapi.py @@ -44,7 +44,7 @@ class ResignApp(object): def __init__(self, my_local_key, app_dev_pem): self.my_local_key = my_local_key self.app_dev_pem = app_dev_pem - self.cmd = "isign -c '%s' -k '%s' " % (self.app_dev_pem, self.my_local_key) + self.cmd = "zsign -c '%s' -k '%s' " % (self.app_dev_pem, self.my_local_key) @staticmethod def sign_mobileconfig(mobilconfig_path, sign_mobilconfig_path, ssl_pem_path, ssl_key_path): @@ -58,10 +58,8 @@ class ResignApp(object): info_plist_properties = {} properties = "" for k, v in info_plist_properties.items(): - properties += "%s=%s," % (k, v) - if properties: - properties = " -i '%s' " % properties[0:-1] - self.cmd = self.cmd + " %s -p '%s' -o '%s' '%s'" % (properties, new_profile, new_ipa, org_ipa) + properties += " %s '%s' " % (k, v) + self.cmd = self.cmd + " %s -m '%s' -o '%s' -z 9 '%s'" % (properties, new_profile, new_ipa, org_ipa) return exec_shell(self.cmd) diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py index e2664f1..fb188f6 100644 --- a/fir_ser/api/utils/app/supersignutils.py +++ b/fir_ser/api/utils/app/supersignutils.py @@ -367,7 +367,9 @@ class IosUtils(object): new_file = os.path.join(MEDIA_ROOT, random_file_name + ".ipa") properties_info = {} if app_obj.new_bundle_id: - properties_info = {'CFBundleIdentifier': app_obj.new_bundle_id} + properties_info = {'-b': app_obj.new_bundle_id} + if app_obj.new_bundle_name: + properties_info = {'-n': app_obj.new_bundle_name} status, result = resign_app_obj.sign(get_profile_full_path(developer_obj, app_obj), org_file, new_file, properties_info) if status: diff --git a/fir_ser/api/views/apps.py b/fir_ser/api/views/apps.py index ea39533..12141eb 100644 --- a/fir_ser/api/views/apps.py +++ b/fir_ser/api/views/apps.py @@ -192,6 +192,7 @@ class AppInfoView(APIView): do_sign_flag = 1 apps_obj.supersign_type = data.get("supersign_type", apps_obj.supersign_type) new_bundle_id = data.get("new_bundle_id", None) + new_bundle_name = data.get("new_bundle_name", None) if new_bundle_id and new_bundle_id != apps_obj.bundle_id and len(new_bundle_id) > 3: if new_bundle_id != apps_obj.new_bundle_id: do_sign_flag = 2 @@ -201,6 +202,15 @@ class AppInfoView(APIView): do_sign_flag = 2 apps_obj.new_bundle_id = None + if new_bundle_name and new_bundle_name != apps_obj.name and len(new_bundle_name) > 0: + if new_bundle_name != apps_obj.new_bundle_name: + do_sign_flag = 2 + apps_obj.new_bundle_name = new_bundle_name + if new_bundle_name == '': + if new_bundle_name != apps_obj.new_bundle_name: + do_sign_flag = 2 + apps_obj.new_bundle_name = None + apps_obj.wxredirect = data.get("wxredirect", apps_obj.wxredirect) if apps_obj.type == 1 and data.get('issupersign', -1) != -1: # 为啥注释掉,就是该udid已经在该平台使用了,虽然已经没有余额,但是其他应用也是可以超级签名的 diff --git a/fir_ser/cli.py b/fir_ser/cli.py index 1f267ce..111745f 100644 --- a/fir_ser/cli.py +++ b/fir_ser/cli.py @@ -15,6 +15,14 @@ import oss2 import requests from androguard.core.bytecodes import apk +''' +pip install --upgrade pip +pip install setuptools-rust +pip install oss2 +pip install requests-toolbelt +pip install androguard +''' + def upload_aliyunoss(access_key_id, access_key_secret, security_token, endpoint, bucket, file_path, file_name): stsauth = oss2.StsAuth(access_key_id, access_key_secret, security_token)