-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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>
- Loading branch information
1 parent
a4e5863
commit c170dfa
Showing
4 changed files
with
49 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
applications/luci-app-tor/htdocs/luci-static/resources/view/tor/tor.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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(); | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,10 @@ | |
"uci": [ | ||
"tor", | ||
"tor-hs" | ||
] | ||
], | ||
"file": { | ||
"/etc/tor/*": [ "write" ] | ||
} | ||
} | ||
} | ||
} |