mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-07-19 12:03:37 +00:00
fix: node-pty
This commit is contained in:
@@ -112,7 +112,7 @@ export default function TerminalPage() {
|
||||
className="h-full overflow-hidden"
|
||||
>
|
||||
<div className="flex items-center gap-2 flex-shrink-0 flex-grow-0">
|
||||
<TabList className="flex-1 !overflow-x-auto hide-scrollbar">
|
||||
<TabList className="flex-1 !overflow-x-auto w-full hide-scrollbar">
|
||||
<SortableContext
|
||||
items={tabs}
|
||||
strategy={horizontalListSortingStrategy}
|
||||
@@ -123,7 +123,7 @@ export default function TerminalPage() {
|
||||
id={tab.id}
|
||||
value={tab.id}
|
||||
isSelected={selectedTab === tab.id}
|
||||
className="flex gap-2 items-center"
|
||||
className="flex gap-2 items-center flex-shrink-0"
|
||||
>
|
||||
{tab.title}
|
||||
<Button
|
||||
@@ -131,7 +131,7 @@ export default function TerminalPage() {
|
||||
radius="full"
|
||||
variant="flat"
|
||||
size="sm"
|
||||
className="min-w-0 w-4 h-4"
|
||||
className="min-w-0 w-4 h-4 flex-shrink-0"
|
||||
onPress={() => closeTerminal(tab.id)}
|
||||
color={selectedTab === tab.id ? 'danger' : 'default'}
|
||||
>
|
||||
|
@@ -56,7 +56,7 @@
|
||||
"dependencies": {
|
||||
"@ffmpeg.wasm/core-mt": "^0.13.2",
|
||||
"@ffmpeg.wasm/main": "^0.13.1",
|
||||
"@homebridge/node-pty-prebuilt-multiarch": "^0.11.14",
|
||||
"@homebridge/node-pty-prebuilt-multiarch": "^0.12.0-beta.5",
|
||||
"express": "^5.0.0",
|
||||
"piscina": "^4.7.0",
|
||||
"qrcode-terminal": "^0.12.0",
|
||||
|
21
src/webui/src/terminal/init-dynamic-dirname.ts
Normal file
21
src/webui/src/terminal/init-dynamic-dirname.ts
Normal file
@@ -0,0 +1,21 @@
|
||||
import path from 'path';
|
||||
|
||||
Object.defineProperty(global, '__dirname', {
|
||||
get() {
|
||||
const err = new Error();
|
||||
const stack = err.stack?.split('\n') || [];
|
||||
let callerFile = '';
|
||||
// 遍历错误堆栈,跳过当前文件所在行
|
||||
// 注意:堆栈格式可能不同,请根据实际环境调整索引及正则表达式
|
||||
for (const line of stack) {
|
||||
const match = line.match(/\((.*):\d+:\d+\)/);
|
||||
if (match) {
|
||||
callerFile = match[1];
|
||||
if (!callerFile.includes('init-dynamic-dirname.ts')) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return callerFile ? path.dirname(callerFile) : '';
|
||||
},
|
||||
});
|
@@ -1,9 +1,10 @@
|
||||
import './init-dynamic-dirname';
|
||||
import { WebUiConfig } from '@/webui';
|
||||
import { AuthHelper } from '../helper/SignToken';
|
||||
import { LogWrapper } from '@/common/log';
|
||||
import { WebSocket, WebSocketServer } from 'ws';
|
||||
import os from 'os';
|
||||
import { IPty, spawn as ptySpawn } from '@homebridge/node-pty-prebuilt-multiarch';
|
||||
import { type IPty, spawn as ptySpawn } from '@homebridge/node-pty-prebuilt-multiarch';
|
||||
import { randomUUID } from 'crypto';
|
||||
|
||||
interface TerminalInstance {
|
||||
|
@@ -12,7 +12,7 @@ const external = [
|
||||
'piscina',
|
||||
'@ffmpeg.wasm/core-mt',
|
||||
'@ffmpeg.wasm/main',
|
||||
'node-pty',
|
||||
'@homebridge/node-pty-prebuilt-multiarch',
|
||||
];
|
||||
const nodeModules = [...builtinModules, builtinModules.map((m) => `node:${m}`)].flat();
|
||||
|
||||
|
Reference in New Issue
Block a user