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
6 changes: 3 additions & 3 deletions backend/apps/dashboard/crud/dashboard_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,11 @@ def load_resource(session: SessionDep, dashboard: QueryDashboard):
sql = text("""
SELECT cd.*,
creator.name AS create_name,
updator.name AS update_name
updater.name AS update_name
FROM core_dashboard cd
LEFT JOIN sys_user creator ON cd.create_by = creator.id::varchar
LEFT JOIN sys_user updator
ON cd.update_by = updator.id:: varchar
LEFT JOIN sys_user updater
ON cd.update_by = updater.id:: varchar
WHERE cd.id = :dashboard_id
""")
result = session.execute(sql, {"dashboard_id": dashboard.id}).mappings().first()
Expand Down
4 changes: 3 additions & 1 deletion backend/common/core/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ class Settings(BaseSettings):
extra="ignore",
)
PROJECT_NAME: str = "SQLBot"
API_V1_STR: str = "/api/v1"
#CONTEXT_PATH: str = "/sqlbot"
CONTEXT_PATH: str = ""
API_V1_STR: str = CONTEXT_PATH + "/api/v1"
SECRET_KEY: str = secrets.token_urlsafe(32)
# 60 minutes * 24 hours * 8 days = 8 days
ACCESS_TOKEN_EXPIRE_MINUTES: int = 60 * 24 * 8
Expand Down
7 changes: 7 additions & 0 deletions backend/common/utils/whitelist.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ def is_whitelisted(self, path: str) -> bool:
prefix = settings.API_V1_STR
if path.startswith(prefix):
path = path[len(prefix):]

context_prefix = settings.CONTEXT_PATH
if context_prefix and path.startswith(context_prefix):
path = path[len(context_prefix):]

if not path:
path = '/'
if path in self.whitelist:
return True

Expand Down
9 changes: 7 additions & 2 deletions frontend/src/components/layout/Person.vue
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ const account = computed(() => userStore.getAccount)
const currentLanguage = computed(() => userStore.getLanguage)
const isAdmin = computed(() => userStore.isAdmin)
const isLocalUser = computed(() => !userStore.getOrigin)

const platFlag = computed(() => {
const platformInfo = userStore.getPlatformInfo
return platformInfo?.flag || 0
})
const dialogVisible = ref(false)
const apikeyDialogVisible = ref(false)
const aboutRef = ref()
Expand Down Expand Up @@ -125,7 +130,7 @@ const logout = async () => {
</el-icon>
<div class="datasource-name">{{ $t('common.system_manage') }}</div>
</div>
<div v-if="isLocalUser" class="popover-item" @click="openPwd">
<div v-if="isLocalUser && !platFlag" class="popover-item" @click="openPwd">
<el-icon size="16">
<icon_key_outlined></icon_key_outlined>
</el-icon>
Expand Down Expand Up @@ -177,7 +182,7 @@ const logout = async () => {
<div class="datasource-name">{{ $t('common.help') }}</div>
</div>
<div style="height: 4px; width: 100%"></div>
<div class="popover-item mr4" @click="logout">
<div v-if="platFlag <= 5" class="popover-item mr4" @click="logout">
<el-icon size="16">
<icon_logout_outlined></icon_logout_outlined>
</el-icon>
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"creator": "Creator",
"dashboard_id": "Dashboard ID",
"create_time": "Create Time",
"updator": "Updater",
"updater": "Updater",
"update_time": "Update Time",
"edit": "Edit",
"edit_title": "Edit Title",
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/i18n/ko-KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"creator": "생성자",
"dashboard_id": "대시보드 ID",
"create_time": "생성 시간",
"updator": "업데이트자",
"updater": "업데이트자",
"update_time": "업데이트 시간",
"edit": "편집",
"edit_title": "제목 편집",
Expand Down Expand Up @@ -852,4 +852,4 @@
"to_doc": "API 보기",
"trigger_limit": "최대 {0}개의 API 키 생성 지원"
}
}
}
2 changes: 1 addition & 1 deletion frontend/src/i18n/zh-CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@
"creator": "创建人",
"dashboard_id": "仪表板ID",
"create_time": "创建时间",
"updator": "更新人",
"updater": "更新人",
"update_time": "更新时间",
"edit": "编辑",
"edit_title": "编辑标题",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<div v-if="dashboardInfo.createName" class="info-content">{{ dashboardInfo.createName }}</div>
<div class="info-title">{{ t('dashboard.create_time') }}</div>
<div class="info-content">{{ timestampFormatDate(dashboardInfo.createTime) }}</div>
<div v-if="dashboardInfo.updateName" class="info-title">{{ t('dashboard.updator') }}</div>
<div v-if="dashboardInfo.updateName" class="info-title">{{ t('dashboard.updater') }}</div>
<div v-if="dashboardInfo.updateName" class="info-content">{{ dashboardInfo.updateName }}</div>
<div class="info-title">{{ t('dashboard.update_time') }}</div>
<div v-if="dashboardInfo.updateTime" class="info-content">
Expand Down
25 changes: 11 additions & 14 deletions frontend/src/views/login/xpack/PlatformClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,24 @@ export const loadClient = (category: LoginCategory) => {
}

const dingtalkClientRequest = async (id: string | null) => {
const dd = window['dd']
if (dd?.requestAuthCode) {
if (!id) {
const clientInfoRes = await queryClientInfo(7)
const corpId = id || clientInfoRes['corpid']
const client_id = clientInfoRes['client_id']
dd.requestAuthCode({
corpId: corpId,
clientId: client_id,
onSuccess: function (result: any) {
ElMessage.success(JSON.stringify(result))
const code = result.code
id = clientInfoRes['corpid']
}
const dd = window['dd']
dd.ready(function () {
dd.runtime.permission.requestAuthCode({
corpId: id,
onSuccess: function (info: any) {
const code = info.code
const state = `fit2cloud-dingtalk-client`
toUrl(`?code=${code}&state=${state}`)
},
onFail: function (err: any) {
console.error(err)
ElMessage.error(err)
},
})
} else {
ElMessage.error('not success')
}
})
}

const larkClientRequest = async () => {
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/views/login/xpack/WecomQr.vue
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const formatQrResult = (data: any): WecomInfo => {
state: null,
redirect_uri: null,
} as unknown as WecomInfo
result.corp_id = data.corp_id
result.corp_id = data.corpid
result.agent_id = data.agent_id
result.state = data.state || 'fit2cloud-wecom-qr'
result.redirect_uri = data.redirect_uri || getSQLBotAddr()
Expand Down
Loading