Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions backend/apps/system/crud/assistant.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import re
import urllib
from typing import Optional

Expand Down Expand Up @@ -142,15 +143,20 @@ def get_ds_from_api(self):
raise Exception(f"Failed to get datasource list from {endpoint}, error: {result_json.get('message')}")
else:
raise Exception(f"Failed to get datasource list from {endpoint}, status code: {res.status_code}")


def get_first_element(self, text: str):
parts = re.split(r'[,;]', text.strip())
first_domain = parts[0].strip()
return first_domain

def get_complete_endpoint(self, endpoint: str) -> str | None:
if endpoint.startswith("http://") or endpoint.startswith("https://"):
return endpoint
domain_text = self.assistant.domain
if not domain_text:
return None
if ',' in domain_text:
return (self.request_origin.strip('/') if self.request_origin else domain_text.split(',')[0].strip('/')) + endpoint
if ',' in domain_text or ';' in domain_text:
return (self.request_origin.strip('/') if self.request_origin else self.get_first_element(domain_text).strip('/')) + endpoint
else:
return f"{domain_text}{endpoint}"

Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,8 @@
"ou_placeholder": "Example: ou=users,dc=example,dc=com",
"user_filter": "User Filter",
"user_filter_placeholder": "Example: uid",
"ldap_field_mapping_placeholder": "Example: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}"
"ldap_field_mapping_placeholder": "Example: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}",
"be_turned_on": "Once the test connection is confirmed to be effective, it can be enabled"
},
"login": {
"default_login": "Default",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,8 @@
"ou_placeholder": "예: ou=users,dc=example,dc=com",
"user_filter": "사용자 필터",
"user_filter_placeholder": "예: uid",
"ldap_field_mapping_placeholder": "예: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}"
"ldap_field_mapping_placeholder": "예: {\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"}",
"be_turned_on": "테스트 연결이 유효한 것으로 확인되면 활성화할 수 있습니다"
},
"login": {
"default_login": "기본값",
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -764,7 +764,8 @@
"ou_placeholder": "例如:ou=users,dc=example,dc=com",
"user_filter": "用户过滤器",
"user_filter_placeholder": "例如:uid",
"ldap_field_mapping_placeholder": "例如:{'{'}\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"{'}'}"
"ldap_field_mapping_placeholder": "例如:{'{'}\"account\": \"ldapAccount\", \"name\": \"ldapName\", \"email\": \"mail\"{'}'}",
"be_turned_on": "测试连接有效后,可开启"
},
"login": {
"default_login": "默认",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/system/authentication/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
v-if="!item.valid"
class="box-item"
effect="dark"
:content="t('system.be_turned_on')"
:content="t('authentication.be_turned_on')"
placement="top"
>
<el-switch
Expand Down