format code

pull/6/head
nineven 4 years ago
parent 81717de958
commit 308faf76b6
  1. 18
      fir_ser/api/migrations/0016_developerappid_developerdevicesid.py
  2. 4
      fir_ser/api/migrations/0017_auto_20210131_2108.py
  3. 6
      fir_ser/api/utils/app/iossignapi.py
  4. 16
      fir_ser/api/utils/app/supersignutils.py
  5. 10
      fir_ser/api/utils/apple/appleapiv3.py
  6. 2
      fir_ser/fir_ser/settings.py
  7. 4
      fir_ser/fir_ser/urls.py
  8. 93
      fir_ser/tests/postudid.py

@ -5,7 +5,6 @@ import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('api', '0015_auto_20210129_1730'), ('api', '0015_auto_20210129_1730'),
] ]
@ -16,9 +15,13 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('did', models.CharField(max_length=64)), ('did', models.CharField(max_length=64)),
('app_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Apps', verbose_name='属于哪个APP')), ('app_id',
('developerid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.AppIOSDeveloperInfo', verbose_name='所使用苹果开发者账户')), models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Apps', verbose_name='属于哪个APP')),
('udid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.AppUDID', verbose_name='所消耗的udid')), ('developerid',
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.AppIOSDeveloperInfo',
verbose_name='所使用苹果开发者账户')),
('udid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.AppUDID',
verbose_name='所消耗的udid')),
], ],
options={ options={
'verbose_name': '超级签Devices id', 'verbose_name': '超级签Devices id',
@ -31,8 +34,11 @@ class Migration(migrations.Migration):
fields=[ fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('aid', models.CharField(max_length=64)), ('aid', models.CharField(max_length=64)),
('app_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Apps', verbose_name='属于哪个APP')), ('app_id',
('developerid', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.AppIOSDeveloperInfo', verbose_name='所使用苹果开发者账户')), models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.Apps', verbose_name='属于哪个APP')),
('developerid',
models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.AppIOSDeveloperInfo',
verbose_name='所使用苹果开发者账户')),
], ],
options={ options={
'verbose_name': '超级签APP id', 'verbose_name': '超级签APP id',

@ -5,7 +5,6 @@ import django.db.models.deletion
class Migration(migrations.Migration): class Migration(migrations.Migration):
dependencies = [ dependencies = [
('api', '0016_developerappid_developerdevicesid'), ('api', '0016_developerappid_developerdevicesid'),
] ]
@ -14,6 +13,7 @@ class Migration(migrations.Migration):
migrations.AlterField( migrations.AlterField(
model_name='developerdevicesid', model_name='developerdevicesid',
name='udid', name='udid',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.UDIDsyncDeveloper', verbose_name='所消耗的udid'), field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='api.UDIDsyncDeveloper',
verbose_name='所消耗的udid'),
), ),
] ]

@ -205,7 +205,8 @@ class AppDeveloperApiV2(object):
result['return_info'] = "%s" % e result['return_info'] = "%s" % e
return False, result return False, result
def get_profile(self, bundleId, app_id, device_udid, device_name, provisionName, auth, developer_app_id, device_id_list): def get_profile(self, bundleId, app_id, device_udid, device_name, provisionName, auth, developer_app_id,
device_id_list):
result = {} result = {}
try: try:
apple_obj = AppStoreConnectApi(self.issuer_id, self.private_key_id, self.p8key) apple_obj = AppStoreConnectApi(self.issuer_id, self.private_key_id, self.p8key)
@ -222,7 +223,8 @@ class AppDeveloperApiV2(object):
if device_obj: if device_obj:
result['did'] = device_obj.id result['did'] = device_obj.id
device_id_list.append(device_obj.id) device_id_list.append(device_obj.id)
profile_obj = apple_obj.create_profile(developer_app_id, auth.get('certid'), provisionName.split("/")[-1], profile_obj = apple_obj.create_profile(developer_app_id, auth.get('certid'),
provisionName.split("/")[-1],
device_id_list) device_id_list)
if profile_obj: if profile_obj:
n = base64.b64decode(profile_obj.profileContent) n = base64.b64decode(profile_obj.profileContent)

