V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
爱意满满的作品展示区。
tsl0922
V2EX  ›  分享创造

终端分享工具 ttyd 1.2.0 发布,添加了中文输入支持

  •  2
     
  •   tsl0922 ·
    tsl0922 · 2016-11-14 20:40:15 +08:00 · 7359 次点击
    这是一个创建于 2691 天前的主题,其中的信息可能已经有所发展或是发生改变。

    ttyd 1.2.0 发布了。

    这个版本主要的改进是网页终端模拟器添加了对 CJK (Chinese, Japanese, Korean) 和 IME 的支持,也就是说可以输入中文了。另外, ttyd 也可以在 FreeBSD 下使用了。

    ChangeLog

    1.2.0

    • Fixed compile error on FreeBSD
    • Re-implemented the base64 function without openssl
    • --client-option option: allows setting terminal preference on the server side
    • Moved the terminal emulator from hterm to xterm.js for CJK and IME support
    • Show websocket connection error with overlay

    1.1.0

    • --once option: accept only one client and exit on disconnection
    • --readonly option: do not allow clients to write to the TTY
    • --check-origin option: do not allow websocket connection from different origin
    • HTTP Server header changed to ttyd, eg: ttyd/1.1.0 (libwebsockets/2.0.2)
    • Added check for lws_config.h, some version of libwebsockets may not have this header file
    • libwebsockets : handle fragmented messages, this allows large input on the web
    • OpenWrt Makefile: changed the openssl dependency to libopenssl

    ttyd 是一个 C 语言编写的命令行程序,可以把任意命令行程序分享到网页上操作,可以看做是个网页版的远程终端,支持 Linux 、 macOS 系统,还可以运行在 OpenWrt 之类的嵌入式系统上。

    功能特色:

    • C 语言编写,在速度和内存占用上相比其它实现有一些优势
    • 网页和服务器端使用 websocket 通信(基于 libwebsockets
    • 前端使用 chromium hterm 实现终端模拟,功能完备(已换为对中文输入更友好的 Xterm.js
    • 客户端和服务器端支持 SSL 加密通信(基于 OpenSSL
    • 支持配置用户名密码认证( Basic Auth )
    • 可以执行任意命令行程序,不只是 bash 之类的 shell
    • 跨平台支持,可以在 Linux 、 macOS 、OpenWrt 下运行

    运行效果:

    screenshot

    更新历史:

    第 1 条附言  ·  2016-11-16 06:59:51 +08:00
    18 条回复    2016-11-23 23:22:50 +08:00
    zhs227
        1
    zhs227  
       2016-11-14 21:12:10 +08:00
    这个工具确实不错,有的时候很方便。支持楼主
    cyio
        2
    cyio  
       2016-11-14 21:45:44 +08:00
    太神奇了,开始还以为只是个玩具,试用后感觉以后不用离开浏览器了
    可以跟已有的浏览器插件配合起来
    lizhenda
        3
    lizhenda  
       2016-11-14 21:49:08 +08:00
    非常不错!
    83f420984
        4
    83f420984  
       2016-11-14 21:50:40 +08:00 via Android
    如何编译成 openwrt ar71xx 版本的?
    tsl0922
        5
    tsl0922  
    OP
       2016-11-14 23:09:07 +08:00
    @83f420984 ttyd 已经包含在 openwrt 的官方软件源里了,可以直接执行 opkg install ttyd 来安装,但是因为比较新,比不是所有版本的 OpenWrt 都有这个软件包。如果无法安装的话也可以自行从源码编译, Makefile 在这里: https://github.com/openwrt/packages/tree/master/utils/ttyd ,如果你在 OpenWrt/LEDE 的源码目录里并且更新了最新的 packages feed ,执行 make menuconfig 应该可以找到 ttyd 。
    tsl0922
        6
    tsl0922  
    OP
       2016-11-14 23:52:01 +08:00   ❤️ 1
    @83f420984 添加了使用 OpenWrt/LEDE SDK 构建 ttyd 的方法,看这个文档: https://github.com/tsl0922/ttyd/tree/master/openwrt
    bobchengbin
        7
    bobchengbin  
       2016-11-15 19:23:01 +08:00 via iPhone
    利害
    20015jjw
        8
    20015jjw  
       2016-11-15 19:29:25 +08:00 via Android
    如果我在服务器上开 有办法让用户验证么
    zzlyzq
        9
    zzlyzq  
       2016-11-15 21:53:15 +08:00
    赞一个
    tsl0922
        10
    tsl0922  
    OP
       2016-11-16 06:53:42 +08:00
    @20015jjw 使用 --credential username:password 可以开启 http basic auth ,或者直接执行 ttyd login 在网页上使用系统账户登录。
    Tink
        11
    Tink  
       2016-11-16 07:38:20 +08:00 via iPhone
    希望能支持 ssl 客户端验证
    20015jjw
        12
    20015jjw  
       2016-11-16 07:50:32 +08:00 via Android
    @tsl0922 nice 可以试试 不过这个比本地 ssh 有什么优势么?除了用 web 端口之外
    tsl0922
        13
    tsl0922  
    OP
       2016-11-16 12:47:37 +08:00 via iPhone
    @Tink 支持 ssl 的,可以通过命令行参数开启
    tsl0922
        14
    tsl0922  
    OP
       2016-11-16 12:48:58 +08:00 via iPhone
    @20015jjw 优势不就是只需要一个浏览器就可以玩了么😄
    Tink
        15
    Tink  
       2016-11-16 14:14:25 +08:00
    @tsl0922 亲不是啊, 我是说 ssl 客户端验证

    比如这个: https://www.v2ex.com/t/318910

    这样安全性会大大提高, 感觉即使公网使用也不会有什么问题
    tsl0922
        16
    tsl0922  
    OP
       2016-11-16 16:39:52 +08:00
    @Tink 理解了,就是客户端必须使用服务器端 CA 签发的证书来连接吧,这个可以做,已创建 issue : https://github.com/tsl0922/ttyd/issues/26
    Tink
        17
    Tink  
       2016-11-16 16:44:02 +08:00
    @tsl0922 棒!
    tsl0922
        18
    tsl0922  
    OP
       2016-11-23 23:22:50 +08:00
    @Tink master 分支已添加 ssl 客户端验证支持, README 里也有使用方法。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   3702 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 29ms · UTC 10:24 · PVG 18:24 · LAX 03:24 · JFK 06:24
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.