JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 28
  • Score
    100M100P100Q51414F
  • License ISC

Ssh addon for xterm.js

Package Exports

  • xterm-addon-ssh
  • xterm-addon-ssh/dist/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (xterm-addon-ssh) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

xterm-addon-ssh

Overview

It forwards to socket server for communicate via ssh.

Install

npm install --save xterm-addon-ssh

Usage

  • Javascript
import { Terminal } from 'xterm';
import { SshAddon } from 'xterm-addon-ssh';

const sockjs = new SockJS('wss://127.0.0.1:8090');

const terminal = new Terminal();
const SshAddon = new SshAddon(webSocket, {
  serverUuid: '123e4567-e89b-12d3-a456-426614174000',
  header: {
    Authorization:
      'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
  },
  connectImmediately: true,
});
terminal.loadAddon(attachAddon);
  • React with Typescript
import * as React from 'react';
import { QPXterm } from 'qp-xtermjs';
import { SshAddon } from 'xterm-addon-ssh';

const sockjs = new SockJS('wss://127.0.0.1:8090');

const Term: React.FC = () => {
  const terminalRef = useRef<QPXterm | null>();
  const sshAddon = React.useRef(
    new SshAddon(webSocket, {
      serverUuid: '123e4567-e89b-12d3-a456-426614174000',
      header: {
        Authorization:
          'Bearer eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c',
      },
      connectImmediately: true,
    }),
  ).current;

  const onDidMount = React.useCallback((terminal: QPXterm) => {
    terminalRef.current = terminal;
  }, []);

  return <QPXterm onDidMount={onDidMount} addons={[sshAddon]} />;
};

export default Term;