@ -207,8 +207,12 @@ class IosUtils(object):
def get_developer_auth(self): def get_developer_auth(self):
developer_obj = self.get_developer_user_by_app_udid() developer_obj = self.get_developer_user_by_app_udid()
self.developer_obj = developer_obj if developer_obj:
self.auth = get_auth_form_developer(developer_obj) self.developer_obj = developer_obj
self.auth = get_auth_form_developer(developer_obj)
else:
logger.error("user %s has no actived apple developer" % (self.user_obj))
raise ModuleNotFoundError("has no actived apple developer")
def get_developer_user_by_app_udid(self): def get_developer_user_by_app_udid(self):
usedeviceobj = APPSuperSignUsedInfo.objects.filter(udid__udid=self.udid_info.get('udid'), usedeviceobj = APPSuperSignUsedInfo.objects.filter(udid__udid=self.udid_info.get('udid'),
@ -242,6 +246,7 @@ class IosUtils(object):
return get_api_obj(self.auth).get_profile(bundleId, app_id, device_udid, device_name, return get_api_obj(self.auth).get_profile(bundleId, app_id, device_udid, device_name,
self.get_profile_full_path(), self.get_profile_full_path(),
self.auth, developer_app_id, device_id_list) self.auth, developer_app_id, device_id_list)
# 开启超级签直接在开发者账户创建 # 开启超级签直接在开发者账户创建
def create_app(self, app_obj): def create_app(self, app_obj):
bundleId = self.app_obj.bundle_id bundleId = self.app_obj.bundle_id
@ -266,7 +271,7 @@ class IosUtils(object):
return return
logger.info("udid %s not exists app_id %s ,need sign" % (self.udid_info.get('udid'), self.app_obj)) logger.info("udid %s not exists app_id %s ,need sign" % (self.udid_info.get('udid'), self.app_obj))
fcount = 3 fcount = 3
result={} result = {}
while fcount > 0: while fcount > 0:
# apptodev_obj = APPToDeveloper.objects.filter(developerid=self.developer_obj, app_id=self.app_obj).first() # apptodev_obj = APPToDeveloper.objects.filter(developerid=self.developer_obj, app_id=self.app_obj).first()
device_id_list = DeveloperDevicesID.objects.filter(app_id=self.app_obj, device_id_list = DeveloperDevicesID.objects.filter(app_id=self.app_obj,
@ -334,7 +339,8 @@ class IosUtils(object):
del_cache_response_by_short(self.app_obj.app_id, udid=self.udid_info.get('udid')) del_cache_response_by_short(self.app_obj.app_id, udid=self.udid_info.get('udid'))
app_udid_obj = UDIDsyncDeveloper.objects.filter(developerid=self.developer_obj, udid=self.udid_info.get('udid')).first() app_udid_obj = UDIDsyncDeveloper.objects.filter(developerid=self.developer_obj,
udid=self.udid_info.get('udid')).first()
if not app_udid_obj: if not app_udid_obj:
appudid_obj = AppUDID.objects.filter(app_id=self.app_obj, udid=self.udid_info.get('udid')) appudid_obj = AppUDID.objects.filter(app_id=self.app_obj, udid=self.udid_info.get('udid'))
device = appudid_obj.values("serial", device = appudid_obj.values("serial",
@ -342,7 +348,7 @@ class IosUtils(object):
'udid', 'udid',
'version').first() 'version').first()
if result.get("did", None): if result.get("did", None):
device['serial']=result["did"] device['serial'] = result["did"]
app_udid_obj = UDIDsyncDeveloper.objects.create(developerid=self.developer_obj, **device) app_udid_obj = UDIDsyncDeveloper.objects.create(developerid=self.developer_obj, **device)
DeveloperDevicesID.objects.create(did=result["did"], udid=app_udid_obj, developerid=self.developer_obj, DeveloperDevicesID.objects.create(did=result["did"], udid=app_udid_obj, developerid=self.developer_obj,
app_id=self.app_obj) app_id=self.app_obj)

@ -635,7 +635,7 @@ class AppStoreConnectApi(DevicesAPI, BundleIDsAPI, BundleIDsCapabilityAPI, Profi
} }
self.headers = headers self.headers = headers
def __base_store(self, stype, req, success_code): def __base_format(self, stype, req, success_code):
if req.status_code == success_code: if req.status_code == success_code:
req_data = req.json() req_data = req.json()
data = req_data.get('data') data = req_data.get('data')
@ -663,16 +663,16 @@ class AppStoreConnectApi(DevicesAPI, BundleIDsAPI, BundleIDsCapabilityAPI, Profi
raise Exception('unknown error: %s code:%s' % (req.text, req.status_code)) raise Exception('unknown error: %s code:%s' % (req.text, req.status_code))
def __device_store(self, req, success_code=200): def __device_store(self, req, success_code=200):
return self.__base_store('devices', req, success_code) return self.__base_format('devices', req, success_code)
def __profile_store(self, req, success_code=200): def __profile_store(self, req, success_code=200):
return self.__base_store('profiles', req, success_code) return self.__base_format('profiles', req, success_code)
def __certificates_store(self, req, success_code=200): def __certificates_store(self, req, success_code=200):
return self.__base_store('certificates', req, success_code) return self.__base_format('certificates', req, success_code)
def __bundle_ids_store(self, req, success_code=200): def __bundle_ids_store(self, req, success_code=200):
return self.__base_store('bundleIds', req, success_code) return self.__base_format('bundleIds', req, success_code)
def get_all_devices(self): def get_all_devices(self):
req = self.list_devices() req = self.list_devices()

@ -170,7 +170,7 @@ REST_FRAMEWORK_EXTENSIONS = {
# 注册方式,如果启用sms或者email 需要配置 THIRD_PART_CONFIG.sender 信息 # 注册方式,如果启用sms或者email 需要配置 THIRD_PART_CONFIG.sender 信息
REGISTER = { REGISTER = {
"enable": True, "enable": False,
"captcha": True, # 是否开启注册字母验证码 "captcha": True, # 是否开启注册字母验证码
"register_type": { "register_type": {
'sms': False, # 短信注册 'sms': False, # 短信注册

@ -15,9 +15,6 @@ Including another URLconf
""" """
from django.contrib import admin from django.contrib import admin
from django.urls import path, re_path, include from django.urls import path, re_path, include
from rest_framework.routers import DefaultRouter
from api.views.login import LoginView
from api.views.logout import LogoutView
from django.views.static import serve from django.views.static import serve
from fir_ser import settings from fir_ser import settings
from api.views.download import DownloadView, InstallView from api.views.download import DownloadView, InstallView
@ -25,7 +22,6 @@ from api.views.receiveudids import IosUDIDView
urlpatterns = [ urlpatterns = [
re_path('fly.admin/', admin.site.urls), re_path('fly.admin/', admin.site.urls),
# path("",include(router.urls)),
re_path("api/v1/fir/server/", include('api.urls')), re_path("api/v1/fir/server/", include('api.urls')),
re_path("api/v2/fir/server/", include('cli.urls')), re_path("api/v2/fir/server/", include('cli.urls')),
re_path('^captcha/', include('captcha.urls')), re_path('^captcha/', include('captcha.urls')),

@ -1,46 +1,49 @@
# import requests import requests
# import random import random
#
# short = ["bgql", "wjbu", "vnfg", "bgql"]
#
# udid_lists = [
# "f55df38afe5c1242b8bc478d0182bbd0d7d08929",
# "f55df38afe5c1242b8bc478d0182bbd0d7d08929",
# "f55df38afe5c1242b8bc478d0182bbd0d7d08922",
# "f55df38afe5c1242b8bc478d0182bbd0d7d01129",
# "f55df38afe5c1242b8bc478d0182bbd0d723929",
# "f55df38afe5c1242b8bc478d0182bbd0d7d118929",
# "f55df38afe5c1242b8bc478d0182bbd0d7d08929",
# "f55df38afe5c1242b8bc478d0182bbd0daed08929",
# "f55df38afe5c1242b8bc478d0182bbd0d7d08929",
# "f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929",
# "f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929",
# "f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929",
# "f55df38afe5c1242b8bc478d0182dsfsdd7d08929",
# "f55df38afe5c1242b8bc478d0182dsfsdd7d08929",
# "f55df38afe5c1242b8bc478d0182dsfsdd7d08929",
# "f55df38afe5c1242b8bc478d0182bbdsdfsadf8929",
# "f55df38afe5c1242b8bc478d01sdsdfsdd0d7d08929",
# "f55df38afe5c1242b8bc478sdfsdffsdafd7d08929",
# "f55df38afe5c1242b8bc478sdfsdffsdafd7d08929",
# "f55df38afe5c1242b8bc478sdfsdffsdafd7d08929",
# "f55df38afe5c1242b8bc478d0182bbd0d7d08929",
# "f55df38afe5c1242b8bc478dsdfeasdfbbd0d7d08929",
# "f55df38afe5c1242b8bc478dfsdfseasbd0d7d08929",
# "f55df38afe5c1242b8bc478d0sdfseafsdbbd0d7d08929",
# "f55df38afe5c1242b8asdfae8ds2bbd0d7d118929",
# "f55df38afe5c1242b8bc47sfsdf2bbd0d7dd18929",
# "f55df38afe5c1242b8bc478d0182bbd0d7d0ae8929",
# "f55df38afe5c1242b8bc478d0182bbd0d7dsfe08929",
# ]
#
# for udid in udid_lists:
# data = '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n\t<key>PRODUCT</key>\n\t<string>iPhone9,1</string>\n\t<key>SERIAL</key>\n\t<string>F71YD58GHG74</string>\n\t<key>UDID</key>\n\t<string>%s</string>\n\t<key>VERSION</key>\n\t<string>17E262</string>\n</dict>\n</plist>\n' % (
# udid)
# uri = "https://fly.harmonygames.cn/udid/%s" % (random.choice(short))
# # uri = "https://fly.harmonygames.cn/udid/%s" % ("bgql")
# req = requests.post(uri, data=data)
# print(req.status_code)
a = '验证码%(code)s,您正在注册成为新用户,感谢您的支持!' short = ["bgql", "wjbu", "vnfg", "bgql"]
print(a % {'code': 111})
udid_lists = [
"f55df38afe5c1242b8bc478d0182bbd0d7d08929",
"f55df38afe5c1242b8bc478d0182bbd0d7d08929",
"f55df38afe5c1242b8bc478d0182bbd0d7d08922",
"f55df38afe5c1242b8bc478d0182bbd0d7d01129",
"f55df38afe5c1242b8bc478d0182bbd0d723929",
"f55df38afe5c1242b8bc478d0182bbd0d7d118929",
"f55df38afe5c1242b8bc478d0182bbd0d7d08929",
"f55df38afe5c1242b8bc478d0182bbd0daed08929",
"f55df38afe5c1242b8bc478d0182bbd0d7d08929",
"f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929",
"f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929",
"f55df38afe5c1242b8bc478d0182bbdfsdfe7d08929",
"f55df38afe5c1242b8bc478d0182dsfsdd7d08929",
"f55df38afe5c1242b8bc478d0182dsfsdd7d08929",
"f55df38afe5c1242b8bc478d0182dsfsdd7d08929",
"f55df38afe5c1242b8bc478d0182bbdsdfsadf8929",
"f55df38afe5c1242b8bc478d01sdsdfsdd0d7d08929",
"f55df38afe5c1242b8bc478sdfsdffsdafd7d08929",
"f55df38afe5c1242b8bc478sdfsdffsdafd7d08929",
"f55df38afe5c1242b8bc478sdfsdffsdafd7d08929",
"f55df38afe5c1242b8bc478d0182bbd0d7d08929",
"f55df38afe5c1242b8bc478dsdfeasdfbbd0d7d08929",
"f55df38afe5c1242b8bc478dfsdfseasbd0d7d08929",
"f55df38afe5c1242b8bc478d0sdfseafsdbbd0d7d08929",
"f55df38afe5c1242b8asdfae8ds2bbd0d7d118929",
"f55df38afe5c1242b8bc47sfsdf2bbd0d7dd18929",
"f55df38afe5c1242b8bc478d0182bbd0d7d0ae8929",
"f55df38afe5c1242b8bc478d0182bbd0d7dsfe08929",
]
shorts='pzsdaaa'
for udid in udid_lists:
data = '<?xml version="1.0" encoding="UTF-8"?>\n<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">\n<plist version="1.0">\n<dict>\n\t<key>PRODUCT</key>\n\t<string>iPhone9,1</string>\n\t<key>SERIAL</key>\n\t<string>F71YD58GHG74</string>\n\t<key>UDID</key>\n\t<string>%s</string>\n\t<key>VERSION</key>\n\t<string>17E262</string>\n</dict>\n</plist>\n' % (
udid)
# uri = "https://app.hehelucky.cn/udid/%s" % (random.choice(short))
uri = "https://app.hehelucky.cn/udid/%s" % (shorts)
req = requests.post(uri, data=data)
print(req.status_code)
print(req.text)
exit(1)
# a = '验证码%(code)s,您正在注册成为新用户,感谢您的支持!'
# print(a % {'code': 111})

Loading…
Cancel
Save