优化代码,增加查询udid的服务器逻辑

dependabot/npm_and_yarn/fir_admin/tmpl-1.0.5
youngS 3 years ago
parent e8931df00f
commit adaf7af866
  1. 2
      fir_ser/api/utils/app/iossignapi.py
  2. 15
      fir_ser/api/views/receiveudids.py
  3. 2
      fir_ser/fir_ser/urls.py
  4. 2
      fir_ser/nginx-vhost.conf

@ -78,7 +78,7 @@ class ResignApp(object):
cas.extend([x509.load_pem_x509_certificate(x.encode('utf-8')) for x in cert_list[1:]]) cas.extend([x509.load_pem_x509_certificate(x.encode('utf-8')) for x in cert_list[1:]])
key = serialization.load_pem_private_key(open(ssl_key_path, 'rb').read(), None) key = serialization.load_pem_private_key(open(ssl_key_path, 'rb').read(), None)
result['data'] = pkcs7.PKCS7SignatureBuilder( result['data'] = pkcs7.PKCS7SignatureBuilder(
data=sign_data, data=sign_data.encode('utf-8'),
signers=[ signers=[
(cert, key, hashes.SHA512()), (cert, key, hashes.SHA512()),
], ],

@ -5,10 +5,10 @@
# date: 2020/3/6 # date: 2020/3/6
from api.utils.app.randomstrings import make_random_uuid from api.utils.app.randomstrings import make_random_uuid
from api.utils.app.supersignutils import udid_bytes_to_dict, get_redirect_server_domain, make_sign_udid_mobile_config, \ from api.utils.app.supersignutils import udid_bytes_to_dict, get_redirect_server_domain, make_sign_udid_mobile_config, \
get_post_udid_url, get_http_server_domain get_post_udid_url, get_http_server_domain, get_server_domain_from_request
from api.models import Apps from api.models import Apps
from django.views import View from django.views import View
from django.http import HttpResponsePermanentRedirect, FileResponse from django.http import HttpResponsePermanentRedirect, FileResponse, HttpResponse
from rest_framework.response import Response from rest_framework.response import Response
from api.tasks import run_sign_task from api.tasks import run_sign_task
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
@ -94,8 +94,11 @@ class TaskView(APIView):
class ShowUdidView(View): class ShowUdidView(View):
def get(self, request): def get(self, request):
udid = request.GET.get("udid")
if udid:
return HttpResponse("udid: %s" % udid)
server_domain = get_http_server_domain(request) server_domain = get_http_server_domain(request)
path_info_lists = [server_domain, "look_udid"] path_info_lists = [server_domain, "show_udid"]
udid_url = "/".join(path_info_lists) udid_url = "/".join(path_info_lists)
ios_udid_mobile_config = make_sign_udid_mobile_config(udid_url, 'show_udid_info', 'flyapps.cn', '查询设备udid') ios_udid_mobile_config = make_sign_udid_mobile_config(udid_url, 'show_udid_info', 'flyapps.cn', '查询设备udid')
response = FileResponse(ios_udid_mobile_config) response = FileResponse(ios_udid_mobile_config)
@ -106,7 +109,7 @@ class ShowUdidView(View):
def post(self, request): def post(self, request):
stream_f = str(request.body) stream_f = str(request.body)
format_udid_info = udid_bytes_to_dict(stream_f) format_udid_info = udid_bytes_to_dict(stream_f)
logger.info(f"look_udid receive new udid {format_udid_info}") logger.info(f"show_udid receive new udid {format_udid_info}")
server_domain = get_redirect_server_domain(request) server_domain = get_http_server_domain(request)
return HttpResponsePermanentRedirect( return HttpResponsePermanentRedirect(
"%sudid=%s" % (server_domain, format_udid_info.get("udid"))) "%s/show_udid?udid=%s" % (server_domain, format_udid_info.get("udid")))

@ -31,6 +31,6 @@ urlpatterns = [
re_path("download/(?P<filename>\w+\.\w+)$", DownloadView.as_view(), name="download"), re_path("download/(?P<filename>\w+\.\w+)$", DownloadView.as_view(), name="download"),
re_path("install/(?P<app_id>\w+)$", InstallView.as_view(), name="install"), re_path("install/(?P<app_id>\w+)$", InstallView.as_view(), name="install"),
re_path("^udid/(?P<short>\w+)$", IosUDIDView.as_view()), re_path("^udid/(?P<short>\w+)$", IosUDIDView.as_view()),
re_path("^look_udid$", ShowUdidView.as_view()), re_path("^show_udid$", ShowUdidView.as_view()),
] ]

@ -38,7 +38,7 @@ server
set_real_ip_from 0.0.0.0/0; set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For; real_ip_header X-Forwarded-For;
location ~ ^/(download|api|files|udid|captcha) { location ~ ^/(download|api|files|udid|captcha|show_udid) {
#proxy_pass http://synchrotron; #proxy_pass http://synchrotron;
#proxy_send_timeout 180; #proxy_send_timeout 180;
#proxy_connect_timeout 180; #proxy_connect_timeout 180;

Loading…
Cancel
Save