Skip to content

Commit a7ff0e5

Browse files
committed
feat: 添加环境变量配置,更新云端存储和授权服务器的默认设置
1 parent 6bfd5fd commit a7ff0e5

File tree

6 files changed

+16
-6
lines changed

6 files changed

+16
-6
lines changed

.env.example

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Classworks KV 默认服务器域名
2+
VITE_DEFAULT_KV_SERVER=https://kv.wuyuan.dev
3+
4+
# Classworks KV 授权服务器域名
5+
VITE_DEFAULT_AUTH_SERVER=https://kv.houlang.cloud

.github/workflows/deploy.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
node-version: "20.x"
3333

3434
- name: Build
35+
env:
36+
VITE_APP_ID: d158067f53627d2b98babe8bffd2fd7d
37+
VITE_DEFAULT_KV_SERVER: https://kv.wuyuan.dev
38+
VITE_DEFAULT_AUTH_SERVER: https://kv.houlang.cloud
3539
run: |
3640
npm install
3741
npm run build

src/components/settings/cards/CloudNamespaceInfoCard.vue

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
<br/><br/>Classworks KV 的全域管理员是 <a href="https://wuyuan.dev" target="_blank">孙悟元</a></v-card-text
7575
><v-card-actions
7676
><v-btn
77-
href="https://kv.houlang.cloud"
77+
:href="defaultAuthServer"
7878
class="text-none"
7979
append-icon="mdi-open-in-new"
8080
target="_blank"
@@ -130,7 +130,7 @@
130130

131131
<script>
132132
import { kvServerProvider } from "@/utils/providers/kvServerProvider";
133-
import { setSetting } from "@/utils/settings";
133+
import { setSetting, getSetting } from "@/utils/settings";
134134
135135
export default {
136136
name: "CloudNamespaceInfoCard",
@@ -146,6 +146,7 @@ export default {
146146
loading: false,
147147
hasNamespaceInfo: false,
148148
showReinitDialog: false, // 确认对话框显示状态
149+
defaultAuthServer: getSetting('server.authDomain'),
149150
};
150151
},
151152
watch: {

src/pages/settings.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
icon="mdi-menu"
1212
variant="text"
1313
@click="drawer = !drawer"
14-
class="d-md-none"
14+
1515
/>
1616
</template>
1717
<v-app-bar-title class="text-h6">设置</v-app-bar-title>

src/utils/dataProvider.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ export default {
183183
if (autoConfigureCloud) {
184184
// 使用classworksCloudDefaults配置
185185
const classworksCloudDefaults = {
186-
"server.domain": "https://kv.wuyuan.dev",
186+
"server.domain": import.meta.env.VITE_DEFAULT_KV_SERVER || "https://kv.wuyuan.dev",
187187
"server.siteKey": "",
188188
};
189189

src/utils/settings.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ const SETTINGS_STORAGE_KEY = "Classworks_settings";
6868

6969
// 新增: Classworks云端存储的默认设置
7070
const classworksCloudDefaults = {
71-
"server.domain": "https://kv.wuyuan.dev",
71+
"server.domain": import.meta.env.VITE_DEFAULT_KV_SERVER || "https://kv.wuyuan.dev",
7272
//"server.domain": "http://localhost:3030",
7373
"server.siteKey": "",
7474
};
@@ -206,7 +206,7 @@ const settingsDefinitions = {
206206
},
207207
"server.authDomain": {
208208
type: "string",
209-
default: "https://kv.houlang.cloud",
209+
default: import.meta.env.VITE_DEFAULT_AUTH_SERVER || "https://kv.houlang.cloud",
210210
description: "授权服务器域名",
211211
icon: "mdi-shield-account",
212212
validate: (value) => {

0 commit comments

Comments
 (0)