summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-tor/htdocs/luci-static/resources/view
diff options
context:
space:
mode:
authorSergey Ponomarev <stokito@gmail.com>2024-02-09 03:07:22 +0200
committerPaul Donald <itsascambutmailmeanyway@gmail.com>2024-02-12 14:26:55 +0100
commitc170dfab9197f714c5e4483caad924631779122a (patch)
tree7d6fa086f7f80bf070755c32937e5a223d16bb0b /applications/luci-app-tor/htdocs/luci-static/resources/view
parenta4e586397e9d5695b2c435b03fb5b5da27ac6aa0 (diff)
luci-app-tor: add config for tor
Currently the UCI for the Tor allows to set only a list of configs to include. The only way to configure it for a user is to upload its own config and add it to list of included. We can simplify this with the app. Signed-off-by: Sergey Ponomarev <stokito@gmail.com>
Diffstat (limited to 'applications/luci-app-tor/htdocs/luci-static/resources/view')
-rw-r--r--applications/luci-app-tor/htdocs/luci-static/resources/view/tor/tor.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/applications/luci-app-tor/htdocs/luci-static/resources/view/tor/tor.js b/applications/luci-app-tor/htdocs/luci-static/resources/view/tor/tor.js
new file mode 100644
index 0000000000..dde7ca75d3
--- /dev/null
+++ b/applications/luci-app-tor/htdocs/luci-static/resources/view/tor/tor.js
@@ -0,0 +1,36 @@
+'use strict';
+'require view';
+'require form';
+'require uci';
+
+
+return view.extend({
+ render: function () {
+ var m, s, o;
+
+ m = new form.Map('tor', _('Tor onion router'),
+ _('For further information <a %s>check the documentation</a>')
+ .format('href="https://openwrt.org/docs/guide-user/services/tor/client" target="_blank" rel="noreferrer"')
+ );
+
+ s = m.section(form.NamedSection, 'conf', 'tor');
+
+ o = s.option(form.DynamicList, 'tail_include', _('Include configs'));
+ o.datatype = 'list(string)';
+
+ o = s.option(form.FileUpload, '_custom_config', _('Custom config'));
+ o.default = '/etc/tor/torrc_custom';
+ o.root_directory = '/etc/tor/';
+ o.optional = true;
+ o.write = function(section_id, formvalue) {
+ let tail_include = uci.get('tor', section_id, 'tail_include');
+ if (!tail_include.includes(formvalue)) {
+ tail_include.push(formvalue);
+ return uci.set('tor', section_id, 'tail_include', tail_include);
+ }
+ };
+
+
+ return m.render();
+ },
+});