diff options
12 files changed, 128 insertions, 42 deletions
diff --git a/applications/luci-app-banip/luasrc/model/cbi/banip/overview_tab.lua b/applications/luci-app-banip/luasrc/model/cbi/banip/overview_tab.lua index 57294e5c46..277b8363ed 100644 --- a/applications/luci-app-banip/luasrc/model/cbi/banip/overview_tab.lua +++ b/applications/luci-app-banip/luasrc/model/cbi/banip/overview_tab.lua @@ -131,6 +131,16 @@ e6.default = 4 e6.datatype = "range(1,32)" e6.rmempty = false +e7 = e:option(Flag, "ban_autoblacklist", translate("Local Save Blacklist Addons"), + translate("Blacklist auto addons are stored temporary in the IPSet and saved permanently in the local blacklist. Disable this option to prevent the local save.")) +e7.default = e7.enabled +e7.rmempty = true + +e8 = e:option(Flag, "ban_autowhitelist", translate("Local Save Whitelist Addons"), + translate("Whitelist auto addons are stored temporary in the IPSet and saved permanently in the local whitelist. Disable this option to prevent the local save.")) +e8.default = e8.enabled +e8.rmempty = true + -- Optional Extra Options e20 = e:option(Value, "ban_triggerdelay", translate("Trigger Delay"), diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua index 83011e9dd5..2c2625dbca 100644 --- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_add.lua @@ -1,9 +1,11 @@ --- Copyright 2017-2018 Dirk Brenken (dev@brenken.org) +-- Copyright 2017-2019 Dirk Brenken (dev@brenken.org) -- This is free software, licensed under the Apache License, Version 2.0 local fs = require("nixio.fs") local uci = require("luci.model.uci").cursor() local http = require("luci.http") +local util = require("luci.util") +local scripts = util.split(util.trim(util.exec("ls /etc/travelmate/*.login 2>/dev/null")), "\n", nil, true) or {} local trmiface = uci:get("travelmate", "global", "trm_iface") or "trm_wwan" local encr_psk = {"psk", "psk2", "psk-mixed"} local encr_wpa = {"wpa", "wpa2", "wpa-mixed"} @@ -135,6 +137,17 @@ elseif (tonumber(m.hidden.wpa_version) or 0) > 0 then end end +local login_section = (m.hidden.ssid or "") .. (m.hidden.bssid or "") +login_section = login_section.lower(login_section:gsub("[^%w_]", "_")) +local cmd = uci:get("travelmate", login_section, "command") +cmd_list = m:field(ListValue, "cmdlist", translate("Auto Login Script"), + translate("External script reference which will be called for automated captive portal logins.")) +cmd_list:value("none") +for _, z in ipairs(scripts) do + cmd_list:value(z) +end +cmd_list.default = cmd or "none" + function wssid.write(self, section, value) newsection = uci:section("wireless", "wifi-iface", nil, { mode = "sta", @@ -174,6 +187,16 @@ function wssid.write(self, section, value) else uci:set("wireless", newsection, "encryption", "none") end + local login_section = (wssid:formvalue(section) or "") .. (bssid:formvalue(section) or "") + login_section = login_section.lower(login_section:gsub("[^%w_]", "_")) + if not uci:get("travelmate", login_section) and cmd_list:formvalue(section) ~= "none" then + uci:set("travelmate", login_section, "login") + end + if uci:get("travelmate", login_section) then + uci:set("travelmate", login_section, "command", cmd_list:formvalue(section)) + uci:save("travelmate") + uci:commit("travelmate") + end uci:save("wireless") uci:commit("wireless") luci.sys.call("env -i /bin/ubus call network reload >/dev/null 2>&1") diff --git a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua index dae358ae03..c2c809cbcc 100644 --- a/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua +++ b/applications/luci-app-travelmate/luasrc/model/cbi/travelmate/wifi_edit.lua @@ -1,9 +1,11 @@ -- Copyright 2017-2019 Dirk Brenken (dev@brenken.org) -- This is free software, licensed under the Apache License, Version 2.0 -local fs = require("nixio.fs") -local uci = require("luci.model.uci").cursor() -local http = require("luci.http") +local fs = require("nixio.fs") +local uci = require("luci.model.uci").cursor() +local http = require("luci.http") +local util = require("luci.util") +local scripts = util.split(util.trim(util.exec("ls /etc/travelmate/*.login 2>/dev/null")), "\n", nil, true) or {} m = SimpleForm("edit", translate("Edit Wireless Uplink Configuration")) m.submit = translate("Save") @@ -19,6 +21,7 @@ m.hidden = { } local s = uci:get_all("wireless", m.hidden.cfg) + if s ~= nil then wssid = m:field(Value, "ssid", translate("SSID")) wssid.datatype = "rangelength(1,32)" @@ -126,6 +129,17 @@ if s ~= nil then wkey.password = true wkey.default = s.key or s.password end + + local login_section = (s.ssid or "") .. (s.bssid or "") + login_section = login_section.lower(login_section:gsub("[^%w_]", "_")) + local cmd = uci:get("travelmate", login_section, "command") + cmd_list = m:field(ListValue, "cmdlist", translate("Auto Login Script"), + translate("External script reference which will be called for automated captive portal logins.")) + cmd_list:value("none") + for _, z in ipairs(scripts) do + cmd_list:value(z) + end + cmd_list.default = cmd or "none" else m.on_cancel() end @@ -160,6 +174,16 @@ function wssid.write(self, section, value) uci:set("wireless", m.hidden.cfg, "priv_key_pwd", privkeypwd:formvalue(section) or "") end end + local login_section = (wssid:formvalue(section) or "") .. (bssid:formvalue(section) or "") + login_section = login_section.lower(login_section:gsub("[^%w_]", "_")) + if not uci:get("travelmate", login_section) and cmd_list:formvalue(section) ~= "none" then + uci:set("travelmate", login_section, "login") + end + if uci:get("travelmate", login_section) then + uci:set("travelmate", login_section, "command", cmd_list:formvalue(section)) + uci:save("travelmate") + uci:commit("travelmate") + end uci:save("wireless") uci:commit("wireless") luci.sys.call("env -i /bin/ubus call network reload >/dev/null 2>&1") diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm index 0e78803d06..5c28966339 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/stations.htm @@ -34,7 +34,7 @@ This is free software, licensed under the Apache License, Version 2.0 if (view) { view.setAttribute("name", "station_nok"); - view.setAttribute("style", "color: #a22; font-weight: bold"); + view.setAttribute("style", "text-align: left !important; color: #a22; font-weight: bold"); } } } @@ -59,7 +59,7 @@ This is free software, licensed under the Apache License, Version 2.0 view = document.getElementById(search); if (view) { - view.setAttribute("style", "color: #37c; font-weight: bold"); + view.setAttribute("style", "text-align: left !important; color: #37c; font-weight: bold"); } } } @@ -122,10 +122,10 @@ This is free software, licensed under the Apache License, Version 2.0 local encr = s.encryption or "-" -%> <div class="tr cbi-section-table-row cbi-rowstyle-1" name="station_ok" id="1_<%=device%>/<%=ssid%>/<%=bssid%>"> - <div class="td left" name="station_ok" id="2_<%=device%>/<%=ssid%>/<%=bssid%>"><%=device%></div> - <div class="td left" name="station_ok" id="3_<%=device%>/<%=ssid%>/<%=bssid%>"><%=ssid%></div> - <div class="td left" name="station_ok" id="4_<%=device%>/<%=ssid%>/<%=bssid%>"><%=bssid%></div> - <div class="td left" name="station_ok" id="5_<%=device%>/<%=ssid%>/<%=bssid%>"><%=encr%></div> + <div class="td left" style="text-align: left !important" name="station_ok" id="2_<%=device%>/<%=ssid%>/<%=bssid%>"><%=device%></div> + <div class="td left" style="text-align: left !important" name="station_ok" id="3_<%=device%>/<%=ssid%>/<%=bssid%>"><%=ssid%></div> + <div class="td left" style="text-align: left !important" name="station_ok" id="4_<%=device%>/<%=ssid%>/<%=bssid%>"><%=bssid%></div> + <div class="td left" style="text-align: left !important" name="station_ok" id="5_<%=device%>/<%=ssid%>/<%=bssid%>"><%=encr%></div> <div class="td middle cbi-section-actions"> <div> <input class="cbi-button cbi-button-up" type="button" value="<%:Up%>" onclick="location.href='<%=luci.dispatcher.build_url('admin/services/travelmate/wifiorder')%>?cfg=<%=section%>&dir=up'" alt="<%:Move up%>" title="<%:Move up%>" /> diff --git a/applications/luci-app-travelmate/luasrc/view/travelmate/wifi_scan.htm b/applications/luci-app-travelmate/luasrc/view/travelmate/wifi_scan.htm index 67568f179e..86846a5710 100644 --- a/applications/luci-app-travelmate/luasrc/view/travelmate/wifi_scan.htm +++ b/applications/luci-app-travelmate/luasrc/view/travelmate/wifi_scan.htm @@ -52,16 +52,16 @@ This is free software, licensed under the Apache License, Version 2.0 </div> <%- for i, net in ipairs(iw.scanlist or { }) do -%> <div class="tr cbi-section-table-row cbi-rowstyle-1"> - <div class="td left"> + <div class="td left" style="text-align: left !important"> <%=net.ssid and utl.pcdata(net.ssid) or "<em>%s</em>" % translate("hidden")%> </div> - <div class="td left"> + <div class="td left" style="text-align: left !important"> <%=net.bssid and utl.pcdata(net.bssid)%> </div> - <div class="td left"> + <div class="td left" style="text-align: left !important"> <%=format_wifi_encryption(net.encryption)%> </div> - <div class="td left"> + <div class="td left" style="text-align: left !important"> <%=percent_wifi_signal(net)%> % </div> <div class="td cbi-section-actions"> diff --git a/libs/luci-lib-ip/src/ip.c b/libs/luci-lib-ip/src/ip.c index 854a0c09c2..188a70f144 100644 --- a/libs/luci-lib-ip/src/ip.c +++ b/libs/luci-lib-ip/src/ip.c @@ -1075,22 +1075,24 @@ static int cb_dump_route(struct nl_msg *msg, void *arg) bitlen = AF_BITS(rt->rtm_family); - if ((f->type && rt->rtm_type != f->type) || - (f->family && rt->rtm_family != f->family) || - (f->proto && rt->rtm_protocol != f->proto) || - (f->scope && rt->rtm_scope != f->scope) || - (f->iif && iif != f->iif) || - (f->oif && oif != f->oif) || - (f->table && table != f->table) || - diff_prefix(rt->rtm_family, from, rt->rtm_src_len, - f->from_exact, &f->from) || - diff_prefix(rt->rtm_family, dst, rt->rtm_dst_len, - f->dst_exact, &f->dst) || - diff_prefix(rt->rtm_family, gw, bitlen, - false, &f->gw) || - diff_prefix(rt->rtm_family, src, bitlen, - false, &f->src)) - goto out; + if (!f->get) { + if ((f->type && rt->rtm_type != f->type) || + (f->family && rt->rtm_family != f->family) || + (f->proto && rt->rtm_protocol != f->proto) || + (f->scope && rt->rtm_scope != f->scope) || + (f->iif && iif != f->iif) || + (f->oif && oif != f->oif) || + (f->table && table != f->table) || + diff_prefix(rt->rtm_family, from, rt->rtm_src_len, + f->from_exact, &f->from) || + diff_prefix(rt->rtm_family, dst, rt->rtm_dst_len, + f->dst_exact, &f->dst) || + diff_prefix(rt->rtm_family, gw, bitlen, + false, &f->gw) || + diff_prefix(rt->rtm_family, src, bitlen, + false, &f->src)) + goto out; + } if (s->callback) lua_pushvalue(s->L, 2); @@ -1216,10 +1218,15 @@ static int _route_dump(lua_State *L, struct dump_filter *filter) nlmsg_append(msg, &rtm, sizeof(rtm), 0); - if (filter->get) + if (filter->get) { nla_put(msg, RTA_DST, AF_BYTES(filter->dst.family), &filter->dst.addr.v6); + if (filter->src.family) + nla_put(msg, RTA_SRC, AF_BYTES(filter->src.family), + &filter->src.addr.v6); + } + nl_cb_set(cb, NL_CB_VALID, NL_CB_CUSTOM, cb_dump_route, &s); nl_cb_set(cb, NL_CB_FINISH, NL_CB_CUSTOM, cb_done, &s); nl_cb_err(cb, NL_CB_CUSTOM, cb_error, &s); @@ -1236,17 +1243,32 @@ static int _route_dump(lua_State *L, struct dump_filter *filter) out: nl_cb_put(cb); - return (s.callback == 0); + + if (s.callback) + return 0; + + if (!filter->get) + return 1; + + return (s.index > 0); } static int route_get(lua_State *L) { struct dump_filter filter = { .get = true }; const char *dest = luaL_checkstring(L, 1); + const char *from = luaL_optstring(L, 2, NULL); if (!parse_cidr(dest, &filter.dst)) return _error(L, -1, "Invalid destination"); + if (from && !parse_cidr(from, &filter.src)) + return _error(L, -1, "Invalid source"); + + if (filter.src.family != 0 && + filter.src.family != filter.dst.family) + return _error(L, -1, "Different source/destination family"); + filter.family = filter.dst.family; return _route_dump(L, &filter); diff --git a/libs/luci-lib-ip/src/ip.luadoc b/libs/luci-lib-ip/src/ip.luadoc index a2df96cdb5..afd171bebf 100644 --- a/libs/luci-lib-ip/src/ip.luadoc +++ b/libs/luci-lib-ip/src/ip.luadoc @@ -178,6 +178,8 @@ Determine the route leading to the given destination. @name route @param address A `luci.ip.cidr` instance or a string containing a valid IPv4 or IPv6 range as specified by `luci.ip.new()`. +@param source A `luci.ip.cidr` instance or a string containing +the preferred source address for route selection (optional). @return <p>Table containing the fields described below.</p> <table id="routetable"> <tr><th>Field</th><th>Description</th></tr> diff --git a/modules/luci-base/po/ja/base.po b/modules/luci-base/po/ja/base.po index 24c13abd2d..8460642c52 100644 --- a/modules/luci-base/po/ja/base.po +++ b/modules/luci-base/po/ja/base.po @@ -3,7 +3,7 @@ msgstr "" "Project-Id-Version: \n" "Report-Msgid-Bugs-To: \n" "POT-Creation-Date: 2009-06-10 03:40+0200\n" -"PO-Revision-Date: 2019-07-13 18:28+0900\n" +"PO-Revision-Date: 2019-08-06 02:52+0900\n" "Last-Translator: INAGAKI Hiroshi <musashino.open@gmail.com>\n" "Language-Team: \n" "Language: ja\n" @@ -320,7 +320,7 @@ msgstr "" #: modules/luci-base/htdocs/luci-static/resources/tools/widgets.js:495 #: modules/luci-base/htdocs/luci-static/resources/tools/widgets.js:499 msgid "Absent Interface" -msgstr "" +msgstr "存在しないインターフェース" #: protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua:19 msgid "Access Concentrator" @@ -1443,7 +1443,7 @@ msgstr "宛先" #: modules/luci-base/htdocs/luci-static/resources/tools/widgets.js:46 #: modules/luci-base/htdocs/luci-static/resources/tools/widgets.js:151 msgid "Destination zone" -msgstr "" +msgstr "宛先ゾーン" #: modules/luci-base/htdocs/luci-static/resources/tools/widgets.js:54 #: modules/luci-base/htdocs/luci-static/resources/tools/widgets.js:177 @@ -2267,7 +2267,7 @@ msgstr "" #: protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua:118 msgid "Host-Uniq tag content" -msgstr "" +msgstr "Host-Uniq タグ" #: modules/luci-base/luasrc/view/lease_status.htm:71 #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js:31 @@ -3465,7 +3465,7 @@ msgstr "ネットワーク名が設定されていません" #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/wifi_join.js:147 msgid "No networks in range" -msgstr "" +msgstr "範囲内にネットワークがありません" #: themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm:173 #: themes/luci-theme-material/luasrc/view/themes/material/header.htm:211 @@ -3734,7 +3734,7 @@ msgstr "出力インターフェース" #: modules/luci-base/htdocs/luci-static/resources/tools/widgets.js:46 #: modules/luci-base/htdocs/luci-static/resources/tools/widgets.js:151 msgid "Output zone" -msgstr "" +msgstr "出力ゾーン" #: modules/luci-base/luasrc/model/cbi/admin_network/proto_dhcp.lua:63 #: modules/luci-base/luasrc/model/cbi/admin_network/proto_static.lua:155 @@ -4219,6 +4219,8 @@ msgstr "Radius認証サーバー" #: protocols/luci-proto-ppp/luasrc/model/cbi/admin_network/proto_pppoe.lua:119 msgid "Raw hex-encoded bytes. Leave empty unless your ISP require this" msgstr "" +"16 進数でエンコードされた、生のバイト値です。 ISP がこれを必須としない場合、" +"空欄のままにします。" #: modules/luci-mod-network/htdocs/luci-static/resources/view/network/dhcp.js:83 msgid "" @@ -6220,7 +6222,7 @@ msgstr "なし" #: modules/luci-mod-system/luasrc/model/cbi/admin_system/fstab.lua:176 #: modules/luci-mod-system/luasrc/model/cbi/admin_system/fstab.lua:186 msgid "not present" -msgstr "" +msgstr "存在しません" #: modules/luci-mod-network/luasrc/model/cbi/admin_network/vlan.lua:363 #: themes/luci-theme-bootstrap/luasrc/view/themes/bootstrap/header.htm:163 diff --git a/protocols/luci-proto-3g/luasrc/model/network/proto_3g.lua b/protocols/luci-proto-3g/luasrc/model/network/proto_3g.lua index b2454838f9..60d8e2ebae 100644 --- a/protocols/luci-proto-3g/luasrc/model/network/proto_3g.lua +++ b/protocols/luci-proto-3g/luasrc/model/network/proto_3g.lua @@ -38,7 +38,7 @@ function proto.get_interfaces(self) return nil end -function proto.contains_interface(self, ifname) +function proto.contains_interface(self, ifc) if self:is_floating() then return (netmod:ifnameof(ifc) == self:ifname()) else diff --git a/protocols/luci-proto-ipv6/luasrc/model/network/proto_4x6.lua b/protocols/luci-proto-ipv6/luasrc/model/network/proto_4x6.lua index 7508e0d4b0..0b329d8a92 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/network/proto_4x6.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/network/proto_4x6.lua @@ -49,7 +49,7 @@ for _, p in ipairs({"dslite", "map", "464xlat"}) do return nil end - function proto.contains_interface(self, ifname) + function proto.contains_interface(self, ifc) return (netmod:ifnameof(ifc) == self:ifname()) end end diff --git a/protocols/luci-proto-ipv6/luasrc/model/network/proto_6x4.lua b/protocols/luci-proto-ipv6/luasrc/model/network/proto_6x4.lua index 9a4396c5be..2fd0b11957 100644 --- a/protocols/luci-proto-ipv6/luasrc/model/network/proto_6x4.lua +++ b/protocols/luci-proto-ipv6/luasrc/model/network/proto_6x4.lua @@ -42,7 +42,7 @@ for _, p in ipairs({"6in4", "6to4", "6rd"}) do return nil end - function proto.contains_interface(self, ifname) + function proto.contains_interface(self, ifc) return (netmod:ifnameof(ifc) == self:ifname()) end diff --git a/themes/luci-theme-rosy/htdocs/luci-static/rosy/cascade.css b/themes/luci-theme-rosy/htdocs/luci-static/rosy/cascade.css index d6460532fa..fca731cadd 100644 --- a/themes/luci-theme-rosy/htdocs/luci-static/rosy/cascade.css +++ b/themes/luci-theme-rosy/htdocs/luci-static/rosy/cascade.css @@ -55,6 +55,8 @@ line-height: normal; display: table-cell; padding: .5em; + word-break: break-all; + word-wrap: break-word; text-align: center; vertical-align: middle; } @@ -136,6 +138,7 @@ .col-10 { flex: 10 10 300px !important; + width: 60%; } /* dom 元素 */ |