diff --git a/fir_client/src/components/FirAppInfosBase.vue b/fir_client/src/components/FirAppInfosBase.vue
index cbaea2f..a3c1dbd 100644
--- a/fir_client/src/components/FirAppInfosBase.vue
+++ b/fir_client/src/components/FirAppInfosBase.vue
@@ -137,7 +137,8 @@
}
},
appDownload() {
- this.$router.push({name: 'FirDownload', params: {short: this.appinfos.short}})
+ window.open(location.origin + '/' + this.appinfos.short,'target','');
+ // this.$router.push({name: 'FirDownload', params: {short: this.appinfos.short}})
},
defaulttimeline() {
this.setfunactive('timeline', 5);
diff --git a/fir_client/src/components/FirAppInfossecurity.vue b/fir_client/src/components/FirAppInfossecurity.vue
index e2cf87a..7e69ae4 100644
--- a/fir_client/src/components/FirAppInfossecurity.vue
+++ b/fir_client/src/components/FirAppInfossecurity.vue
@@ -41,6 +41,13 @@
默认开启,关闭之后用户无法通过短连接访问下载该应用
+
+
+
+ 保存
+
@@ -122,7 +129,8 @@
wxeasytypeflag: false,
wxredirectflag: false,
clecount: 0,
- wxeasy_disable: false
+ wxeasy_disable: false,
+ defualt_dtitle: '专属下载页域名',
}
},
methods: {
@@ -137,6 +145,11 @@
this.saveappinfo({"clean": true});
this.currentapp.count = 0;
},
+ save_app_domain() {
+ this.saveappinfo({
+ "domain_name": this.currentapp.domain_name,
+ });
+ },
saveappinfo(data) {
apputils(data => {
if (data.code === 1000) {
@@ -364,6 +377,11 @@
this.set_default_flag();
this.setbuttondefault(this.currentapp);
this.orgcurrentapp = deepCopy(this.currentapp);
+ if(!this.currentapp.domain_name || this.currentapp.domain_name.length < 3){
+ if(this.$store.state.userinfo.domain_name && this.$store.state.userinfo.domain_name.length > 3){
+ this.defualt_dtitle = this.$store.state.userinfo.domain_name;
+ }
+ }
}
},
mounted() {
diff --git a/fir_ser/api/migrations/0013_auto_20210128_1815.py b/fir_ser/api/migrations/0013_auto_20210128_1815.py
new file mode 100644
index 0000000..1cec7dd
--- /dev/null
+++ b/fir_ser/api/migrations/0013_auto_20210128_1815.py
@@ -0,0 +1,23 @@
+# Generated by Django 3.0.3 on 2021-01-28 18:15
+
+from django.db import migrations, models
+
+
+class Migration(migrations.Migration):
+
+ dependencies = [
+ ('api', '0012_auto_20210127_2101'),
+ ]
+
+ operations = [
+ migrations.AddField(
+ model_name='apps',
+ name='domain_name',
+ field=models.CharField(blank=True, max_length=64, null=True, verbose_name='专属访问域名'),
+ ),
+ migrations.AlterField(
+ model_name='apps',
+ name='wxeasytype',
+ field=models.BigIntegerField(default=True, verbose_name='微信内简易模式,避免微信封停'),
+ ),
+ ]
diff --git a/fir_ser/api/models.py b/fir_ser/api/models.py
index 31dc3ad..29f16b7 100644
--- a/fir_ser/api/models.py
+++ b/fir_ser/api/models.py
@@ -114,7 +114,8 @@ class Apps(models.Model):
isshow = models.BigIntegerField(verbose_name="下载页可见", default=1)
issupersign = models.BigIntegerField(verbose_name="是否超级签名包", default=False)
wxredirect = models.BigIntegerField(verbose_name="微信内第三方链接自动跳转", default=True)
- wxeasytype = models.BigIntegerField(verbose_name="微信内简易房屋,避免微信封停", default=True)
+ wxeasytype = models.BigIntegerField(verbose_name="微信内简易模式,避免微信封停", default=True)
+ domain_name = models.CharField(verbose_name="专属访问域名", blank=True, null=True, max_length=64)
description = models.TextField('描述', blank=True, null=True, default=None, )
updated_time = models.DateTimeField(auto_now=True, verbose_name="更新时间")
diff --git a/fir_ser/api/utils/app/supersignutils.py b/fir_ser/api/utils/app/supersignutils.py
index f9bfbfe..a380c20 100644
--- a/fir_ser/api/utils/app/supersignutils.py
+++ b/fir_ser/api/utils/app/supersignutils.py
@@ -136,9 +136,12 @@ def get_http_server_doamin(request):
return server_domain
-def get_redirect_server_domain(request, user_obj=None):
+def get_redirect_server_domain(request, user_obj=None, app_domain_name=None):
if user_obj:
- domain_name = user_obj.domain_name
+ if app_domain_name and len(app_domain_name) > 3:
+ domain_name = app_domain_name
+ else:
+ domain_name = user_obj.domain_name
else:
domain_name = None
if domain_name and len(domain_name) > 3:
diff --git a/fir_ser/api/utils/serializer.py b/fir_ser/api/utils/serializer.py
index 64486ca..7d1577b 100644
--- a/fir_ser/api/utils/serializer.py
+++ b/fir_ser/api/utils/serializer.py
@@ -88,7 +88,7 @@ class AppsShortSerializer(serializers.ModelSerializer):
class Meta:
model = models.Apps
fields = ["app_id", "name", "short", "has_combo", "isshow", "description", "need_password", 'master_release',
- 'type', 'issupersign', 'wxeasytype', 'wxredirect']
+ 'type', 'issupersign', 'wxeasytype', 'wxredirect', 'domain_name']
need_password = serializers.SerializerMethodField()
diff --git a/fir_ser/api/utils/storage/caches.py b/fir_ser/api/utils/storage/caches.py
index ff46de2..943be26 100644
--- a/fir_ser/api/utils/storage/caches.py
+++ b/fir_ser/api/utils/storage/caches.py
@@ -253,7 +253,10 @@ def login_auth_failed(act, email):
cache.delete(auth_code_key)
-def set_default_app_wx_easy(user_obj):
- app_obj_lists = Apps.objects.filter(user_id=user_obj)
- for app_obj in app_obj_lists:
+def set_default_app_wx_easy(user_obj, app_obj=None):
+ if app_obj:
del_cache_response_by_short(app_obj.app_id)
+ else:
+ app_obj_lists = Apps.objects.filter(user_id=user_obj)
+ for app_obj in app_obj_lists:
+ del_cache_response_by_short(app_obj.app_id)
diff --git a/fir_ser/api/views/apps.py b/fir_ser/api/views/apps.py
index 2b24de3..a99b04a 100644
--- a/fir_ser/api/views/apps.py
+++ b/fir_ser/api/views/apps.py
@@ -16,7 +16,9 @@ from api.models import Apps, AppReleaseInfo, APPToDeveloper, AppIOSDeveloperInfo
from api.utils.serializer import AppsSerializer, AppReleaseSerializer, UserInfoSerializer
from rest_framework.pagination import PageNumberPagination
import logging
-
+from fir_ser.settings import CACHE_KEY_TEMPLATE, SERVER_DOMAIN, REGISTER, LOGIN
+from api.utils.storage.caches import set_default_app_wx_easy
+from api.utils.utils import is_valid_domain
logger = logging.getLogger(__name__)
@@ -152,6 +154,7 @@ class AppInfoView(APIView):
return Response(res.dict)
has_combo = data.get("has_combo", None)
+ domain_name = data.get("domain_name", None)
if has_combo:
actions = has_combo.get("action", None)
hcombo_id = has_combo.get("hcombo_id", None)
@@ -177,6 +180,40 @@ class AppInfoView(APIView):
logger.error("app_id:%s actions:%s hcombo_id:%s Exception:%s" % (app_id, actions, hcombo_id, e))
res.code = 1004
res.msg = "该应用已经关联"
+ elif domain_name:
+ apps_obj = Apps.objects.filter(user_id=request.user, app_id=app_id).first()
+ logger.info("app_id:%s update old data:%s" % (app_id, apps_obj.__dict__))
+ if domain_name:
+ domain_name_list = domain_name.strip(' ').replace("http://", "").replace("https://", "").split("/")
+ if len(domain_name_list) > 0:
+ domain_name = domain_name_list[0]
+ if len(domain_name) > 3 and is_valid_domain(domain_name_list[0]):
+ if domain_name == SERVER_DOMAIN.get("REDIRECT_UDID_DOMAIN").split("//")[1]:
+ admin_storage = UserInfo.objects.filter(is_superuser=True).order_by('pk').first()
+ if admin_storage and admin_storage.uid == request.user.uid:
+ apps_obj.domain_name = domain_name
+ set_default_app_wx_easy(request.user, apps_obj)
+ else:
+ serializer = UserInfoSerializer(request.user)
+ res.data = serializer.data
+ res.code = 1004
+ res.msg = "域名设置失败,请更换其他域名"
+ return Response(res.dict)
+ else:
+ apps_obj.domain_name = domain_name
+ set_default_app_wx_easy(request.user, apps_obj)
+ else:
+ res.code = 1004
+ res.msg = "域名校验失败"
+ return Response(res.dict)
+
+ if domain_name == '':
+ apps_obj.domain_name = None
+ apps_obj.wxeasytype = True
+ set_default_app_wx_easy(request.user, apps_obj)
+ apps_obj.save()
+ del_cache_response_by_short(apps_obj.app_id)
+ return Response(res.dict)
else:
try:
apps_obj = Apps.objects.filter(user_id=request.user, app_id=app_id).first()
@@ -186,6 +223,7 @@ class AppInfoView(APIView):
apps_obj.name = data.get("name", apps_obj.name)
apps_obj.password = data.get("password", apps_obj.password)
apps_obj.isshow = data.get("isshow", apps_obj.isshow)
+ apps_obj.domain_name = data.get("domain_name", apps_obj.domain_name)
if request.user.domain_name and len(request.user.domain_name) > 3:
apps_obj.wxeasytype = data.get("wxeasytype", apps_obj.wxeasytype)
else:
diff --git a/fir_ser/api/views/download.py b/fir_ser/api/views/download.py
index e7e486a..4f6d834 100644
--- a/fir_ser/api/views/download.py
+++ b/fir_ser/api/views/download.py
@@ -162,7 +162,7 @@ class ShortDownloadView(APIView):
"storage": Storage(app_obj.user_id)})
res.data = app_serializer.data
res.udid = udid
- res.domain_name = get_redirect_server_domain(request, app_obj.user_id)
+ res.domain_name = get_redirect_server_domain(request, app_obj.user_id, app_serializer.data['domain_name'])
return Response(res.dict)
# key的设置