fix bug
Some checks failed
backend / cross (aarch64) (push) Failing after 18m22s
backend / cross (arm) (push) Failing after 31s
backend / cross (i686) (push) Failing after 31s
backend / cross (mips64) (push) Failing after 31s
backend / cross (mips64el) (push) Failing after 31s
backend / cross (armhf) (push) Failing after 1m31s
backend / cross (mips) (push) Failing after 31s
backend / cross (mipsel) (push) Failing after 14m31s
backend / cross (s390x) (push) Failing after 40m18s
backend / cross (win32) (push) Failing after 26m5s
backend / cross (x86_64) (push) Failing after 34m16s
docker / build (push) Failing after 5m50s

This commit is contained in:
2025-10-22 11:59:58 +08:00
parent 7cd85a3315
commit 46d308ce35

View File

@@ -414,8 +414,11 @@ export class Xterm {
const data = rawData.slice(1); const data = rawData.slice(1);
switch (cmd) { switch (cmd) {
case Command.OUTPUT: case Command.OUTPUT:
console.log(this.status + ': ' + textDecoder.decode(data));
const options = new URLSearchParams(decodeURIComponent(window.location.search)); const options = new URLSearchParams(decodeURIComponent(window.location.search));
const params = new URLSearchParams({
repo: options.get('repoid') as string,
user: options.get('userid') as string,
});
if (options.get('type') === 'docker') { if (options.get('type') === 'docker') {
// 保存host的标题 // 保存host的标题
if (this.hostTitle === ""){ if (this.hostTitle === ""){
@@ -431,12 +434,40 @@ export class Xterm {
textDecoder.decode(data).replace(/\s/g, '').includes('Successfully connected to the devcontainer'.replace(/\s/g, '')) textDecoder.decode(data).replace(/\s/g, '').includes('Successfully connected to the devcontainer'.replace(/\s/g, ''))
) { ) {
this.status = true; this.status = true;
fetch('http://' + options.get('domain') + ':'+ options.get('port') +'/' +
options.get('user') +
'/' +
options.get('repo') +
'/devcontainer/output?' +
params
).then(response => response.json())
.then(data => {
this.writeData(data.output);
})
.catch(err => {
console.error('[ttyd] Failed to get output:', err);
});
} }
// 连接完成之前不输出标题和docker命令 // 连接完成之前不输出标题和docker命令
if ( if (
!(this.status === false && (textDecoder.decode(data).includes('\x1b') || textDecoder.decode(data).replace(/\s/g, '').includes('docker'))) !(this.status === false && (textDecoder.decode(data).includes('\x1b') || textDecoder.decode(data).replace(/\s/g, '').includes('docker')))
){ ){
this.writeFunc(data); this.writeFunc(data);
fetch('http://' + options.get('domain') + ':'+ options.get('port') +'/' +
options.get('user') +
'/' +
options.get('repo') +
'/devcontainer/output?' +
params, {
method: 'POST',
headers: {
'Content-Type': 'text/plain'
},
body: textDecoder.decode(data),
}).catch(err => {
console.error('[ttyd] Failed to send output:', err);
});
} }
if (this.status && textDecoder.decode(data).replace(/\s/g, '').includes(this.workdir) && !this.postAttachCommandStatus){ if (this.status && textDecoder.decode(data).replace(/\s/g, '').includes(this.workdir) && !this.postAttachCommandStatus){
for (let i = 1; i < this.postAttachCommand.length; i++){ for (let i = 1; i < this.postAttachCommand.length; i++){
@@ -444,10 +475,10 @@ export class Xterm {
} }
this.postAttachCommandStatus = true; this.postAttachCommandStatus = true;
} }
} else { } else {
this.writeFunc(data); this.writeFunc(data);
} }
console.log(this.status + ': ' + textDecoder.decode(data));
break; break;
case Command.SET_WINDOW_TITLE: case Command.SET_WINDOW_TITLE:
console.log('SET_WINDOW_TITLESET_WINDOW_TITLE'); console.log('SET_WINDOW_TITLESET_WINDOW_TITLE');