修复webterminal无法获取docker exec命令
Some checks failed
backend / cross (aarch64) (push) Has been cancelled
backend / cross (arm) (push) Has been cancelled
backend / cross (armhf) (push) Has been cancelled
backend / cross (i686) (push) Has been cancelled
backend / cross (aarch64) (pull_request) Has been cancelled
backend / cross (mips) (push) Has been cancelled
backend / cross (mips64) (push) Has been cancelled
backend / cross (mips64el) (push) Has been cancelled
backend / cross (mipsel) (push) Has been cancelled
backend / cross (s390x) (push) Has been cancelled
backend / cross (win32) (push) Has been cancelled
backend / cross (x86_64) (push) Has been cancelled
backend / cross (arm) (pull_request) Has been cancelled
backend / cross (armhf) (pull_request) Has been cancelled
backend / cross (i686) (pull_request) Has been cancelled
backend / cross (mips) (pull_request) Has been cancelled
backend / cross (mips64) (pull_request) Has been cancelled
backend / cross (mips64el) (pull_request) Has been cancelled
backend / cross (mipsel) (pull_request) Has been cancelled
backend / cross (s390x) (pull_request) Has been cancelled
backend / cross (win32) (pull_request) Has been cancelled
backend / cross (x86_64) (pull_request) Has been cancelled

This commit is contained in:
2025-12-06 20:01:08 +08:00
parent 56a324413f
commit 1dcd5c8905
2 changed files with 16201 additions and 16195 deletions

View File

@@ -280,7 +280,7 @@ export class Xterm {
register(addEventListener(socket, 'close', this.onSocketClose as EventListener));
register(addEventListener(socket, 'error', () => (this.doReconnect = false)));
const options = new URLSearchParams(decodeURIComponent(window.location.search));
if (options.get('type') === 'docker') {
if (options.get('type') === 'docker' && !this.intervalID) {
this.intervalID = setInterval(this.loadCommand, 3000);
}
}
@@ -352,28 +352,29 @@ export class Xterm {
)
.then(response => response.json())
.then(data => {
if (data.status !== '4' && data.status !== '0') {
this.sendData(data.command);
} else {
clearInterval(this.intervalID);
if (data.status === '4') {
fetch(
'http://' + options.get('domain') + ':'+ options.get('port') +'/' +
options.get('user') +
'/' +
options.get('repo') +
'/devcontainer/command?' +
params
)
.then(response => response.json())
.then(data => {
this.sendData(data.command);
})
.catch(error => {
console.error('Error:', error);
});
}
const isReady = data.status === '4';
this.changeStatus(isReady);
if (data.status === '0') {
this.beforeCommand = undefined;
return;
}
if (isReady) {
if (this.beforeCommand !== data.command) {
this.beforeCommand = data.command;
// 确保命令以换行符结尾,并增加一点延迟
const cmd = data.command.endsWith('\n') ? data.command : data.command + '\n';
setTimeout(() => {
this.sendData(cmd);
}, 500);
// 停止轮询,因为已经进入交互模式
clearInterval(this.intervalID);
}
return;
}
this.beforeCommand = data.command;
this.sendData(data.command);
})
.catch(error => {
console.error('Error:', error);

32351
src/html.h generated

File diff suppressed because it is too large Load Diff