fix: 嵌入式js

This commit is contained in:
shaohuzhang1 2024-03-14 11:46:18 +08:00
parent 0fbd5873f7
commit 20cefe8207
2 changed files with 5 additions and 6 deletions

View File

@ -118,11 +118,10 @@ class ApplicationSerializer(serializers.Serializer):
file = open(index_path, "r", encoding='utf-8')
content = file.read()
file.close()
is_auth = 'true'
try:
ApplicationSerializer.Authentication(data={'access_token': self.data.get('token')}).auth()
except Exception as e:
is_auth = 'false'
application_access_token = QuerySet(ApplicationAccessToken).filter(
access_token=self.data.get('token')).first()
is_auth = 'true' if application_access_token is not None and application_access_token.is_active else 'false'
application_access_token = QuerySet(ApplicationAccessToken).filter(
access_token=self.data.get('token')).first()
t = Template(content)

View File

@ -289,7 +289,7 @@ function embedChatbot() {
white_list_str='{{white_list_str}}'
white_list=white_list_str.split(',')
if ({{is_auth}}&&{{white_active}}?white_list.includes(window.location.origin):true) {
if ({{is_auth}}&&({{white_active}}?white_list.includes(window.location.origin):true)) {
// 初始化maxkb智能小助手
initMaxkb()
} else console.error('invalid parameter')