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';
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'));
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();
}
});
},
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;'
});
},