@freestyle-sh/with-ttyd 0.0.6 → 0.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +3 -0
- package/dist/index.js +6 -1
- package/package.json +2 -2
- package/src/index.ts +9 -0
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ type TtydConfig = {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
/** Read-only terminal (no input allowed) */
|
|
24
24
|
readOnly?: boolean;
|
|
25
|
+
/** Xterm.js theme settings passed to ttyd client options */
|
|
26
|
+
theme?: Record<string, string | number | boolean>;
|
|
25
27
|
};
|
|
26
28
|
type ResolvedTerminalConfig = {
|
|
27
29
|
port: number;
|
|
@@ -34,6 +36,7 @@ type ResolvedTerminalConfig = {
|
|
|
34
36
|
};
|
|
35
37
|
title: string;
|
|
36
38
|
readOnly: boolean;
|
|
39
|
+
theme?: Record<string, string | number | boolean>;
|
|
37
40
|
};
|
|
38
41
|
declare class VmWebTerminal<T extends TtydConfig[] = TtydConfig[]> extends VmWith<VmWebTerminalInstance<T>> {
|
|
39
42
|
private resolvedTerminals;
|
package/dist/index.js
CHANGED
|
@@ -23,7 +23,8 @@ class VmWebTerminal extends VmWith {
|
|
|
23
23
|
cwd: config.cwd ?? "/root",
|
|
24
24
|
credential: config.credential,
|
|
25
25
|
title: config.title ?? `terminal-${port}`,
|
|
26
|
-
readOnly: config.readOnly ?? false
|
|
26
|
+
readOnly: config.readOnly ?? false,
|
|
27
|
+
theme: config.theme
|
|
27
28
|
};
|
|
28
29
|
});
|
|
29
30
|
}
|
|
@@ -66,6 +67,10 @@ class VmWebTerminal extends VmWith {
|
|
|
66
67
|
} else {
|
|
67
68
|
args.push(`--writable`);
|
|
68
69
|
}
|
|
70
|
+
if (t.theme) {
|
|
71
|
+
const themeJson = JSON.stringify(t.theme);
|
|
72
|
+
args.push(`-t 'theme=${themeJson}'`);
|
|
73
|
+
}
|
|
69
74
|
args.push(t.command);
|
|
70
75
|
return {
|
|
71
76
|
name: `web-terminal-${t.port}`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@freestyle-sh/with-ttyd",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Web terminal for freestyle sandboxes",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
27
|
"freestyle-sandboxes": "^0.1.28",
|
|
28
|
-
"@freestyle-sh/with-pty": "^0.0.
|
|
28
|
+
"@freestyle-sh/with-pty": "^0.0.3"
|
|
29
29
|
},
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "pkgroll"
|
package/src/index.ts
CHANGED
|
@@ -23,6 +23,8 @@ export type TtydConfig = {
|
|
|
23
23
|
title?: string;
|
|
24
24
|
/** Read-only terminal (no input allowed) */
|
|
25
25
|
readOnly?: boolean;
|
|
26
|
+
/** Xterm.js theme settings passed to ttyd client options */
|
|
27
|
+
theme?: Record<string, string | number | boolean>;
|
|
26
28
|
};
|
|
27
29
|
|
|
28
30
|
export type ResolvedTerminalConfig = {
|
|
@@ -33,6 +35,7 @@ export type ResolvedTerminalConfig = {
|
|
|
33
35
|
credential?: { username: string; password: string };
|
|
34
36
|
title: string;
|
|
35
37
|
readOnly: boolean;
|
|
38
|
+
theme?: Record<string, string | number | boolean>;
|
|
36
39
|
};
|
|
37
40
|
|
|
38
41
|
// ============================================================================
|
|
@@ -73,6 +76,7 @@ export class VmWebTerminal<
|
|
|
73
76
|
credential: config.credential,
|
|
74
77
|
title: config.title ?? `terminal-${port}`,
|
|
75
78
|
readOnly: config.readOnly ?? false,
|
|
79
|
+
theme: config.theme,
|
|
76
80
|
};
|
|
77
81
|
});
|
|
78
82
|
}
|
|
@@ -129,6 +133,11 @@ export class VmWebTerminal<
|
|
|
129
133
|
args.push(`--writable`);
|
|
130
134
|
}
|
|
131
135
|
|
|
136
|
+
if (t.theme) {
|
|
137
|
+
const themeJson = JSON.stringify(t.theme);
|
|
138
|
+
args.push(`-t 'theme=${themeJson}'`);
|
|
139
|
+
}
|
|
140
|
+
|
|
132
141
|
// Shell command at the end
|
|
133
142
|
args.push(t.command);
|
|
134
143
|
|