diff --git a/Makefile b/Makefile index 4cd610a..4dcfa12 100644 --- a/Makefile +++ b/Makefile @@ -2,9 +2,9 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-fleth LUCI_TITLE:=LuCI Support for Flet'h -LUCI_DESCRIPTION:=luci-app-fleth is a helper that can configure your IPv4 over IPv6 tunnel automatically. -PKG_VERSION:=0.3 -PKG_RELEASE:=2 +LUCI_DESCRIPTION:=luci-app-fleth is a helper that can configure IPv4 over IPv6 tunnel automatically in Japan. +PKG_VERSION:=0.4 +PKG_RELEASE:=1 LUCI_PKGARCH:=all LUCI_DEPENDS:=+luci-base +lua +map +ds-lite +luci-proto-ipv6 diff --git a/htdocs/luci-static/resources/view/fleth.js b/htdocs/luci-static/resources/view/fleth.js index d091833..796d861 100644 --- a/htdocs/luci-static/resources/view/fleth.js +++ b/htdocs/luci-static/resources/view/fleth.js @@ -33,7 +33,7 @@ return view.extend({ ) ); - s = m.section(form.NamedSection, "global", "fleth"); + s = m.section(form.NamedSection, "global"); s.tab("info", _("Information")); s.tab("general", _("General Settings")); @@ -99,16 +99,20 @@ return view.extend({ form.Flag, "ip6prefix_enabled", _("Auto Add IPv6 PD in IPv6 Interface"), - _( - "We recommend enabling it in MAP-E and when not using Hikari Denwa." - ) + _("We recommend enabling it in MAP-E and when not using Hikari Denwa.") ); o.rmempty = false; o.default = "0"; - // o = s.taboption('general', form.Flag, 'ip6relay_enabled', _('Auto Configure IPv6 with relay mode')); + // o = s.taboption( + // "general", + // form.Flag, + // "ip6relay_enabled", + // _("Auto Configure lan side IPv6"), + // _("You can hold both ISP and ULA address simultaneously.") + // ); // o.rmempty = false; - // o.default = '0'; + // o.default = "0"; // o = s.taboption('general', form.ListValue, 'type', _('Tunnel Type'), _('Now only support DS-Lite')) // o.value('auto', _('Auto')) @@ -148,19 +152,5 @@ return view.extend({ o.default = "1460"; return m.render(); - }, - handleSaveApply: async function (ev) { - await this.__base__.handleSaveApply(ev); - // console.log('triggered save & apply button'); - try { - await fs.exec("/usr/sbin/fleth", ["ip6prefix"]); - } catch (error) { - console.warn(error); - } - try { - await fs.exec("/usr/sbin/fleth", ["auto"]); - } catch (error) { - console.warn(error); - } - }, + } }); diff --git a/root/etc/init.d/fleth b/root/etc/init.d/fleth new file mode 100644 index 0000000..d3a0dd3 --- /dev/null +++ b/root/etc/init.d/fleth @@ -0,0 +1,17 @@ +#!/bin/sh /etc/rc.common + +START=99 +USE_PROCD=1 +NAME="fleth" + +start_service() { + config_load "$NAME" + /usr/sbin/fleth auto +} +reload_service() { + config_load "$NAME" + /usr/sbin/fleth auto +} +service_triggers() { + procd_add_reload_trigger "$NAME" +} \ No newline at end of file diff --git a/root/etc/uci-defaults/luci-app-fleth b/root/etc/uci-defaults/luci-app-fleth index f21ab68..dcc8079 100644 --- a/root/etc/uci-defaults/luci-app-fleth +++ b/root/etc/uci-defaults/luci-app-fleth @@ -1,6 +1,6 @@ #!/bin/sh -chmod +x /usr/sbin/fleth +chmod +x /usr/sbin/fleth /etc/init.d/fleth /etc/hotplug.d/iface/25-fleth-ip6prefix if [ ! -f /etc/config/fleth ]; then cat < /etc/config/fleth diff --git a/root/usr/sbin/fleth b/root/usr/sbin/fleth index cd20eb7..4755dc2 100755 --- a/root/usr/sbin/fleth +++ b/root/usr/sbin/fleth @@ -39,12 +39,12 @@ e_AREA="UNKNOWN" # domain iptvf.jp xxxx-east.jp <- point get_area(){ # east or west - wget --timeout=1 -s "http://[2404:1a8:f401:100::1]/l/__healthcheck" -O/tmp/null > /dev/null 2>&1 + wget --timeout=1 -s "http://[2404:1a8:f401:100::1]/l/__healthcheck" -O /tmp/null > /dev/null 2>&1 if [ $? -eq 0 ]; then e_AREA="EAST" DNS=$DNS_E else - wget --timeout=1 -s "http://[2001:a7ff:ff0e:1::2]/l/__healthcheck" -O/tmp/null > /dev/null 2>&1 + wget --timeout=1 -s "http://[2001:a7ff:ff0e:1::2]/l/__healthcheck" -O /tmp/null > /dev/null 2>&1 if [ $? -eq 0 ]; then e_AREA="WEST" DNS=$DNS_W @@ -224,6 +224,7 @@ EOF } if [ "$1" = "auto" ]; then + logger -t fleth "is running $h_ENABLED" $0 ip6prefix & if [ "$h_ENABLED" == "1" ]; then get_area