Compare commits

...

9 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
66c0fe3ad0 fix bug
Some checks failed
backend / cross (mips64) (push) Failing after 21m30s
backend / cross (mips64el) (push) Failing after 10s
backend / cross (arm) (push) Failing after 1m33s
backend / cross (mipsel) (push) Failing after 31s
backend / cross (s390x) (push) Failing after 32s
backend / cross (armhf) (push) Failing after 1m33s
backend / cross (win32) (push) Failing after 31s
backend / cross (x86_64) (push) Failing after 31s
docker / build (push) Failing after 36s
backend / cross (i686) (push) Failing after 31s
backend / cross (aarch64) (push) Failing after 13m18s
backend / cross (mips) (push) Failing after 22m12s
2025-10-29 08:41:29 +08:00
e0fbf4f434 fix bug
Some checks failed
backend / cross (armhf) (push) Has been cancelled
docker / build (push) Has been cancelled
backend / cross (aarch64) (push) Failing after 1m31s
backend / cross (arm) (push) Failing after 1m34s
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 (i686) (push) Has been cancelled
backend / cross (mips) (push) Has been cancelled
2025-10-29 08:32:18 +08:00
22b99c3562 fix bug
Some checks failed
backend / cross (win32) (push) Failing after 14m55s
backend / cross (aarch64) (push) Failing after 9m39s
backend / cross (arm) (push) Failing after 11s
backend / cross (mips64el) (push) Failing after 31s
backend / cross (armhf) (push) Failing after 1m32s
backend / cross (i686) (push) Failing after 32s
backend / cross (mips) (push) Failing after 11s
backend / cross (mips64) (push) Failing after 30s
backend / cross (mipsel) (push) Failing after 32s
backend / cross (s390x) (push) Failing after 34s
backend / cross (x86_64) (push) Failing after 7m4s
docker / build (push) Failing after 56s
2025-10-28 22:03:51 +08:00
a03c1a8ee4 fix bug
Some checks failed
docker / build (push) Failing after 10m58s
2025-10-28 18:09:33 +08:00
2bf050cff9 fix bug
Some checks failed
backend / cross (arm) (push) Failing after 31s
backend / cross (armhf) (push) Failing after 31s
backend / cross (i686) (push) Failing after 31s
backend / cross (mips64el) (push) Failing after 11s
backend / cross (aarch64) (push) Failing after 3m14s
backend / cross (mips) (push) Failing after 31s
backend / cross (mips64) (push) Failing after 31s
backend / cross (s390x) (push) Failing after 13m3s
backend / cross (win32) (push) Failing after 1m31s
backend / cross (x86_64) (push) Failing after 6m39s
backend / cross (mipsel) (push) Failing after 4m36s
docker / build (push) Failing after 1h16m25s
2025-10-22 22:52:39 +08:00
3 changed files with 16219 additions and 16218 deletions

View File

