refactor(frontend): 地址栏改成动态显示当前 host,不再写死任何域名

上次 filter-repo 把 api.wangjinding.com 直接替换成 127.0.0.1:8808,
是写死的 —— 用户从自己域名访问时会显示错误的地址。

这次改成 location.host:
  · SideNav 的 logo 下方 → {{ apiHost }}(= location.host)
  · MainLayout 副标题兜底 → location.host
  · i18n 的「已连接 <域名>」→「已连接」
  · 前端重新 build(不是打补丁),产物里没有任何写死的地址

实测:
  http://localhost:8808  → 侧栏 localhost:8808 | 已连接
  http://127.0.0.1:8808  → 侧栏 127.0.0.1:8808 | 已连接

顺带修掉 filter-repo 留下的一个错误 scheme:
  gateway.yaml 的 cors 里出现了 https://127.0.0.1:8808(应为 http),已删除。
This commit is contained in:
Jidekin committed 2026-11-20 17:22:32 +08:00
1 parent ebbe64ce61
commit feb055d4e6
10 files changed
+17 -17

No files matched your search

+1 -1
View File
@@ -161,7 +161,7 @@ const pageSub = computed(() => {
const key = String(route.name || '')
const sub = t(`nav.sub${key}`)
// 没写副标题的页面,t() 会把 key 原样返回 —— 这时显示连接地址兜底
return sub.startsWith('nav.') ? '127.0.0.1:8808' : sub
return sub.startsWith('nav.') ? location.host : sub
})
function onTheme(cmd: string | number | object) {
+2 -1
View File
@@ -5,7 +5,7 @@
<span class="logo"><Icon name="bolt" :size="17" /></span>
<div>
<b>{{ t('nav.title') }}</b>
<span>127.0.0.1:8808</span>
<span>{{ apiHost }}</span>
</div>
</div>
@@ -33,6 +33,7 @@
</template>
<script setup lang="ts">
const apiHost = location.host
import { onMounted, onUnmounted, ref } from 'vue'
import { useRoute } from 'vue-router'
import { useI18n } from 'vue-i18n'
+1 -1
View File
@@ -66,7 +66,7 @@ export default {
nav: {
title: 'Xiaoyin Gateway',
connected: 'Connected to 127.0.0.1:8808',
connected: 'Connected',
disconnected: 'Connection error',
menudashboard: 'Dashboard',
menuchat: 'Chat',
+1 -1
View File
@@ -66,7 +66,7 @@ export default {
nav: {
title: '小银网关',
connected: '已连接 127.0.0.1:8808',
connected: '已连接',
disconnected: '连接异常',
menudashboard: '仪表盘',
menuchat: '对话',