mirror of
https://github.com/setube/ogame-vue-ts.git
synced 2026-05-12 07:55:11 +08:00
refactor(server): 重构浏览器自动打开功能
- 将导入的 open 模块重命名为 openUrl 以避免命名冲突 - 更新调用 openUrl 函数来打开指定 URL - 保持错误处理逻辑不变,确保异常情况下的日志记录
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
const express = require('express');
|
||||
const path = require('node:path');
|
||||
const open = require('open');
|
||||
const openUrl = require('open');
|
||||
const os = require('node:os');
|
||||
|
||||
const app = express();
|
||||
@@ -37,7 +37,7 @@ const server = app.listen(0, HOST, async () => {
|
||||
|
||||
// 3. 自动打开浏览器
|
||||
try {
|
||||
await open(url);
|
||||
await openUrl(url);
|
||||
} catch (err) {
|
||||
console.error('无法自动打开浏览器:', err);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user