@@ -61,9 +61,10 @@ export class Terminal extends Component<Props, State> {
if (data.status !== '-1') { if (data.status !== '-1') {
if (options.get('type') === 'docker') { if (options.get('type') === 'docker') {
this.xterm.open(this.container); this.xterm.open(this.container);
this.xterm.changeContainerStatus(data.status);
this.xterm.connect(); this.xterm.connect();
} else { } else {
this.intervalID = setInterval(this.loadOutput, 3000); this.intervalID = setInterval(this.loadOutput, 8000);
this.xterm.open(this.container); this.xterm.open(this.container);
this.xterm.changeUrl(this.currentDevcontainer.ip, this.currentDevcontainer.port) this.xterm.changeUrl(this.currentDevcontainer.ip, this.currentDevcontainer.port)
this.xterm.changeStatus(true); this.xterm.changeStatus(true);

View File

@@ -103,11 +103,12 @@ export class Xterm {
private closeOnDisconnect = false; private closeOnDisconnect = false;
private intervalID: NodeJS.Timeout; private intervalID: NodeJS.Timeout;
private writeFunc = (data: ArrayBuffer) => this.writeData(new Uint8Array(data)); private writeFunc = (data: ArrayBuffer) => this.writeData(new Uint8Array(data));
private status = false; private connectStatus = false;
private hostTitle = ""; private hostTitle = "";
private postAttachCommand = []; private postAttachCommand = [];
private postAttachCommandStatus = false; private postAttachCommandStatus = false;
private workdir = ""; private workdir = "";
private containerStatus = "";
private beforeCommand?: string; private beforeCommand?: string;
constructor( constructor(
private options: XtermOptions, private options: XtermOptions,
@@ -187,7 +188,7 @@ export class Xterm {
register( register(
terminal.onData(data => terminal.onData(data =>
{ {
if (this.status) { if (this.connectStatus) {
sendData(data); sendData(data);
} else { } else {
this.writeData('\b \b'); this.writeData('\b \b');
@@ -267,7 +268,7 @@ export class Xterm {
@bind @bind
public changeStatus(v: boolean){ public changeStatus(v: boolean){
this.status = v; this.connectStatus = v;
} }
@bind @bind
@@ -282,7 +283,11 @@ export class Xterm {
register(addEventListener(socket, 'error', () => (this.doReconnect = false))); register(addEventListener(socket, 'error', () => (this.doReconnect = false)));
const options = new URLSearchParams(decodeURIComponent(window.location.search)); const options = new URLSearchParams(decodeURIComponent(window.location.search));
if (options.get('type') === 'docker') { if (options.get('type') === 'docker') {
this.intervalID = setInterval(this.loadCommand, 3000); if(this.containerStatus === '4' || this.containerStatus === '-1'){
this.intervalID = setInterval(this.loadCommand, 1000);
}else{
this.intervalID = setInterval(this.loadCommand, 8000);
}
} }
} }
@@ -357,9 +362,15 @@ export class Xterm {
this.workdir = data.workdir; this.workdir = data.workdir;
} }
if (data.status !== '4' && data.status !== '0') { if (data.status !== '4' && data.status !== '0') {
this.sendData(data.command); if(this.containerStatus !== data.status){
this.sendData(data.command);
}
this.containerStatus = data.status;
} else { } 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') { if (data.status === '4') {
const parts = data.command.split('\n'); const parts = data.command.split('\n');
this.sendData(parts[0]+"\n"); this.sendData(parts[0]+"\n");
@@ -371,7 +382,10 @@ export class Xterm {
console.error('Error:', error); console.error('Error:', error);
}); });
} }
@bind
public changeContainerStatus(v: string){
this.containerStatus = v;
}
@bind @bind
private parseOptsFromUrlQuery(query: string): Preferences { private parseOptsFromUrlQuery(query: string): Preferences {
const { terminal } = this; const { terminal } = this;
@@ -414,6 +428,7 @@ 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('[ttyd] output:', textDecoder.decode(data));
const options = new URLSearchParams(decodeURIComponent(window.location.search)); const options = new URLSearchParams(decodeURIComponent(window.location.search));
const params = new URLSearchParams({ const params = new URLSearchParams({
repo: options.get('repoid') as string, repo: options.get('repoid') as string,
@@ -425,51 +440,27 @@ export class Xterm {
this.hostTitle = textDecoder.decode(data).replace(/\s/g, ''); this.hostTitle = textDecoder.decode(data).replace(/\s/g, '');
} }
// 检测是否退出devcontainer标题等于host的标题 // 检测是否退出devcontainer标题等于host的标题
if (this.status && textDecoder.decode(data).replace(/\s/g, '').includes(this.hostTitle)){ if (this.connectStatus && textDecoder.decode(data).replace(/\s/g, '').includes(this.hostTitle)){
this.status = false this.connectStatus = false
} }
// this.status = true 连接完成 // this.connectStatus = true 连接完成
if ( if (
this.status === false && this.connectStatus === false &&
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.connectStatus = true;
fetch('http://' + options.get('domain') + ':'+ options.get('port') +'/' + clearInterval(this.intervalID);
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.connectStatus === false &&
(textDecoder.decode(data).includes('\x1b') ||
textDecoder.decode(data).replace(/\s/g, '').includes('docker-H')))
){ ){
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){ // 连接完成且出现容器的标题且没有执行过postAttach命令
if (this.connectStatus && 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++){
this.sendData(this.postAttachCommand[i]+"\n"); this.sendData(this.postAttachCommand[i]+"\n");
} }

32359
src/html.h generated

File diff suppressed because it is too large Load Diff