phirepass-widgets 0.0.22 → 0.0.24
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/cjs/phirepass-terminal.cjs.entry.js +23 -20
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +23 -20
- package/dist/components/phirepass-terminal.js +1 -1
- package/dist/esm/phirepass-terminal.entry.js +23 -20
- package/dist/phirepass-widgets/{p-4d9374b4.entry.js → p-9f8cf22e.entry.js} +4 -4
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/components/phirepass-terminal/phirepass-terminal.d.ts +18 -19
- package/package.json +1 -1
|
@@ -1085,7 +1085,7 @@ const PhirepassTerminal = class {
|
|
|
1085
1085
|
onServerIdChange(_newValue, _oldValue) {
|
|
1086
1086
|
this.onNodeIdChange(this.nodeId, this.nodeId);
|
|
1087
1087
|
}
|
|
1088
|
-
|
|
1088
|
+
create_web_socket_endpoint() {
|
|
1089
1089
|
const protocol = this.allowInsecure ? 'ws' : 'wss';
|
|
1090
1090
|
if (!this.allowInsecure && this.serverPort === 443) {
|
|
1091
1091
|
return `${protocol}://${this.serverHost}`;
|
|
@@ -1164,10 +1164,10 @@ const PhirepassTerminal = class {
|
|
|
1164
1164
|
}
|
|
1165
1165
|
open_comms() {
|
|
1166
1166
|
if (this.serverId) {
|
|
1167
|
-
this.channel = new Channel(`${this.
|
|
1167
|
+
this.channel = new Channel(`${this.create_web_socket_endpoint()}/api/web/ws`, this.nodeId, this.serverId);
|
|
1168
1168
|
}
|
|
1169
1169
|
else {
|
|
1170
|
-
this.channel = new Channel(`${this.
|
|
1170
|
+
this.channel = new Channel(`${this.create_web_socket_endpoint()}/api/web/ws`, this.nodeId);
|
|
1171
1171
|
}
|
|
1172
1172
|
this.channel.on_connection_open(() => {
|
|
1173
1173
|
this.channel.authenticate(this.token, this.nodeId);
|
|
@@ -1188,7 +1188,7 @@ const PhirepassTerminal = class {
|
|
|
1188
1188
|
this.handle_error(web);
|
|
1189
1189
|
break;
|
|
1190
1190
|
case "AuthSuccess":
|
|
1191
|
-
this.
|
|
1191
|
+
this.handle_auth_success(web);
|
|
1192
1192
|
break;
|
|
1193
1193
|
case "TunnelOpened":
|
|
1194
1194
|
this.session_id = web.sid;
|
|
@@ -1196,7 +1196,7 @@ const PhirepassTerminal = class {
|
|
|
1196
1196
|
this.send_ssh_terminal_resize();
|
|
1197
1197
|
break;
|
|
1198
1198
|
case "TunnelClosed":
|
|
1199
|
-
this.
|
|
1199
|
+
this.handle_tunnel_closed();
|
|
1200
1200
|
break;
|
|
1201
1201
|
case "TunnelData":
|
|
1202
1202
|
this.terminal.write(new Uint8Array(web.data));
|
|
@@ -1208,11 +1208,13 @@ const PhirepassTerminal = class {
|
|
|
1208
1208
|
}
|
|
1209
1209
|
send_ssh_terminal_resize() {
|
|
1210
1210
|
if (!this.channel || !this.channel.is_connected() || !this.session_id) {
|
|
1211
|
+
console.warn('Cannot send terminal resize: channel not connected or session_id missing');
|
|
1211
1212
|
return;
|
|
1212
1213
|
}
|
|
1213
1214
|
const cols = this.terminal?.cols ?? 0;
|
|
1214
1215
|
const rows = this.terminal?.rows ?? 0;
|
|
1215
1216
|
if (cols <= 0 || rows <= 0) {
|
|
1217
|
+
console.warn('Cannot send terminal resize: invalid terminal dimensions (cols:', cols, 'rows:', rows, ') ');
|
|
1216
1218
|
return;
|
|
1217
1219
|
}
|
|
1218
1220
|
try {
|
|
@@ -1272,12 +1274,12 @@ const PhirepassTerminal = class {
|
|
|
1272
1274
|
this.inputMode = InputMode.Default;
|
|
1273
1275
|
this.clear_creds_buffer();
|
|
1274
1276
|
}
|
|
1275
|
-
|
|
1277
|
+
handle_auth_success(_auth_) {
|
|
1276
1278
|
this.clear_creds_buffer();
|
|
1277
1279
|
this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
|
|
1278
1280
|
this.channel.open_ssh_tunnel(this.nodeId);
|
|
1279
1281
|
}
|
|
1280
|
-
|
|
1282
|
+
handle_tunnel_closed() {
|
|
1281
1283
|
this.session_id = undefined;
|
|
1282
1284
|
this.inputMode = InputMode.Default;
|
|
1283
1285
|
this.clear_creds_buffer();
|
|
@@ -1292,15 +1294,16 @@ const PhirepassTerminal = class {
|
|
|
1292
1294
|
console.log('Terminal opened in container');
|
|
1293
1295
|
this.fitAddon.fit();
|
|
1294
1296
|
this.terminal.focus();
|
|
1295
|
-
this.terminal.onData(this.
|
|
1297
|
+
this.terminal.onData(this.handle_terminal_data.bind(this));
|
|
1296
1298
|
this.channel.connect();
|
|
1297
|
-
this.
|
|
1299
|
+
this.setup_resize_observer();
|
|
1298
1300
|
this.connected = true;
|
|
1299
1301
|
console.log('Terminal connected and ready');
|
|
1300
1302
|
}
|
|
1301
1303
|
}
|
|
1302
|
-
|
|
1304
|
+
setup_resize_observer() {
|
|
1303
1305
|
this.resizeObserver = new ResizeObserver(() => {
|
|
1306
|
+
console.log('Container resized, fitting terminal');
|
|
1304
1307
|
if (this.resizeDebounceHandle) {
|
|
1305
1308
|
clearTimeout(this.resizeDebounceHandle);
|
|
1306
1309
|
}
|
|
@@ -1311,23 +1314,23 @@ const PhirepassTerminal = class {
|
|
|
1311
1314
|
});
|
|
1312
1315
|
this.resizeObserver.observe(this.el);
|
|
1313
1316
|
}
|
|
1314
|
-
|
|
1317
|
+
handle_terminal_data(data) {
|
|
1315
1318
|
switch (this.inputMode) {
|
|
1316
1319
|
case InputMode.Username:
|
|
1317
|
-
this.
|
|
1320
|
+
this.handle_username_input(data);
|
|
1318
1321
|
break;
|
|
1319
1322
|
case InputMode.Password:
|
|
1320
|
-
this.
|
|
1323
|
+
this.handle_password_input(data);
|
|
1321
1324
|
break;
|
|
1322
1325
|
case InputMode.Default:
|
|
1323
1326
|
this.send_ssh_data(data);
|
|
1324
1327
|
break;
|
|
1325
1328
|
}
|
|
1326
1329
|
}
|
|
1327
|
-
|
|
1330
|
+
handle_username_input(data) {
|
|
1328
1331
|
if (data === "\r" || data === "\n") {
|
|
1329
1332
|
this.terminal.write("\r\n");
|
|
1330
|
-
this.
|
|
1333
|
+
this.submit_username();
|
|
1331
1334
|
return;
|
|
1332
1335
|
}
|
|
1333
1336
|
if (data === "\u0003") {
|
|
@@ -1347,7 +1350,7 @@ const PhirepassTerminal = class {
|
|
|
1347
1350
|
this.terminal.write(data);
|
|
1348
1351
|
}
|
|
1349
1352
|
}
|
|
1350
|
-
|
|
1353
|
+
submit_username() {
|
|
1351
1354
|
if (!this.channel.is_connected()) {
|
|
1352
1355
|
return;
|
|
1353
1356
|
}
|
|
@@ -1361,10 +1364,10 @@ const PhirepassTerminal = class {
|
|
|
1361
1364
|
this.inputMode = InputMode.Default;
|
|
1362
1365
|
this.channel.open_ssh_tunnel(this.nodeId, username);
|
|
1363
1366
|
}
|
|
1364
|
-
|
|
1367
|
+
handle_password_input(data) {
|
|
1365
1368
|
if (data === "\r" || data === "\n") {
|
|
1366
1369
|
this.terminal.write("\r\n");
|
|
1367
|
-
this.
|
|
1370
|
+
this.submit_password();
|
|
1368
1371
|
return;
|
|
1369
1372
|
}
|
|
1370
1373
|
if (data === "\u0003") {
|
|
@@ -1384,7 +1387,7 @@ const PhirepassTerminal = class {
|
|
|
1384
1387
|
this.terminal.write("*");
|
|
1385
1388
|
}
|
|
1386
1389
|
}
|
|
1387
|
-
|
|
1390
|
+
submit_password() {
|
|
1388
1391
|
if (!this.channel.is_connected()) {
|
|
1389
1392
|
return;
|
|
1390
1393
|
}
|
|
@@ -1404,7 +1407,7 @@ const PhirepassTerminal = class {
|
|
|
1404
1407
|
this.usernameBuffer = "";
|
|
1405
1408
|
}
|
|
1406
1409
|
render() {
|
|
1407
|
-
return (h$1(Host, { key: '
|
|
1410
|
+
return (h$1(Host, { key: '950ca187bc694294927925a686eb9534040c2b75' }, h$1("div", { key: 'f67f5a4ed398e97a336f8f04c95335eb47b3dfd2', id: "ccc", ref: el => (this.containerEl = el) })));
|
|
1408
1411
|
}
|
|
1409
1412
|
static get watchers() { return {
|
|
1410
1413
|
"nodeId": [{
|