diff options
author | Richard Yu <yurichard3839@gmail.com> | 2024-03-26 01:08:06 +0800 |
---|---|---|
committer | Paul Donald <itsascambutmailmeanyway+github@gmail.com> | 2024-03-27 02:01:20 +0100 |
commit | 9f3ae08703e23d7395ef9daa05ab1000dde09152 (patch) | |
tree | dca8442c60d0af50ef376d607f294b13a86a7527 /applications/luci-app-ttyd/htdocs/luci-static/resources/view | |
parent | 41c18218f382757b62cbf678168bb749c10c8a5e (diff) |
luci-app-ttyd: add option for UNIX socket and URL override
Signed-off-by: Richard Yu <yurichard3839@gmail.com>
Diffstat (limited to 'applications/luci-app-ttyd/htdocs/luci-static/resources/view')
-rw-r--r-- | applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/config.js | 18 | ||||
-rw-r--r-- | applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/term.js | 5 |
2 files changed, 19 insertions, 4 deletions
diff --git a/applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/config.js b/applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/config.js index 3ab453a0ab..240b5140eb 100644 --- a/applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/config.js +++ b/applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/config.js @@ -17,13 +17,22 @@ return view.extend({ o = s.option(form.Flag, 'enable', _('Enable')); o.default = true; + s.option(form.Flag, 'unix_sock', _('UNIX socket'), _('Bind to UNIX domain socket instead of IP port')); + o = s.option(form.Value, 'port', _('Port'), _('Port to listen (default: 7681, use `0` for random port)')); + o.depends('unix_sock', '0'); o.datatype = 'port'; o.placeholder = 7681; - o = s.option(widgets.DeviceSelect, 'interface', _('Interface'), _('Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)')); + o = s.option(widgets.DeviceSelect, 'interface', _('Interface'), _('Network interface to bind (eg: eth0)')); + o.depends('unix_sock', '0'); o.nocreate = true; + o = s.option(form.Value, '_unix_sock_path', _('UNIX socket path'), _('UNIX domain socket path (eg: /var/run/ttyd.sock)')); + o.depends('unix_sock', '1'); + o.ucioption = 'interface'; + o.retain = true; + o = s.option(form.Value, 'credential', _('Credential'), _('Credential for Basic Authentication')); o.placeholder = 'username:password'; @@ -54,7 +63,7 @@ return view.extend({ s.option(form.Flag, 'once', _('Once'), _('Accept only one client and exit on disconnection')); - o = s.option(form.Value, 'index', _('Index'), _('Custom index.html path')); + s.option(form.Value, 'index', _('Index'), _('Custom index.html path')); s.option(form.Flag, 'ipv6', _('IPv6'), _('Enable IPv6 support')); @@ -78,6 +87,11 @@ return view.extend({ s.option(form.Value, 'command', _('Command')); + s.option(form.Value, 'url_override', _('URL override'), + _('Override URL in Terminal tab. For use with reverse proxy.') + '<br />' + + _('Note that reverse proxied pages is NOT protected by password like LuCI.') + '<br />' + + _('Make sure to set up another authorization method.')); + return m.render(); } }); diff --git a/applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/term.js b/applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/term.js index 6ee712a0b7..fac6da51a2 100644 --- a/applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/term.js +++ b/applications/luci-app-ttyd/htdocs/luci-static/resources/view/ttyd/term.js @@ -8,12 +8,13 @@ return view.extend({ }, render: function() { var port = uci.get_first('ttyd', 'ttyd', 'port') || '7681', - ssl = uci.get_first('ttyd', 'ttyd', 'ssl') || '0'; + ssl = uci.get_first('ttyd', 'ttyd', 'ssl') || '0', + url = uci.get_first('ttyd', 'ttyd', 'url_override'); if (port === '0') return E('div', { class: 'alert-message warning' }, _('Random ttyd port (port=0) is not supported.<br />Change to a fixed port and try again.')); return E('iframe', { - src: (ssl === '1' ? 'https' : 'http') + '://' + window.location.hostname + ':' + port, + src: url || ((ssl === '1' ? 'https' : 'http') + '://' + window.location.hostname + ':' + port), style: 'width: 100%; min-height: 500px; border: none; border-radius: 3px; resize: vertical;' }); }, |