Merge pull request #3202 from ysc3839/ttyd
[oweals/luci.git] / applications / luci-app-ttyd / htdocs / luci-static / resources / view / ttyd / config.js
1 'use strict';
2 'require form';
3 'require tools.widgets as widgets';
4
5 return L.view.extend({
6         render: function() {
7                 var m, s, o;
8
9                 m = new form.Map('ttyd');
10
11                 s = m.section(form.TypedSection, 'ttyd', _('ttyd Instance'));
12                 s.anonymous   = true;
13                 s.addremove   = true;
14                 s.addbtntitle = _('Add instance');
15
16                 o = s.option(form.Flag, 'enable', _('Enable'));
17                 o.default = true;
18
19                 o = s.option(form.Value, 'port', _('Port'), _('Port to listen (default: 7681, use `0` for random port)'));
20                 o.datatype    = 'port';
21                 o.placeholder = 7681;
22
23                 o = s.option(widgets.DeviceSelect, 'interface', _('Interface'), _('Network interface to bind (eg: eth0), or UNIX domain socket path (eg: /var/run/ttyd.sock)'));
24                 o.nocreate    = true;
25                 o.unspecified = true;
26
27                 o = s.option(form.Value, 'credential', _('Credential'), _('Credential for Basic Authentication'));
28                 o.placeholder = 'username:password';
29
30                 o = s.option(form.Value, 'uid', _('User ID'), _('User id to run with'));
31                 o.datatype = 'uinteger';
32
33                 o = s.option(form.Value, 'gid', _('Group ID'), _('Group id to run with'));
34                 o.datatype = 'uinteger';
35
36                 o = s.option(form.Value, 'signal', _('Signal'), _('Signal to send to the command when exit it (default: 1, SIGHUP)'));
37                 o.datatype = 'uinteger';
38
39                 s.option(form.Flag, 'url_arg', _('Allow URL args'), _('Allow client to send command line arguments in URL (eg: http://localhost:7681?arg=foo&arg=bar)'));
40
41                 s.option(form.Flag, 'readonly', _('Read-only'), _('Do not allow clients to write to the TTY'));
42
43                 o = s.option(form.DynamicList, 'client_option', _('Client option'), _('Send option to client'));
44                 o.placeholder = 'key=value';
45
46                 o = s.option(form.Value, 'terminal_type', _('Terminal type'), _('Terminal type to report (default: xterm-256color)'));
47                 o.placeholder = 'xterm-256color';
48
49                 s.option(form.Flag, 'check_origin', _('Check origin'), _('Do not allow websocket connection from different origin'));
50
51                 o = s.option(form.Value, 'max_clients', _('Max clients'), _('Maximum clients to support (default: 0, no limit)'));
52                 o.datatype = 'uinteger';
53                 o.placeholder = '0';
54
55                 s.option(form.Flag, 'once', _('Once'), _('Accept only one client and exit on disconnection'));
56
57                 o = s.option(form.Value, 'index', _('Index'), _('Custom index.html path'));
58
59                 s.option(form.Flag, 'ipv6', _('IPv6'), _('Enable IPv6 support'));
60
61                 s.option(form.Flag, 'ssl', _('SSL'), _('Enable SSL'));
62
63                 o = s.option(form.Value, 'ssl_cert', _('SSL cert'), _('SSL certificate file path'));
64                 o.depends('ssl', '1');
65
66                 o = s.option(form.Value, 'ssl_key', _('SSL key'), _('SSL key file path'));
67                 o.depends('ssl', '1');
68
69                 o = s.option(form.Value, 'ssl_ca', _('SSL ca'), _('SSL CA file path for client certificate verification'));
70                 o.depends('ssl', '1');
71
72                 o = s.option(form.Value, 'debug', _('Debug'), _('Set log level (default: 7)'));
73                 o.placeholder = '7';
74
75                 s.option(form.Value, 'command', _('Command'));
76
77                 return m.render();
78         }
79 });