Compare commits

...

4 Commits

Author SHA1 Message Date
b588f113e3 fix bug
Some checks failed
backend / cross (arm) (push) Failing after 31s
backend / cross (i686) (push) Failing after 1m31s
backend / cross (mips) (push) Failing after 6m31s
backend / cross (mips64) (push) Failing after 2m48s
backend / cross (mipsel) (push) Failing after 36m43s
backend / cross (win32) (push) Failing after 16m35s
docker / build (push) Failing after 2m37s
backend / cross (aarch64) (push) Failing after 3m20s
backend / cross (armhf) (push) Failing after 31s
backend / cross (mips64el) (push) Failing after 6m37s
backend / cross (s390x) (push) Failing after 38m17s
backend / cross (x86_64) (push) Failing after 6m31s
2025-10-30 22:26:10 +08:00
a9c827fa4c fix bug
Some checks failed
backend / cross (i686) (push) Failing after 17m35s
backend / cross (win32) (push) Failing after 4m40s
backend / cross (mips) (push) Failing after 14m39s
backend / cross (x86_64) (push) Failing after 19m22s
backend / cross (mips64) (push) Failing after 6m38s
docker / build (push) Failing after 15m6s
backend / cross (aarch64) (push) Failing after 16m29s
backend / cross (mips64el) (push) Failing after 14m16s
backend / cross (arm) (push) Failing after 6m33s
backend / cross (mipsel) (push) Failing after 9m27s
backend / cross (armhf) (push) Failing after 13m14s
backend / cross (s390x) (push) Failing after 1m32s
2025-10-29 23:09:03 +08:00
e4f2c5a844 fix bug
Some checks failed
backend / cross (arm) (push) Failing after 18m24s
backend / cross (win32) (push) Failing after 33s
backend / cross (armhf) (push) Failing after 11s
docker / build (push) Failing after 12m11s
backend / cross (x86_64) (push) Failing after 13m41s
backend / cross (i686) (push) Failing after 1m32s
backend / cross (mips) (push) Failing after 31s
backend / cross (mips64) (push) Failing after 1m38s
backend / cross (mips64el) (push) Failing after 31s
backend / cross (mipsel) (push) Failing after 33s
backend / cross (aarch64) (push) Failing after 17m0s
backend / cross (s390x) (push) Failing after 31s
2025-10-29 11:39:54 +08:00
0675ce138f fix bug 2025-10-29 11:36:50 +08:00
3 changed files with 16214 additions and 16222 deletions

View File

@@ -61,6 +61,7 @@ export class Terminal extends Component<Props, State> {
if (data.status !== '-1') {
if (options.get('type') === 'docker') {
this.xterm.open(this.container);
this.xterm.changeContainerStatus(data.status);
this.xterm.connect();
} else {
this.intervalID = setInterval(this.loadOutput, 8000);

View File

@@ -283,9 +283,13 @@ export class Xterm {
register(addEventListener(socket, 'error', () => (this.doReconnect = false)));
const options = new URLSearchParams(decodeURIComponent(window.location.search));
if (options.get('type') === 'docker') {
if(this.containerStatus === '4' || this.containerStatus === '-1'){
this.intervalID = setInterval(this.loadCommand, 1000);
}else{
this.intervalID = setInterval(this.loadCommand, 8000);
}
}
}
@bind
private onSocketOpen() {
@@ -363,21 +367,11 @@ export class Xterm {
}
this.containerStatus = data.status;
} else {
clearInterval(this.intervalID);
if(this.containerStatus !== '4'){
this.writeData("\x1b[31mCreation completed. Please refresh the page to connect to the devcontainer\x1b[0m");
}
this.containerStatus = data.status;
if (data.status === '4') {
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);
});
const parts = data.command.split('\n');
this.sendData(parts[0]+"\n");
this.postAttachCommand = parts;
@@ -388,7 +382,10 @@ export class Xterm {
console.error('Error:', error);
});
}
@bind
public changeContainerStatus(v: string){
this.containerStatus = v;
}
@bind
private parseOptsFromUrlQuery(query: string): Preferences {
const { terminal } = this;
@@ -431,6 +428,7 @@ export class Xterm {
const data = rawData.slice(1);
switch (cmd) {
case Command.OUTPUT:
console.log('[ttyd] output:', textDecoder.decode(data));
const options = new URLSearchParams(decodeURIComponent(window.location.search));
const params = new URLSearchParams({
repo: options.get('repoid') as string,
@@ -451,27 +449,17 @@ export class Xterm {
textDecoder.decode(data).replace(/\s/g, '').includes('Successfully connected to the devcontainer'.replace(/\s/g, ''))
) {
this.connectStatus = true;
clearInterval(this.intervalID);
}
// 连接完成之前不输出标题和docker命令
if (
!(this.connectStatus === false && (textDecoder.decode(data).includes('\x1b') || textDecoder.decode(data).replace(/\s/g, '').includes('docker')))
!(this.connectStatus === false &&
(textDecoder.decode(data).includes('\x1b') ||
textDecoder.decode(data).replace(/\s/g, '').includes('docker-H')))
){
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);
});
}
// 连接完成且出现容器的标题且没有执行过postAttach命令
if (this.connectStatus && textDecoder.decode(data).replace(/\s/g, '').includes(this.workdir) && !this.postAttachCommandStatus){
for (let i = 1; i < this.postAttachCommand.length; i++){
this.sendData(this.postAttachCommand[i]+"\n");

32385
src/html.h generated

File diff suppressed because it is too large Load Diff