ttyd でSixel

以前試したターミナルをWebで共有できるttyd のSixel の対応状況を確認してみると1つ前のリリースの 1,7.3 で対応しているようなので少し試してみました.

Sixel support is off by default now, use -t enableSixel=true to enable it.

以前試した時の記事.
* 端末をWeb共有できるttyd – matoken’s meme

オンラインでttyd を使いプレゼンテーションを試みた時のスライド.
* Terminalとウェブブラウザでプレゼンテーションの試み – Speaker Deck

GitHub のRelease にbinary があるけどsource からBuild してみました.

build
$ sudo apt install build-essential cmake git libjson-c-dev libwebsockets-dev
$ git clone https://github.com/tsl0922/ttyd.git
$ cd ttyd && mkdir build && cd build
$ cmake ..
$ make && make install
$ ./ttyd --version
ttyd version 1.7.4-fd280fe
$ ./ttyd
ttyd is a tool for sharing terminal over the web

USAGE:
    ttyd [options] <command> [<arguments...>]

VERSION:
    1.7.4-fd280fe

OPTIONS:
    -p, --port              Port to listen (default: 7681, use `0` for random port)
    -i, --interface         Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)
    -U, --socket-owner      User owner of the UNIX domain socket file, when enabled (eg: user:group)
    -c, --credential        Credential for basic authentication (format: username:password)
    -H, --auth-header       HTTP Header name for auth proxy, this will configure ttyd to let a HTTP reverse proxy handle authentication
    -u, --uid               User id to run with
    -g, --gid               Group id to run with
    -s, --signal            Signal to send to the command when exit it (default: 1, SIGHUP)
    -w, --cwd               Working directory to be set for the child program
    -a, --url-arg           Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)
    -W, --writable          Allow clients to write to the TTY (readonly by default)
    -t, --client-option     Send option to client (format: key=value), repeat to add more options
    -T, --terminal-type     Terminal type to report, default: xterm-256color
    -O, --check-origin      Do not allow websocket connection from different origin
    -m, --max-clients       Maximum clients to support (default: 0, no limit)
    -o, --once              Accept only one client and exit on disconnection
    -B, --browser           Open terminal with the default system browser
    -I, --index             Custom index.html path
    -b, --base-path         Expected base path for requests coming from a reverse proxy (eg: /mounted/here, max length: 128)
    -P, --ping-interval     Websocket ping interval(sec) (default: 5)
    -6, --ipv6              Enable IPv6 support
    -S, --ssl               Enable SSL
    -C, --ssl-cert          SSL certificate file path
    -K, --ssl-key           SSL key file path
    -A, --ssl-ca            SSL CA file path for client certificate verification
    -d, --debug             Set log level (default: 7)
    -v, --version           Print the version and exit
    -h, --help              Print this text and exit

Visit https://github.com/tsl0922/ttyd to get more information and report bugs.
ttyd でbash を起動
$ ttyd -p 8080 --writable -t enableSixel=true /bin/bash
Note
  • 1.7.4 から --readonly オプションが --writable に変更になっています.
  • -t enableSixel=true でSixel を有効に出来ます.
sayaka ちゃんを起動

ttyd sayaka

環境
$ ./ttyd -v
ttyd version 1.7.4-fd280fe
$ dpkg-query -W build-essential cmake git libjson-c-dev libwebsockets-dev
build-essential 12.10
cmake   3.28.1-1
git     1:2.43.0-1
libjson-c-dev:amd64     0.17-1
libwebsockets-dev:amd64 4.3.3-1
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:    Debian GNU/Linux trixie/sid
Release:        n/a
Codename:       trixie
$ arch
x86_64

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です