luci-mod-system: allow configuration of HTTPS redirection

Add a posibility for easy configuration of HTTPS redirection in uHTTPd.

References: https://lists.infradead.org/pipermail/openwrt-devel/2020-December/032718.html
Signed-off-by: Petr Štetiar <ynezz@true.cz>
This commit is contained in:
Petr Štetiar 2020-12-14 13:11:08 +01:00 committed by Paul Spooren
parent b5faba1244
commit 7c943a1d6b
3 changed files with 50 additions and 0 deletions

View file

@ -0,0 +1,22 @@
'use strict';
'require view';
'require form';
return view.extend({
render: function() {
var m, s, o;
m = new form.Map('uhttpd', _('HTTP(S) Access'), _('uHTTPd offers <abbr title="Hypertext Transfer Protocol">HTTP</abbr> or <abbr title="Hypertext Transfer Protocol Secure">HTTPS</abbr> network access.'));
s = m.section(form.NamedSection, 'main', 'uhttpd', _('Settings'));
s.addremove = false;
o = s.option(form.Flag, 'redirect_https', _('Redirect to HTTPS'), _('Enable automatic redirection of <abbr title="Hypertext Transfer Protocol">HTTP</abbr> requests to <abbr title="Hypertext Transfer Protocol Secure">HTTPS</abbr> port.'));
o.enabled = 'on';
o.disabled = 'off';
o.default = o.disabled;
o.rmempty = false;
return m.render();
}
});

View file

@ -60,6 +60,20 @@
}
},
"admin/system/admin/uhttpd": {
"title": "HTTP(S) Access",
"order": 4,
"action": {
"type": "view",
"path": "system/uhttpd"
},
"depends": {
"acl": [ "luci-mod-system-uhttpd" ],
"fs": { "/usr/sbin/uhttpd": "executable" }
}
},
"admin/system/startup": {
"title": "Startup",
"order": 45,

View file

@ -38,6 +38,20 @@
}
},
"luci-mod-system-uhttpd": {
"description": "Grant access to uHTTPd configuration",
"read": {
"uci": [ "uhttpd" ]
},
"write": {
"ubus": {
"luci": [ "setInitAction" ]
},
"uci": [ "uhttpd" ]
}
},
"luci-mod-system-init": {
"description": "Grant access to startup configuration",
"read": {