增加预览下载页路由模式

ossnew
isummer 2 years ago
parent 49832ca702
commit 8a8d2f2400
  1. 15
      fir_client/src/components/apps/FirAppInfosBase.vue
  2. 2
      fir_client/src/components/apps/FirAppInfossecurity.vue
  3. 7
      fir_client/src/components/apps/FirAppInfostimeline.vue
  4. 2
      fir_client/src/components/apps/FirApps.vue
  5. 1
      fir_client/src/components/user/FirSuperSignBase.vue
  6. 11
      fir_client/src/components/user/FirUserQrcode.vue
  7. 11
      fir_ser/api/tasks.py
  8. 4
      fir_ser/api/utils/modelutils.py
  9. 17
      fir_ser/api/utils/serializer.py
  10. 7
      fir_ser/api/views/download.py
  11. 4
      fir_ser/common/core/sysconfig.py
  12. 1
      fir_ser/config.py

@ -8,10 +8,10 @@
</div> </div>
<div class="badges"> <div class="badges">
<el-tooltip content="复制到剪切板" placement="top"> <el-tooltip content="复制到剪切板" placement="top">
<span v-clipboard:copy="short_full_url" <span v-clipboard:copy="appinfos.preview_url"
v-clipboard:success="copy_success" v-clipboard:success="copy_success"
class="bundleid short" class="bundleid short"
>&nbsp;{{ short_full_url }}</span> >&nbsp;{{ appinfos.preview_url }}</span>
</el-tooltip> </el-tooltip>
<el-popover <el-popover
@ -23,7 +23,7 @@
:logoScale="qrinfo.logoScale" :logoScale="qrinfo.logoScale"
:logoSrc="icon_url" :logoSrc="icon_url"
:margin="qrinfo.margin" :size="266" :margin="qrinfo.margin" :size="266"
:text="short_url(appinfos)"> :text="appinfos.preview_url">
</vue-qr> </vue-qr>
<el-button size="small" type="primary" @click="save_qr()">保存本地</el-button> <el-button size="small" type="primary" @click="save_qr()">保存本地</el-button>
</div> </div>
@ -123,13 +123,12 @@ export default {
margin: 20 margin: 20
}, },
icon_url: "", icon_url: "",
appinfos: {status: 1}, appinfos: {status: 1, preview_url: ''},
master_release: {}, master_release: {},
allapp: [], allapp: [],
activity: { activity: {
editing: false editing: false
}, },
short_full_url: '',
} }
}, },
methods: { methods: {
@ -149,9 +148,6 @@ export default {
// //
a.dispatchEvent(new MouseEvent('click')) a.dispatchEvent(new MouseEvent('click'))
}, },
short_url(appinfo) {
return appinfo.preview_url + '/' + appinfo.short;
},
setfunactive(item, index) { setfunactive(item, index) {
for (let key in this.$refs) { for (let key in this.$refs) {
if (key === "qr") continue; if (key === "qr") continue;
@ -168,7 +164,7 @@ export default {
} }
}, },
appDownload(appinfo) { appDownload(appinfo) {
window.open(this.short_url(appinfo), '_blank', ''); window.open(appinfo.preview_url, '_blank', '');
}, },
defaulttimeline() { defaulttimeline() {
this.setfunactive('timeline', 5); this.setfunactive('timeline', 5);
@ -219,7 +215,6 @@ export default {
this.master_release = data.data.master_release; this.master_release = data.data.master_release;
this.appinfos["icon_url"] = this.master_release.icon_url; this.appinfos["icon_url"] = this.master_release.icon_url;
this.$store.dispatch('doucurrentapp', this.appinfos); this.$store.dispatch('doucurrentapp', this.appinfos);
this.short_full_url = this.appinfos.preview_url + "/" + this.appinfos.short;
} else if (data.code === 1003) { } else if (data.code === 1003) {
this.$router.push({name: 'FirApps'}); this.$router.push({name: 'FirApps'});
} else { } else {

@ -324,7 +324,7 @@ export default {
}, },
methods: { methods: {
format_copy_text(token) { format_copy_text(token) {
return this.currentapp.preview_url + "/" + this.currentapp.short + "?password=" + token return this.currentapp.preview_url + "?password=" + token
}, },
copy_success() { copy_success() {
this.$message.success('复制剪切板成功'); this.$message.success('复制剪切板成功');

@ -142,12 +142,7 @@ export default {
); );
}, },
previewRelease(app) { previewRelease(app) {
let routeData = this.$router.resolve({ window.open(this.currentapp.preview_url + '?release_id=' + app.release_id, '_blank', '');
name: 'FirDownload',
params: {short: this.currentapp.short},
query: {release_id: app.release_id}
});
window.open(this.currentapp.preview_url + routeData.href, 'target', '');
}, },
getAppTimelineFun(act = '') { getAppTimelineFun(act = '') {
const loading = this.$loading({ const loading = this.$loading({

@ -1161,7 +1161,7 @@ export default {
this.$router.push({name: 'FirAppInfostimeline', params: {id: app.app_id}}) this.$router.push({name: 'FirAppInfostimeline', params: {id: app.app_id}})
}, },
appDownload(app) { appDownload(app) {
window.open(app.preview_url + '/' + app.short, '_blank', ''); window.open(app.preview_url, '_blank', '');
} }
}, computed: { }, computed: {
getDelappTitle() { getDelappTitle() {

@ -1430,7 +1430,6 @@
<el-date-picker <el-date-picker
v-model="timerangesearch" v-model="timerangesearch"
:picker-options="pickerOptions" :picker-options="pickerOptions"
align="right"
end-placeholder="结束日期" end-placeholder="结束日期"
range-separator="至" range-separator="至"
start-placeholder="开始日期" start-placeholder="开始日期"

@ -56,7 +56,7 @@
:logoSrc="appinfo.master_release.icon_url" :logoSrc="appinfo.master_release.icon_url"
:margin="qrinfo.margin" :qid="appinfo.app_id" :margin="qrinfo.margin" :qid="appinfo.app_id"
:size="200" :size="200"
:text="short_url(appinfo)"> :text="appinfo.preview_url">
</vue-qr> </vue-qr>
<div style="margin: 5px 0 5px"> <div style="margin: 5px 0 5px">
<i v-if="appinfo.type === 1" class=" type-icon iconfont icon-ios"/> <i v-if="appinfo.type === 1" class=" type-icon iconfont icon-ios"/>
@ -65,9 +65,9 @@
<span>{{ appinfo.name }}</span> <span>{{ appinfo.name }}</span>
<div class="bottom clearfix"> <div class="bottom clearfix">
<el-popover placement="top" trigger="hover"> <el-popover placement="top" trigger="hover">
<span v-clipboard:copy="short_url(appinfo)" <span v-clipboard:copy="appinfo.preview_url"
v-clipboard:success="copy_success" v-clipboard:success="copy_success"
>{{ short_url(appinfo) }}</span> >{{ appinfo.preview_url }}</span>
<div slot="reference" class="name-wrapper"> <div slot="reference" class="name-wrapper">
<el-button plain size="small" type="primary" @click="go_download(appinfo)">预览</el-button> <el-button plain size="small" type="primary" @click="go_download(appinfo)">预览</el-button>
<el-button plain size="small" type="primary" @click="save_qr(appinfo)">保存本地</el-button> <el-button plain size="small" type="primary" @click="save_qr(appinfo)">保存本地</el-button>
@ -213,15 +213,12 @@ export default {
this.isIndeterminate = checkedCount > 0 && checkedCount < this.allQrcodeAppid.length; this.isIndeterminate = checkedCount > 0 && checkedCount < this.allQrcodeAppid.length;
}, },
go_download(appinfo) { go_download(appinfo) {
window.open(this.short_url(appinfo), '_blank', ''); window.open(appinfo.preview_url, '_blank', '');
}, },
qrback(dataUrl, id) { qrback(dataUrl, id) {
this.qrcode_img_info[id] = dataUrl; this.qrcode_img_info[id] = dataUrl;
this.allQrcodeAppid.push(id); this.allQrcodeAppid.push(id);
}, },
short_url(appinfo) {
return appinfo.preview_url + '/' + appinfo.short;
},
save_qr(appinfo) { save_qr(appinfo) {
let dtype = "I"; let dtype = "I";
if (appinfo.master_release.release_type === 0) { if (appinfo.master_release.release_type === 0) {

@ -22,17 +22,18 @@ from xsign.utils.ctasks import auto_delete_ios_mobile_tmp_file
logger = logging.getLogger(__name__) logger = logging.getLogger(__name__)
def clean_config_cache(key):
ConfigCacheBase().invalid_config_cache(key)
ConfigCacheBase(px='user').invalid_config_cache(key)
@app.task @app.task
def start_api_sever_do_clean(): def start_api_sever_do_clean():
# 启动服务的时候,同时执行下面操作,主要是修改配置存储的时候,需要执行清理,否则会出问题,如果不修改,则无需执行 # 启动服务的时候,同时执行下面操作,主要是修改配置存储的时候,需要执行清理,否则会出问题,如果不修改,则无需执行
logger.info("clean local storage cache") logger.info("clean local storage cache")
get_local_storage(clean_cache=True) get_local_storage(clean_cache=True)
check_bypass_status() check_bypass_status()
ConfigCacheBase().invalid_config_cache() clean_config_cache('*')
def clean_config_cache(key):
return ConfigCacheBase().invalid_config_cache(key)
@app.task @app.task

@ -319,3 +319,7 @@ def get_user_storage_obj(user_obj, default=False):
auth = storage.get('auth', {}) auth = storage.get('auth', {})
storage = AppStorage(user_id=user_obj, storage_type=storage_type, **auth) storage = AppStorage(user_id=user_obj, storage_type=storage_type, **auth)
return storage return storage
def get_preview_short_config(user_obj, short):
return f"{'#/' if UserConfig(user_obj).PREVIEW_ROUTE_HASH else ''}{short}"

@ -7,7 +7,8 @@ from rest_framework.exceptions import ValidationError
from api import models from api import models
from api.utils.apputils import bytes2human from api.utils.apputils import bytes2human
from api.utils.modelutils import get_user_domain_name, get_app_domain_name, get_app_download_uri, get_user_storage_used from api.utils.modelutils import get_user_domain_name, get_app_domain_name, get_app_download_uri, get_user_storage_used, \
get_preview_short_config
from common.base.baseutils import get_choices_dict, WeixinLoginUid from common.base.baseutils import get_choices_dict, WeixinLoginUid
from common.cache.storage import AdPicShowCache from common.cache.storage import AdPicShowCache
from common.core.sysconfig import Config, UserConfig from common.core.sysconfig import Config, UserConfig
@ -153,19 +154,7 @@ class AppsSerializer(serializers.ModelSerializer):
preview_url = serializers.SerializerMethodField() preview_url = serializers.SerializerMethodField()
def get_preview_url(self, obj): def get_preview_url(self, obj):
return get_app_download_uri(None, obj.user_id, obj) return f"{get_app_download_uri(None, obj.user_id, obj)}/{get_preview_short_config(obj.user_id, obj.short)}"
# private_developer_number = serializers.IntegerField(default=0)
# count = serializers.IntegerField(default=0)
#
# def get_private_developer_number(self, obj):
# return models.AppleDeveloperToAppUse.objects.filter(app_id=obj).count()
#
# private_developer_used_number = serializers.IntegerField(default=0)
#
# def get_private_developer_used_number(self, obj):
# return models.DeveloperDevicesID.objects.filter(app_id=obj,
# developerid__appledevelopertoappuse__app_id=obj).distinct().count()
domain_name = serializers.SerializerMethodField() domain_name = serializers.SerializerMethodField()

@ -13,12 +13,12 @@ from rest_framework.views import APIView
from api.models import Apps, AppReleaseInfo from api.models import Apps, AppReleaseInfo
from api.utils.modelutils import get_filename_form_file, check_app_domain_name_access, \ from api.utils.modelutils import get_filename_form_file, check_app_domain_name_access, \
ad_random_weight, get_app_download_uri ad_random_weight, get_app_download_uri, get_preview_short_config
from api.utils.response import BaseResponse from api.utils.response import BaseResponse
from api.utils.serializer import AppsShortSerializer, AppAdInfoSerializer from api.utils.serializer import AppsShortSerializer, AppAdInfoSerializer
from api.utils.signalutils import run_get_xsign_binary_file from api.utils.signalutils import run_get_xsign_binary_file
from common.base.baseutils import get_origin_domain_name, format_get_uri, make_random_uuid, make_resigned from common.base.baseutils import get_origin_domain_name, format_get_uri, make_random_uuid, make_resigned
from common.core.decorators import cache_response # 本来使用的是 drf-extensions==0.7.0 但是还未支持该版本Django from common.core.decorators import cache_response
from common.core.response import mobileprovision_file_response, file_response, ApiResponse from common.core.response import mobileprovision_file_response, file_response, ApiResponse
from common.core.sysconfig import Config from common.core.sysconfig import Config
from common.core.throttle import VisitShortThrottle, InstallShortThrottle, InstallThrottle1, InstallThrottle2 from common.core.throttle import VisitShortThrottle, InstallShortThrottle, InstallThrottle1, InstallThrottle2
@ -124,7 +124,8 @@ class ShortDownloadView(APIView):
res.code = 1000 res.code = 1000
res.domain_name = domain_name res.domain_name = domain_name
res.redirect = True res.redirect = True
res.data = format_get_uri(domain_name, short, {'release_id': release_id, 'udid': udid}) res.data = format_get_uri(domain_name, get_preview_short_config(user_obj, short),
{'release_id': release_id, 'udid': udid})
return Response(res.dict) return Response(res.dict)
if udid: if udid:
if not app_obj.issupersign: if not app_obj.issupersign:

@ -445,6 +445,10 @@ class UserPersonalConfKeyCache(ConfigCacheBase):
def DEVELOPER_STATUS_CONFIG(self): def DEVELOPER_STATUS_CONFIG(self):
return super().get_value('DEVELOPER_STATUS_CONFIG', USERPERSONALCONFIGKEY.DEVELOPER_STATUS_CONFIG) return super().get_value('DEVELOPER_STATUS_CONFIG', USERPERSONALCONFIGKEY.DEVELOPER_STATUS_CONFIG)
@property
def PREVIEW_ROUTE_HASH(self):
return super().get_value('PREVIEW_ROUTE_HASH', USERPERSONALCONFIGKEY.PREVIEW_ROUTE_HASH)
class ConfigDescriptionCache(ConfigCacheBase): class ConfigDescriptionCache(ConfigCacheBase):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):

@ -468,6 +468,7 @@ class CONFIGDESCRIPTION(object):
class USERPERSONALCONFIGKEY(object): class USERPERSONALCONFIGKEY(object):
DEVELOPER_STATUS_CONFIG = ['DEVELOPER_WAIT_ABNORMAL_STATE', 'DEVELOPER_WAIT_ABNORMAL_DEVICE', DEVELOPER_STATUS_CONFIG = ['DEVELOPER_WAIT_ABNORMAL_STATE', 'DEVELOPER_WAIT_ABNORMAL_DEVICE',
'DEVELOPER_ABNORMAL_DEVICE_WRITE'] 'DEVELOPER_ABNORMAL_DEVICE_WRITE']
PREVIEW_ROUTE_HASH = False # 预览路由模式是否是hash, 如果使用hash模式,url中就会存在“#“符号,这个符号后面的是路径。
class OSSSTORAGECONF(object): class OSSSTORAGECONF(object):

Loading…
Cancel
Save