Rename product to Lingma Proxy
This commit is contained in:
@@ -198,6 +198,11 @@ func (a *App) QuitApp() {
|
||||
a.beginQuit()
|
||||
}
|
||||
|
||||
// ForceQuitApp stops the proxy and exits the desktop process immediately.
|
||||
func (a *App) ForceQuitApp() {
|
||||
a.beginQuit()
|
||||
}
|
||||
|
||||
// RequestQuitShortcut requires two shortcut presses to avoid accidental exits.
|
||||
func (a *App) RequestQuitShortcut() {
|
||||
now := time.Now()
|
||||
@@ -358,7 +363,7 @@ func (a *App) saveConfig(cfg service.Config) error {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
dir := filepath.Join(home, ".config", "lingma-ipc-proxy")
|
||||
dir := filepath.Join(home, ".config", "lingma-proxy")
|
||||
if err := os.MkdirAll(dir, 0755); err != nil {
|
||||
return err
|
||||
}
|
||||
@@ -1041,15 +1046,19 @@ func configSearchPaths() []string {
|
||||
var paths []string
|
||||
// 1. Executable directory (for dev / portable mode)
|
||||
if exe, err := os.Executable(); err == nil {
|
||||
paths = append(paths, filepath.Join(filepath.Dir(exe), "lingma-proxy.json"))
|
||||
paths = append(paths, filepath.Join(filepath.Dir(exe), "lingma-ipc-proxy.json"))
|
||||
}
|
||||
// 2. Current working directory
|
||||
if wd, err := os.Getwd(); err == nil {
|
||||
paths = append(paths, filepath.Join(wd, "lingma-proxy.json"))
|
||||
paths = append(paths, filepath.Join(wd, "lingma-ipc-proxy.json"))
|
||||
}
|
||||
// 3. User home directory
|
||||
if home, err := os.UserHomeDir(); err == nil {
|
||||
paths = append(paths, filepath.Join(home, "lingma-proxy.json"))
|
||||
paths = append(paths, filepath.Join(home, "lingma-ipc-proxy.json"))
|
||||
paths = append(paths, filepath.Join(home, ".config", "lingma-proxy", "config.json"))
|
||||
paths = append(paths, filepath.Join(home, ".config", "lingma-ipc-proxy", "config.json"))
|
||||
}
|
||||
return paths
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<meta charset="UTF-8"/>
|
||||
<meta content="width=device-width, initial-scale=1.0" name="viewport"/>
|
||||
<link rel="icon" type="image/png" href="/favicon.png"/>
|
||||
<title>lingma-proxy-desktop</title>
|
||||
<title>Lingma Proxy</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
@@ -6,7 +6,7 @@ import Models from './views/Models.vue'
|
||||
import Requests from './views/Requests.vue'
|
||||
import Settings from './views/Settings.vue'
|
||||
import { EventsOff, EventsOn } from '../wailsjs/runtime'
|
||||
import { ClearLogs, GetLogs, GetStatus, HideWindow, MinimizeWindow } from '../wailsjs/go/main/App.js'
|
||||
import { ClearLogs, ForceQuitApp, GetLogs, GetStatus, HideWindow, MinimizeWindow } from '../wailsjs/go/main/App.js'
|
||||
import lingmaIcon from './assets/images/lingma-icon.png'
|
||||
|
||||
const currentTab = ref('dashboard')
|
||||
@@ -105,6 +105,17 @@ async function copyEndpoint() {
|
||||
handleNotice('已复制接口地址:' + value)
|
||||
}
|
||||
|
||||
async function forceQuitApp() {
|
||||
const confirmed = window.confirm('确定要停止代理并退出应用吗?')
|
||||
if (!confirmed) return
|
||||
showToast('正在停止代理并退出应用...')
|
||||
try {
|
||||
await ForceQuitApp()
|
||||
} catch (e) {
|
||||
addLog('error', '退出应用失败:' + (e.message || String(e)))
|
||||
}
|
||||
}
|
||||
|
||||
function safeEventsOn(name, handler) {
|
||||
try {
|
||||
EventsOn(name, handler)
|
||||
@@ -215,7 +226,7 @@ onUnmounted(() => {
|
||||
</span>
|
||||
<span>
|
||||
<strong>灵码代理</strong>
|
||||
<small>IPC Proxy</small>
|
||||
<small>Proxy</small>
|
||||
</span>
|
||||
</button>
|
||||
|
||||
@@ -260,6 +271,9 @@ onUnmounted(() => {
|
||||
<button class="icon-button" type="button" :title="themeTitle()" @click="toggleTheme">
|
||||
<i class="bi" :class="themeIcon()" aria-hidden="true"></i>
|
||||
</button>
|
||||
<button class="icon-button danger-icon-button" type="button" title="停止代理并退出应用" @click="forceQuitApp">
|
||||
<i class="bi bi-power" aria-hidden="true"></i>
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
|
||||
@@ -1289,6 +1289,17 @@ button {
|
||||
border: 1px solid var(--line);
|
||||
}
|
||||
|
||||
.danger-icon-button {
|
||||
color: #b42318;
|
||||
background: rgba(254, 226, 226, 0.72);
|
||||
border-color: rgba(220, 38, 38, 0.24);
|
||||
}
|
||||
|
||||
.danger-icon-button:hover {
|
||||
color: #991b1b;
|
||||
background: rgba(254, 202, 202, 0.88);
|
||||
}
|
||||
|
||||
.primary-button:hover,
|
||||
.secondary-button:hover,
|
||||
.ghost-button:hover,
|
||||
@@ -1963,6 +1974,17 @@ button:disabled {
|
||||
background: rgba(30, 41, 59, 0.66);
|
||||
}
|
||||
|
||||
:root[data-theme='dark'] .danger-icon-button {
|
||||
color: #fecaca;
|
||||
border-color: rgba(248, 113, 113, 0.32);
|
||||
background: rgba(127, 29, 29, 0.42);
|
||||
}
|
||||
|
||||
:root[data-theme='dark'] .danger-icon-button:hover {
|
||||
color: #fff1f2;
|
||||
background: rgba(153, 27, 27, 0.62);
|
||||
}
|
||||
|
||||
:root[data-theme='dark'] .strip-actions {
|
||||
background: rgba(15, 23, 42, 0.78);
|
||||
}
|
||||
|
||||
2
desktop/frontend/wailsjs/go/main/App.d.ts
vendored
2
desktop/frontend/wailsjs/go/main/App.d.ts
vendored
@@ -7,6 +7,8 @@ export function ClearLogs():Promise<void>;
|
||||
|
||||
export function ClearRequests():Promise<void>;
|
||||
|
||||
export function ForceQuitApp():Promise<void>;
|
||||
|
||||
export function GetConfig():Promise<service.Config>;
|
||||
|
||||
export function GetDetectionInfo():Promise<main.DetectionInfo>;
|
||||
|
||||
@@ -10,6 +10,10 @@ export function ClearRequests() {
|
||||
return window['go']['main']['App']['ClearRequests']();
|
||||
}
|
||||
|
||||
export function ForceQuitApp() {
|
||||
return window['go']['main']['App']['ForceQuitApp']();
|
||||
}
|
||||
|
||||
export function GetConfig() {
|
||||
return window['go']['main']['App']['GetConfig']();
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ func main() {
|
||||
enableInspector := os.Getenv("LINGMA_DESKTOP_DEBUG") == "1"
|
||||
|
||||
err := wails.Run(&options.App{
|
||||
Title: "Lingma IPC Proxy",
|
||||
Title: "Lingma Proxy",
|
||||
Width: 1100,
|
||||
Height: 750,
|
||||
MinWidth: 900,
|
||||
@@ -40,7 +40,7 @@ func main() {
|
||||
OnBeforeClose: app.beforeClose,
|
||||
OnDomReady: app.onDomReady,
|
||||
SingleInstanceLock: &options.SingleInstanceLock{
|
||||
UniqueId: "lingma-ipc-proxy-desktop",
|
||||
UniqueId: "lingma-proxy-desktop",
|
||||
OnSecondInstanceLaunch: app.onSecondInstanceLaunch,
|
||||
},
|
||||
Bind: []interface{}{
|
||||
@@ -57,8 +57,8 @@ func main() {
|
||||
HideToolbarSeparator: true,
|
||||
},
|
||||
About: &mac.AboutInfo{
|
||||
Title: "Lingma IPC Proxy",
|
||||
Message: "A desktop GUI for lingma-ipc-proxy",
|
||||
Title: "Lingma Proxy",
|
||||
Message: "A desktop GUI for Lingma Proxy",
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -86,7 +86,7 @@ func appMenu(app *App) *menu.Menu {
|
||||
app.MinimizeWindow()
|
||||
})
|
||||
appMenu.AddSeparator()
|
||||
appMenu.AddText("退出 Lingma IPC Proxy", quitAccelerator, func(_ *menu.CallbackData) {
|
||||
appMenu.AddText("退出 Lingma Proxy", quitAccelerator, func(_ *menu.CallbackData) {
|
||||
app.RequestQuitShortcut()
|
||||
})
|
||||
|
||||
@@ -100,7 +100,7 @@ func appMenu(app *App) *menu.Menu {
|
||||
editMenu.AddText("全选", keys.CmdOrCtrl("a"), func(_ *menu.CallbackData) {})
|
||||
|
||||
return menu.NewMenuFromItems(
|
||||
menu.SubMenu("Lingma IPC Proxy", appMenu),
|
||||
menu.SubMenu("Lingma Proxy", appMenu),
|
||||
menu.SubMenu("编辑", editMenu),
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"$schema": "https://wails.io/schemas/config.v2.json",
|
||||
"name": "Lingma IPC Proxy",
|
||||
"name": "Lingma Proxy",
|
||||
"outputfilename": "LingmaProxy",
|
||||
"frontend:install": "npm install",
|
||||
"frontend:build": "npm run build",
|
||||
|
||||
Reference in New Issue
Block a user