Skip to content

Commit 0c52c73

Browse files
feat. custom port support
1 parent d6a8322 commit 0c52c73

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/components/terminal/terminal.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ export default class TerminalComponent {
3131
scrollOnUserInput: true,
3232
rows: options.rows || 24,
3333
cols: options.cols || 80,
34+
port: options.port || 8767,
3435
fontSize: terminalSettings.fontSize,
3536
fontFamily: terminalSettings.fontFamily,
3637
fontWeight: terminalSettings.fontWeight,
@@ -566,7 +567,7 @@ export default class TerminalComponent {
566567
rows: this.terminal.rows,
567568
};
568569

569-
const response = await fetch("http://localhost:8767/terminals", {
570+
const response = await fetch(`http://localhost:${this.options.port}/terminals`, {
570571
method: "POST",
571572
headers: {
572573
"Content-Type": "application/json",
@@ -604,7 +605,7 @@ export default class TerminalComponent {
604605

605606
this.pid = pid;
606607

607-
const wsUrl = `ws://localhost:8767/terminals/${pid}`;
608+
const wsUrl = `ws://localhost:${this.options.port}/terminals/${pid}`;
608609

609610
this.websocket = new WebSocket(wsUrl);
610611

@@ -658,7 +659,7 @@ export default class TerminalComponent {
658659
if (!this.pid || !this.serverMode) return;
659660

660661
try {
661-
await fetch(`http://localhost:8767/terminals/${this.pid}/resize`, {
662+
await fetch(`http://localhost:${this.options.port}/terminals/${this.pid}/resize`, {
662663
method: "POST",
663664
headers: {
664665
"Content-Type": "application/json",
@@ -953,7 +954,7 @@ export default class TerminalComponent {
953954

954955
if (this.pid && this.serverMode) {
955956
try {
956-
await fetch(`http://localhost:8767/terminals/${this.pid}/terminate`, {
957+
await fetch(`http://localhost:${this.options.port}/terminals/${this.pid}/terminate`, {
957958
method: "POST",
958959
});
959960
} catch (error) {

0 commit comments

Comments
 (0)