0
0
mirror of https://github.com/openwrt/packages.git synced 2025-07-31 23:10:32 +00:00
Files
packages/utils/ttyd/files/ttyd.init
Paul Donald 7f0772c1a4 ttyd: update to 1.7.7
Breaking Changes

    The web terminal is readonly by default now, to make it writable,
    use -W option.

Changelog 1.7.7

    Bump to 1.7.7
    cmake: add static version back

Changelog 1.7.6

    workflow: update actions packages
    cmake: get version from git ref

Changelog 1.7.5

    html: allow overriding client options with URL query
    server: add --exit-no-conn option
    html: add safari mobile full screen support
    html: Add Unicode 11 xterm.js addon
    html: upgrade to xterm 5.4.0
    add trzszDragInitTimeout option

Changelog 1.7.4

    Leverage Docker Layer System
    html: update dependencies
    build(deps): update zlib version 1.2.13 to 1.3 in cross-build.sh
    server: print working directory on start
    server: replace --readonly with --writable
    server: fix -U option not work
    server: do not expose port to public by default
    Add -y flag for easier installation
    improve support for trzsz
    info.max_http_header_data = 65535;
    Add Docker pulls badge
    fix flow control
    Fix typo, OPTOINS -> OPTIONS
    Bump CMake version to 2.8.12

Signed-off-by: Paul Donald <newtwen+github@gmail.com>
2025-04-24 12:50:04 +02:00

103 lines
2.0 KiB
Bash

#!/bin/sh /etc/rc.common
START=99
STOP=50
USE_PROCD=1
NAME=ttyd
PROG=/usr/bin/$NAME
validate_section_ttyd()
{
uci_load_validate ttyd ttyd "$1" "$2" \
'enable:bool:1' \
'port:port' \
'interface:string' \
'credential:string' \
'uid:uinteger' \
'gid:uinteger' \
'signal:uinteger' \
'url_arg:bool' \
'readonly:bool:0' \
'client_option:list(string)' \
'terminal_type:string' \
'check_origin:bool' \
'max_clients:uinteger' \
'once:bool' \
'index:string' \
'ipv6:bool' \
'ssl:bool' \
'ssl_cert:file' \
'ssl_key:file' \
'ssl_ca:file' \
'debug:uinteger' \
'command:string'
}
ttyd_instance()
{
[ "$2" = 0 ] || {
echo "validation failed"
return 1
}
[ "$enable" = 0 ] && return 1
[ -z "$command" ] && return 1
[ "${interface::1}" = @ ] && {
interface=$(
. /lib/functions/network.sh
network_get_device device "${interface:1}"
echo -n "$device"
)
}
[ "$url_arg" = 0 ] && url_arg=""
[ "$readonly" = 0 ] && readonly="-W"
[ "$check_origin" = 0 ] && check_origin=""
[ "$once" = 0 ] && once=""
[ "$ipv6" = 0 ] && ipv6=""
[ "$ssl" = 0 ] && ssl=""
procd_open_instance
procd_set_param command "$PROG" \
${port:+-p $port} \
${interface:+-i $interface} \
${credential:+-c $credential} \
${uid:+-u $uid} \
${gid:+-g $gid} \
${signal:+-s $signal} \
${url_arg:+-a} \
${readonly:-} \
${terminal_type:+-T $terminal_type} \
${check_origin:+-O} \
${max_clients:+-m $max_clients} \
${once:+-o} \
${index:+-I $index} \
${ipv6:+-6} \
${ssl:+-S} \
${ssl_cert:+-C $ssl_cert} \
${ssl_key:+-K $ssl_key} \
${ssl_ca:+-A $ssl_ca} \
${debug:+-d $debug}
config_list_foreach "$1" client_option "procd_append_param command -t"
procd_append_param command $command
procd_set_param stdout 1
procd_set_param stderr 1
procd_close_instance
}
start_service() {
config_load "$NAME"
config_foreach validate_section_ttyd ttyd ttyd_instance
}
shutdown() {
# close all open connections
killall "$NAME"
}
service_triggers() {
procd_add_reload_trigger "$NAME"
}