mirror of
https://github.com/kenzok8/small-package
synced 2025-01-05 11:36:47 +08:00
update 2024-08-10 04:20:22
This commit is contained in:
parent
c6561ee919
commit
996e6727ff
@ -99,7 +99,9 @@ return view.extend({
|
||||
o = s.taboption('firmware', form.Flag, 'cookie_p', _('Persistent cookies'),
|
||||
_('Keep the background login state to avoid the need to log in again every time the browser is closed'));
|
||||
o.default = o.enabled;
|
||||
|
||||
|
||||
o = s.taboption('firmware', form.Flag, 'https', _('Force the use of HTTPS in the backend.'));
|
||||
|
||||
if (data.istorex || data.routerdog){
|
||||
o = s.taboption('firmware', form.ListValue, 'landing_page', _('主题模式'));
|
||||
o.value('default', _('默认'));
|
||||
|
@ -70,3 +70,6 @@ msgstr "目标URL"
|
||||
msgid "Please enter a valid URL starting with http:// or https://"
|
||||
msgstr "URL需以http:// 或 https://开头"
|
||||
|
||||
msgid "Force the use of HTTPS in the backend."
|
||||
msgstr "后台强制使用https"
|
||||
|
||||
|
@ -136,7 +136,9 @@ add_wizard() {
|
||||
uci commit wireless
|
||||
}
|
||||
fi
|
||||
|
||||
|
||||
sethttps
|
||||
|
||||
uci commit wizard
|
||||
uci commit dhcp
|
||||
uci commit firewall
|
||||
@ -165,6 +167,43 @@ uci -q set wizard.default.lan_dns="$(uci -q get network.lan.dns)"
|
||||
uci commit wizard
|
||||
}
|
||||
|
||||
sethttps() {
|
||||
config_get https "$cfg" https
|
||||
if [ -n "$(command -v nginx)" ]; then
|
||||
if [ -z "`uci -q get nginx._redirect2ssl`" ]; then
|
||||
uci -q set nginx._redirect2ssl=server
|
||||
uci -q set nginx._redirect2ssl.server_name='_redirect2ssl'
|
||||
uci -q set nginx._redirect2ssl.return='302 https://$host$request_uri'
|
||||
uci -q set nginx._redirect2ssl.access_log='off; # logd openwrt'
|
||||
fi
|
||||
if [ "x${https}" = "x1" ] ; then
|
||||
uci -q del nginx.default_server.listen
|
||||
uci -q add_list nginx.default_server.listen='80'
|
||||
uci -q add_list nginx.default_server.listen='[::]:80'
|
||||
uci -q del nginx._redirect2ssl.listen
|
||||
uci -q add_list nginx._redirect2ssl.listen='80 default_server'
|
||||
uci -q add_list nginx._redirect2ssl.listen='[::]:80 default_server'
|
||||
else
|
||||
uci -q del nginx._redirect2ssl.listen
|
||||
uci -q add_list nginx._redirect2ssl.listen='80'
|
||||
uci -q add_list nginx._redirect2ssl.listen='[::]:80'
|
||||
uci -q del nginx.default_server.listen
|
||||
uci -q add_list nginx.default_server.listen='80 default_server'
|
||||
uci -q add_list nginx.default_server.listen='[::]:80 default_server'
|
||||
fi
|
||||
uci commit nginx
|
||||
/etc/init.d/nginx reload
|
||||
else
|
||||
if [ "x${https}" = "x1" ] ; then
|
||||
uci -q set uhttpd.main.redirect_https='1'
|
||||
else
|
||||
uci -q set uhttpd.main.redirect_https='0'
|
||||
fi
|
||||
uci commit uhttpd
|
||||
/etc/init.d/uhttpd reload
|
||||
fi
|
||||
}
|
||||
|
||||
process_shortcut() {
|
||||
local shortcut to_url comments lanaddr
|
||||
local cfg="$1"
|
||||
|
Loading…
Reference in New Issue
Block a user