Skip to content

Commit

Permalink
update 2024-08-10 04:20:22
Browse files Browse the repository at this point in the history
  • Loading branch information
kenzok8 committed Aug 9, 2024
1 parent c6561ee commit 996e672
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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', _('默认'));
Expand Down
3 changes: 3 additions & 0 deletions luci-app-wizard/po/zh_Hans/wizard.po
Original file line number Diff line number Diff line change
Expand Up @@ -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"

41 changes: 40 additions & 1 deletion luci-app-wizard/root/etc/init.d/wizard
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,9 @@ add_wizard() {
uci commit wireless
}
fi


sethttps

uci commit wizard
uci commit dhcp
uci commit firewall
Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit 996e672

Please sign in to comment.