修复 bytesio 导致uwsgi 不识别问题

dependabot/npm_and_yarn/fir_admin/async-2.6.4
nineven 3 years ago
parent 5ca5b0eb34
commit 0a64689902
  1. 10
      fir_client/src/restful/download.js
  2. 14
      fir_client/src/restful/index.js
  3. 5
      fir_ser/xsign/utils/supersignutils.py

@ -7,7 +7,7 @@ const DOMAIN = process.env.base_env.baseShortUrl;
const APIPATH = '/api/v1/fir/server'; const APIPATH = '/api/v1/fir/server';
let USERSEVER = DOMAIN + APIPATH; let USERSEVER = DOMAIN + APIPATH;
function ErrorMsg(error,callBack) { function ErrorMsg(error, callBack) {
if (error && error.response) { if (error && error.response) {
switch (error.response.status) { switch (error.response.status) {
case 400: case 400:
@ -28,7 +28,7 @@ function ErrorMsg(error,callBack) {
} else { } else {
error.message = '连接服务器失败!'; error.message = '连接服务器失败!';
} }
callBack({code:-1,msg:error.message}) callBack({code: -1, msg: error.message})
} }
function responseMiddleware(data, callBack) { function responseMiddleware(data, callBack) {
@ -48,7 +48,7 @@ function getData(methods = 'GET', url, params = {}, callBack) {
responseMiddleware(response.data, callBack); responseMiddleware(response.data, callBack);
}) })
.catch(function (error) { .catch(function (error) {
ErrorMsg(error,callBack); ErrorMsg(error, callBack);
}); });
} else if (methods === 'POST') { } else if (methods === 'POST') {
Axios Axios
@ -57,7 +57,7 @@ function getData(methods = 'GET', url, params = {}, callBack) {
responseMiddleware(response.data, callBack); responseMiddleware(response.data, callBack);
}) })
.catch(function (error) { .catch(function (error) {
ErrorMsg(error,callBack); ErrorMsg(error, callBack);
}); });
} else } else
Axios Axios
@ -66,7 +66,7 @@ function getData(methods = 'GET', url, params = {}, callBack) {
responseMiddleware(response.data, callBack); responseMiddleware(response.data, callBack);
}) })
.catch(function (error) { .catch(function (error) {
ErrorMsg(error,callBack); ErrorMsg(error, callBack);
}); });
} }

@ -79,7 +79,7 @@ export function set_auth_token() {
set_auth_token(); set_auth_token();
function ErrorMsg(error,callBack) { function ErrorMsg(error, callBack) {
if (error && error.response) { if (error && error.response) {
switch (error.response.status) { switch (error.response.status) {
case 400: case 400:
@ -127,7 +127,7 @@ function ErrorMsg(error,callBack) {
if (error.response && error.response.status === 403) { if (error.response && error.response.status === 403) {
router.push({name: 'FirLogin'}); router.push({name: 'FirLogin'});
} }
callBack({code:-1, msg:error.message}) callBack({code: -1, msg: error.message})
} }
function responseMiddleware(data, callBack) { function responseMiddleware(data, callBack) {
@ -147,7 +147,7 @@ function getData(methods, url, params = {}, callBack) {
responseMiddleware(response.data, callBack); responseMiddleware(response.data, callBack);
}) })
.catch(function (error) { .catch(function (error) {
ErrorMsg(error,callBack); ErrorMsg(error, callBack);
}); });
} else if (methods === "PUT") { } else if (methods === "PUT") {
@ -157,7 +157,7 @@ function getData(methods, url, params = {}, callBack) {
responseMiddleware(response.data, callBack); responseMiddleware(response.data, callBack);
}) })
.catch(function (error) { .catch(function (error) {
ErrorMsg(error,callBack); ErrorMsg(error, callBack);
}); });
} else if (methods === 'POST') { } else if (methods === 'POST') {
@ -167,7 +167,7 @@ function getData(methods, url, params = {}, callBack) {
responseMiddleware(response.data, callBack); responseMiddleware(response.data, callBack);
}) })
.catch(function (error) { .catch(function (error) {
ErrorMsg(error,callBack); ErrorMsg(error, callBack);
}); });
} else if (methods === 'FILE') { } else if (methods === 'FILE') {
Axios Axios
@ -176,7 +176,7 @@ function getData(methods, url, params = {}, callBack) {
convertRes2Blob(response) convertRes2Blob(response)
}) })
.catch(function (error) { .catch(function (error) {
ErrorMsg(error,callBack); ErrorMsg(error, callBack);
}); });
} else { } else {
Axios Axios
@ -185,7 +185,7 @@ function getData(methods, url, params = {}, callBack) {
responseMiddleware(response.data, callBack); responseMiddleware(response.data, callBack);
}) })
.catch(function (error) { .catch(function (error) {
ErrorMsg(error,callBack); ErrorMsg(error, callBack);
}); });
} }
} }

@ -10,6 +10,7 @@ import time
import uuid import uuid
import zipfile import zipfile
from io import BytesIO from io import BytesIO
from wsgiref.util import FileWrapper
import xmltodict import xmltodict
from django.core.cache import cache from django.core.cache import cache
@ -166,8 +167,8 @@ def make_sign_udid_mobile_config(udid_url, bundle_id, app_name):
status, result = ResignApp.sign_mobile_config(make_udid_mobile_config(udid_url, bundle_id, app_name), status, result = ResignApp.sign_mobile_config(make_udid_mobile_config(udid_url, bundle_id, app_name),
ssl_pem_path, ssl_key_path, ssl_pem_data, ssl_key_data) ssl_pem_path, ssl_key_path, ssl_pem_data, ssl_key_data)
if status and result.get('data'): if status and result.get('data'):
buffer = BytesIO(result.get("data")) buffer = BytesIO(result.get("data")) # uwsgi 无法解析该类型,需求加上 FileWrapper 包装
return buffer return FileWrapper(buffer)
else: else:
logger.error( logger.error(
f"{bundle_id} {app_name} sign_mobile_config failed ERROR:{result.get('err_info')}") f"{bundle_id} {app_name} sign_mobile_config failed ERROR:{result.get('err_info')}")

Loading…
Cancel
Save