phirepass-widgets 0.0.13 → 0.0.15
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/loader.cjs.js +1 -1
- package/dist/cjs/phirepass-terminal.cjs.entry.js +42 -19
- package/dist/cjs/phirepass-widgets.cjs.js +1 -1
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.css +8 -0
- package/dist/collection/components/phirepass-terminal/phirepass-terminal.js +48 -18
- package/dist/collection/phirepass-channel_bg.wasm +0 -0
- package/dist/components/phirepass-terminal.js +4 -4
- package/dist/esm/loader.js +1 -1
- package/dist/esm/phirepass-terminal.entry.js +42 -19
- package/dist/esm/phirepass-widgets.js +1 -1
- package/dist/phirepass-widgets/{p-11be5283.entry.js → p-e7a1889e.entry.js} +4 -4
- package/dist/phirepass-widgets/phirepass-channel_bg.wasm +0 -0
- package/dist/phirepass-widgets/phirepass-widgets.esm.js +1 -1
- package/dist/types/common/protocol.d.ts +7 -1
- package/dist/types/components/phirepass-terminal/phirepass-terminal.d.ts +7 -4
- package/dist/types/components.d.ts +4 -1
- package/package.json +4 -4
package/dist/esm/loader.js
CHANGED
|
@@ -5,7 +5,7 @@ import { g as globalScripts } from './app-globals-DQuL1Twl.js';
|
|
|
5
5
|
const defineCustomElements = async (win, options) => {
|
|
6
6
|
if (typeof window === 'undefined') return undefined;
|
|
7
7
|
await globalScripts();
|
|
8
|
-
return bootstrapLazy([["phirepass-sftp-client",[[257,"phirepass-sftp-client"]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
|
|
8
|
+
return bootstrapLazy([["phirepass-sftp-client",[[257,"phirepass-sftp-client"]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
|
|
9
9
|
};
|
|
10
10
|
|
|
11
11
|
export { defineCustomElements };
|
|
@@ -224,6 +224,18 @@ class Channel {
|
|
|
224
224
|
const ptr = this.__destroy_into_raw();
|
|
225
225
|
wasm.__wbg_channel_free(ptr, 0);
|
|
226
226
|
}
|
|
227
|
+
/**
|
|
228
|
+
* @param {string} token
|
|
229
|
+
* @param {string} node_id
|
|
230
|
+
* @param {number | null} [msg_id]
|
|
231
|
+
*/
|
|
232
|
+
authenticate(token, node_id, msg_id) {
|
|
233
|
+
const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
234
|
+
const len0 = WASM_VECTOR_LEN;
|
|
235
|
+
const ptr1 = passStringToWasm0(node_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
|
|
236
|
+
const len1 = WASM_VECTOR_LEN;
|
|
237
|
+
wasm.channel_authenticate(this.__wbg_ptr, ptr0, len0, ptr1, len1, isLikeNone(msg_id) ? 0x100000001 : (msg_id) >>> 0);
|
|
238
|
+
}
|
|
227
239
|
connect() {
|
|
228
240
|
wasm.channel_connect(this.__wbg_ptr);
|
|
229
241
|
}
|
|
@@ -579,7 +591,7 @@ function __wbg_get_imports() {
|
|
|
579
591
|
__wbg_set_onopen_34e3e24cf9337ddd: function(arg0, arg1) {
|
|
580
592
|
getObject(arg0).onopen = getObject(arg1);
|
|
581
593
|
},
|
|
582
|
-
|
|
594
|
+
__wbg_warn_3ba994e68c965ce3: function(arg0, arg1) {
|
|
583
595
|
console.warn(getStringFromWasm0(arg0, arg1));
|
|
584
596
|
},
|
|
585
597
|
__wbindgen_cast_0000000000000001: function(arg0, arg1) {
|
|
@@ -963,7 +975,7 @@ async function __wbg_init(module_or_path) {
|
|
|
963
975
|
return __wbg_finalize_init(instance);
|
|
964
976
|
}
|
|
965
977
|
|
|
966
|
-
const phirepassTerminalCss = () => `.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#FFF;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1 !important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px !important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:rgba(0,0,0,0);transition:opacity 100ms linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity 800ms linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}:host{display:block;width:100%;height:100%}:host #ccc{width:inherit;height:inherit}`;
|
|
978
|
+
const phirepassTerminalCss = () => `.xterm{cursor:text;position:relative;user-select:none;-ms-user-select:none;-webkit-user-select:none}.xterm.focus,.xterm:focus{outline:none}.xterm .xterm-helpers{position:absolute;top:0;z-index:5}.xterm .xterm-helper-textarea{padding:0;border:0;margin:0;position:absolute;opacity:0;left:-9999em;top:0;width:0;height:0;z-index:-5;white-space:nowrap;overflow:hidden;resize:none}.xterm .composition-view{background:#000;color:#FFF;display:none;position:absolute;white-space:nowrap;z-index:1}.xterm .composition-view.active{display:block}.xterm .xterm-viewport{background-color:#000;overflow-y:scroll;cursor:default;position:absolute;right:0;left:0;top:0;bottom:0}.xterm .xterm-screen{position:relative}.xterm .xterm-screen canvas{position:absolute;left:0;top:0}.xterm-char-measure-element{display:inline-block;visibility:hidden;position:absolute;top:0;left:-9999em;line-height:normal}.xterm.enable-mouse-events{cursor:default}.xterm.xterm-cursor-pointer,.xterm .xterm-cursor-pointer{cursor:pointer}.xterm.column-select.focus{cursor:crosshair}.xterm .xterm-accessibility:not(.debug),.xterm .xterm-message{position:absolute;left:0;top:0;bottom:0;right:0;z-index:10;color:transparent;pointer-events:none}.xterm .xterm-accessibility-tree:not(.debug) *::selection{color:transparent}.xterm .xterm-accessibility-tree{font-family:monospace;user-select:text;white-space:pre}.xterm .xterm-accessibility-tree>div{transform-origin:left;width:fit-content}.xterm .live-region{position:absolute;left:-9999px;width:1px;height:1px;overflow:hidden}.xterm-dim{opacity:1 !important}.xterm-underline-1{text-decoration:underline}.xterm-underline-2{text-decoration:double underline}.xterm-underline-3{text-decoration:wavy underline}.xterm-underline-4{text-decoration:dotted underline}.xterm-underline-5{text-decoration:dashed underline}.xterm-overline{text-decoration:overline}.xterm-overline.xterm-underline-1{text-decoration:overline underline}.xterm-overline.xterm-underline-2{text-decoration:overline double underline}.xterm-overline.xterm-underline-3{text-decoration:overline wavy underline}.xterm-overline.xterm-underline-4{text-decoration:overline dotted underline}.xterm-overline.xterm-underline-5{text-decoration:overline dashed underline}.xterm-strikethrough{text-decoration:line-through}.xterm-screen .xterm-decoration-container .xterm-decoration{z-index:6;position:absolute}.xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer{z-index:7}.xterm-decoration-overview-ruler{z-index:8;position:absolute;top:0;right:0;pointer-events:none}.xterm-decoration-top{z-index:2;position:relative}.xterm .xterm-scrollable-element>.scrollbar{cursor:default}.xterm .xterm-scrollable-element>.scrollbar>.scra{cursor:pointer;font-size:11px !important}.xterm .xterm-scrollable-element>.visible{opacity:1;background:rgba(0,0,0,0);transition:opacity 100ms linear;z-index:11}.xterm .xterm-scrollable-element>.invisible{opacity:0;pointer-events:none}.xterm .xterm-scrollable-element>.invisible.fade{transition:opacity 800ms linear}.xterm .xterm-scrollable-element>.shadow{position:absolute;display:none}.xterm .xterm-scrollable-element>.shadow.top{display:block;top:0;left:3px;height:3px;width:100%;box-shadow:var(--vscode-scrollbar-shadow, #000) 0 6px 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.left{display:block;top:3px;left:0;height:100%;width:3px;box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}.xterm .xterm-scrollable-element>.shadow.top-left-corner{display:block;top:0;left:0;height:3px;width:3px}.xterm .xterm-scrollable-element>.shadow.top.left{box-shadow:var(--vscode-scrollbar-shadow, #000) 6px 0 6px -6px inset}:host{display:block;width:100%;height:100%}:host #ccc{width:inherit;height:inherit}:host #ccc .terminal{height:inherit}:host #ccc .terminal .xterm-scrollable-element{height:inherit}`;
|
|
967
979
|
|
|
968
980
|
var InputMode;
|
|
969
981
|
(function (InputMode) {
|
|
@@ -1048,11 +1060,12 @@ const PhirepassTerminal = class {
|
|
|
1048
1060
|
allowInsecure = false;
|
|
1049
1061
|
heartbeatInterval = 30_000;
|
|
1050
1062
|
nodeId;
|
|
1063
|
+
token;
|
|
1051
1064
|
onNodeIdChange(newValue, _oldValue) {
|
|
1052
1065
|
// Handle the change in node_id here
|
|
1053
1066
|
// console.log(`node_id changed from ${oldValue} to ${newValue}`);
|
|
1054
1067
|
// Always clear local session state and reset terminal view
|
|
1055
|
-
this.
|
|
1068
|
+
this.reset_session_state();
|
|
1056
1069
|
this.terminal.reset();
|
|
1057
1070
|
// Close existing comms if connected
|
|
1058
1071
|
if (this.channel && this.channel.is_connected()) {
|
|
@@ -1079,9 +1092,13 @@ const PhirepassTerminal = class {
|
|
|
1079
1092
|
return `${protocol}://${this.serverHost}:${this.serverPort}`;
|
|
1080
1093
|
}
|
|
1081
1094
|
async connectedCallback() {
|
|
1095
|
+
console.log('PhirepassTerminal connected to DOM');
|
|
1082
1096
|
await __wbg_init();
|
|
1097
|
+
console.log('PhirepassChannel module initialized');
|
|
1083
1098
|
this.setup_terminal();
|
|
1099
|
+
console.log('Terminal setup complete');
|
|
1084
1100
|
this.open_comms();
|
|
1101
|
+
console.log('Comms opened');
|
|
1085
1102
|
if (!this.nodeId) {
|
|
1086
1103
|
console.warn('Prop node_id is not set. Cannot connect to terminal.');
|
|
1087
1104
|
return;
|
|
@@ -1132,8 +1149,7 @@ const PhirepassTerminal = class {
|
|
|
1132
1149
|
this.channel = new Channel(`${this.createWebSocketEndpoint()}/api/web/ws`, this.nodeId);
|
|
1133
1150
|
}
|
|
1134
1151
|
this.channel.on_connection_open(() => {
|
|
1135
|
-
this.channel.
|
|
1136
|
-
this.channel.open_ssh_tunnel(this.nodeId);
|
|
1152
|
+
this.channel.authenticate(this.token, this.nodeId);
|
|
1137
1153
|
});
|
|
1138
1154
|
this.channel.on_connection_close(() => {
|
|
1139
1155
|
this.terminal.reset();
|
|
@@ -1150,6 +1166,9 @@ const PhirepassTerminal = class {
|
|
|
1150
1166
|
case "Error":
|
|
1151
1167
|
this.handle_error(web);
|
|
1152
1168
|
break;
|
|
1169
|
+
case "AuthSuccess":
|
|
1170
|
+
this.handleAuthSuccess(web);
|
|
1171
|
+
break;
|
|
1153
1172
|
case "TunnelOpened":
|
|
1154
1173
|
this.session_id = web.sid;
|
|
1155
1174
|
this.terminal.reset();
|
|
@@ -1216,27 +1235,30 @@ const PhirepassTerminal = class {
|
|
|
1216
1235
|
this.channel.stop_heartbeat();
|
|
1217
1236
|
this.channel.disconnect();
|
|
1218
1237
|
}
|
|
1219
|
-
|
|
1238
|
+
cancel_credential_entry() {
|
|
1220
1239
|
this.inputMode = InputMode.Default;
|
|
1221
|
-
this.
|
|
1222
|
-
this.passwordBuffer = "";
|
|
1240
|
+
this.clear_creds_buffer();
|
|
1223
1241
|
this.terminal.writeln("Authentication cancelled.");
|
|
1224
1242
|
this.terminal.reset();
|
|
1225
1243
|
}
|
|
1226
|
-
|
|
1227
|
-
this.session_id = undefined;
|
|
1228
|
-
this.inputMode = InputMode.Default;
|
|
1244
|
+
clear_creds_buffer() {
|
|
1229
1245
|
this.usernameBuffer = "";
|
|
1230
1246
|
this.passwordBuffer = "";
|
|
1231
1247
|
}
|
|
1248
|
+
reset_session_state() {
|
|
1249
|
+
this.session_id = undefined;
|
|
1250
|
+
this.inputMode = InputMode.Default;
|
|
1251
|
+
this.clear_creds_buffer();
|
|
1252
|
+
}
|
|
1253
|
+
handleAuthSuccess(_auth_) {
|
|
1254
|
+
this.clear_creds_buffer();
|
|
1255
|
+
this.channel.start_heartbeat(this.heartbeatInterval <= 15_000 ? 30_000 : this.heartbeatInterval);
|
|
1256
|
+
this.channel.open_ssh_tunnel(this.nodeId);
|
|
1257
|
+
}
|
|
1232
1258
|
handleTunnelClosed() {
|
|
1233
|
-
// Clear session state
|
|
1234
1259
|
this.session_id = undefined;
|
|
1235
1260
|
this.inputMode = InputMode.Default;
|
|
1236
|
-
|
|
1237
|
-
this.usernameBuffer = "";
|
|
1238
|
-
this.passwordBuffer = "";
|
|
1239
|
-
// Reset terminal display
|
|
1261
|
+
this.clear_creds_buffer();
|
|
1240
1262
|
this.terminal.reset();
|
|
1241
1263
|
this.terminal.writeln("Connection closed.");
|
|
1242
1264
|
}
|
|
@@ -1249,6 +1271,7 @@ const PhirepassTerminal = class {
|
|
|
1249
1271
|
this.terminal.onData(this.handleTerminalData.bind(this));
|
|
1250
1272
|
this.channel.connect();
|
|
1251
1273
|
this.setupResizeObserver();
|
|
1274
|
+
console.log('Terminal connected and ready');
|
|
1252
1275
|
}
|
|
1253
1276
|
}
|
|
1254
1277
|
setupResizeObserver() {
|
|
@@ -1284,7 +1307,7 @@ const PhirepassTerminal = class {
|
|
|
1284
1307
|
}
|
|
1285
1308
|
if (data === "\u0003") {
|
|
1286
1309
|
this.terminal.write("^C\r\n");
|
|
1287
|
-
this.
|
|
1310
|
+
this.cancel_credential_entry();
|
|
1288
1311
|
return;
|
|
1289
1312
|
}
|
|
1290
1313
|
if (data === "\u007f") {
|
|
@@ -1321,7 +1344,7 @@ const PhirepassTerminal = class {
|
|
|
1321
1344
|
}
|
|
1322
1345
|
if (data === "\u0003") {
|
|
1323
1346
|
this.terminal.write("^C\r\n");
|
|
1324
|
-
this.
|
|
1347
|
+
this.cancel_credential_entry();
|
|
1325
1348
|
return;
|
|
1326
1349
|
}
|
|
1327
1350
|
if (data === "\u007f") {
|
|
@@ -1356,7 +1379,7 @@ const PhirepassTerminal = class {
|
|
|
1356
1379
|
this.usernameBuffer = "";
|
|
1357
1380
|
}
|
|
1358
1381
|
render() {
|
|
1359
|
-
return (h$1(Host, { key: '
|
|
1382
|
+
return (h$1(Host, { key: '3f923e0cc42c6a8eca61424a7e75960317a5d99c' }, h$1("div", { key: '4a3e2f6d4652b7049c9ec9f535ad32fd6401cc09', id: "ccc" })));
|
|
1360
1383
|
}
|
|
1361
1384
|
static get watchers() { return {
|
|
1362
1385
|
"nodeId": [{
|
|
@@ -17,5 +17,5 @@ var patchBrowser = () => {
|
|
|
17
17
|
|
|
18
18
|
patchBrowser().then(async (options) => {
|
|
19
19
|
await globalScripts();
|
|
20
|
-
return bootstrapLazy([["phirepass-sftp-client",[[257,"phirepass-sftp-client"]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
|
|
20
|
+
return bootstrapLazy([["phirepass-sftp-client",[[257,"phirepass-sftp-client"]]],["phirepass-terminal",[[513,"phirepass-terminal",{"terminalOptions":[16],"serverHost":[1,"server-host"],"serverPort":[2,"server-port"],"allowInsecure":[4,"allow-insecure"],"heartbeatInterval":[2,"heartbeat-interval"],"nodeId":[1,"node-id"],"token":[1],"serverId":[1,"server-id"]},null,{"nodeId":[{"onNodeIdChange":0}],"serverId":[{"onServerIdChange":0}]}]]]], options);
|
|
21
21
|
});
|