From 31cf574da5275069d538efbdba1262a16c341f1d Mon Sep 17 00:00:00 2001 From: Germey Date: Sun, 7 Jan 2024 14:13:44 +0800 Subject: [PATCH 1/3] add --- hub.config.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 hub.config.js diff --git a/hub.config.js b/hub.config.js new file mode 100644 index 0000000..dcb30b2 --- /dev/null +++ b/hub.config.js @@ -0,0 +1,20 @@ +module.exports = { + site: { + logo: { + url: 'https://hub.zhishuyun.com/assets/logo.da8de841.svg', + width: 'auto', + height: 'auto' + } + }, + apps: { + chat: { + enabled: true + }, + midjourney: { + enabled: true + } + }, + distribution: { + inviterId: '123' + } +}; From 785941a669449121d7b277b06542cf7f47818053 Mon Sep 17 00:00:00 2001 From: Germey Date: Sun, 7 Jan 2024 14:17:13 +0800 Subject: [PATCH 2/3] chagne log --- ...zhishuyun-hub-3b8e7fee-8ae8-4ea3-aedb-19b2411ab13c.json | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 change/@zhishuyun-hub-3b8e7fee-8ae8-4ea3-aedb-19b2411ab13c.json diff --git a/change/@zhishuyun-hub-3b8e7fee-8ae8-4ea3-aedb-19b2411ab13c.json b/change/@zhishuyun-hub-3b8e7fee-8ae8-4ea3-aedb-19b2411ab13c.json new file mode 100644 index 0000000..4588b1f --- /dev/null +++ b/change/@zhishuyun-hub-3b8e7fee-8ae8-4ea3-aedb-19b2411ab13c.json @@ -0,0 +1,7 @@ +{ + "type": "minor", + "comment": "add config support global", + "packageName": "@zhishuyun/hub", + "email": "cqc@cuiqingcai.com", + "dependentChangeType": "patch" +} From 7c66f9e29a91a5a1e63bcce822fc07939945ca91 Mon Sep 17 00:00:00 2001 From: Germey Tsui Date: Sun, 7 Jan 2024 17:51:30 +0800 Subject: [PATCH 3/3] update styles --- src/components/common/AuthPanel.vue | 10 +- src/components/common/Chevron.vue | 38 ++++++ src/components/common/Navigator.vue | 146 ++++++++++++++++++----- src/components/console/SidePanel.vue | 16 ++- src/config.ts | 62 ++++++++++ src/env.d.ts | 3 + src/i18n/zh/common/nav.ts | 2 +- src/layouts/Chat.vue | 2 +- src/layouts/Console.vue | 9 +- src/layouts/Main.vue | 1 - src/layouts/Midjourney.vue | 2 +- src/main.ts | 6 + src/pages/console/distribution/Index.vue | 3 + src/plugins/config.ts | 14 +++ src/plugins/font-awesome.ts | 4 +- src/store/common/models.ts | 4 +- src/store/common/state.ts | 4 + tsconfig.json | 2 +- 18 files changed, 278 insertions(+), 50 deletions(-) create mode 100644 src/components/common/Chevron.vue create mode 100644 src/config.ts create mode 100644 src/plugins/config.ts diff --git a/src/components/common/AuthPanel.vue b/src/components/common/AuthPanel.vue index 06db452..3fa5e0d 100644 --- a/src/components/common/AuthPanel.vue +++ b/src/components/common/AuthPanel.vue @@ -27,7 +27,15 @@ export default defineComponent({ return `${getBaseUrlAuth()}/auth/login?inviter_id=${this.inviterId}`; }, inviterId() { - const result = this.$route.query.inviter_id?.toString() || getCookie('INVITER_ID'); + // if forceInviterId is set, then use forceInviterId + if (this.$config?.distribution?.forceInviterId) { + return this.$config?.distribution?.defaultInviterId; + } + // Otherwise, use the inviter_id in the url, then use the inviter_id in the cookie, and finally use the default inviter_id + const result = + this.$route.query.inviter_id?.toString() || + getCookie('INVITER_ID') || + this.$config?.distribution?.defaultInviterId; return result; }, authenticated() { diff --git a/src/components/common/Chevron.vue b/src/components/common/Chevron.vue new file mode 100644 index 0000000..374131f --- /dev/null +++ b/src/components/common/Chevron.vue @@ -0,0 +1,38 @@ + + + + + diff --git a/src/components/common/Navigator.vue b/src/components/common/Navigator.vue index 58819c7..01e3e27 100644 --- a/src/components/common/Navigator.vue +++ b/src/components/common/Navigator.vue @@ -1,13 +1,26 @@