diff --git a/packages/app-console/src/api/oss.js b/packages/app-console/src/api/oss.js index 3e3794bba6..58e94fb9dd 100644 --- a/packages/app-console/src/api/oss.js +++ b/packages/app-console/src/api/oss.js @@ -91,14 +91,13 @@ export async function deleteBucket(bucketName) { } /** - * 获取当前应用的指定文件桶的服务地址 + * get bucket's url * @param {*} bucket * @returns */ export function getBucketUrl(bucket) { const appid = store.state.app.appid - const domain = store.state.app.storage_deploy_host - const schema = store.state.app.storage_deploy_url_schema || 'http' - const url = `${schema}://${appid}-${bucket}.${domain}` + const endpoint = store.state.app.oss_external_endpoint + const url = `${endpoint}/${appid}-${bucket}` return url } \ No newline at end of file diff --git a/packages/app-console/src/store/modules/app.js b/packages/app-console/src/store/modules/app.js index 31b3af5d55..f93639d259 100644 --- a/packages/app-console/src/store/modules/app.js +++ b/packages/app-console/src/store/modules/app.js @@ -31,7 +31,9 @@ const state = { app_deploy_host: null, app_deploy_url_schema: 'http', storage_deploy_host: null, - storage_deploy_url_schema: 'http' + storage_deploy_url_schema: 'http', + oss_internal_endpoint: null, + oss_external_endpoint: null, } const mutations = { @@ -60,6 +62,9 @@ const mutations = { SET_STORAGE_DEPLOY_HOST: (state, domain) => { state.storage_deploy_host = domain }, + SET_OSS_EXTERNAL_ENDPOINT: (state, endpoint) => { + state.oss_external_endpoint = endpoint + }, SET_STORAGE_DEPLOY_URL_SCHEMA: (state, schema) => { state.storage_deploy_url_schema = schema }, @@ -92,6 +97,7 @@ const actions = { commit('SET_APP_DEPLOY_HOST', res.data?.app_deploy_host) commit('SET_APP_DEPLOY_URL_SCHEMA', res.data?.app_deploy_url_schema) commit('SET_STORAGE_DEPLOY_HOST', res.data?.storage_deploy_host) + commit('SET_OSS_EXTERNAL_ENDPOINT', res.data?.oss_external_endpoint) commit('SET_STORAGE_DEPLOY_URL_SCHEMA', res.data?.storage_deploy_url_schema) }, clearStates({ commit }) { diff --git a/packages/app-console/src/views/storage/buckets.vue b/packages/app-console/src/views/storage/buckets.vue index 0198c68937..4ca78cf8ae 100644 --- a/packages/app-console/src/views/storage/buckets.vue +++ b/packages/app-console/src/views/storage/buckets.vue @@ -174,9 +174,9 @@ export default { this.$refs['dataForm'].validate(async(valid) => { if (!valid) { return } - const isNameValid = /^[A-Za-z0-9\-]{1,16}$/g.test(this.form.name) + const isNameValid = /^[A-Za-z0-9]{1,16}$/g.test(this.form.name) if (!isNameValid) { - return showError('Bucket 名称长度必须在 1~16 之间,且只能包含字母、数字和中划线') + return showError('Bucket 名称长度必须在 1~16 之间,且只能包含字母、数字') } // 执行创建请求 diff --git a/packages/system-server/src/router/application/get.ts b/packages/system-server/src/router/application/get.ts index 1d6155cf34..4fb878dfc8 100644 --- a/packages/system-server/src/router/application/get.ts +++ b/packages/system-server/src/router/application/get.ts @@ -78,6 +78,8 @@ export async function handleGetApplicationByAppid(req: Request, res: Response) { const app_deploy_url_schema = Config.APP_SERVICE_DEPLOY_URL_SCHEMA const storage_deploy_host = Config.STORAGE_SERVICE_CONFIG.deploy_host const storage_deploy_url_schema = Config.STORAGE_SERVICE_CONFIG.schema + const oss_external_endpoint = Config.MINIO_CONFIG.endpoint.external + const oss_internal_endpoint = Config.MINIO_CONFIG.endpoint.internal app.config = undefined return res.send({ @@ -90,7 +92,9 @@ export async function handleGetApplicationByAppid(req: Request, res: Response) { app_deploy_host, app_deploy_url_schema, storage_deploy_host, - storage_deploy_url_schema + storage_deploy_url_schema, + oss_external_endpoint, + oss_internal_endpoint } }) } \ No newline at end of file