From d9083e21c63912f52de6792b35e0f0e723d4d17d Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 23 Jan 2021 22:39:13 +0800 Subject: [PATCH 01/30] autocore: display `?` if "model name" doesn't exist Signed-off-by: CN_SZTL (cherry-pick from 285bb05ca3feccd86675bbaaf4895ece211a14f0) --- package/lean/autocore/files/arm/sbin/cpuinfo | 1 + 1 file changed, 1 insertion(+) diff --git a/package/lean/autocore/files/arm/sbin/cpuinfo b/package/lean/autocore/files/arm/sbin/cpuinfo index 92c6f0bd9d..fef62e3aaf 100755 --- a/package/lean/autocore/files/arm/sbin/cpuinfo +++ b/package/lean/autocore/files/arm/sbin/cpuinfo @@ -1,6 +1,7 @@ #!/bin/sh cpu_arch="$(cat "/proc/cpuinfo" | grep "model name" | sed -n "1p" | awk -F ': ' '{print $2}')" +[ -z "${cpu_arch}" ] && cpu_arch="?" cpu_cores="$(cat "/proc/cpuinfo" | grep "processor" | wc -l)" if grep -q "bcm27xx" "/etc/openwrt_release"; then From 2aaece6c54d952227338a61a109ddecd1aa1e800 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 23 Jan 2021 23:06:00 +0800 Subject: [PATCH 02/30] bpytop: bump to 1.0.60 Signed-off-by: CN_SZTL --- package/ctcgfw/bpytop/Makefile | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/package/ctcgfw/bpytop/Makefile b/package/ctcgfw/bpytop/Makefile index eae751164d..c6d8917324 100644 --- a/package/ctcgfw/bpytop/Makefile +++ b/package/ctcgfw/bpytop/Makefile @@ -8,11 +8,11 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bpytop -PKG_VERSION:=1.0.54 +PKG_VERSION:=1.0.60 PKG_RELEASE:=1 PYPI_NAME:=bpytop -PKG_HASH:=a25665e71627a5ec918e6ecf4422bea1ba449069958f64c3879029cfb58a0ac1 +PKG_HASH:=48cf23725a873f77f562a89b18ac91dedfd39cf35586582a7668580da7b12826 PKG_LICENSE:=Apache-2.0 PKG_LICENSE_FILES:=LICENSE @@ -35,11 +35,9 @@ define Package/bpytop/description endef define Package/bpytop/install - $(call Py3Package/$(1)/install,$(PKG_BUILD_DIR)) - $(INSTALL_DIR) $(1)/usr - $(CP) $(PKG_INSTALL_DIR)/usr/* $(1)/usr/ - $(INSTALL_DIR) $(1)/usr/share/bpytop - $(CP) $(PKG_BUILD_DIR)/bpytop-themes/* $(1)/usr/share/bpytop/ + $(call Py3Package/$(1)/install,$(PKG_INSTALL_DIR)) + $(INSTALL_DIR) $(1) + $(CP) $(PKG_INSTALL_DIR)/* $(1)/ endef $(eval $(call Py3Package,bpytop)) From e2d52f3593d57fac1ba3e36bfaf04854d216f037 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 23 Jan 2021 23:12:26 +0800 Subject: [PATCH 03/30] tinyportmapper: cleanup Makefile Signed-off-by: CN_SZTL --- package/ctcgfw/tinyportmapper/Makefile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/package/ctcgfw/tinyportmapper/Makefile b/package/ctcgfw/tinyportmapper/Makefile index b703e6693f..d56f66e21a 100644 --- a/package/ctcgfw/tinyportmapper/Makefile +++ b/package/ctcgfw/tinyportmapper/Makefile @@ -9,20 +9,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tinyPortMapper PKG_VERSION:=20200818.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/wangyu-/tinyPortMapper.git -PKG_SOURCE_VERSION:=b6c5c05ba9a9db00571d185edcd534434f41b50a -PKG_MIRROR_HASH:=93946ec018ef515d0f443fd9a6e6510ce3ceb1be373a2393fe2daeeb5e7ced95 - -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/wangyu-/tinyPortMapper/tar.gz/$(PKG_VERSION)? +PKG_HASH:=094aef3fa0646fe3d0418f87767c1dd24ba1a80518f1e8a7cae2783aed88e732 PKG_LICENSE:=MIT PKG_MAINTAINER:=Yu Wang -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk @@ -42,8 +37,7 @@ endef MAKE_FLAGS += cross -define Build/Prepare - $(PKG_UNPACK) +define Build/Configure sed -i 's/cc_cross=.*/cc_cross=$(TARGET_CXX)/g' $(PKG_BUILD_DIR)/makefile sed -i '/\*gitversion/d' $(PKG_BUILD_DIR)/makefile echo 'const char *gitversion = "$(PKG_VERSION)";' > $(PKG_BUILD_DIR)/git_version.h From 7078e1470a001573fbbd7d1e10eeae3422688889 Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sat, 23 Jan 2021 23:14:11 +0800 Subject: [PATCH 04/30] tinyfecvpn: cleanup Makefile Signed-off-by: CN_SZTL --- package/ctcgfw/tinyfecvpn/Makefile | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/package/ctcgfw/tinyfecvpn/Makefile b/package/ctcgfw/tinyfecvpn/Makefile index 33457a8b6a..487a3f1249 100644 --- a/package/ctcgfw/tinyfecvpn/Makefile +++ b/package/ctcgfw/tinyfecvpn/Makefile @@ -9,20 +9,15 @@ include $(TOPDIR)/rules.mk PKG_NAME:=tinyfecVPN PKG_VERSION:=20180820.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 -PKG_SOURCE_PROTO:=git -PKG_SOURCE_URL:=https://github.com/wangyu-/tinyfecVPN.git -PKG_SOURCE_VERSION:=e8364ba8ff94415ee3bedcbdb9557bfe5994a469 -PKG_MIRROR_HASH:=30fd808b0203c70e8e6cfe8ca55b907faaea6a8be12a7a7fef6658f4ddbb523c - -PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz +PKG_SOURCE_URL:=https://codeload.github.com/wangyu-/tinyfecVPN/tar.gz/$(PKG_VERSION)? +PKG_HASH:=ab758480e3ae43e851d2285a4441dee9c0b524b1a279e38e701302aa61617a5d PKG_LICENSE:=MIT PKG_MAINTAINER:=Yu Wang -PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) PKG_BUILD_PARALLEL:=1 include $(INCLUDE_DIR)/package.mk @@ -43,8 +38,7 @@ endef MAKE_FLAGS += cross -define Build/Prepare - $(PKG_UNPACK) +define Build/Configure sed -i 's/cc_cross=.*/cc_cross=$(TARGET_CXX)/g' $(PKG_BUILD_DIR)/makefile sed -i '/\*gitversion/d' $(PKG_BUILD_DIR)/makefile echo 'const char *gitversion = "$(PKG_VERSION)";' > $(PKG_BUILD_DIR)/git_version.h From 015df15104e4fb4b29a3739f2448fb77314ca0be Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sun, 24 Jan 2021 01:19:42 +0800 Subject: [PATCH 05/30] bpytop: install missing theme files Signed-off-by: CN_SZTL --- package/ctcgfw/bpytop/Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/package/ctcgfw/bpytop/Makefile b/package/ctcgfw/bpytop/Makefile index c6d8917324..67bea755ab 100644 --- a/package/ctcgfw/bpytop/Makefile +++ b/package/ctcgfw/bpytop/Makefile @@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bpytop PKG_VERSION:=1.0.60 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PYPI_NAME:=bpytop PKG_HASH:=48cf23725a873f77f562a89b18ac91dedfd39cf35586582a7668580da7b12826 @@ -38,6 +38,8 @@ define Package/bpytop/install $(call Py3Package/$(1)/install,$(PKG_INSTALL_DIR)) $(INSTALL_DIR) $(1) $(CP) $(PKG_INSTALL_DIR)/* $(1)/ + $(INSTALL_DIR) $(1)/usr/share + $(CP) $(PKG_BUILD_DIR)/bpytop-themes $(1)/usr/share/bpytop endef $(eval $(call Py3Package,bpytop)) From b01af9983bbbeb76b1c8755100df9c6689d1ef0f Mon Sep 17 00:00:00 2001 From: CN_SZTL Date: Sun, 24 Jan 2021 02:47:59 +0800 Subject: [PATCH 06/30] kernel: bump to 4.9.253, 4.14.217, 4.19.170 Refreshed all patches. Signed-off-by: CN_SZTL --- include/kernel-version.mk | 12 ++++++------ ...-arm64-Add-Revision-Serial-Model-to-cpuinfo.patch | 2 +- ...v4.16-netfilter-flow-table-support-for-IPv6.patch | 4 ++-- ...-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch | 2 +- ...-__alloc_page_frag-to-page_frag_alloc-and-_.patch | 2 +- .../090-net-generalize-napi_complete_done.patch | 2 +- target/linux/generic/hack-4.14/721-phy_packets.patch | 6 +++--- target/linux/generic/hack-4.19/721-phy_packets.patch | 6 +++--- target/linux/generic/hack-4.9/721-phy_packets.patch | 2 +- .../pending-4.14/601-add-kernel-imq-support.patch | 8 ++++---- .../generic/pending-4.14/655-increase_skb_pad.patch | 2 +- ...ver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch | 2 +- .../pending-4.19/601-add-kernel-imq-support.patch | 8 ++++---- .../generic/pending-4.19/655-increase_skb_pad.patch | 2 +- .../pending-4.9/601-add-kernel-imq-support.patch | 6 +++--- .../ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch | 2 +- .../202-core-linux-support-layerscape.patch | 8 ++++---- 17 files changed, 38 insertions(+), 38 deletions(-) diff --git a/include/kernel-version.mk b/include/kernel-version.mk index 6d2eb13ee8..b0f6b54ca0 100644 --- a/include/kernel-version.mk +++ b/include/kernel-version.mk @@ -6,13 +6,13 @@ ifdef CONFIG_TESTING_KERNEL KERNEL_PATCHVER:=$(KERNEL_TESTING_PATCHVER) endif -LINUX_VERSION-4.9 = .252 -LINUX_VERSION-4.14 = .216 -LINUX_VERSION-4.19 = .169 +LINUX_VERSION-4.9 = .253 +LINUX_VERSION-4.14 = .217 +LINUX_VERSION-4.19 = .170 -LINUX_KERNEL_HASH-4.9.252 = 1c9edadf5e17540b01d95c879f42859d5f28ff577ff2ef6d56cdc45ef3a314ea -LINUX_KERNEL_HASH-4.14.216 = b7864fef15ca9bdefe38cd19232538e3387f05c6ace17f44a0da07bd71edbba5 -LINUX_KERNEL_HASH-4.19.169 = c7d24ddb8ecc348ca7bed24111ff98e2a87f74666c8bbbf4f9c57b7c3c25de94 +LINUX_KERNEL_HASH-4.9.253 = 9a5b51a8350201bd38e3ff13909323a6571b4572a7b3caed76e462b07619bc18 +LINUX_KERNEL_HASH-4.14.217 = 62a36a25431016d98d0f1cff98be432086c51f86fd79042bd10a867b3a924d11 +LINUX_KERNEL_HASH-4.19.170 = dd0d0264f8ef4363d0080054fd344470a73f07aca2cd673e91bf6e77fbe25b4a remove_uri_prefix=$(subst git://,,$(subst http://,,$(subst https://,,$(1)))) sanitize_uri=$(call qstrip,$(subst @,_,$(subst :,_,$(subst .,_,$(subst -,_,$(subst /,_,$(1))))))) diff --git a/target/linux/bcm27xx/patches-4.19/950-0676-arch-arm64-Add-Revision-Serial-Model-to-cpuinfo.patch b/target/linux/bcm27xx/patches-4.19/950-0676-arch-arm64-Add-Revision-Serial-Model-to-cpuinfo.patch index 5e29b47e57..b09e7c2b54 100644 --- a/target/linux/bcm27xx/patches-4.19/950-0676-arch-arm64-Add-Revision-Serial-Model-to-cpuinfo.patch +++ b/target/linux/bcm27xx/patches-4.19/950-0676-arch-arm64-Add-Revision-Serial-Model-to-cpuinfo.patch @@ -29,7 +29,7 @@ Signed-off-by: Phil Elwell for_each_online_cpu(i) { struct cpuinfo_arm64 *cpuinfo = &per_cpu(cpu_data, i); -@@ -177,6 +182,26 @@ static int c_show(struct seq_file *m, vo +@@ -176,6 +181,26 @@ static int c_show(struct seq_file *m, vo seq_printf(m, "CPU revision\t: %d\n\n", MIDR_REVISION(midr)); } diff --git a/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch b/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch index 8e776383d1..7dc1dd7f46 100644 --- a/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch +++ b/target/linux/generic/backport-4.14/324-v4.16-netfilter-flow-table-support-for-IPv6.patch @@ -26,7 +26,7 @@ Signed-off-by: Pablo Neira Ayuso struct dst_entry *ip6_dst_lookup_flow(struct net *net, const struct sock *sk, struct flowi6 *fl6, --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c -@@ -381,7 +381,7 @@ static inline int ip6_forward_finish(str +@@ -419,7 +419,7 @@ static inline int ip6_forward_finish(str return dst_output(net, sk, skb); } @@ -35,7 +35,7 @@ Signed-off-by: Pablo Neira Ayuso { unsigned int mtu; struct inet6_dev *idev; -@@ -401,6 +401,7 @@ static unsigned int ip6_dst_mtu_forward( +@@ -439,6 +439,7 @@ static unsigned int ip6_dst_mtu_forward( return mtu; } diff --git a/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch b/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch index 1c52cf51c6..b38ff36414 100644 --- a/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch +++ b/target/linux/generic/backport-4.14/350-v4.18-ipv6-make-ip6_dst_mtu_forward-inline.patch @@ -49,7 +49,7 @@ Signed-off-by: Felix Fietkau struct dst_entry *ip6_dst_lookup_flow(struct net *net, const struct sock *sk, struct flowi6 *fl6, --- a/net/ipv6/ip6_output.c +++ b/net/ipv6/ip6_output.c -@@ -381,28 +381,6 @@ static inline int ip6_forward_finish(str +@@ -419,28 +419,6 @@ static inline int ip6_forward_finish(str return dst_output(net, sk, skb); } diff --git a/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch b/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch index d27bf94057..b14bf9c1ea 100644 --- a/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch +++ b/target/linux/generic/backport-4.9/041-mm-rename-__alloc_page_frag-to-page_frag_alloc-and-_.patch @@ -126,7 +126,7 @@ Signed-off-by: Linus Torvalds pfmemalloc = nc->pfmemalloc; local_irq_restore(flags); -@@ -509,7 +509,7 @@ struct sk_buff *__napi_alloc_skb(struct +@@ -514,7 +514,7 @@ struct sk_buff *__napi_alloc_skb(struct if (sk_memalloc_socks()) gfp_mask |= __GFP_MEMALLOC; diff --git a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch index dcd2bf5698..e978a171b3 100644 --- a/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch +++ b/target/linux/generic/backport-4.9/090-net-generalize-napi_complete_done.patch @@ -960,7 +960,7 @@ Signed-off-by: David S. Miller pasemi_mac_restart_tx_intr(mac); --- a/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c +++ b/drivers/net/ethernet/qlogic/netxen/netxen_nic_main.c -@@ -2391,7 +2391,7 @@ static int netxen_nic_poll(struct napi_s +@@ -2386,7 +2386,7 @@ static int netxen_nic_poll(struct napi_s work_done = budget; if (work_done < budget) { diff --git a/target/linux/generic/hack-4.14/721-phy_packets.patch b/target/linux/generic/hack-4.14/721-phy_packets.patch index 176784640c..bbf2273f72 100644 --- a/target/linux/generic/hack-4.14/721-phy_packets.patch +++ b/target/linux/generic/hack-4.14/721-phy_packets.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2563,6 +2563,10 @@ static inline int pskb_trim(struct sk_bu +@@ -2579,6 +2579,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -2694,16 +2698,6 @@ static inline struct sk_buff *dev_alloc_ +@@ -2710,16 +2714,6 @@ static inline struct sk_buff *dev_alloc_ } @@ -136,7 +136,7 @@ Signed-off-by: Felix Fietkau #include #include -@@ -584,6 +585,22 @@ skb_fail: +@@ -589,6 +590,22 @@ skb_fail: } EXPORT_SYMBOL(__napi_alloc_skb); diff --git a/target/linux/generic/hack-4.19/721-phy_packets.patch b/target/linux/generic/hack-4.19/721-phy_packets.patch index a1583cfb24..2b4e652c4b 100644 --- a/target/linux/generic/hack-4.19/721-phy_packets.patch +++ b/target/linux/generic/hack-4.19/721-phy_packets.patch @@ -56,7 +56,7 @@ Signed-off-by: Felix Fietkau */ --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2578,6 +2578,10 @@ static inline int pskb_trim(struct sk_bu +@@ -2583,6 +2583,10 @@ static inline int pskb_trim(struct sk_bu return (len < skb->len) ? __pskb_trim(skb, len) : 0; } @@ -67,7 +67,7 @@ Signed-off-by: Felix Fietkau /** * pskb_trim_unique - remove end from a paged unique (not cloned) buffer * @skb: buffer to alter -@@ -2709,16 +2713,6 @@ static inline struct sk_buff *dev_alloc_ +@@ -2714,16 +2718,6 @@ static inline struct sk_buff *dev_alloc_ } @@ -136,7 +136,7 @@ Signed-off-by: Felix Fietkau #include #include -@@ -555,6 +556,22 @@ skb_fail: +@@ -560,6 +561,22 @@ skb_fail: } EXPORT_SYMBOL(__napi_alloc_skb); diff --git a/target/linux/generic/hack-4.9/721-phy_packets.patch b/target/linux/generic/hack-4.9/721-phy_packets.patch index 13078c18e4..28e68d09a0 100644 --- a/target/linux/generic/hack-4.9/721-phy_packets.patch +++ b/target/linux/generic/hack-4.9/721-phy_packets.patch @@ -136,7 +136,7 @@ Signed-off-by: Felix Fietkau #include #include -@@ -614,6 +615,22 @@ skb_fail: +@@ -619,6 +620,22 @@ skb_fail: } EXPORT_SYMBOL(__napi_alloc_skb); diff --git a/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch index e6f19cba9a..49d125b45d 100644 --- a/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.14/601-add-kernel-imq-support.patch @@ -1569,7 +1569,7 @@ extern struct kmem_cache *skbuff_head_cache; void kfree_skb_partial(struct sk_buff *skb, bool head_stolen); -@@ -3860,8 +3879,12 @@ static inline void __nf_copy(struct sk_b +@@ -3876,8 +3895,12 @@ static inline void __nf_copy(struct sk_b dst->_nfct = src->_nfct; nf_conntrack_get(skb_nfct(src)); #endif @@ -1761,7 +1761,7 @@ /** * skb_panic - private function for out-of-line support -@@ -615,6 +696,28 @@ void skb_release_head_state(struct sk_bu +@@ -620,6 +701,28 @@ void skb_release_head_state(struct sk_bu WARN_ON(in_irq()); skb->destructor(skb); } @@ -1790,7 +1790,7 @@ #if IS_ENABLED(CONFIG_NF_CONNTRACK) nf_conntrack_put(skb_nfct(skb)); #endif -@@ -804,6 +907,10 @@ static void __copy_skb_header(struct sk_ +@@ -809,6 +912,10 @@ static void __copy_skb_header(struct sk_ new->sp = secpath_get(old->sp); #endif __nf_copy(new, old, false); @@ -1801,7 +1801,7 @@ /* Note : this field could be in headers_start/headers_end section * It is not yet because we do not want to have a 16 bit hole -@@ -3949,6 +4056,13 @@ void __init skb_init(void) +@@ -3954,6 +4061,13 @@ void __init skb_init(void) 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); diff --git a/target/linux/generic/pending-4.14/655-increase_skb_pad.patch b/target/linux/generic/pending-4.14/655-increase_skb_pad.patch index aef3f12ce8..a3ab252f04 100644 --- a/target/linux/generic/pending-4.14/655-increase_skb_pad.patch +++ b/target/linux/generic/pending-4.14/655-increase_skb_pad.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2527,7 +2527,7 @@ static inline int pskb_network_may_pull( +@@ -2543,7 +2543,7 @@ static inline int pskb_network_may_pull( * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) */ #ifndef NET_SKB_PAD diff --git a/target/linux/generic/pending-4.14/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch b/target/linux/generic/pending-4.14/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch index 47b4800fd0..3afa4b0a6b 100644 --- a/target/linux/generic/pending-4.14/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch +++ b/target/linux/generic/pending-4.14/760-net-usb-aqc111-Driver-skeleton-for-Aquantia-AQtionUSB-to-5GbE.patch @@ -1856,7 +1856,7 @@ static const struct usb_device_id products[] = { /* BLACKLIST !! -@@ -842,6 +844,30 @@ static const struct usb_device_id produc +@@ -849,6 +851,30 @@ static const struct usb_device_id produc .driver_info = 0, }, diff --git a/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch index 413ac39e15..921a4871d6 100644 --- a/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.19/601-add-kernel-imq-support.patch @@ -1264,7 +1264,7 @@ extern struct kmem_cache *skbuff_head_cache; void kfree_skb_partial(struct sk_buff *skb, bool head_stolen); -@@ -3935,8 +3954,12 @@ static inline void __nf_copy(struct sk_b +@@ -3940,8 +3959,12 @@ static inline void __nf_copy(struct sk_b dst->_nfct = src->_nfct; nf_conntrack_get(skb_nfct(src)); #endif @@ -1427,7 +1427,7 @@ /** * skb_panic - private function for out-of-line support -@@ -615,6 +667,28 @@ void skb_release_head_state(struct sk_bu +@@ -620,6 +672,28 @@ void skb_release_head_state(struct sk_bu WARN_ON(in_irq()); skb->destructor(skb); } @@ -1456,7 +1456,7 @@ #if IS_ENABLED(CONFIG_NF_CONNTRACK) nf_conntrack_put(skb_nfct(skb)); #endif -@@ -804,6 +878,9 @@ static void __copy_skb_header(struct sk_ +@@ -809,6 +883,9 @@ static void __copy_skb_header(struct sk_ new->sp = secpath_get(old->sp); #endif __nf_copy(new, old, false); @@ -1466,7 +1466,7 @@ /* Note : this field could be in headers_start/headers_end section * It is not yet because we do not want to have a 16 bit hole -@@ -3975,6 +4052,13 @@ void __init skb_init(void) +@@ -3980,6 +4057,13 @@ void __init skb_init(void) 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); diff --git a/target/linux/generic/pending-4.19/655-increase_skb_pad.patch b/target/linux/generic/pending-4.19/655-increase_skb_pad.patch index dbb846c1e0..4430bb33ed 100644 --- a/target/linux/generic/pending-4.19/655-increase_skb_pad.patch +++ b/target/linux/generic/pending-4.19/655-increase_skb_pad.patch @@ -9,7 +9,7 @@ Signed-off-by: Felix Fietkau --- a/include/linux/skbuff.h +++ b/include/linux/skbuff.h -@@ -2542,7 +2542,7 @@ static inline int pskb_network_may_pull( +@@ -2547,7 +2547,7 @@ static inline int pskb_network_may_pull( * NET_IP_ALIGN(2) + ethernet_header(14) + IP_header(20/40) + ports(8) */ #ifndef NET_SKB_PAD diff --git a/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch b/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch index f6a3e888c2..80f8637807 100644 --- a/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch +++ b/target/linux/generic/pending-4.9/601-add-kernel-imq-support.patch @@ -1714,7 +1714,7 @@ /** * skb_panic - private function for out-of-line support -@@ -658,6 +739,28 @@ static void skb_release_head_state(struc +@@ -663,6 +744,28 @@ static void skb_release_head_state(struc WARN_ON(in_irq()); skb->destructor(skb); } @@ -1743,7 +1743,7 @@ #if IS_ENABLED(CONFIG_NF_CONNTRACK) nf_conntrack_put(skb->nfct); #endif -@@ -847,6 +950,10 @@ static void __copy_skb_header(struct sk_ +@@ -852,6 +955,10 @@ static void __copy_skb_header(struct sk_ new->sp = secpath_get(old->sp); #endif __nf_copy(new, old, false); @@ -1754,7 +1754,7 @@ /* Note : this field could be in headers_start/headers_end section * It is not yet because we do not want to have a 16 bit hole -@@ -3527,6 +3634,13 @@ void __init skb_init(void) +@@ -3532,6 +3639,13 @@ void __init skb_init(void) 0, SLAB_HWCACHE_ALIGN|SLAB_PANIC, NULL); diff --git a/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch b/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch index c2773f2d7b..5e294ff118 100644 --- a/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch +++ b/target/linux/ixp4xx/patches-4.9/600-skb_avoid_dmabounce.patch @@ -10,7 +10,7 @@ /* Get the HEAD */ skb = kmem_cache_alloc_node(cache, gfp_mask & ~__GFP_DMA, node); -@@ -1335,6 +1338,10 @@ int pskb_expand_head(struct sk_buff *skb +@@ -1340,6 +1343,10 @@ int pskb_expand_head(struct sk_buff *skb if (skb_shared(skb)) BUG(); diff --git a/target/linux/layerscape/patches-4.14/202-core-linux-support-layerscape.patch b/target/linux/layerscape/patches-4.14/202-core-linux-support-layerscape.patch index 95ab0f9d2d..94d59c09b7 100644 --- a/target/linux/layerscape/patches-4.14/202-core-linux-support-layerscape.patch +++ b/target/linux/layerscape/patches-4.14/202-core-linux-support-layerscape.patch @@ -580,7 +580,7 @@ Signed-off-by: Yangbo Lu void __kfree_skb(struct sk_buff *skb); #if defined(CONFIG_IMQ) || defined(CONFIG_IMQ_MODULE) -@@ -3350,6 +3351,7 @@ static inline void skb_free_datagram_loc +@@ -3366,6 +3367,7 @@ static inline void skb_free_datagram_loc } int skb_kill_datagram(struct sock *sk, struct sk_buff *skb, unsigned int flags); int skb_copy_bits(const struct sk_buff *skb, int offset, void *to, int len); @@ -837,7 +837,7 @@ Signed-off-by: Yangbo Lu --- a/net/core/skbuff.c +++ b/net/core/skbuff.c -@@ -906,6 +906,32 @@ void napi_consume_skb(struct sk_buff *sk +@@ -911,6 +911,32 @@ void napi_consume_skb(struct sk_buff *sk } EXPORT_SYMBOL(napi_consume_skb); @@ -870,7 +870,7 @@ Signed-off-by: Yangbo Lu /* Make sure a field is enclosed inside headers_start/headers_end section */ #define CHECK_SKB_FIELD(field) \ BUILD_BUG_ON(offsetof(struct sk_buff, field) < \ -@@ -1429,7 +1455,7 @@ static void skb_headers_offset_update(st +@@ -1434,7 +1460,7 @@ static void skb_headers_offset_update(st skb->inner_mac_header += off; } @@ -879,7 +879,7 @@ Signed-off-by: Yangbo Lu { __copy_skb_header(new, old); -@@ -1437,6 +1463,7 @@ static void copy_skb_header(struct sk_bu +@@ -1442,6 +1468,7 @@ static void copy_skb_header(struct sk_bu skb_shinfo(new)->gso_segs = skb_shinfo(old)->gso_segs; skb_shinfo(new)->gso_type = skb_shinfo(old)->gso_type; } From d9e355865b5387ed276fd196374c49c7e380b789 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Fri, 22 Jan 2021 10:46:10 +0100 Subject: [PATCH 07/30] owipcalc: remove package This is a helpful utility, but it does not have any dependencies in this repository. Move it to packages feed. Cc: Jo-Philipp Wich Cc: Nick Hainke Signed-off-by: Adrian Schmutzler --- package/network/utils/owipcalc/Makefile | 44 - package/network/utils/owipcalc/src/owipcalc.c | 950 ------------------ 2 files changed, 994 deletions(-) delete mode 100644 package/network/utils/owipcalc/Makefile delete mode 100644 package/network/utils/owipcalc/src/owipcalc.c diff --git a/package/network/utils/owipcalc/Makefile b/package/network/utils/owipcalc/Makefile deleted file mode 100644 index dc68a0346b..0000000000 --- a/package/network/utils/owipcalc/Makefile +++ /dev/null @@ -1,44 +0,0 @@ -# -# Copyright (C) 2012 Jo-Philipp Wich -# -# This is free software, licensed under the Apache 2 license. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=owipcalc -PKG_RELEASE:=5 -PKG_LICENSE:=Apache-2.0 - -include $(INCLUDE_DIR)/package.mk - - -define Package/owipcalc - SECTION:=utils - CATEGORY:=Utilities - TITLE:=Simple IPv4/IPv6 address calculator - MAINTAINER:=Jo-Philipp Wich -endef - -define Package/owipcalc/description - The owipcalc utility supports a number of calculations and tests to work - with ip-address ranges, this is useful for scripts that e.g. need to - partition ipv6-prefixes into small subnets or to calculate address ranges - for dhcp pools. -endef - -define Build/Configure -endef - -define Build/Compile - $(TARGET_CC) $(TARGET_CFLAGS) \ - -o $(PKG_BUILD_DIR)/owipcalc $(PKG_BUILD_DIR)/owipcalc.c -endef - - -define Package/owipcalc/install - $(INSTALL_DIR) $(1)/usr/bin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/owipcalc $(1)/usr/bin/owipcalc -endef - -$(eval $(call BuildPackage,owipcalc)) diff --git a/package/network/utils/owipcalc/src/owipcalc.c b/package/network/utils/owipcalc/src/owipcalc.c deleted file mode 100644 index 5ed609f158..0000000000 --- a/package/network/utils/owipcalc/src/owipcalc.c +++ /dev/null @@ -1,950 +0,0 @@ -/* - * owipcalc - OpenWrt IP Calculator - * - * Copyright (C) 2012 Jo-Philipp Wich - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -#include -#include -#include -#include - -#include -#include - -#include - - -struct cidr { - uint8_t family; - uint32_t prefix; - union { - struct in_addr v4; - struct in6_addr v6; - } addr; - union { - char v4[sizeof("255.255.255.255/255.255.255.255 ")]; - char v6[sizeof("FFFF:FFFF:FFFF:FFFF:FFFF:FFFF:255.255.255.255/128 ")]; - } buf; - struct cidr *next; -}; - -struct op { - const char *name; - const char *desc; - struct { - bool (*a1)(struct cidr *a); - bool (*a2)(struct cidr *a, struct cidr *b); - } f4; - struct { - bool (*a1)(struct cidr *a); - bool (*a2)(struct cidr *a, struct cidr *b); - } f6; -}; - - -static bool quiet = false; -static bool printed = false; - -static struct cidr *stack = NULL; - -#define qprintf(...) \ - do { \ - if (!quiet) printf(__VA_ARGS__); \ - printed = true; \ - } while(0) - -static void cidr_push(struct cidr *a) -{ - if (a) - { - a->next = stack; - stack = a; - } -} - -static bool cidr_pop(struct cidr *a) -{ - struct cidr *old = stack; - - if (old) - { - stack = stack->next; - free(old); - - return true; - } - - return false; -} - -static struct cidr * cidr_clone(struct cidr *a) -{ - struct cidr *b = malloc(sizeof(*b)); - - if (!b) - { - fprintf(stderr, "out of memory\n"); - exit(255); - } - - memcpy(b, a, sizeof(*b)); - cidr_push(b); - - return b; -} - - -static struct cidr * cidr_parse4(const char *s) -{ - char *p = NULL, *r; - struct in_addr mask; - struct cidr *addr = malloc(sizeof(struct cidr)); - - if (!addr || (strlen(s) >= sizeof(addr->buf.v4))) - goto err; - - snprintf(addr->buf.v4, sizeof(addr->buf.v4), "%s", s); - - addr->family = AF_INET; - - if ((p = strchr(addr->buf.v4, '/')) != NULL) - { - *p++ = 0; - - if (strchr(p, '.') != NULL) - { - if (inet_pton(AF_INET, p, &mask) != 1) - goto err; - - for (addr->prefix = 0; mask.s_addr; mask.s_addr >>= 1) - addr->prefix += (mask.s_addr & 1); - } - else - { - addr->prefix = strtoul(p, &r, 10); - - if ((p == r) || (*r != 0) || (addr->prefix > 32)) - goto err; - } - } - else - { - addr->prefix = 32; - } - - if (p == addr->buf.v4+1) - memset(&addr->addr.v4, 0, sizeof(addr->addr.v4)); - else if (inet_pton(AF_INET, addr->buf.v4, &addr->addr.v4) != 1) - goto err; - - return addr; - -err: - if (addr) - free(addr); - - return NULL; -} - -static bool cidr_add4(struct cidr *a, struct cidr *b) -{ - uint32_t x = ntohl(a->addr.v4.s_addr); - uint32_t y = ntohl(b->addr.v4.s_addr); - - struct cidr *n = cidr_clone(a); - - if ((n->family != AF_INET) || (b->family != AF_INET)) - return false; - - if ((uint32_t)(x + y) < x) - { - fprintf(stderr, "overflow during 'add'\n"); - return false; - } - - n->addr.v4.s_addr = htonl(x + y); - return true; -} - -static bool cidr_sub4(struct cidr *a, struct cidr *b) -{ - uint32_t x = ntohl(a->addr.v4.s_addr); - uint32_t y = ntohl(b->addr.v4.s_addr); - - struct cidr *n = cidr_clone(a); - - if ((n->family != AF_INET) || (b->family != AF_INET)) - return false; - - if ((uint32_t)(x - y) > x) - { - fprintf(stderr, "underflow during 'sub'\n"); - return false; - } - - n->addr.v4.s_addr = htonl(x - y); - return true; -} - -static bool cidr_network4(struct cidr *a) -{ - struct cidr *n = cidr_clone(a); - - n->addr.v4.s_addr &= htonl(~((1 << (32 - n->prefix)) - 1)); - n->prefix = 32; - - return true; -} - -static bool cidr_broadcast4(struct cidr *a) -{ - struct cidr *n = cidr_clone(a); - - n->addr.v4.s_addr |= htonl(((1 << (32 - n->prefix)) - 1)); - n->prefix = 32; - - return true; -} - -static bool cidr_contains4(struct cidr *a, struct cidr *b) -{ - uint32_t net1 = a->addr.v4.s_addr & htonl(~((1 << (32 - a->prefix)) - 1)); - uint32_t net2 = b->addr.v4.s_addr & htonl(~((1 << (32 - a->prefix)) - 1)); - - if (printed) - qprintf(" "); - - if ((b->prefix >= a->prefix) && (net1 == net2)) - { - qprintf("1"); - return true; - } - else - { - qprintf("0"); - return false; - } -} - -static bool cidr_netmask4(struct cidr *a) -{ - struct cidr *n = cidr_clone(a); - - n->addr.v4.s_addr = htonl(~((1 << (32 - n->prefix)) - 1)); - n->prefix = 32; - - return true; -} - -static bool cidr_private4(struct cidr *a) -{ - uint32_t x = ntohl(a->addr.v4.s_addr); - - if (printed) - qprintf(" "); - - if (((x >= 0x0A000000) && (x <= 0x0AFFFFFF)) || - ((x >= 0xAC100000) && (x <= 0xAC1FFFFF)) || - ((x >= 0xC0A80000) && (x <= 0xC0A8FFFF))) - { - qprintf("1"); - return true; - } - else - { - qprintf("0"); - return false; - } -} - -static bool cidr_linklocal4(struct cidr *a) -{ - uint32_t x = ntohl(a->addr.v4.s_addr); - - if (printed) - qprintf(" "); - - if ((x >= 0xA9FE0000) && (x <= 0xA9FEFFFF)) - { - qprintf("1"); - return true; - } - else - { - qprintf("0"); - return false; - } -} - -static bool cidr_prev4(struct cidr *a, struct cidr *b) -{ - struct cidr *n = cidr_clone(a); - - n->prefix = b->prefix; - n->addr.v4.s_addr -= htonl(1 << (32 - b->prefix)); - - return true; -} - -static bool cidr_next4(struct cidr *a, struct cidr *b) -{ - struct cidr *n = cidr_clone(a); - - n->prefix = b->prefix; - n->addr.v4.s_addr += htonl(1 << (32 - b->prefix)); - - return true; -} - -static bool cidr_6to4(struct cidr *a) -{ - struct cidr *n = cidr_clone(a); - uint32_t x = a->addr.v4.s_addr; - - memset(&n->addr.v6.s6_addr, 0, sizeof(n->addr.v6.s6_addr)); - - n->family = AF_INET6; - n->prefix = 48; - - n->addr.v6.s6_addr[0] = 0x20; - n->addr.v6.s6_addr[1] = 0x02; - n->addr.v6.s6_addr[2] = (x >> 24); - n->addr.v6.s6_addr[3] = (x >> 16) & 0xFF; - n->addr.v6.s6_addr[4] = (x >> 8) & 0xFF; - n->addr.v6.s6_addr[5] = x & 0xFF; - - return true; -} - -static bool cidr_print4(struct cidr *a) -{ - char *p; - - if (!a || (a->family != AF_INET)) - return false; - - if (!(p = (char *)inet_ntop(AF_INET, &a->addr.v4, a->buf.v4, sizeof(a->buf.v4)))) - return false; - - if (printed) - qprintf(" "); - - qprintf("%s", p); - - if (a->prefix < 32) - qprintf("/%u", a->prefix); - - cidr_pop(a); - - return true; -} - - -static struct cidr * cidr_parse6(const char *s) -{ - char *p = NULL, *r; - struct cidr *addr = malloc(sizeof(struct cidr)); - - if (!addr || (strlen(s) >= sizeof(addr->buf.v6))) - goto err; - - snprintf(addr->buf.v6, sizeof(addr->buf.v6), "%s", s); - - addr->family = AF_INET6; - - if ((p = strchr(addr->buf.v6, '/')) != NULL) - { - *p++ = 0; - - addr->prefix = strtoul(p, &r, 10); - - if ((p == r) || (*r != 0) || (addr->prefix > 128)) - goto err; - } - else - { - addr->prefix = 128; - } - - if (p == addr->buf.v6+1) - memset(&addr->addr.v6, 0, sizeof(addr->addr.v6)); - else if (inet_pton(AF_INET6, addr->buf.v6, &addr->addr.v6) != 1) - goto err; - - return addr; - -err: - if (addr) - free(addr); - - return NULL; -} - -static bool cidr_add6(struct cidr *a, struct cidr *b) -{ - uint8_t idx = 15, carry = 0, overflow = 0; - - struct cidr *n = cidr_clone(a); - struct in6_addr *x = &n->addr.v6; - struct in6_addr *y = &b->addr.v6; - - if ((a->family != AF_INET6) || (b->family != AF_INET6)) - return false; - - do { - overflow = !!((x->s6_addr[idx] + y->s6_addr[idx] + carry) >= 256); - x->s6_addr[idx] += y->s6_addr[idx] + carry; - carry = overflow; - } - while (idx-- > 0); - - if (carry) - { - fprintf(stderr, "overflow during 'add'\n"); - return false; - } - - return true; -} - -static bool cidr_sub6(struct cidr *a, struct cidr *b) -{ - uint8_t idx = 15, carry = 0, underflow = 0; - - struct cidr *n = cidr_clone(a); - struct in6_addr *x = &n->addr.v6; - struct in6_addr *y = &b->addr.v6; - - if ((n->family != AF_INET6) || (b->family != AF_INET6)) - return false; - - do { - underflow = !!((x->s6_addr[idx] - y->s6_addr[idx] - carry) < 0); - x->s6_addr[idx] -= y->s6_addr[idx] + carry; - carry = underflow; - } - while (idx-- > 0); - - if (carry) - { - fprintf(stderr, "underflow during 'sub'\n"); - return false; - } - - return true; -} - -static bool cidr_prev6(struct cidr *a, struct cidr *b) -{ - uint8_t idx, carry = 1, underflow = 0; - struct cidr *n = cidr_clone(a); - struct in6_addr *x = &n->addr.v6; - - if (b->prefix == 0) - { - fprintf(stderr, "underflow during 'prev'\n"); - return false; - } - - idx = (b->prefix - 1) / 8; - - do { - underflow = !!((x->s6_addr[idx] - carry) < 0); - x->s6_addr[idx] -= carry; - carry = underflow; - } - while (idx-- > 0); - - if (carry) - { - fprintf(stderr, "underflow during 'prev'\n"); - return false; - } - - n->prefix = b->prefix; - - return true; -} - -static bool cidr_next6(struct cidr *a, struct cidr *b) -{ - uint8_t idx, carry = 1, overflow = 0; - struct cidr *n = cidr_clone(a); - struct in6_addr *x = &n->addr.v6; - - if (b->prefix == 0) - { - fprintf(stderr, "overflow during 'next'\n"); - return false; - } - - idx = (b->prefix - 1) / 8; - - do { - overflow = !!((x->s6_addr[idx] + carry) >= 256); - x->s6_addr[idx] += carry; - carry = overflow; - } - while (idx-- > 0); - - if (carry) - { - fprintf(stderr, "overflow during 'next'\n"); - return false; - } - - n->prefix = b->prefix; - - return true; -} - -static bool cidr_network6(struct cidr *a) -{ - uint8_t i; - struct cidr *n = cidr_clone(a); - - for (i = 0; i < (128 - n->prefix) / 8; i++) - n->addr.v6.s6_addr[15-i] = 0; - - if ((128 - n->prefix) % 8) - n->addr.v6.s6_addr[15-i] &= ~((1 << ((128 - n->prefix) % 8)) - 1); - - return true; -} - -static bool cidr_contains6(struct cidr *a, struct cidr *b) -{ - struct in6_addr *x = &a->addr.v6; - struct in6_addr *y = &b->addr.v6; - uint8_t i = (128 - a->prefix) / 8; - uint8_t m = ~((1 << ((128 - a->prefix) % 8)) - 1); - uint8_t net1 = x->s6_addr[15-i] & m; - uint8_t net2 = y->s6_addr[15-i] & m; - - if (printed) - qprintf(" "); - - if ((b->prefix >= a->prefix) && (net1 == net2) && - ((i == 15) || !memcmp(&x->s6_addr, &y->s6_addr, 15-i))) - { - qprintf("1"); - return true; - } - else - { - qprintf("0"); - return false; - } -} - -static bool cidr_linklocal6(struct cidr *a) -{ - if (printed) - qprintf(" "); - - if ((a->addr.v6.s6_addr[0] == 0xFE) && - (a->addr.v6.s6_addr[1] >= 0x80) && - (a->addr.v6.s6_addr[1] <= 0xBF)) - { - qprintf("1"); - return true; - } - else - { - qprintf("0"); - return false; - } -} - -static bool cidr_ula6(struct cidr *a) -{ - if (printed) - qprintf(" "); - - if ((a->addr.v6.s6_addr[0] >= 0xFC) && - (a->addr.v6.s6_addr[0] <= 0xFD)) - { - qprintf("1"); - return true; - } - else - { - qprintf("0"); - return false; - } -} - -static bool cidr_print6(struct cidr *a) -{ - char *p; - - if (!a || (a->family != AF_INET6)) - return NULL; - - if (!(p = (char *)inet_ntop(AF_INET6, &a->addr.v6, a->buf.v6, sizeof(a->buf.v6)))) - return false; - - if (printed) - qprintf(" "); - - qprintf("%s", p); - - if (a->prefix < 128) - qprintf("/%u", a->prefix); - - cidr_pop(a); - - return true; -} - - -static struct cidr * cidr_parse(const char *op, const char *s, int af_hint) -{ - char *r; - struct cidr *a; - - uint8_t i; - uint32_t sum = strtoul(s, &r, 0); - - if ((r > s) && (*r == 0)) - { - a = malloc(sizeof(struct cidr)); - - if (!a) - return NULL; - - if (af_hint == AF_INET) - { - a->family = AF_INET; - a->prefix = sum; - a->addr.v4.s_addr = htonl(sum); - } - else - { - a->family = AF_INET6; - a->prefix = sum; - - for (i = 0; i <= 15; i++) - { - a->addr.v6.s6_addr[15-i] = sum % 256; - sum >>= 8; - } - } - - return a; - } - - if (strchr(s, ':')) - a = cidr_parse6(s); - else - a = cidr_parse4(s); - - if (!a) - return NULL; - - if (a->family != af_hint) - { - fprintf(stderr, "attempt to '%s' %s with %s address\n", - op, - (af_hint == AF_INET) ? "ipv4" : "ipv6", - (af_hint != AF_INET) ? "ipv4" : "ipv6"); - exit(4); - } - - return a; -} - -static bool cidr_howmany(struct cidr *a, struct cidr *b) -{ - if (printed) - qprintf(" "); - - if (b->prefix < a->prefix) - qprintf("0"); - else - qprintf("%u", 1 << (b->prefix - a->prefix)); - - return true; -} - -static bool cidr_prefix(struct cidr *a, struct cidr *b) -{ - a->prefix = b->prefix; - return true; -} - -static bool cidr_quiet(struct cidr *a) -{ - quiet = true; - return true; -} - - -struct op ops[] = { - { .name = "add", - .desc = "Add argument to base address", - .f4.a2 = cidr_add4, - .f6.a2 = cidr_add6 }, - - { .name = "sub", - .desc = "Substract argument from base address", - .f4.a2 = cidr_sub4, - .f6.a2 = cidr_sub6 }, - - { .name = "next", - .desc = "Advance base address to next prefix of given size", - .f4.a2 = cidr_next4, - .f6.a2 = cidr_next6 }, - - { .name = "prev", - .desc = "Lower base address to previous prefix of give size", - .f4.a2 = cidr_prev4, - .f6.a2 = cidr_prev6 }, - - { .name = "network", - .desc = "Turn base address into network address", - .f4.a1 = cidr_network4, - .f6.a1 = cidr_network6 }, - - { .name = "broadcast", - .desc = "Turn base address into broadcast address", - .f4.a1 = cidr_broadcast4 }, - - { .name = "prefix", - .desc = "Set the prefix of base address to argument", - .f4.a2 = cidr_prefix, - .f6.a2 = cidr_prefix }, - - { .name = "netmask", - .desc = "Calculate netmask of base address", - .f4.a1 = cidr_netmask4 }, - - { .name = "6to4", - .desc = "Calculate 6to4 prefix of given ipv4-address", - .f4.a1 = cidr_6to4 }, - - { .name = "howmany", - .desc = "Print amount of righ-hand prefixes that fit into base address", - .f4.a2 = cidr_howmany, - .f6.a2 = cidr_howmany }, - - { .name = "contains", - .desc = "Print '1' if argument fits into base address or '0' if not", - .f4.a2 = cidr_contains4, - .f6.a2 = cidr_contains6 }, - - { .name = "private", - .desc = "Print '1' if base address is in RFC1918 private space or '0' " - "if not", - .f4.a1 = cidr_private4 }, - - { .name = "linklocal", - .desc = "Print '1' if base address is in 169.254.0.0/16 or FE80::/10 " - "link local space or '0' if not", - .f4.a1 = cidr_linklocal4, - .f6.a1 = cidr_linklocal6 }, - - { .name = "ula", - .desc = "Print '1' if base address is in FC00::/7 unique local address " - "(ULA) space or '0' if not", - .f6.a1 = cidr_ula6 }, - - { .name = "quiet", - .desc = "Suppress output, useful for test operation where the result can " - "be inferred from the exit code", - .f4.a1 = cidr_quiet, - .f6.a1 = cidr_quiet }, - - { .name = "pop", - .desc = "Pop intermediate result from stack", - .f4.a1 = cidr_pop, - .f6.a1 = cidr_pop }, - - { .name = "print", - .desc = "Print intermediate result and pop it from stack, invoked " - "implicitely at the end of calculation if no intermediate prints " - "happened", - .f4.a1 = cidr_print4, - .f6.a1 = cidr_print6 }, -}; - -static void usage(const char *prog) -{ - int i; - - fprintf(stderr, - "\n" - "Usage:\n\n" - " %s {base address} operation [argument] " - "[operation [argument] ...]\n\n" - "Operations:\n\n", - prog); - - for (i = 0; i < sizeof(ops) / sizeof(ops[0]); i++) - { - if (ops[i].f4.a2 || ops[i].f6.a2) - { - fprintf(stderr, " %s %s\n", - ops[i].name, - (ops[i].f4.a2 && ops[i].f6.a2) ? "{ipv4/ipv6/amount}" : - (ops[i].f6.a2 ? "{ipv6/amount}" : "{ipv4/amount}")); - } - else - { - fprintf(stderr, " %s\n", ops[i].name); - } - - fprintf(stderr, " %s.\n", ops[i].desc); - - if ((ops[i].f4.a1 && ops[i].f6.a1) || (ops[i].f4.a2 && ops[i].f6.a2)) - fprintf(stderr, " Applicable to ipv4- and ipv6-addresses.\n\n"); - else if (ops[i].f6.a2 || ops[i].f6.a1) - fprintf(stderr, " Only applicable to ipv6-addresses.\n\n"); - else - fprintf(stderr, " Only applicable to ipv4-addresses.\n\n"); - } - - fprintf(stderr, - "Examples:\n\n" - " Calculate a DHCP range:\n\n" - " $ %s 192.168.1.1/255.255.255.0 network add 100 print add 150 print\n" - " 192.168.1.100\n" - " 192.168.1.250\n\n" - " Count number of prefixes:\n\n" - " $ %s 2001:0DB8:FDEF::/48 howmany ::/64\n" - " 65536\n\n", - prog, prog); - - exit(1); -} - -static bool runop(char ***arg, int *status) -{ - int i; - char *arg1 = **arg; - char *arg2 = *(*arg+1); - struct cidr *a = stack; - struct cidr *b = NULL; - - if (!arg1) - return false; - - for (i = 0; i < sizeof(ops) / sizeof(ops[0]); i++) - { - if (!strcmp(ops[i].name, arg1)) - { - if (ops[i].f4.a2 || ops[i].f6.a2) - { - if (!arg2) - { - fprintf(stderr, "'%s' requires an argument\n", - ops[i].name); - - *status = 2; - return false; - } - - b = cidr_parse(ops[i].name, arg2, a->family); - - if (!b) - { - fprintf(stderr, "invalid address argument for '%s'\n", - ops[i].name); - - *status = 3; - return false; - } - - *arg += 2; - - if (((a->family == AF_INET) && !ops[i].f4.a2) || - ((a->family == AF_INET6) && !ops[i].f6.a2)) - { - fprintf(stderr, "'%s' not supported for %s addresses\n", - ops[i].name, - (a->family == AF_INET) ? "ipv4" : "ipv6"); - - *status = 5; - return false; - } - - *status = !((a->family == AF_INET) ? ops[i].f4.a2(a, b) - : ops[i].f6.a2(a, b)); - - return true; - } - else - { - *arg += 1; - - if (((a->family == AF_INET) && !ops[i].f4.a1) || - ((a->family == AF_INET6) && !ops[i].f6.a1)) - { - fprintf(stderr, "'%s' not supported for %s addresses\n", - ops[i].name, - (a->family == AF_INET) ? "ipv4" : "ipv6"); - - *status = 5; - return false; - } - - *status = !((a->family == AF_INET) ? ops[i].f4.a1(a) - : ops[i].f6.a1(a)); - - return true; - } - } - } - - return false; -} - -int main(int argc, char **argv) -{ - int status = 0; - char **arg = argv+2; - struct cidr *a; - - if (argc < 3) - usage(argv[0]); - - a = strchr(argv[1], ':') ? cidr_parse6(argv[1]) : cidr_parse4(argv[1]); - - if (!a) - usage(argv[0]); - - cidr_push(a); - - while (runop(&arg, &status)); - - if (*arg) - { - fprintf(stderr, "unknown operation '%s'\n", *arg); - exit(6); - } - - if (!printed && (status < 2)) - { - if (stack->family == AF_INET) - cidr_print4(stack); - else - cidr_print6(stack); - } - - qprintf("\n"); - - exit(status); -} From f0428617ad3d04ca65c377d1e0a3f78c4105d6a3 Mon Sep 17 00:00:00 2001 From: Adrian Schmutzler Date: Fri, 22 Jan 2021 10:48:51 +0100 Subject: [PATCH 08/30] maccalc: remove package This is a helpful utility, but it does not have any dependencies in this repository. Move it to packages feed. The package does not seem to have a maintainer. Cc: Jo-Philipp Wich Cc: Nick Hainke Signed-off-by: Adrian Schmutzler --- package/network/utils/maccalc/Makefile | 43 ---- package/network/utils/maccalc/src/Makefile | 14 -- package/network/utils/maccalc/src/main.c | 256 --------------------- 3 files changed, 313 deletions(-) delete mode 100644 package/network/utils/maccalc/Makefile delete mode 100644 package/network/utils/maccalc/src/Makefile delete mode 100644 package/network/utils/maccalc/src/main.c diff --git a/package/network/utils/maccalc/Makefile b/package/network/utils/maccalc/Makefile deleted file mode 100644 index dc11b6b7c1..0000000000 --- a/package/network/utils/maccalc/Makefile +++ /dev/null @@ -1,43 +0,0 @@ -# -# Copyright (C) 2011 OpenWrt.org -# -# This is free software, licensed under the GNU General Public License v2. -# See /LICENSE for more information. -# - -include $(TOPDIR)/rules.mk - -PKG_NAME:=maccalc -PKG_RELEASE:=1 -PKG_LICENSE:=GPL-2.0 - -PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) - -include $(INCLUDE_DIR)/package.mk - -define Package/maccalc - SECTION:=utils - CATEGORY:=Utilities - TITLE:=MAC address calculation -endef - -define Package/maccalc/description - This package contains a MAC address manipulation utility. -endef - -define Build/Configure -endef - -define Build/Compile - $(MAKE) -C $(PKG_BUILD_DIR) \ - CC="$(TARGET_CC)" \ - CFLAGS="$(TARGET_CFLAGS) -Wall" \ - LDFLAGS="$(TARGET_LDFLAGS)" -endef - -define Package/maccalc/install - $(INSTALL_DIR) $(1)/usr/sbin - $(INSTALL_BIN) $(PKG_BUILD_DIR)/maccalc $(1)/usr/sbin/ -endef - -$(eval $(call BuildPackage,maccalc)) diff --git a/package/network/utils/maccalc/src/Makefile b/package/network/utils/maccalc/src/Makefile deleted file mode 100644 index 486badb256..0000000000 --- a/package/network/utils/maccalc/src/Makefile +++ /dev/null @@ -1,14 +0,0 @@ -CC = gcc -CFLAGS = -Wall -OBJS = main.o - -all: maccalc - -%.o: %.c - $(CC) $(CFLAGS) -c -o $@ $< - -maccalc: $(OBJS) - $(CC) -o $@ $(OBJS) - -clean: - rm -f maccalc *.o diff --git a/package/network/utils/maccalc/src/main.c b/package/network/utils/maccalc/src/main.c deleted file mode 100644 index dcb5f55c55..0000000000 --- a/package/network/utils/maccalc/src/main.c +++ /dev/null @@ -1,256 +0,0 @@ -/* - * MAC address manupulation utility - * - * Copyright (C) 2011 Gabor Juhos - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 as published - * by the Free Software Foundation. - * - */ - -#include -#include -#include -#include -#include -#include - -#define MAC_ADDRESS_LEN 6 - -#define ERR_INVALID 1 -#define ERR_IO 2 - -static void usage(void); - -char *maccalc_name; - -static int parse_mac(const char *mac_str, unsigned char *buf) -{ - int t; - - t = sscanf(mac_str, "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx", - &buf[0], &buf[1], &buf[2], &buf[3], &buf[4], &buf[5]); - - if (t != MAC_ADDRESS_LEN) - return ERR_INVALID; - - return 0; -} - -static void print_mac(unsigned char *buf) -{ - printf("%02x:%02x:%02x:%02x:%02x:%02x\n", - buf[0], buf[1], buf[2], buf[3], buf[4], buf[5]); -} - -static int maccalc_do_add(int argc, const char *argv[]) -{ - unsigned char mac[MAC_ADDRESS_LEN]; - uint32_t t; - int err; - int i; - - if (argc != 2) { - usage(); - return ERR_INVALID; - } - - err = parse_mac(argv[0], mac); - if (err) - return err; - - i = atoi(argv[1]); - - t = (mac[3] << 16) | (mac[4] << 8) | mac[5]; - t += i; - mac[3] = (t >> 16) & 0xff; - mac[4] = (t >> 8) & 0xff; - mac[5] = t & 0xff; - - print_mac(mac); - return 0; -} - -static int maccalc_do_logical(int argc, const char *argv[], - unsigned char (*op)(unsigned char n1, - unsigned char n2)) -{ - unsigned char mac1[MAC_ADDRESS_LEN]; - unsigned char mac2[MAC_ADDRESS_LEN]; - int err; - int i; - - if (argc != 2) { - usage(); - return ERR_INVALID; - } - - err = parse_mac(argv[0], mac1); - if (err) - return err; - - err = parse_mac(argv[1], mac2); - if (err) - return err; - - for (i = 0; i < MAC_ADDRESS_LEN; i++) - mac1[i] = op(mac1[i],mac2[i]); - - print_mac(mac1); - return 0; -} - -static int maccalc_do_mac2bin(int argc, const char *argv[]) -{ - unsigned char mac[MAC_ADDRESS_LEN]; - ssize_t c; - int err; - - if (argc != 1) { - usage(); - return ERR_INVALID; - } - - err = parse_mac(argv[0], mac); - if (err) - return err; - - c = write(STDOUT_FILENO, mac, sizeof(mac)); - if (c != sizeof(mac)) { - fprintf(stderr, "failed to write to stdout\n"); - return ERR_IO; - } - - return 0; -} - -static ssize_t read_safe(int fd, void *buf, size_t count) -{ - ssize_t total = 0; - ssize_t r; - - while(count > 0) { - r = read(fd, buf, count); - if (r == 0) - /* EOF */ - break; - if (r < 0) { - if (errno == EINTR) - /* interrupted by a signal, restart */ - continue; - /* error */ - total = -1; - break; - } - - /* ok */ - total += r; - count -= r; - buf += r; - } - - return total; -} - -static int maccalc_do_bin2mac(int argc, const char *argv[]) -{ - unsigned char mac[MAC_ADDRESS_LEN]; - ssize_t c; - - if (argc != 0) { - usage(); - return ERR_INVALID; - } - - c = read_safe(STDIN_FILENO, mac, sizeof(mac)); - if (c != sizeof(mac)) { - fprintf(stderr, "failed to read from stdin\n"); - return ERR_IO; - } - - print_mac(mac); - return 0; -} - -static unsigned char op_or(unsigned char n1, unsigned char n2) -{ - return n1 | n2; -} - -static int maccalc_do_or(int argc, const char *argv[]) -{ - return maccalc_do_logical(argc, argv, op_or); -} - -static unsigned char op_and(unsigned char n1, unsigned char n2) -{ - return n1 & n2; -} - -static int maccalc_do_and(int argc, const char *argv[]) -{ - return maccalc_do_logical(argc, argv, op_and); -} - -static unsigned char op_xor(unsigned char n1, unsigned char n2) -{ - return n1 ^ n2; -} - -static int maccalc_do_xor(int argc, const char *argv[]) -{ - return maccalc_do_logical(argc, argv, op_xor); -} - -static void usage(void) -{ - fprintf(stderr, - "Usage: %s \n" - "valid commands:\n" - " add \n" - " and|or|xor \n" - " mac2bin \n" - " bin2mac\n", - maccalc_name); -} - -int main(int argc, const char *argv[]) -{ - int (*op)(int argc, const char *argv[]); - int ret; - - maccalc_name = (char *) argv[0]; - - if (argc < 2) { - usage(); - return EXIT_FAILURE; - } - - if (strcmp(argv[1], "add") == 0) { - op = maccalc_do_add; - } else if (strcmp(argv[1], "and") == 0) { - op = maccalc_do_and; - } else if (strcmp(argv[1], "or") == 0) { - op = maccalc_do_or; - } else if (strcmp(argv[1], "xor") == 0) { - op = maccalc_do_xor; - } else if (strcmp(argv[1], "mac2bin") == 0) { - op = maccalc_do_mac2bin; - } else if (strcmp(argv[1], "bin2mac") == 0) { - op = maccalc_do_bin2mac; - } else { - fprintf(stderr, "unknown command '%s'\n", argv[1]); - usage(); - return EXIT_FAILURE; - } - - argc -= 2; - argv += 2; - - ret = op(argc, argv); - if (ret) - return EXIT_FAILURE; - - return EXIT_SUCCESS; -} From 6a87bdb14e3f92a0faff57a82756b214b1b0ad32 Mon Sep 17 00:00:00 2001 From: Hans Dedecker Date: Sat, 23 Jan 2021 20:54:23 +0100 Subject: [PATCH 09/30] glibc: update to latest 2.32 commit (BZ#2692 BZ#26988 BZ#26831 BZ#2706) d3cb8f6222 aarch64: fix static PIE start code for BTI [BZ #27068] 082798622d __vfscanf_internal: fix aliasing violation (bug 26690) 33dc30bc83 aarch64: Use mmap to add PROT_BTI instead of mprotect [BZ #26831] 46e1e64fe3 elf: Pass the fd to note processing b6eae83717 elf: Move note processing after l_phdr is updated c6090dcebd aarch64: align address for BTI protection [BZ #26988] 610e2c5150 aarch64: Fix missing BTI protection from dependencies [BZ #26926] Signed-off-by: Hans Dedecker --- toolchain/glibc/common.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/toolchain/glibc/common.mk b/toolchain/glibc/common.mk index a32e375117..7941f6d4d9 100644 --- a/toolchain/glibc/common.mk +++ b/toolchain/glibc/common.mk @@ -12,8 +12,8 @@ PKG_RELEASE:=2 PKG_SOURCE_PROTO:=git PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) -PKG_SOURCE_VERSION:=4c619b3eed558172198790f842740abb9af1989d -PKG_MIRROR_HASH:=b662bceabc5a077c5be8a582aaf1567450fd774df5e31f91928272c1e4e572de +PKG_SOURCE_VERSION:=d3cb8f6222a3cb955712b720d7c0c0dba37898f9 +PKG_MIRROR_HASH:=c3e97ad622eafaf539b733a18c0d62e9fb4c0f18d190b7bcc0e93611e582fb1e PKG_SOURCE_URL:=https://sourceware.org/git/glibc.git PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.xz From d3c39a460e770a966eba2d2bb127954cc84459ae Mon Sep 17 00:00:00 2001 From: liwenjie119 Date: Sun, 20 Dec 2020 00:31:55 -0600 Subject: [PATCH 10/30] luci-app-kodexplorer: fix nginx info MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 修复nginx的path_info,以及可道云中查看数据库的adminer的依赖 --- .../lean/luci-app-kodexplorer/root/etc/init.d/kodexplorer | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/package/lean/luci-app-kodexplorer/root/etc/init.d/kodexplorer b/package/lean/luci-app-kodexplorer/root/etc/init.d/kodexplorer index 8c3b4b7d22..854d6450a3 100755 --- a/package/lean/luci-app-kodexplorer/root/etc/init.d/kodexplorer +++ b/package/lean/luci-app-kodexplorer/root/etc/init.d/kodexplorer @@ -44,12 +44,14 @@ gen_nginx_config() { location = /50x.html { root html; } - location ~ \.php$ { + location ~ \.php(.*)$ { root $project_directory; try_files \$uri = 404; # PHP 文件不存在返回404 fastcgi_pass unix:/var/run/php7-fpm.sock; # 通过 Unix 套接字执行 PHP fastcgi_index index.php; + fastcgi_split_path_info ^(.+\.php)(.*)$; fastcgi_param SCRIPT_FILENAME \$document_root\$fastcgi_script_name; # 修复 Nginx fastcgi 漏洞 + fastcgi_param PATH_INFO \$fastcgi_path_info; include /etc/nginx/fastcgi_params; } } @@ -75,7 +77,7 @@ gen_php_config() { unserialize_callback_func = serialize_precision = 100 - open_basedir = $storage_device_path:/tmp/:/proc/ + open_basedir = $storage_device_path:/tmp/:/proc/:/usr/bin/ disable_functions = disable_classes = expose_php = On From 22fd7dfc3dea0e83ae9e583d8cdef6c5ab36b8bb Mon Sep 17 00:00:00 2001 From: Kevin Darbyshire-Bryant Date: Sat, 23 Jan 2021 10:20:03 +0000 Subject: [PATCH 11/30] dnsmasq: Update to 2.84test3 dnsmasq v2.83 has a bug in handling duplicate queries which means it may try to reply using the incorrect network socket. This is especially noticeable in dual stack environments where replies may be mis-directed to IPv4 addresses on an IPv6 socket or IPv6 addresses on an IPv4 socket. This results in system log spam such as: dnsmasq[16020]: failed to send packet: Network unreachable dnsmasq[16020]: failed to send packet: Address family not supported by protocol dnsmasq v2.84test3 resolves these issues. Signed-off-by: Kevin Darbyshire-Bryant --- package/network/services/dnsmasq/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile index fef6e8bb7f..ce39c94370 100644 --- a/package/network/services/dnsmasq/Makefile +++ b/package/network/services/dnsmasq/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=dnsmasq -PKG_VERSION:=2.83 +PKG_VERSION:=2.84test3 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz -PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq -PKG_HASH:=ffc1f7e8b05e22d910b9a71d09f1128197292766dc7c54cb7018a1b2c3af4aea +PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq/test-releases +PKG_HASH:=20d1109c991ca08778ea20322b8f3245f2e974688d494b59b2e6ae096ec592b1 PKG_LICENSE:=GPL-2.0 PKG_LICENSE_FILES:=COPYING From 5cb63c747f0e5d1e9e96f5d4e3f845756ccd1d30 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Tue, 19 Jan 2021 20:01:06 +0800 Subject: [PATCH 12/30] rtl8821cu: fix the link rate on some devices From user feedback, we should change this option to avoid slow link speed on some wireless network cards. Ref: brektrou/rtl8821CU/issues #5 --- .../patches/050-change-value-of-vht-enable.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 package/ctcgfw/rtl8821cu/patches/050-change-value-of-vht-enable.patch diff --git a/package/ctcgfw/rtl8821cu/patches/050-change-value-of-vht-enable.patch b/package/ctcgfw/rtl8821cu/patches/050-change-value-of-vht-enable.patch new file mode 100644 index 0000000000..34dcd8e4de --- /dev/null +++ b/package/ctcgfw/rtl8821cu/patches/050-change-value-of-vht-enable.patch @@ -0,0 +1,11 @@ +--- a/os_dep/linux/os_intfs.c ++++ b/os_dep/linux/os_intfs.c +@@ -238,7 +238,7 @@ + #endif /* CONFIG_80211N_HT */ + + #ifdef CONFIG_80211AC_VHT +-int rtw_vht_enable = 1; /* 0:disable, 1:enable, 2:force auto enable */ ++int rtw_vht_enable = 2; /* 0:disable, 1:enable, 2:force auto enable */ + module_param(rtw_vht_enable, int, 0644); + + int rtw_ampdu_factor = 7; From 86bedd0ae06a2d07bb24731ed47d4beceac4a3bd Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Wed, 21 Oct 2020 09:24:33 -0700 Subject: [PATCH 13/30] config: drop CONFIG_KPROBE_EVENT unused since kernel 4.9 The config setting was renamed to CONFIG_KPROBE_EVENTS. Fixes: 97d3f800a8 ("config: kernel: Add KPROBE_EVENTS config option) Signed-off-by: Tony Ambardar --- config/Config-kernel.in | 4 ---- 1 file changed, 4 deletions(-) diff --git a/config/Config-kernel.in b/config/Config-kernel.in index 83c4c70b51..51c84704c3 100644 --- a/config/Config-kernel.in +++ b/config/Config-kernel.in @@ -208,10 +208,6 @@ config KERNEL_KPROBES instrumentation and testing. If in doubt, say "N". -config KERNEL_KPROBE_EVENT - bool - default y if KERNEL_KPROBES - config KERNEL_KPROBE_EVENTS bool default y if KERNEL_KPROBES From 9752eb45dcfcf980edb218e5fec248d514a7d465 Mon Sep 17 00:00:00 2001 From: Tony Ambardar Date: Mon, 14 Dec 2020 21:39:19 -0800 Subject: [PATCH 14/30] bpftools: update to 5.10.10 Use the latest stable kernel since the previous 5.8.x series is EOL. Also drop the following patches recently accepted upstream: * 001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch * 002-libbpf-fix-build-failure-from-uninitialized-variable.patch * 003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch * 004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch Signed-off-by: Tony Ambardar --- package/network/utils/bpftools/Makefile | 4 +- ...o-local-symbols-counted-in-ABI-check.patch | 31 --- ...-failure-from-uninitialized-variable.patch | 41 ---- ...llow-passing-BPFTOOL_VERSION-to-make.patch | 21 -- ...l-use-only-ftw-for-file-tree-parsing.patch | 231 ------------------ 5 files changed, 2 insertions(+), 326 deletions(-) delete mode 100644 package/network/utils/bpftools/patches/001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch delete mode 100644 package/network/utils/bpftools/patches/002-libbpf-fix-build-failure-from-uninitialized-variable.patch delete mode 100644 package/network/utils/bpftools/patches/003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch delete mode 100644 package/network/utils/bpftools/patches/004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch diff --git a/package/network/utils/bpftools/Makefile b/package/network/utils/bpftools/Makefile index e760d50c5e..06a7a7adfd 100644 --- a/package/network/utils/bpftools/Makefile +++ b/package/network/utils/bpftools/Makefile @@ -8,12 +8,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=bpftools -PKG_VERSION:=5.8.9 +PKG_VERSION:=5.10.10 PKG_RELEASE:=1 PKG_SOURCE:=linux-$(PKG_VERSION).tar.xz PKG_SOURCE_URL:=@KERNEL/linux/kernel/v5.x -PKG_HASH:=99d8bc1b82f17d7d79f9af4a94af4c0e3772159e9e6e278761bde8569f93e15f +PKG_HASH:=60ed866fa951522a5255ea37ec3ac2006d3f3427d4783a13ef478464f37cdb19 PKG_MAINTAINER:=Tony Ambardar diff --git a/package/network/utils/bpftools/patches/001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch b/package/network/utils/bpftools/patches/001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch deleted file mode 100644 index 18000b6940..0000000000 --- a/package/network/utils/bpftools/patches/001-libbpf-ensure-no-local-symbols-counted-in-ABI-check.patch +++ /dev/null @@ -1,31 +0,0 @@ -From fafb2e7eaec6d33ce16e28f481edf781219d5d27 Mon Sep 17 00:00:00 2001 -From: Tony Ambardar -Date: Fri, 24 Jul 2020 23:58:17 -0700 -Subject: [PATCH] tools/libbpf: ensure no local symbols counted in ABI check - -This avoids finding versioned local symbols such as _init and _fini in -the libbpf.so file. - -Signed-off-by: Tony Ambardar ---- - tools/lib/bpf/Makefile | 2 ++ - 1 file changed, 2 insertions(+) - ---- a/tools/lib/bpf/Makefile -+++ b/tools/lib/bpf/Makefile -@@ -152,6 +152,7 @@ GLOBAL_SYM_COUNT = $(shell readelf -s -- - awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ - sort -u | wc -l) - VERSIONED_SYM_COUNT = $(shell readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ -+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}' | \ - grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | sort -u | wc -l) - - CMD_TARGETS = $(LIB_TARGET) $(PC_FILE) -@@ -219,6 +220,7 @@ check_abi: $(OUTPUT)libbpf.so - awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ - sort -u > $(OUTPUT)libbpf_global_syms.tmp; \ - readelf --dyn-syms --wide $(OUTPUT)libbpf.so | \ -+ awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$NF}'| \ - grep -Eo '[^ ]+@LIBBPF_' | cut -d@ -f1 | \ - sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; \ - diff -u $(OUTPUT)libbpf_global_syms.tmp \ diff --git a/package/network/utils/bpftools/patches/002-libbpf-fix-build-failure-from-uninitialized-variable.patch b/package/network/utils/bpftools/patches/002-libbpf-fix-build-failure-from-uninitialized-variable.patch deleted file mode 100644 index 96ab2084b7..0000000000 --- a/package/network/utils/bpftools/patches/002-libbpf-fix-build-failure-from-uninitialized-variable.patch +++ /dev/null @@ -1,41 +0,0 @@ -From 74d0dcf7608b1bab116e297468ac51b57eb97ce0 Mon Sep 17 00:00:00 2001 -From: Tony Ambardar -Date: Thu, 20 Aug 2020 10:06:24 -0700 -Subject: [PATCH] libbpf: fix build failure from uninitialized variable warning - -While compiling libbpf, some GCC versions (at least 8.4.0) have difficulty -determining control flow and a emit warning for potentially uninitialized -usage of 'map', which results in a build error if using "-Werror": - -In file included from libbpf.c:56: -libbpf.c: In function '__bpf_object__open': -libbpf_internal.h:59:2: warning: 'map' may be used uninitialized in this function [-Wmaybe-uninitialized] - libbpf_print(level, "libbpf: " fmt, ##__VA_ARGS__); \ - ^~~~~~~~~~~~ -libbpf.c:5032:18: note: 'map' was declared here - struct bpf_map *map, *targ_map; - ^~~ - -The warning/error is false based on code inspection, so silence it with a -NULL initialization. - -Fixes: 646f02ffdd49 ("libbpf: Add BTF-defined map-in-map support") -Ref: 063e68813391 ("libbpf: Fix false uninitialized variable warning") - -Signed-off-by: Tony Ambardar ---- - tools/lib/bpf/libbpf.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/tools/lib/bpf/libbpf.c -+++ b/tools/lib/bpf/libbpf.c -@@ -5030,8 +5030,8 @@ static int bpf_object__collect_map_relos - int i, j, nrels, new_sz; - const struct btf_var_secinfo *vi = NULL; - const struct btf_type *sec, *var, *def; -+ struct bpf_map *map = NULL, *targ_map; - const struct btf_member *member; -- struct bpf_map *map, *targ_map; - const char *name, *mname; - Elf_Data *symbols; - unsigned int moff; diff --git a/package/network/utils/bpftools/patches/003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch b/package/network/utils/bpftools/patches/003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch deleted file mode 100644 index 1c569afe6b..0000000000 --- a/package/network/utils/bpftools/patches/003-bpftool-allow-passing-BPFTOOL_VERSION-to-make.patch +++ /dev/null @@ -1,21 +0,0 @@ -From 668d1c2951e18512a27aec20b80dea627d01bf04 Mon Sep 17 00:00:00 2001 -From: Tony Ambardar -Date: Thu, 20 Aug 2020 16:05:48 -0700 -Subject: [PATCH] tools/bpftool: allow passing BPFTOOL_VERSION to make - -Signed-off-by: Tony Ambardar ---- - tools/bpf/bpftool/Makefile | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - ---- a/tools/bpf/bpftool/Makefile -+++ b/tools/bpf/bpftool/Makefile -@@ -25,7 +25,7 @@ endif - - LIBBPF = $(LIBBPF_PATH)libbpf.a - --BPFTOOL_VERSION := $(shell make -rR --no-print-directory -sC ../../.. kernelversion) -+BPFTOOL_VERSION ?= $(shell make -rR --no-print-directory -sC ../../.. kernelversion) - - $(LIBBPF): FORCE - $(if $(LIBBPF_OUTPUT),@mkdir -p $(LIBBPF_OUTPUT)) diff --git a/package/network/utils/bpftools/patches/004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch b/package/network/utils/bpftools/patches/004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch deleted file mode 100644 index 99ce513723..0000000000 --- a/package/network/utils/bpftools/patches/004-v5.9-bpftool-use-only-ftw-for-file-tree-parsing.patch +++ /dev/null @@ -1,231 +0,0 @@ -From 6edda7633e4fdf33b91c2e86c05cab805a0dabb3 Mon Sep 17 00:00:00 2001 -From: Tony Ambardar -Date: Mon, 20 Jul 2020 19:48:16 -0700 -Subject: [PATCH] bpftool: Use only nftw for file tree parsing - -The bpftool sources include code to walk file trees, but use multiple -frameworks to do so: nftw and fts. While nftw conforms to POSIX/SUSv3 and -is widely available, fts is not conformant and less common, especially on -non-glibc systems. The inconsistent framework usage hampers maintenance -and portability of bpftool, in particular for embedded systems. - -Standardize code usage by rewriting one fts-based function to use nftw and -clean up some related function warnings by extending use of "const char *" -arguments. This change helps in building bpftool against musl for OpenWrt. - -Also fix an unsafe call to dirname() by duplicating the string to pass, -since some implementations may directly alter it. The same approach is -used in libbpf.c. - -Signed-off-by: Tony Ambardar -Signed-off-by: Daniel Borkmann -Reviewed-by: Quentin Monnet -Link: https://lore.kernel.org/bpf/20200721024817.13701-1-Tony.Ambardar@gmail.com ---- - tools/bpf/bpftool/common.c | 137 ++++++++++++++++++++++--------------- - tools/bpf/bpftool/main.h | 4 +- - 2 files changed, 82 insertions(+), 59 deletions(-) - ---- a/tools/bpf/bpftool/common.c -+++ b/tools/bpf/bpftool/common.c -@@ -1,10 +1,11 @@ - // SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) - /* Copyright (C) 2017-2018 Netronome Systems, Inc. */ - -+#define _GNU_SOURCE - #include - #include - #include --#include -+#include - #include - #include - #include -@@ -123,24 +124,35 @@ int mount_tracefs(const char *target) - return err; - } - --int open_obj_pinned(char *path, bool quiet) -+int open_obj_pinned(const char *path, bool quiet) - { -- int fd; -+ char *pname; -+ int fd = -1; - -- fd = bpf_obj_get(path); -+ pname = strdup(path); -+ if (!pname) { -+ if (!quiet) -+ p_err("mem alloc failed"); -+ goto out_ret; -+ } -+ -+ fd = bpf_obj_get(pname); - if (fd < 0) { - if (!quiet) -- p_err("bpf obj get (%s): %s", path, -- errno == EACCES && !is_bpffs(dirname(path)) ? -+ p_err("bpf obj get (%s): %s", pname, -+ errno == EACCES && !is_bpffs(dirname(pname)) ? - "directory not in bpf file system (bpffs)" : - strerror(errno)); -- return -1; -+ goto out_free; - } - -+out_free: -+ free(pname); -+out_ret: - return fd; - } - --int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type) -+int open_obj_pinned_any(const char *path, enum bpf_obj_type exp_type) - { - enum bpf_obj_type type; - int fd; -@@ -330,71 +342,82 @@ void print_hex_data_json(uint8_t *data, - jsonw_end_array(json_wtr); - } - -+/* extra params for nftw cb */ -+static struct pinned_obj_table *build_fn_table; -+static enum bpf_obj_type build_fn_type; -+ -+static int do_build_table_cb(const char *fpath, const struct stat *sb, -+ int typeflag, struct FTW *ftwbuf) -+{ -+ struct bpf_prog_info pinned_info; -+ __u32 len = sizeof(pinned_info); -+ struct pinned_obj *obj_node; -+ enum bpf_obj_type objtype; -+ int fd, err = 0; -+ -+ if (typeflag != FTW_F) -+ goto out_ret; -+ -+ fd = open_obj_pinned(fpath, true); -+ if (fd < 0) -+ goto out_ret; -+ -+ objtype = get_fd_type(fd); -+ if (objtype != build_fn_type) -+ goto out_close; -+ -+ memset(&pinned_info, 0, sizeof(pinned_info)); -+ if (bpf_obj_get_info_by_fd(fd, &pinned_info, &len)) -+ goto out_close; -+ -+ obj_node = calloc(1, sizeof(*obj_node)); -+ if (!obj_node) { -+ err = -1; -+ goto out_close; -+ } -+ -+ obj_node->id = pinned_info.id; -+ obj_node->path = strdup(fpath); -+ if (!obj_node->path) { -+ err = -1; -+ free(obj_node); -+ goto out_close; -+ } -+ -+ hash_add(build_fn_table->table, &obj_node->hash, obj_node->id); -+out_close: -+ close(fd); -+out_ret: -+ return err; -+} -+ - int build_pinned_obj_table(struct pinned_obj_table *tab, - enum bpf_obj_type type) - { -- struct bpf_prog_info pinned_info = {}; -- struct pinned_obj *obj_node = NULL; -- __u32 len = sizeof(pinned_info); - struct mntent *mntent = NULL; -- enum bpf_obj_type objtype; - FILE *mntfile = NULL; -- FTSENT *ftse = NULL; -- FTS *fts = NULL; -- int fd, err; -+ int flags = FTW_PHYS; -+ int nopenfd = 16; -+ int err = 0; - - mntfile = setmntent("/proc/mounts", "r"); - if (!mntfile) - return -1; - -+ build_fn_table = tab; -+ build_fn_type = type; -+ - while ((mntent = getmntent(mntfile))) { -- char *path[] = { mntent->mnt_dir, NULL }; -+ char *path = mntent->mnt_dir; - - if (strncmp(mntent->mnt_type, "bpf", 3) != 0) - continue; -- -- fts = fts_open(path, 0, NULL); -- if (!fts) -- continue; -- -- while ((ftse = fts_read(fts))) { -- if (!(ftse->fts_info & FTS_F)) -- continue; -- fd = open_obj_pinned(ftse->fts_path, true); -- if (fd < 0) -- continue; -- -- objtype = get_fd_type(fd); -- if (objtype != type) { -- close(fd); -- continue; -- } -- memset(&pinned_info, 0, sizeof(pinned_info)); -- err = bpf_obj_get_info_by_fd(fd, &pinned_info, &len); -- if (err) { -- close(fd); -- continue; -- } -- -- obj_node = malloc(sizeof(*obj_node)); -- if (!obj_node) { -- close(fd); -- fts_close(fts); -- fclose(mntfile); -- return -1; -- } -- -- memset(obj_node, 0, sizeof(*obj_node)); -- obj_node->id = pinned_info.id; -- obj_node->path = strdup(ftse->fts_path); -- hash_add(tab->table, &obj_node->hash, obj_node->id); -- -- close(fd); -- } -- fts_close(fts); -+ err = nftw(path, do_build_table_cb, nopenfd, flags); -+ if (err) -+ break; - } - fclose(mntfile); -- return 0; -+ return err; - } - - void delete_pinned_obj_table(struct pinned_obj_table *tab) ---- a/tools/bpf/bpftool/main.h -+++ b/tools/bpf/bpftool/main.h -@@ -196,8 +196,8 @@ int cmd_select(const struct cmd *cmds, i - int get_fd_type(int fd); - const char *get_fd_type_name(enum bpf_obj_type type); - char *get_fdinfo(int fd, const char *key); --int open_obj_pinned(char *path, bool quiet); --int open_obj_pinned_any(char *path, enum bpf_obj_type exp_type); -+int open_obj_pinned(const char *path, bool quiet); -+int open_obj_pinned_any(const char *path, enum bpf_obj_type exp_type); - int mount_bpffs_for_pin(const char *name); - int do_pin_any(int argc, char **argv, int (*get_fd_by_id)(int *, char ***)); - int do_pin_fd(int fd, const char *name); From a14e666e0c266175af6f79141e4de660b7cb1b3c Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Tue, 26 Jan 2021 09:49:14 -1000 Subject: [PATCH 15/30] umdns: bump to 2021-01-26 * i78aa36b umdns: fix 64-bit time format string * Update Copyright Signed-off-by: Paul Spooren --- package/network/services/umdns/Makefile | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/package/network/services/umdns/Makefile b/package/network/services/umdns/Makefile index d8cd9ae749..108d872868 100644 --- a/package/network/services/umdns/Makefile +++ b/package/network/services/umdns/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2014 OpenWrt.org +# Copyright (C) 2014-2021 OpenWrt.org # # This is free software, licensed under the GNU General Public License v2. # See /LICENSE for more information. @@ -8,13 +8,13 @@ include $(TOPDIR)/rules.mk PKG_NAME:=umdns -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_SOURCE_URL=$(PROJECT_GIT)/project/mdnsd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_DATE:=2020-10-26 -PKG_SOURCE_VERSION:=59e4fc98162d253b4e5ecd110f7bc5ea3962e221 -PKG_MIRROR_HASH:=35fefc76d84c963ccb0aa72ac738065649f361d2946d3bc45fbd205d1dfc3d9f +PKG_SOURCE_DATE:=2021-01-26 +PKG_SOURCE_VERSION:=78aa36b0e9808e801c527c6dc47320e593309522 +PKG_MIRROR_HASH:=241833f2bf2f3366f356703159be386862ef747d9b253af6c13555f252cc970d PKG_MAINTAINER:=John Crispin PKG_LICENSE:=LGPL-2.1 From 33532502f886b5af949cfa4b0ff084d8718632ac Mon Sep 17 00:00:00 2001 From: Rosen Penev Date: Wed, 20 Jan 2021 20:51:45 -0800 Subject: [PATCH 16/30] toolchain/libstdcpp: disable dual ABI and default to new GCC 5.1 changed the std::string ABI in order to properly support C++11. For compatibility with libraries compiled with the older ABI, that is, linking between old-abi.so and new-abi.bin, both ABIs are enabled. In terms of OpenWrt, all packages are compiled with the same toolchain, which means these issues do not need to be handled. Most importantly, this results in a significant size reduction of libstdpp: Before: 450794 bytes After: 327752 bytes Tested with all OpenWrt packages. Signed-off-by: Rosen Penev --- toolchain/gcc/common.mk | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/toolchain/gcc/common.mk b/toolchain/gcc/common.mk index aaddb74642..55fad1fcc4 100644 --- a/toolchain/gcc/common.mk +++ b/toolchain/gcc/common.mk @@ -117,7 +117,9 @@ GCC_CONFIGURE:= \ --with-mpc=$(TOPDIR)/staging_dir/host \ --disable-decimal-float \ --with-diagnostics-color=auto-if-env \ - --enable-__cxa_atexit + --enable-__cxa_atexit \ + --disable-libstdcxx-dual-abi \ + --with-default-libstdcxx-abi=new ifneq ($(CONFIG_mips)$(CONFIG_mipsel),) GCC_CONFIGURE += --with-mips-plt endif From bc1aecc42a160a1daed2803c7c65d3b06a13ebd3 Mon Sep 17 00:00:00 2001 From: Jeffrey Elms Date: Tue, 26 Jan 2021 18:28:14 -0800 Subject: [PATCH 17/30] px5g-wolfssl: Fix certificate signature Certificate signature algorithm was being set after call to `wc_MakeCert`, resulting in a mismatch between specified signature in certificate and the actual signature type. Signed-off-by: Jeffrey Elms [fix commit subject, use COMMITCOUNT] Signed-off-by: Paul Spooren --- package/utils/px5g-wolfssl/Makefile | 2 +- package/utils/px5g-wolfssl/px5g-wolfssl.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package/utils/px5g-wolfssl/Makefile b/package/utils/px5g-wolfssl/Makefile index be36f9f33d..12ebcdcd2e 100644 --- a/package/utils/px5g-wolfssl/Makefile +++ b/package/utils/px5g-wolfssl/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=px5g-wolfssl -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_LICENSE:=GPL-2.0-or-later PKG_USE_MIPS16:=0 diff --git a/package/utils/px5g-wolfssl/px5g-wolfssl.c b/package/utils/px5g-wolfssl/px5g-wolfssl.c index b937d220ca..763d7b4b71 100644 --- a/package/utils/px5g-wolfssl/px5g-wolfssl.c +++ b/package/utils/px5g-wolfssl/px5g-wolfssl.c @@ -232,8 +232,10 @@ int selfsigned(WC_RNG *rng, char **arg) { subject, fstr, tstr); if (type == EC_KEY_TYPE) { + newCert.sigType = CTC_SHA256wECDSA; ret = wc_MakeCert(&newCert, derBuf, sizeof(derBuf), NULL, &ecKey, rng); } else { + newCert.sigType = CTC_SHA256wRSA; ret = wc_MakeCert(&newCert, derBuf, sizeof(derBuf), &rsaKey, NULL, rng); } if (ret <= 0) { @@ -242,11 +244,9 @@ int selfsigned(WC_RNG *rng, char **arg) { } if (type == EC_KEY_TYPE) { - newCert.sigType = CTC_SHA256wECDSA; ret = wc_SignCert(newCert.bodySz, newCert.sigType, derBuf, sizeof(derBuf), NULL, &ecKey, rng); } else { - newCert.sigType = CTC_SHA256wRSA; ret = wc_SignCert(newCert.bodySz, newCert.sigType, derBuf, sizeof(derBuf), &rsaKey, NULL, rng); } From 29b6bdd0853ddef364686c40677bb3cc992ec975 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Tue, 26 Jan 2021 17:16:36 -1000 Subject: [PATCH 18/30] rules: fix COMMITCOUNT logic The newly added $(COMMITCOUNT) variable was wrongly increased by plus one. The addition should have been only added to $(AUTORELEASE) as OpenWrt traditionally starts counting at one rather than zero. $(AUTORELEASE) counts the commits since the last bump, which is zero on the version bump commit itself. This commit increases $(AUTORELEASE) by one while leaving $(COMMITCOUNT) as is. The base-files package is the only package using $(COMMITCOUNT) so far and requires a pseudo commit to keep the PKG_RELEASE correct. A non functional change (Copyright bump) is done in the next commit. Signed-off-by: Paul Spooren --- rules.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rules.mk b/rules.mk index 7ec15defce..ae4249d571 100644 --- a/rules.mk +++ b/rules.mk @@ -423,7 +423,7 @@ $(shell \ if [ -n "$$last_bump" ]; then \ echo -n $$(($$(git rev-list --count "$$last_bump..HEAD" .) + 1)); \ else \ - echo -n $$(($$(git rev-list --count HEAD .) + 1)); \ + git rev-list --count HEAD .; \ fi; \ else \ secs="$$(($(SOURCE_DATE_EPOCH) % 86400))"; \ From ed6c0eeae86f6453c8a576d3e98999c7d47beeb9 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Tue, 26 Jan 2021 17:21:48 -1000 Subject: [PATCH 19/30] base-files: bump Copyright to 2021 This commit is only added to keep the PKG_RELEASE correct after fixing the $(COMMITCOUNT) logic in the previous commit. This way the PKG_RELEASE stays the same while the compiled packages content isn't changed. Signed-off-by: Paul Spooren --- package/base-files/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package/base-files/Makefile b/package/base-files/Makefile index f0ea41d98c..81c66a00a2 100644 --- a/package/base-files/Makefile +++ b/package/base-files/Makefile @@ -1,5 +1,5 @@ # -# Copyright (C) 2007-2016 OpenWrt.org +# Copyright (C) 2007-2021 OpenWrt.org # Copyright (C) 2010 Vertical Communications # # This is free software, licensed under the GNU General Public License v2. From dc69016ea68faf655b56fb70f21f3543d4f5e742 Mon Sep 17 00:00:00 2001 From: AmadeusGhost <42570690+AmadeusGhost@users.noreply.github.com> Date: Sat, 16 Jan 2021 12:20:02 +0800 Subject: [PATCH 20/30] rtl8812au-ac: fix bug after enable concurrent mode support Fixes: 8ea8e4be955b10555745b9e408fd161d1b15e129 ("rtl8812au-ac: enable concurrent mode support") --- .../0003-Add-missing-code-for-concurrent-mode.patch | 10 ++++++++++ .../0003-Remove-wdev-code-for-concurrent-mode.patch | 13 ------------- 2 files changed, 10 insertions(+), 13 deletions(-) create mode 100644 package/ctcgfw/rtl8812au-ac/patches/0003-Add-missing-code-for-concurrent-mode.patch delete mode 100644 package/ctcgfw/rtl8812au-ac/patches/0003-Remove-wdev-code-for-concurrent-mode.patch diff --git a/package/ctcgfw/rtl8812au-ac/patches/0003-Add-missing-code-for-concurrent-mode.patch b/package/ctcgfw/rtl8812au-ac/patches/0003-Add-missing-code-for-concurrent-mode.patch new file mode 100644 index 0000000000..f6af34d3e3 --- /dev/null +++ b/package/ctcgfw/rtl8812au-ac/patches/0003-Add-missing-code-for-concurrent-mode.patch @@ -0,0 +1,10 @@ +--- a/os_dep/linux/os_intfs.c ++++ b/os_dep/linux/os_intfs.c +@@ -2803,6 +2803,7 @@ static int netdev_vir_if_close(struct net_device *pnetdev) + { + _adapter *padapter = (_adapter *)rtw_netdev_priv(pnetdev); + struct mlme_priv *pmlmepriv = &padapter->mlmepriv; ++ struct wireless_dev *wdev = padapter->rtw_wdev; + + RTW_INFO(FUNC_NDEV_FMT" , bup=%d\n", FUNC_NDEV_ARG(pnetdev), padapter->bup); + padapter->net_closed = _TRUE; diff --git a/package/ctcgfw/rtl8812au-ac/patches/0003-Remove-wdev-code-for-concurrent-mode.patch b/package/ctcgfw/rtl8812au-ac/patches/0003-Remove-wdev-code-for-concurrent-mode.patch deleted file mode 100644 index 4f644af4b7..0000000000 --- a/package/ctcgfw/rtl8812au-ac/patches/0003-Remove-wdev-code-for-concurrent-mode.patch +++ /dev/null @@ -1,13 +0,0 @@ ---- a/os_dep/linux/os_intfs.c -+++ b/os_dep/linux/os_intfs.c -@@ -2817,8 +2817,10 @@ static int netdev_vir_if_close(struct net_device *pnetdev) - #endif - - #ifdef CONFIG_IOCTL_CFG80211 -+#ifndef CONFIG_CONCURRENT_MODE - wdev->iftype = NL80211_IFTYPE_MONITOR; - wdev->current_bss = NULL; -+#endif - rtw_scan_abort(padapter); - rtw_cfg80211_wait_scan_req_empty(padapter, 200); - adapter_wdev_data(padapter)->bandroid_scan = _FALSE; From bf200c046722f904b23225df6e03accf519f8634 Mon Sep 17 00:00:00 2001 From: Paul Spooren Date: Tue, 26 Jan 2021 18:13:28 -1000 Subject: [PATCH 21/30] scripts: sources CDN as fallback in download.pl In case the default sources for a package fail use the CDN rather than our own mirror. In case the CDN fails, fallback to our mirror. Also remove mirror1 which isn't available anymore. Signed-off-by: Paul Spooren Signed-off-by: CN_SZTL --- scripts/download.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/download.pl b/scripts/download.pl index 2623740d6f..6296174212 100755 --- a/scripts/download.pl +++ b/scripts/download.pl @@ -273,7 +273,7 @@ foreach my $mirror (@ARGV) { } } -#push @mirrors, 'https://mirror1.openwrt.org'; +push @mirrors, 'https://sources.cdn.openwrt.org'; push @mirrors, 'https://sources.openwrt.org'; push @mirrors, 'https://mirror2.openwrt.org/sources'; From f790f0ca78fbd033b1bf83d35a89361d7495e48e Mon Sep 17 00:00:00 2001 From: Tim Zhang Date: Tue, 26 Jan 2021 22:47:38 +0800 Subject: [PATCH 22/30] OpenClash: Fix DNS-hijacking related firewall rules Co-authored-by: vernesong <42875168+vernesong@users.noreply.github.com> Signed-off-by: CN_SZTL --- .../root/etc/init.d/openclash | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/package/ctcgfw/luci-app-openclash/root/etc/init.d/openclash b/package/ctcgfw/luci-app-openclash/root/etc/init.d/openclash index 21fad97232..d2b9544ba2 100755 --- a/package/ctcgfw/luci-app-openclash/root/etc/init.d/openclash +++ b/package/ctcgfw/luci-app-openclash/root/etc/init.d/openclash @@ -1200,15 +1200,16 @@ firewall_redirect_exclude() set_firewall() { - -if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep "redir ports 53$")"]; then - iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports 53 - iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports 53 + +DNSPORT="$(uci get dhcp.@dnsmasq[0].port 2>/dev/null || echo 53)" +if [ "$enable_redirect_dns" -eq 1 ] && [ -z "$(iptables -t nat -nL PREROUTING --line-number |grep 'dns_hijack')"]; then + iptables -t nat -A PREROUTING -p udp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment dns_hijack + iptables -t nat -A PREROUTING -p tcp --dport 53 -j REDIRECT --to-ports "$DNSPORT" -m comment --comment dns_hijack fi -if [ "$(iptables -t nat -nL PREROUTING --line-number |grep "redir ports 53" |wc -l)" -gt 2 ] && [ "$enable_redirect_dns" -eq 1 ]; then +if [ "$(iptables -t nat -nL PREROUTING --line-number | grep "redir port $DNSPORT" | wc -l)" -gt 2 ] && [ "$enable_redirect_dns" -eq 1 ]; then echo "发现53端口被劫持,清理防火墙规则..." >$START_LOG - pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/redir ports 53/=' 2>/dev/null |sort -rn) + pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d | sed -n "/redir port $DNSPORT/=" 2>/dev/null |sort -rn) for pre_line in $pre_lines; do iptables -t nat -D PREROUTING "$pre_line" >/dev/null 2>&1 done @@ -1521,6 +1522,11 @@ revert_firewall() done >/dev/null 2>&1 iptables -t nat -D PREROUTING -p tcp -j openclash >/dev/null 2>&1 + pre_lines=$(iptables -nvL PREROUTING -t nat |sed 1,2d |sed -n '/dns_hijack/=' 2>/dev/null |sort -rn) + for pre_line in $pre_lines; do + iptables -t nat -D PREROUTING "$pre_line" >/dev/null 2>&1 + done >/dev/null 2>&1 + #ipv6 #ip6tables -t mangle -F openclash >/dev/null 2>&1 #ip6tables -t mangle -D PREROUTING -p udp -j openclash >/dev/null 2>&1 From 1c5dbc06a808cd135d677939e4fd89a48cd8e3b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E7=AB=AD=E5=8A=9B?= Date: Mon, 25 Jan 2021 22:50:49 +0800 Subject: [PATCH 23/30] luci-app-jd-dailybonus: bump to 1.0.3 Signed-off-by: CN_SZTL --- .../ctcgfw/luci-app-jd-dailybonus/Makefile | 7 +- .../htdocs/jd-dailybonus/jquery.min.js | 2 - .../htdocs/jd-dailybonus/qrcode.min.js | 1 - .../luasrc/controller/jd-dailybonus.lua | 96 +-- .../luasrc/model/cbi/jd-dailybonus/log.lua | 4 +- .../luasrc/model/cbi/jd-dailybonus/script.lua | 1 - .../view/jd-dailybonus/cookie_tools.htm | 14 +- .../view/jd-dailybonus/update_service.htm | 569 ++++++++---------- .../root/lib/upgrade/keep.d/jd-dailybonus | 1 + .../usr/share/jd-dailybonus/JD_DailyBonus.js | 122 ++-- .../usr/share/jd-dailybonus/gen_cookieset.lua | 19 + .../usr/share/jd-dailybonus/jd_cookie.lua | 168 ------ .../root/usr/share/jd-dailybonus/newapp.sh | 13 +- .../root/usr/share/jd-dailybonus/requests.lua | 303 ---------- 14 files changed, 415 insertions(+), 905 deletions(-) delete mode 100644 package/ctcgfw/luci-app-jd-dailybonus/htdocs/jd-dailybonus/jquery.min.js delete mode 100644 package/ctcgfw/luci-app-jd-dailybonus/htdocs/jd-dailybonus/qrcode.min.js create mode 100644 package/ctcgfw/luci-app-jd-dailybonus/root/lib/upgrade/keep.d/jd-dailybonus create mode 100644 package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/gen_cookieset.lua delete mode 100644 package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/jd_cookie.lua delete mode 100644 package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/requests.lua diff --git a/package/ctcgfw/luci-app-jd-dailybonus/Makefile b/package/ctcgfw/luci-app-jd-dailybonus/Makefile index 406342eeed..42a35a12c8 100644 --- a/package/ctcgfw/luci-app-jd-dailybonus/Makefile +++ b/package/ctcgfw/luci-app-jd-dailybonus/Makefile @@ -8,13 +8,12 @@ include $(TOPDIR)/rules.mk LUCI_TITLE:=Luci for JD dailybonus Script -LUCI_DEPENDS:=+coreutils +coreutils-nohup +node +node-request \ - +lua +luasocket +lua-cjson +lua-md5 +luasec +wget-ssl +LUCI_DEPENDS:=+lua +node +node-request +wget-ssl LUCI_PKGARCH:=all PKG_NAME:=luci-app-jd-dailybonus -PKG_VERSION:=1.0.1 -PKG_RELEASE:=20210123 +PKG_VERSION:=1.0.3 +PKG_RELEASE:=20210125 include $(TOPDIR)/feeds/luci/luci.mk diff --git a/package/ctcgfw/luci-app-jd-dailybonus/htdocs/jd-dailybonus/jquery.min.js b/package/ctcgfw/luci-app-jd-dailybonus/htdocs/jd-dailybonus/jquery.min.js deleted file mode 100644 index 4d9b3a2587..0000000000 --- a/package/ctcgfw/luci-app-jd-dailybonus/htdocs/jd-dailybonus/jquery.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! jQuery v3.3.1 | (c) JS Foundation and other contributors | jquery.org/license */ -!function(e,t){"use strict";"object"==typeof module&&"object"==typeof module.exports?module.exports=e.document?t(e,!0):function(e){if(!e.document)throw new Error("jQuery requires a window with a document");return t(e)}:t(e)}("undefined"!=typeof window?window:this,function(e,t){"use strict";var n=[],r=e.document,i=Object.getPrototypeOf,o=n.slice,a=n.concat,s=n.push,u=n.indexOf,l={},c=l.toString,f=l.hasOwnProperty,p=f.toString,d=p.call(Object),h={},g=function e(t){return"function"==typeof t&&"number"!=typeof t.nodeType},y=function e(t){return null!=t&&t===t.window},v={type:!0,src:!0,noModule:!0};function m(e,t,n){var i,o=(t=t||r).createElement("script");if(o.text=e,n)for(i in v)n[i]&&(o[i]=n[i]);t.head.appendChild(o).parentNode.removeChild(o)}function x(e){return null==e?e+"":"object"==typeof e||"function"==typeof e?l[c.call(e)]||"object":typeof e}var b="3.3.1",w=function(e,t){return new w.fn.init(e,t)},T=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g;w.fn=w.prototype={jquery:"3.3.1",constructor:w,length:0,toArray:function(){return o.call(this)},get:function(e){return null==e?o.call(this):e<0?this[e+this.length]:this[e]},pushStack:function(e){var t=w.merge(this.constructor(),e);return t.prevObject=this,t},each:function(e){return w.each(this,e)},map:function(e){return this.pushStack(w.map(this,function(t,n){return e.call(t,n,t)}))},slice:function(){return this.pushStack(o.apply(this,arguments))},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},eq:function(e){var t=this.length,n=+e+(e<0?t:0);return this.pushStack(n>=0&&n0&&t-1 in e)}var E=function(e){var t,n,r,i,o,a,s,u,l,c,f,p,d,h,g,y,v,m,x,b="sizzle"+1*new Date,w=e.document,T=0,C=0,E=ae(),k=ae(),S=ae(),D=function(e,t){return e===t&&(f=!0),0},N={}.hasOwnProperty,A=[],j=A.pop,q=A.push,L=A.push,H=A.slice,O=function(e,t){for(var n=0,r=e.length;n+~]|"+M+")"+M+"*"),z=new RegExp("="+M+"*([^\\]'\"]*?)"+M+"*\\]","g"),X=new RegExp(W),U=new RegExp("^"+R+"$"),V={ID:new RegExp("^#("+R+")"),CLASS:new RegExp("^\\.("+R+")"),TAG:new RegExp("^("+R+"|[*])"),ATTR:new RegExp("^"+I),PSEUDO:new RegExp("^"+W),CHILD:new RegExp("^:(only|first|last|nth|nth-last)-(child|of-type)(?:\\("+M+"*(even|odd|(([+-]|)(\\d*)n|)"+M+"*(?:([+-]|)"+M+"*(\\d+)|))"+M+"*\\)|)","i"),bool:new RegExp("^(?:"+P+")$","i"),needsContext:new RegExp("^"+M+"*[>+~]|:(even|odd|eq|gt|lt|nth|first|last)(?:\\("+M+"*((?:-\\d)?\\d*)"+M+"*\\)|)(?=[^-]|$)","i")},G=/^(?:input|select|textarea|button)$/i,Y=/^h\d$/i,Q=/^[^{]+\{\s*\[native \w/,J=/^(?:#([\w-]+)|(\w+)|\.([\w-]+))$/,K=/[+~]/,Z=new RegExp("\\\\([\\da-f]{1,6}"+M+"?|("+M+")|.)","ig"),ee=function(e,t,n){var r="0x"+t-65536;return r!==r||n?t:r<0?String.fromCharCode(r+65536):String.fromCharCode(r>>10|55296,1023&r|56320)},te=/([\0-\x1f\x7f]|^-?\d)|^-$|[^\0-\x1f\x7f-\uFFFF\w-]/g,ne=function(e,t){return t?"\0"===e?"\ufffd":e.slice(0,-1)+"\\"+e.charCodeAt(e.length-1).toString(16)+" ":"\\"+e},re=function(){p()},ie=me(function(e){return!0===e.disabled&&("form"in e||"label"in e)},{dir:"parentNode",next:"legend"});try{L.apply(A=H.call(w.childNodes),w.childNodes),A[w.childNodes.length].nodeType}catch(e){L={apply:A.length?function(e,t){q.apply(e,H.call(t))}:function(e,t){var n=e.length,r=0;while(e[n++]=t[r++]);e.length=n-1}}}function oe(e,t,r,i){var o,s,l,c,f,h,v,m=t&&t.ownerDocument,T=t?t.nodeType:9;if(r=r||[],"string"!=typeof e||!e||1!==T&&9!==T&&11!==T)return r;if(!i&&((t?t.ownerDocument||t:w)!==d&&p(t),t=t||d,g)){if(11!==T&&(f=J.exec(e)))if(o=f[1]){if(9===T){if(!(l=t.getElementById(o)))return r;if(l.id===o)return r.push(l),r}else if(m&&(l=m.getElementById(o))&&x(t,l)&&l.id===o)return r.push(l),r}else{if(f[2])return L.apply(r,t.getElementsByTagName(e)),r;if((o=f[3])&&n.getElementsByClassName&&t.getElementsByClassName)return L.apply(r,t.getElementsByClassName(o)),r}if(n.qsa&&!S[e+" "]&&(!y||!y.test(e))){if(1!==T)m=t,v=e;else if("object"!==t.nodeName.toLowerCase()){(c=t.getAttribute("id"))?c=c.replace(te,ne):t.setAttribute("id",c=b),s=(h=a(e)).length;while(s--)h[s]="#"+c+" "+ve(h[s]);v=h.join(","),m=K.test(e)&&ge(t.parentNode)||t}if(v)try{return L.apply(r,m.querySelectorAll(v)),r}catch(e){}finally{c===b&&t.removeAttribute("id")}}}return u(e.replace(B,"$1"),t,r,i)}function ae(){var e=[];function t(n,i){return e.push(n+" ")>r.cacheLength&&delete t[e.shift()],t[n+" "]=i}return t}function se(e){return e[b]=!0,e}function ue(e){var t=d.createElement("fieldset");try{return!!e(t)}catch(e){return!1}finally{t.parentNode&&t.parentNode.removeChild(t),t=null}}function le(e,t){var n=e.split("|"),i=n.length;while(i--)r.attrHandle[n[i]]=t}function ce(e,t){var n=t&&e,r=n&&1===e.nodeType&&1===t.nodeType&&e.sourceIndex-t.sourceIndex;if(r)return r;if(n)while(n=n.nextSibling)if(n===t)return-1;return e?1:-1}function fe(e){return function(t){return"input"===t.nodeName.toLowerCase()&&t.type===e}}function pe(e){return function(t){var n=t.nodeName.toLowerCase();return("input"===n||"button"===n)&&t.type===e}}function de(e){return function(t){return"form"in t?t.parentNode&&!1===t.disabled?"label"in t?"label"in t.parentNode?t.parentNode.disabled===e:t.disabled===e:t.isDisabled===e||t.isDisabled!==!e&&ie(t)===e:t.disabled===e:"label"in t&&t.disabled===e}}function he(e){return se(function(t){return t=+t,se(function(n,r){var i,o=e([],n.length,t),a=o.length;while(a--)n[i=o[a]]&&(n[i]=!(r[i]=n[i]))})})}function ge(e){return e&&"undefined"!=typeof e.getElementsByTagName&&e}n=oe.support={},o=oe.isXML=function(e){var t=e&&(e.ownerDocument||e).documentElement;return!!t&&"HTML"!==t.nodeName},p=oe.setDocument=function(e){var t,i,a=e?e.ownerDocument||e:w;return a!==d&&9===a.nodeType&&a.documentElement?(d=a,h=d.documentElement,g=!o(d),w!==d&&(i=d.defaultView)&&i.top!==i&&(i.addEventListener?i.addEventListener("unload",re,!1):i.attachEvent&&i.attachEvent("onunload",re)),n.attributes=ue(function(e){return e.className="i",!e.getAttribute("className")}),n.getElementsByTagName=ue(function(e){return e.appendChild(d.createComment("")),!e.getElementsByTagName("*").length}),n.getElementsByClassName=Q.test(d.getElementsByClassName),n.getById=ue(function(e){return h.appendChild(e).id=b,!d.getElementsByName||!d.getElementsByName(b).length}),n.getById?(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){return e.getAttribute("id")===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n=t.getElementById(e);return n?[n]:[]}}):(r.filter.ID=function(e){var t=e.replace(Z,ee);return function(e){var n="undefined"!=typeof e.getAttributeNode&&e.getAttributeNode("id");return n&&n.value===t}},r.find.ID=function(e,t){if("undefined"!=typeof t.getElementById&&g){var n,r,i,o=t.getElementById(e);if(o){if((n=o.getAttributeNode("id"))&&n.value===e)return[o];i=t.getElementsByName(e),r=0;while(o=i[r++])if((n=o.getAttributeNode("id"))&&n.value===e)return[o]}return[]}}),r.find.TAG=n.getElementsByTagName?function(e,t){return"undefined"!=typeof t.getElementsByTagName?t.getElementsByTagName(e):n.qsa?t.querySelectorAll(e):void 0}:function(e,t){var n,r=[],i=0,o=t.getElementsByTagName(e);if("*"===e){while(n=o[i++])1===n.nodeType&&r.push(n);return r}return o},r.find.CLASS=n.getElementsByClassName&&function(e,t){if("undefined"!=typeof t.getElementsByClassName&&g)return t.getElementsByClassName(e)},v=[],y=[],(n.qsa=Q.test(d.querySelectorAll))&&(ue(function(e){h.appendChild(e).innerHTML="",e.querySelectorAll("[msallowcapture^='']").length&&y.push("[*^$]="+M+"*(?:''|\"\")"),e.querySelectorAll("[selected]").length||y.push("\\["+M+"*(?:value|"+P+")"),e.querySelectorAll("[id~="+b+"-]").length||y.push("~="),e.querySelectorAll(":checked").length||y.push(":checked"),e.querySelectorAll("a#"+b+"+*").length||y.push(".#.+[+~]")}),ue(function(e){e.innerHTML="";var t=d.createElement("input");t.setAttribute("type","hidden"),e.appendChild(t).setAttribute("name","D"),e.querySelectorAll("[name=d]").length&&y.push("name"+M+"*[*^$|!~]?="),2!==e.querySelectorAll(":enabled").length&&y.push(":enabled",":disabled"),h.appendChild(e).disabled=!0,2!==e.querySelectorAll(":disabled").length&&y.push(":enabled",":disabled"),e.querySelectorAll("*,:x"),y.push(",.*:")})),(n.matchesSelector=Q.test(m=h.matches||h.webkitMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector||h.msMatchesSelector))&&ue(function(e){n.disconnectedMatch=m.call(e,"*"),m.call(e,"[s!='']:x"),v.push("!=",W)}),y=y.length&&new RegExp(y.join("|")),v=v.length&&new RegExp(v.join("|")),t=Q.test(h.compareDocumentPosition),x=t||Q.test(h.contains)?function(e,t){var n=9===e.nodeType?e.documentElement:e,r=t&&t.parentNode;return e===r||!(!r||1!==r.nodeType||!(n.contains?n.contains(r):e.compareDocumentPosition&&16&e.compareDocumentPosition(r)))}:function(e,t){if(t)while(t=t.parentNode)if(t===e)return!0;return!1},D=t?function(e,t){if(e===t)return f=!0,0;var r=!e.compareDocumentPosition-!t.compareDocumentPosition;return r||(1&(r=(e.ownerDocument||e)===(t.ownerDocument||t)?e.compareDocumentPosition(t):1)||!n.sortDetached&&t.compareDocumentPosition(e)===r?e===d||e.ownerDocument===w&&x(w,e)?-1:t===d||t.ownerDocument===w&&x(w,t)?1:c?O(c,e)-O(c,t):0:4&r?-1:1)}:function(e,t){if(e===t)return f=!0,0;var n,r=0,i=e.parentNode,o=t.parentNode,a=[e],s=[t];if(!i||!o)return e===d?-1:t===d?1:i?-1:o?1:c?O(c,e)-O(c,t):0;if(i===o)return ce(e,t);n=e;while(n=n.parentNode)a.unshift(n);n=t;while(n=n.parentNode)s.unshift(n);while(a[r]===s[r])r++;return r?ce(a[r],s[r]):a[r]===w?-1:s[r]===w?1:0},d):d},oe.matches=function(e,t){return oe(e,null,null,t)},oe.matchesSelector=function(e,t){if((e.ownerDocument||e)!==d&&p(e),t=t.replace(z,"='$1']"),n.matchesSelector&&g&&!S[t+" "]&&(!v||!v.test(t))&&(!y||!y.test(t)))try{var r=m.call(e,t);if(r||n.disconnectedMatch||e.document&&11!==e.document.nodeType)return r}catch(e){}return oe(t,d,null,[e]).length>0},oe.contains=function(e,t){return(e.ownerDocument||e)!==d&&p(e),x(e,t)},oe.attr=function(e,t){(e.ownerDocument||e)!==d&&p(e);var i=r.attrHandle[t.toLowerCase()],o=i&&N.call(r.attrHandle,t.toLowerCase())?i(e,t,!g):void 0;return void 0!==o?o:n.attributes||!g?e.getAttribute(t):(o=e.getAttributeNode(t))&&o.specified?o.value:null},oe.escape=function(e){return(e+"").replace(te,ne)},oe.error=function(e){throw new Error("Syntax error, unrecognized expression: "+e)},oe.uniqueSort=function(e){var t,r=[],i=0,o=0;if(f=!n.detectDuplicates,c=!n.sortStable&&e.slice(0),e.sort(D),f){while(t=e[o++])t===e[o]&&(i=r.push(o));while(i--)e.splice(r[i],1)}return c=null,e},i=oe.getText=function(e){var t,n="",r=0,o=e.nodeType;if(o){if(1===o||9===o||11===o){if("string"==typeof e.textContent)return e.textContent;for(e=e.firstChild;e;e=e.nextSibling)n+=i(e)}else if(3===o||4===o)return e.nodeValue}else while(t=e[r++])n+=i(t);return n},(r=oe.selectors={cacheLength:50,createPseudo:se,match:V,attrHandle:{},find:{},relative:{">":{dir:"parentNode",first:!0}," ":{dir:"parentNode"},"+":{dir:"previousSibling",first:!0},"~":{dir:"previousSibling"}},preFilter:{ATTR:function(e){return e[1]=e[1].replace(Z,ee),e[3]=(e[3]||e[4]||e[5]||"").replace(Z,ee),"~="===e[2]&&(e[3]=" "+e[3]+" "),e.slice(0,4)},CHILD:function(e){return e[1]=e[1].toLowerCase(),"nth"===e[1].slice(0,3)?(e[3]||oe.error(e[0]),e[4]=+(e[4]?e[5]+(e[6]||1):2*("even"===e[3]||"odd"===e[3])),e[5]=+(e[7]+e[8]||"odd"===e[3])):e[3]&&oe.error(e[0]),e},PSEUDO:function(e){var t,n=!e[6]&&e[2];return V.CHILD.test(e[0])?null:(e[3]?e[2]=e[4]||e[5]||"":n&&X.test(n)&&(t=a(n,!0))&&(t=n.indexOf(")",n.length-t)-n.length)&&(e[0]=e[0].slice(0,t),e[2]=n.slice(0,t)),e.slice(0,3))}},filter:{TAG:function(e){var t=e.replace(Z,ee).toLowerCase();return"*"===e?function(){return!0}:function(e){return e.nodeName&&e.nodeName.toLowerCase()===t}},CLASS:function(e){var t=E[e+" "];return t||(t=new RegExp("(^|"+M+")"+e+"("+M+"|$)"))&&E(e,function(e){return t.test("string"==typeof e.className&&e.className||"undefined"!=typeof e.getAttribute&&e.getAttribute("class")||"")})},ATTR:function(e,t,n){return function(r){var i=oe.attr(r,e);return null==i?"!="===t:!t||(i+="","="===t?i===n:"!="===t?i!==n:"^="===t?n&&0===i.indexOf(n):"*="===t?n&&i.indexOf(n)>-1:"$="===t?n&&i.slice(-n.length)===n:"~="===t?(" "+i.replace($," ")+" ").indexOf(n)>-1:"|="===t&&(i===n||i.slice(0,n.length+1)===n+"-"))}},CHILD:function(e,t,n,r,i){var o="nth"!==e.slice(0,3),a="last"!==e.slice(-4),s="of-type"===t;return 1===r&&0===i?function(e){return!!e.parentNode}:function(t,n,u){var l,c,f,p,d,h,g=o!==a?"nextSibling":"previousSibling",y=t.parentNode,v=s&&t.nodeName.toLowerCase(),m=!u&&!s,x=!1;if(y){if(o){while(g){p=t;while(p=p[g])if(s?p.nodeName.toLowerCase()===v:1===p.nodeType)return!1;h=g="only"===e&&!h&&"nextSibling"}return!0}if(h=[a?y.firstChild:y.lastChild],a&&m){x=(d=(l=(c=(f=(p=y)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1])&&l[2],p=d&&y.childNodes[d];while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if(1===p.nodeType&&++x&&p===t){c[e]=[T,d,x];break}}else if(m&&(x=d=(l=(c=(f=(p=t)[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]||[])[0]===T&&l[1]),!1===x)while(p=++d&&p&&p[g]||(x=d=0)||h.pop())if((s?p.nodeName.toLowerCase()===v:1===p.nodeType)&&++x&&(m&&((c=(f=p[b]||(p[b]={}))[p.uniqueID]||(f[p.uniqueID]={}))[e]=[T,x]),p===t))break;return(x-=i)===r||x%r==0&&x/r>=0}}},PSEUDO:function(e,t){var n,i=r.pseudos[e]||r.setFilters[e.toLowerCase()]||oe.error("unsupported pseudo: "+e);return i[b]?i(t):i.length>1?(n=[e,e,"",t],r.setFilters.hasOwnProperty(e.toLowerCase())?se(function(e,n){var r,o=i(e,t),a=o.length;while(a--)e[r=O(e,o[a])]=!(n[r]=o[a])}):function(e){return i(e,0,n)}):i}},pseudos:{not:se(function(e){var t=[],n=[],r=s(e.replace(B,"$1"));return r[b]?se(function(e,t,n,i){var o,a=r(e,null,i,[]),s=e.length;while(s--)(o=a[s])&&(e[s]=!(t[s]=o))}):function(e,i,o){return t[0]=e,r(t,null,o,n),t[0]=null,!n.pop()}}),has:se(function(e){return function(t){return oe(e,t).length>0}}),contains:se(function(e){return e=e.replace(Z,ee),function(t){return(t.textContent||t.innerText||i(t)).indexOf(e)>-1}}),lang:se(function(e){return U.test(e||"")||oe.error("unsupported lang: "+e),e=e.replace(Z,ee).toLowerCase(),function(t){var n;do{if(n=g?t.lang:t.getAttribute("xml:lang")||t.getAttribute("lang"))return(n=n.toLowerCase())===e||0===n.indexOf(e+"-")}while((t=t.parentNode)&&1===t.nodeType);return!1}}),target:function(t){var n=e.location&&e.location.hash;return n&&n.slice(1)===t.id},root:function(e){return e===h},focus:function(e){return e===d.activeElement&&(!d.hasFocus||d.hasFocus())&&!!(e.type||e.href||~e.tabIndex)},enabled:de(!1),disabled:de(!0),checked:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&!!e.checked||"option"===t&&!!e.selected},selected:function(e){return e.parentNode&&e.parentNode.selectedIndex,!0===e.selected},empty:function(e){for(e=e.firstChild;e;e=e.nextSibling)if(e.nodeType<6)return!1;return!0},parent:function(e){return!r.pseudos.empty(e)},header:function(e){return Y.test(e.nodeName)},input:function(e){return G.test(e.nodeName)},button:function(e){var t=e.nodeName.toLowerCase();return"input"===t&&"button"===e.type||"button"===t},text:function(e){var t;return"input"===e.nodeName.toLowerCase()&&"text"===e.type&&(null==(t=e.getAttribute("type"))||"text"===t.toLowerCase())},first:he(function(){return[0]}),last:he(function(e,t){return[t-1]}),eq:he(function(e,t,n){return[n<0?n+t:n]}),even:he(function(e,t){for(var n=0;n=0;)e.push(r);return e}),gt:he(function(e,t,n){for(var r=n<0?n+t:n;++r1?function(t,n,r){var i=e.length;while(i--)if(!e[i](t,n,r))return!1;return!0}:e[0]}function be(e,t,n){for(var r=0,i=t.length;r-1&&(o[l]=!(a[l]=f))}}else v=we(v===a?v.splice(h,v.length):v),i?i(null,a,v,u):L.apply(a,v)})}function Ce(e){for(var t,n,i,o=e.length,a=r.relative[e[0].type],s=a||r.relative[" "],u=a?1:0,c=me(function(e){return e===t},s,!0),f=me(function(e){return O(t,e)>-1},s,!0),p=[function(e,n,r){var i=!a&&(r||n!==l)||((t=n).nodeType?c(e,n,r):f(e,n,r));return t=null,i}];u1&&xe(p),u>1&&ve(e.slice(0,u-1).concat({value:" "===e[u-2].type?"*":""})).replace(B,"$1"),n,u0,i=e.length>0,o=function(o,a,s,u,c){var f,h,y,v=0,m="0",x=o&&[],b=[],w=l,C=o||i&&r.find.TAG("*",c),E=T+=null==w?1:Math.random()||.1,k=C.length;for(c&&(l=a===d||a||c);m!==k&&null!=(f=C[m]);m++){if(i&&f){h=0,a||f.ownerDocument===d||(p(f),s=!g);while(y=e[h++])if(y(f,a||d,s)){u.push(f);break}c&&(T=E)}n&&((f=!y&&f)&&v--,o&&x.push(f))}if(v+=m,n&&m!==v){h=0;while(y=t[h++])y(x,b,a,s);if(o){if(v>0)while(m--)x[m]||b[m]||(b[m]=j.call(u));b=we(b)}L.apply(u,b),c&&!o&&b.length>0&&v+t.length>1&&oe.uniqueSort(u)}return c&&(T=E,l=w),x};return n?se(o):o}return s=oe.compile=function(e,t){var n,r=[],i=[],o=S[e+" "];if(!o){t||(t=a(e)),n=t.length;while(n--)(o=Ce(t[n]))[b]?r.push(o):i.push(o);(o=S(e,Ee(i,r))).selector=e}return o},u=oe.select=function(e,t,n,i){var o,u,l,c,f,p="function"==typeof e&&e,d=!i&&a(e=p.selector||e);if(n=n||[],1===d.length){if((u=d[0]=d[0].slice(0)).length>2&&"ID"===(l=u[0]).type&&9===t.nodeType&&g&&r.relative[u[1].type]){if(!(t=(r.find.ID(l.matches[0].replace(Z,ee),t)||[])[0]))return n;p&&(t=t.parentNode),e=e.slice(u.shift().value.length)}o=V.needsContext.test(e)?0:u.length;while(o--){if(l=u[o],r.relative[c=l.type])break;if((f=r.find[c])&&(i=f(l.matches[0].replace(Z,ee),K.test(u[0].type)&&ge(t.parentNode)||t))){if(u.splice(o,1),!(e=i.length&&ve(u)))return L.apply(n,i),n;break}}}return(p||s(e,d))(i,t,!g,n,!t||K.test(e)&&ge(t.parentNode)||t),n},n.sortStable=b.split("").sort(D).join("")===b,n.detectDuplicates=!!f,p(),n.sortDetached=ue(function(e){return 1&e.compareDocumentPosition(d.createElement("fieldset"))}),ue(function(e){return e.innerHTML="","#"===e.firstChild.getAttribute("href")})||le("type|href|height|width",function(e,t,n){if(!n)return e.getAttribute(t,"type"===t.toLowerCase()?1:2)}),n.attributes&&ue(function(e){return e.innerHTML="",e.firstChild.setAttribute("value",""),""===e.firstChild.getAttribute("value")})||le("value",function(e,t,n){if(!n&&"input"===e.nodeName.toLowerCase())return e.defaultValue}),ue(function(e){return null==e.getAttribute("disabled")})||le(P,function(e,t,n){var r;if(!n)return!0===e[t]?t.toLowerCase():(r=e.getAttributeNode(t))&&r.specified?r.value:null}),oe}(e);w.find=E,w.expr=E.selectors,w.expr[":"]=w.expr.pseudos,w.uniqueSort=w.unique=E.uniqueSort,w.text=E.getText,w.isXMLDoc=E.isXML,w.contains=E.contains,w.escapeSelector=E.escape;var k=function(e,t,n){var r=[],i=void 0!==n;while((e=e[t])&&9!==e.nodeType)if(1===e.nodeType){if(i&&w(e).is(n))break;r.push(e)}return r},S=function(e,t){for(var n=[];e;e=e.nextSibling)1===e.nodeType&&e!==t&&n.push(e);return n},D=w.expr.match.needsContext;function N(e,t){return e.nodeName&&e.nodeName.toLowerCase()===t.toLowerCase()}var A=/^<([a-z][^\/\0>:\x20\t\r\n\f]*)[\x20\t\r\n\f]*\/?>(?:<\/\1>|)$/i;function j(e,t,n){return g(t)?w.grep(e,function(e,r){return!!t.call(e,r,e)!==n}):t.nodeType?w.grep(e,function(e){return e===t!==n}):"string"!=typeof t?w.grep(e,function(e){return u.call(t,e)>-1!==n}):w.filter(t,e,n)}w.filter=function(e,t,n){var r=t[0];return n&&(e=":not("+e+")"),1===t.length&&1===r.nodeType?w.find.matchesSelector(r,e)?[r]:[]:w.find.matches(e,w.grep(t,function(e){return 1===e.nodeType}))},w.fn.extend({find:function(e){var t,n,r=this.length,i=this;if("string"!=typeof e)return this.pushStack(w(e).filter(function(){for(t=0;t1?w.uniqueSort(n):n},filter:function(e){return this.pushStack(j(this,e||[],!1))},not:function(e){return this.pushStack(j(this,e||[],!0))},is:function(e){return!!j(this,"string"==typeof e&&D.test(e)?w(e):e||[],!1).length}});var q,L=/^(?:\s*(<[\w\W]+>)[^>]*|#([\w-]+))$/;(w.fn.init=function(e,t,n){var i,o;if(!e)return this;if(n=n||q,"string"==typeof e){if(!(i="<"===e[0]&&">"===e[e.length-1]&&e.length>=3?[null,e,null]:L.exec(e))||!i[1]&&t)return!t||t.jquery?(t||n).find(e):this.constructor(t).find(e);if(i[1]){if(t=t instanceof w?t[0]:t,w.merge(this,w.parseHTML(i[1],t&&t.nodeType?t.ownerDocument||t:r,!0)),A.test(i[1])&&w.isPlainObject(t))for(i in t)g(this[i])?this[i](t[i]):this.attr(i,t[i]);return this}return(o=r.getElementById(i[2]))&&(this[0]=o,this.length=1),this}return e.nodeType?(this[0]=e,this.length=1,this):g(e)?void 0!==n.ready?n.ready(e):e(w):w.makeArray(e,this)}).prototype=w.fn,q=w(r);var H=/^(?:parents|prev(?:Until|All))/,O={children:!0,contents:!0,next:!0,prev:!0};w.fn.extend({has:function(e){var t=w(e,this),n=t.length;return this.filter(function(){for(var e=0;e-1:1===n.nodeType&&w.find.matchesSelector(n,e))){o.push(n);break}return this.pushStack(o.length>1?w.uniqueSort(o):o)},index:function(e){return e?"string"==typeof e?u.call(w(e),this[0]):u.call(this,e.jquery?e[0]:e):this[0]&&this[0].parentNode?this.first().prevAll().length:-1},add:function(e,t){return this.pushStack(w.uniqueSort(w.merge(this.get(),w(e,t))))},addBack:function(e){return this.add(null==e?this.prevObject:this.prevObject.filter(e))}});function P(e,t){while((e=e[t])&&1!==e.nodeType);return e}w.each({parent:function(e){var t=e.parentNode;return t&&11!==t.nodeType?t:null},parents:function(e){return k(e,"parentNode")},parentsUntil:function(e,t,n){return k(e,"parentNode",n)},next:function(e){return P(e,"nextSibling")},prev:function(e){return P(e,"previousSibling")},nextAll:function(e){return k(e,"nextSibling")},prevAll:function(e){return k(e,"previousSibling")},nextUntil:function(e,t,n){return k(e,"nextSibling",n)},prevUntil:function(e,t,n){return k(e,"previousSibling",n)},siblings:function(e){return S((e.parentNode||{}).firstChild,e)},children:function(e){return S(e.firstChild)},contents:function(e){return N(e,"iframe")?e.contentDocument:(N(e,"template")&&(e=e.content||e),w.merge([],e.childNodes))}},function(e,t){w.fn[e]=function(n,r){var i=w.map(this,t,n);return"Until"!==e.slice(-5)&&(r=n),r&&"string"==typeof r&&(i=w.filter(r,i)),this.length>1&&(O[e]||w.uniqueSort(i),H.test(e)&&i.reverse()),this.pushStack(i)}});var M=/[^\x20\t\r\n\f]+/g;function R(e){var t={};return w.each(e.match(M)||[],function(e,n){t[n]=!0}),t}w.Callbacks=function(e){e="string"==typeof e?R(e):w.extend({},e);var t,n,r,i,o=[],a=[],s=-1,u=function(){for(i=i||e.once,r=t=!0;a.length;s=-1){n=a.shift();while(++s-1)o.splice(n,1),n<=s&&s--}),this},has:function(e){return e?w.inArray(e,o)>-1:o.length>0},empty:function(){return o&&(o=[]),this},disable:function(){return i=a=[],o=n="",this},disabled:function(){return!o},lock:function(){return i=a=[],n||t||(o=n=""),this},locked:function(){return!!i},fireWith:function(e,n){return i||(n=[e,(n=n||[]).slice?n.slice():n],a.push(n),t||u()),this},fire:function(){return l.fireWith(this,arguments),this},fired:function(){return!!r}};return l};function I(e){return e}function W(e){throw e}function $(e,t,n,r){var i;try{e&&g(i=e.promise)?i.call(e).done(t).fail(n):e&&g(i=e.then)?i.call(e,t,n):t.apply(void 0,[e].slice(r))}catch(e){n.apply(void 0,[e])}}w.extend({Deferred:function(t){var n=[["notify","progress",w.Callbacks("memory"),w.Callbacks("memory"),2],["resolve","done",w.Callbacks("once memory"),w.Callbacks("once memory"),0,"resolved"],["reject","fail",w.Callbacks("once memory"),w.Callbacks("once memory"),1,"rejected"]],r="pending",i={state:function(){return r},always:function(){return o.done(arguments).fail(arguments),this},"catch":function(e){return i.then(null,e)},pipe:function(){var e=arguments;return w.Deferred(function(t){w.each(n,function(n,r){var i=g(e[r[4]])&&e[r[4]];o[r[1]](function(){var e=i&&i.apply(this,arguments);e&&g(e.promise)?e.promise().progress(t.notify).done(t.resolve).fail(t.reject):t[r[0]+"With"](this,i?[e]:arguments)})}),e=null}).promise()},then:function(t,r,i){var o=0;function a(t,n,r,i){return function(){var s=this,u=arguments,l=function(){var e,l;if(!(t=o&&(r!==W&&(s=void 0,u=[e]),n.rejectWith(s,u))}};t?c():(w.Deferred.getStackHook&&(c.stackTrace=w.Deferred.getStackHook()),e.setTimeout(c))}}return w.Deferred(function(e){n[0][3].add(a(0,e,g(i)?i:I,e.notifyWith)),n[1][3].add(a(0,e,g(t)?t:I)),n[2][3].add(a(0,e,g(r)?r:W))}).promise()},promise:function(e){return null!=e?w.extend(e,i):i}},o={};return w.each(n,function(e,t){var a=t[2],s=t[5];i[t[1]]=a.add,s&&a.add(function(){r=s},n[3-e][2].disable,n[3-e][3].disable,n[0][2].lock,n[0][3].lock),a.add(t[3].fire),o[t[0]]=function(){return o[t[0]+"With"](this===o?void 0:this,arguments),this},o[t[0]+"With"]=a.fireWith}),i.promise(o),t&&t.call(o,o),o},when:function(e){var t=arguments.length,n=t,r=Array(n),i=o.call(arguments),a=w.Deferred(),s=function(e){return function(n){r[e]=this,i[e]=arguments.length>1?o.call(arguments):n,--t||a.resolveWith(r,i)}};if(t<=1&&($(e,a.done(s(n)).resolve,a.reject,!t),"pending"===a.state()||g(i[n]&&i[n].then)))return a.then();while(n--)$(i[n],s(n),a.reject);return a.promise()}});var B=/^(Eval|Internal|Range|Reference|Syntax|Type|URI)Error$/;w.Deferred.exceptionHook=function(t,n){e.console&&e.console.warn&&t&&B.test(t.name)&&e.console.warn("jQuery.Deferred exception: "+t.message,t.stack,n)},w.readyException=function(t){e.setTimeout(function(){throw t})};var F=w.Deferred();w.fn.ready=function(e){return F.then(e)["catch"](function(e){w.readyException(e)}),this},w.extend({isReady:!1,readyWait:1,ready:function(e){(!0===e?--w.readyWait:w.isReady)||(w.isReady=!0,!0!==e&&--w.readyWait>0||F.resolveWith(r,[w]))}}),w.ready.then=F.then;function _(){r.removeEventListener("DOMContentLoaded",_),e.removeEventListener("load",_),w.ready()}"complete"===r.readyState||"loading"!==r.readyState&&!r.documentElement.doScroll?e.setTimeout(w.ready):(r.addEventListener("DOMContentLoaded",_),e.addEventListener("load",_));var z=function(e,t,n,r,i,o,a){var s=0,u=e.length,l=null==n;if("object"===x(n)){i=!0;for(s in n)z(e,t,s,n[s],!0,o,a)}else if(void 0!==r&&(i=!0,g(r)||(a=!0),l&&(a?(t.call(e,r),t=null):(l=t,t=function(e,t,n){return l.call(w(e),n)})),t))for(;s1,null,!0)},removeData:function(e){return this.each(function(){K.remove(this,e)})}}),w.extend({queue:function(e,t,n){var r;if(e)return t=(t||"fx")+"queue",r=J.get(e,t),n&&(!r||Array.isArray(n)?r=J.access(e,t,w.makeArray(n)):r.push(n)),r||[]},dequeue:function(e,t){t=t||"fx";var n=w.queue(e,t),r=n.length,i=n.shift(),o=w._queueHooks(e,t),a=function(){w.dequeue(e,t)};"inprogress"===i&&(i=n.shift(),r--),i&&("fx"===t&&n.unshift("inprogress"),delete o.stop,i.call(e,a,o)),!r&&o&&o.empty.fire()},_queueHooks:function(e,t){var n=t+"queueHooks";return J.get(e,n)||J.access(e,n,{empty:w.Callbacks("once memory").add(function(){J.remove(e,[t+"queue",n])})})}}),w.fn.extend({queue:function(e,t){var n=2;return"string"!=typeof e&&(t=e,e="fx",n--),arguments.length\x20\t\r\n\f]+)/i,he=/^$|^module$|\/(?:java|ecma)script/i,ge={option:[1,""],thead:[1,"","
"],col:[2,"","
"],tr:[2,"","
"],td:[3,"","
"],_default:[0,"",""]};ge.optgroup=ge.option,ge.tbody=ge.tfoot=ge.colgroup=ge.caption=ge.thead,ge.th=ge.td;function ye(e,t){var n;return n="undefined"!=typeof e.getElementsByTagName?e.getElementsByTagName(t||"*"):"undefined"!=typeof e.querySelectorAll?e.querySelectorAll(t||"*"):[],void 0===t||t&&N(e,t)?w.merge([e],n):n}function ve(e,t){for(var n=0,r=e.length;n-1)i&&i.push(o);else if(l=w.contains(o.ownerDocument,o),a=ye(f.appendChild(o),"script"),l&&ve(a),n){c=0;while(o=a[c++])he.test(o.type||"")&&n.push(o)}return f}!function(){var e=r.createDocumentFragment().appendChild(r.createElement("div")),t=r.createElement("input");t.setAttribute("type","radio"),t.setAttribute("checked","checked"),t.setAttribute("name","t"),e.appendChild(t),h.checkClone=e.cloneNode(!0).cloneNode(!0).lastChild.checked,e.innerHTML="",h.noCloneChecked=!!e.cloneNode(!0).lastChild.defaultValue}();var be=r.documentElement,we=/^key/,Te=/^(?:mouse|pointer|contextmenu|drag|drop)|click/,Ce=/^([^.]*)(?:\.(.+)|)/;function Ee(){return!0}function ke(){return!1}function Se(){try{return r.activeElement}catch(e){}}function De(e,t,n,r,i,o){var a,s;if("object"==typeof t){"string"!=typeof n&&(r=r||n,n=void 0);for(s in t)De(e,s,n,r,t[s],o);return e}if(null==r&&null==i?(i=n,r=n=void 0):null==i&&("string"==typeof n?(i=r,r=void 0):(i=r,r=n,n=void 0)),!1===i)i=ke;else if(!i)return e;return 1===o&&(a=i,(i=function(e){return w().off(e),a.apply(this,arguments)}).guid=a.guid||(a.guid=w.guid++)),e.each(function(){w.event.add(this,t,i,r,n)})}w.event={global:{},add:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.get(e);if(y){n.handler&&(n=(o=n).handler,i=o.selector),i&&w.find.matchesSelector(be,i),n.guid||(n.guid=w.guid++),(u=y.events)||(u=y.events={}),(a=y.handle)||(a=y.handle=function(t){return"undefined"!=typeof w&&w.event.triggered!==t.type?w.event.dispatch.apply(e,arguments):void 0}),l=(t=(t||"").match(M)||[""]).length;while(l--)d=g=(s=Ce.exec(t[l])||[])[1],h=(s[2]||"").split(".").sort(),d&&(f=w.event.special[d]||{},d=(i?f.delegateType:f.bindType)||d,f=w.event.special[d]||{},c=w.extend({type:d,origType:g,data:r,handler:n,guid:n.guid,selector:i,needsContext:i&&w.expr.match.needsContext.test(i),namespace:h.join(".")},o),(p=u[d])||((p=u[d]=[]).delegateCount=0,f.setup&&!1!==f.setup.call(e,r,h,a)||e.addEventListener&&e.addEventListener(d,a)),f.add&&(f.add.call(e,c),c.handler.guid||(c.handler.guid=n.guid)),i?p.splice(p.delegateCount++,0,c):p.push(c),w.event.global[d]=!0)}},remove:function(e,t,n,r,i){var o,a,s,u,l,c,f,p,d,h,g,y=J.hasData(e)&&J.get(e);if(y&&(u=y.events)){l=(t=(t||"").match(M)||[""]).length;while(l--)if(s=Ce.exec(t[l])||[],d=g=s[1],h=(s[2]||"").split(".").sort(),d){f=w.event.special[d]||{},p=u[d=(r?f.delegateType:f.bindType)||d]||[],s=s[2]&&new RegExp("(^|\\.)"+h.join("\\.(?:.*\\.|)")+"(\\.|$)"),a=o=p.length;while(o--)c=p[o],!i&&g!==c.origType||n&&n.guid!==c.guid||s&&!s.test(c.namespace)||r&&r!==c.selector&&("**"!==r||!c.selector)||(p.splice(o,1),c.selector&&p.delegateCount--,f.remove&&f.remove.call(e,c));a&&!p.length&&(f.teardown&&!1!==f.teardown.call(e,h,y.handle)||w.removeEvent(e,d,y.handle),delete u[d])}else for(d in u)w.event.remove(e,d+t[l],n,r,!0);w.isEmptyObject(u)&&J.remove(e,"handle events")}},dispatch:function(e){var t=w.event.fix(e),n,r,i,o,a,s,u=new Array(arguments.length),l=(J.get(this,"events")||{})[t.type]||[],c=w.event.special[t.type]||{};for(u[0]=t,n=1;n=1))for(;l!==this;l=l.parentNode||this)if(1===l.nodeType&&("click"!==e.type||!0!==l.disabled)){for(o=[],a={},n=0;n-1:w.find(i,this,null,[l]).length),a[i]&&o.push(r);o.length&&s.push({elem:l,handlers:o})}return l=this,u\x20\t\r\n\f]*)[^>]*)\/>/gi,Ae=/\s*$/g;function Le(e,t){return N(e,"table")&&N(11!==t.nodeType?t:t.firstChild,"tr")?w(e).children("tbody")[0]||e:e}function He(e){return e.type=(null!==e.getAttribute("type"))+"/"+e.type,e}function Oe(e){return"true/"===(e.type||"").slice(0,5)?e.type=e.type.slice(5):e.removeAttribute("type"),e}function Pe(e,t){var n,r,i,o,a,s,u,l;if(1===t.nodeType){if(J.hasData(e)&&(o=J.access(e),a=J.set(t,o),l=o.events)){delete a.handle,a.events={};for(i in l)for(n=0,r=l[i].length;n1&&"string"==typeof y&&!h.checkClone&&je.test(y))return e.each(function(i){var o=e.eq(i);v&&(t[0]=y.call(this,i,o.html())),Re(o,t,n,r)});if(p&&(i=xe(t,e[0].ownerDocument,!1,e,r),o=i.firstChild,1===i.childNodes.length&&(i=o),o||r)){for(u=(s=w.map(ye(i,"script"),He)).length;f")},clone:function(e,t,n){var r,i,o,a,s=e.cloneNode(!0),u=w.contains(e.ownerDocument,e);if(!(h.noCloneChecked||1!==e.nodeType&&11!==e.nodeType||w.isXMLDoc(e)))for(a=ye(s),r=0,i=(o=ye(e)).length;r0&&ve(a,!u&&ye(e,"script")),s},cleanData:function(e){for(var t,n,r,i=w.event.special,o=0;void 0!==(n=e[o]);o++)if(Y(n)){if(t=n[J.expando]){if(t.events)for(r in t.events)i[r]?w.event.remove(n,r):w.removeEvent(n,r,t.handle);n[J.expando]=void 0}n[K.expando]&&(n[K.expando]=void 0)}}}),w.fn.extend({detach:function(e){return Ie(this,e,!0)},remove:function(e){return Ie(this,e)},text:function(e){return z(this,function(e){return void 0===e?w.text(this):this.empty().each(function(){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||(this.textContent=e)})},null,e,arguments.length)},append:function(){return Re(this,arguments,function(e){1!==this.nodeType&&11!==this.nodeType&&9!==this.nodeType||Le(this,e).appendChild(e)})},prepend:function(){return Re(this,arguments,function(e){if(1===this.nodeType||11===this.nodeType||9===this.nodeType){var t=Le(this,e);t.insertBefore(e,t.firstChild)}})},before:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this)})},after:function(){return Re(this,arguments,function(e){this.parentNode&&this.parentNode.insertBefore(e,this.nextSibling)})},empty:function(){for(var e,t=0;null!=(e=this[t]);t++)1===e.nodeType&&(w.cleanData(ye(e,!1)),e.textContent="");return this},clone:function(e,t){return e=null!=e&&e,t=null==t?e:t,this.map(function(){return w.clone(this,e,t)})},html:function(e){return z(this,function(e){var t=this[0]||{},n=0,r=this.length;if(void 0===e&&1===t.nodeType)return t.innerHTML;if("string"==typeof e&&!Ae.test(e)&&!ge[(de.exec(e)||["",""])[1].toLowerCase()]){e=w.htmlPrefilter(e);try{for(;n=0&&(u+=Math.max(0,Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-o-u-s-.5))),u}function et(e,t,n){var r=$e(e),i=Fe(e,t,r),o="border-box"===w.css(e,"boxSizing",!1,r),a=o;if(We.test(i)){if(!n)return i;i="auto"}return a=a&&(h.boxSizingReliable()||i===e.style[t]),("auto"===i||!parseFloat(i)&&"inline"===w.css(e,"display",!1,r))&&(i=e["offset"+t[0].toUpperCase()+t.slice(1)],a=!0),(i=parseFloat(i)||0)+Ze(e,t,n||(o?"border":"content"),a,r,i)+"px"}w.extend({cssHooks:{opacity:{get:function(e,t){if(t){var n=Fe(e,"opacity");return""===n?"1":n}}}},cssNumber:{animationIterationCount:!0,columnCount:!0,fillOpacity:!0,flexGrow:!0,flexShrink:!0,fontWeight:!0,lineHeight:!0,opacity:!0,order:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{},style:function(e,t,n,r){if(e&&3!==e.nodeType&&8!==e.nodeType&&e.style){var i,o,a,s=G(t),u=Xe.test(t),l=e.style;if(u||(t=Je(s)),a=w.cssHooks[t]||w.cssHooks[s],void 0===n)return a&&"get"in a&&void 0!==(i=a.get(e,!1,r))?i:l[t];"string"==(o=typeof n)&&(i=ie.exec(n))&&i[1]&&(n=ue(e,t,i),o="number"),null!=n&&n===n&&("number"===o&&(n+=i&&i[3]||(w.cssNumber[s]?"":"px")),h.clearCloneStyle||""!==n||0!==t.indexOf("background")||(l[t]="inherit"),a&&"set"in a&&void 0===(n=a.set(e,n,r))||(u?l.setProperty(t,n):l[t]=n))}},css:function(e,t,n,r){var i,o,a,s=G(t);return Xe.test(t)||(t=Je(s)),(a=w.cssHooks[t]||w.cssHooks[s])&&"get"in a&&(i=a.get(e,!0,n)),void 0===i&&(i=Fe(e,t,r)),"normal"===i&&t in Ve&&(i=Ve[t]),""===n||n?(o=parseFloat(i),!0===n||isFinite(o)?o||0:i):i}}),w.each(["height","width"],function(e,t){w.cssHooks[t]={get:function(e,n,r){if(n)return!ze.test(w.css(e,"display"))||e.getClientRects().length&&e.getBoundingClientRect().width?et(e,t,r):se(e,Ue,function(){return et(e,t,r)})},set:function(e,n,r){var i,o=$e(e),a="border-box"===w.css(e,"boxSizing",!1,o),s=r&&Ze(e,t,r,a,o);return a&&h.scrollboxSize()===o.position&&(s-=Math.ceil(e["offset"+t[0].toUpperCase()+t.slice(1)]-parseFloat(o[t])-Ze(e,t,"border",!1,o)-.5)),s&&(i=ie.exec(n))&&"px"!==(i[3]||"px")&&(e.style[t]=n,n=w.css(e,t)),Ke(e,n,s)}}}),w.cssHooks.marginLeft=_e(h.reliableMarginLeft,function(e,t){if(t)return(parseFloat(Fe(e,"marginLeft"))||e.getBoundingClientRect().left-se(e,{marginLeft:0},function(){return e.getBoundingClientRect().left}))+"px"}),w.each({margin:"",padding:"",border:"Width"},function(e,t){w.cssHooks[e+t]={expand:function(n){for(var r=0,i={},o="string"==typeof n?n.split(" "):[n];r<4;r++)i[e+oe[r]+t]=o[r]||o[r-2]||o[0];return i}},"margin"!==e&&(w.cssHooks[e+t].set=Ke)}),w.fn.extend({css:function(e,t){return z(this,function(e,t,n){var r,i,o={},a=0;if(Array.isArray(t)){for(r=$e(e),i=t.length;a1)}});function tt(e,t,n,r,i){return new tt.prototype.init(e,t,n,r,i)}w.Tween=tt,tt.prototype={constructor:tt,init:function(e,t,n,r,i,o){this.elem=e,this.prop=n,this.easing=i||w.easing._default,this.options=t,this.start=this.now=this.cur(),this.end=r,this.unit=o||(w.cssNumber[n]?"":"px")},cur:function(){var e=tt.propHooks[this.prop];return e&&e.get?e.get(this):tt.propHooks._default.get(this)},run:function(e){var t,n=tt.propHooks[this.prop];return this.options.duration?this.pos=t=w.easing[this.easing](e,this.options.duration*e,0,1,this.options.duration):this.pos=t=e,this.now=(this.end-this.start)*t+this.start,this.options.step&&this.options.step.call(this.elem,this.now,this),n&&n.set?n.set(this):tt.propHooks._default.set(this),this}},tt.prototype.init.prototype=tt.prototype,tt.propHooks={_default:{get:function(e){var t;return 1!==e.elem.nodeType||null!=e.elem[e.prop]&&null==e.elem.style[e.prop]?e.elem[e.prop]:(t=w.css(e.elem,e.prop,""))&&"auto"!==t?t:0},set:function(e){w.fx.step[e.prop]?w.fx.step[e.prop](e):1!==e.elem.nodeType||null==e.elem.style[w.cssProps[e.prop]]&&!w.cssHooks[e.prop]?e.elem[e.prop]=e.now:w.style(e.elem,e.prop,e.now+e.unit)}}},tt.propHooks.scrollTop=tt.propHooks.scrollLeft={set:function(e){e.elem.nodeType&&e.elem.parentNode&&(e.elem[e.prop]=e.now)}},w.easing={linear:function(e){return e},swing:function(e){return.5-Math.cos(e*Math.PI)/2},_default:"swing"},w.fx=tt.prototype.init,w.fx.step={};var nt,rt,it=/^(?:toggle|show|hide)$/,ot=/queueHooks$/;function at(){rt&&(!1===r.hidden&&e.requestAnimationFrame?e.requestAnimationFrame(at):e.setTimeout(at,w.fx.interval),w.fx.tick())}function st(){return e.setTimeout(function(){nt=void 0}),nt=Date.now()}function ut(e,t){var n,r=0,i={height:e};for(t=t?1:0;r<4;r+=2-t)i["margin"+(n=oe[r])]=i["padding"+n]=e;return t&&(i.opacity=i.width=e),i}function lt(e,t,n){for(var r,i=(pt.tweeners[t]||[]).concat(pt.tweeners["*"]),o=0,a=i.length;o1)},removeAttr:function(e){return this.each(function(){w.removeAttr(this,e)})}}),w.extend({attr:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return"undefined"==typeof e.getAttribute?w.prop(e,t,n):(1===o&&w.isXMLDoc(e)||(i=w.attrHooks[t.toLowerCase()]||(w.expr.match.bool.test(t)?dt:void 0)),void 0!==n?null===n?void w.removeAttr(e,t):i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:(e.setAttribute(t,n+""),n):i&&"get"in i&&null!==(r=i.get(e,t))?r:null==(r=w.find.attr(e,t))?void 0:r)},attrHooks:{type:{set:function(e,t){if(!h.radioValue&&"radio"===t&&N(e,"input")){var n=e.value;return e.setAttribute("type",t),n&&(e.value=n),t}}}},removeAttr:function(e,t){var n,r=0,i=t&&t.match(M);if(i&&1===e.nodeType)while(n=i[r++])e.removeAttribute(n)}}),dt={set:function(e,t,n){return!1===t?w.removeAttr(e,n):e.setAttribute(n,n),n}},w.each(w.expr.match.bool.source.match(/\w+/g),function(e,t){var n=ht[t]||w.find.attr;ht[t]=function(e,t,r){var i,o,a=t.toLowerCase();return r||(o=ht[a],ht[a]=i,i=null!=n(e,t,r)?a:null,ht[a]=o),i}});var gt=/^(?:input|select|textarea|button)$/i,yt=/^(?:a|area)$/i;w.fn.extend({prop:function(e,t){return z(this,w.prop,e,t,arguments.length>1)},removeProp:function(e){return this.each(function(){delete this[w.propFix[e]||e]})}}),w.extend({prop:function(e,t,n){var r,i,o=e.nodeType;if(3!==o&&8!==o&&2!==o)return 1===o&&w.isXMLDoc(e)||(t=w.propFix[t]||t,i=w.propHooks[t]),void 0!==n?i&&"set"in i&&void 0!==(r=i.set(e,n,t))?r:e[t]=n:i&&"get"in i&&null!==(r=i.get(e,t))?r:e[t]},propHooks:{tabIndex:{get:function(e){var t=w.find.attr(e,"tabindex");return t?parseInt(t,10):gt.test(e.nodeName)||yt.test(e.nodeName)&&e.href?0:-1}}},propFix:{"for":"htmlFor","class":"className"}}),h.optSelected||(w.propHooks.selected={get:function(e){var t=e.parentNode;return t&&t.parentNode&&t.parentNode.selectedIndex,null},set:function(e){var t=e.parentNode;t&&(t.selectedIndex,t.parentNode&&t.parentNode.selectedIndex)}}),w.each(["tabIndex","readOnly","maxLength","cellSpacing","cellPadding","rowSpan","colSpan","useMap","frameBorder","contentEditable"],function(){w.propFix[this.toLowerCase()]=this});function vt(e){return(e.match(M)||[]).join(" ")}function mt(e){return e.getAttribute&&e.getAttribute("class")||""}function xt(e){return Array.isArray(e)?e:"string"==typeof e?e.match(M)||[]:[]}w.fn.extend({addClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).addClass(e.call(this,t,mt(this)))});if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])r.indexOf(" "+o+" ")<0&&(r+=o+" ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},removeClass:function(e){var t,n,r,i,o,a,s,u=0;if(g(e))return this.each(function(t){w(this).removeClass(e.call(this,t,mt(this)))});if(!arguments.length)return this.attr("class","");if((t=xt(e)).length)while(n=this[u++])if(i=mt(n),r=1===n.nodeType&&" "+vt(i)+" "){a=0;while(o=t[a++])while(r.indexOf(" "+o+" ")>-1)r=r.replace(" "+o+" "," ");i!==(s=vt(r))&&n.setAttribute("class",s)}return this},toggleClass:function(e,t){var n=typeof e,r="string"===n||Array.isArray(e);return"boolean"==typeof t&&r?t?this.addClass(e):this.removeClass(e):g(e)?this.each(function(n){w(this).toggleClass(e.call(this,n,mt(this),t),t)}):this.each(function(){var t,i,o,a;if(r){i=0,o=w(this),a=xt(e);while(t=a[i++])o.hasClass(t)?o.removeClass(t):o.addClass(t)}else void 0!==e&&"boolean"!==n||((t=mt(this))&&J.set(this,"__className__",t),this.setAttribute&&this.setAttribute("class",t||!1===e?"":J.get(this,"__className__")||""))})},hasClass:function(e){var t,n,r=0;t=" "+e+" ";while(n=this[r++])if(1===n.nodeType&&(" "+vt(mt(n))+" ").indexOf(t)>-1)return!0;return!1}});var bt=/\r/g;w.fn.extend({val:function(e){var t,n,r,i=this[0];{if(arguments.length)return r=g(e),this.each(function(n){var i;1===this.nodeType&&(null==(i=r?e.call(this,n,w(this).val()):e)?i="":"number"==typeof i?i+="":Array.isArray(i)&&(i=w.map(i,function(e){return null==e?"":e+""})),(t=w.valHooks[this.type]||w.valHooks[this.nodeName.toLowerCase()])&&"set"in t&&void 0!==t.set(this,i,"value")||(this.value=i))});if(i)return(t=w.valHooks[i.type]||w.valHooks[i.nodeName.toLowerCase()])&&"get"in t&&void 0!==(n=t.get(i,"value"))?n:"string"==typeof(n=i.value)?n.replace(bt,""):null==n?"":n}}}),w.extend({valHooks:{option:{get:function(e){var t=w.find.attr(e,"value");return null!=t?t:vt(w.text(e))}},select:{get:function(e){var t,n,r,i=e.options,o=e.selectedIndex,a="select-one"===e.type,s=a?null:[],u=a?o+1:i.length;for(r=o<0?u:a?o:0;r-1)&&(n=!0);return n||(e.selectedIndex=-1),o}}}}),w.each(["radio","checkbox"],function(){w.valHooks[this]={set:function(e,t){if(Array.isArray(t))return e.checked=w.inArray(w(e).val(),t)>-1}},h.checkOn||(w.valHooks[this].get=function(e){return null===e.getAttribute("value")?"on":e.value})}),h.focusin="onfocusin"in e;var wt=/^(?:focusinfocus|focusoutblur)$/,Tt=function(e){e.stopPropagation()};w.extend(w.event,{trigger:function(t,n,i,o){var a,s,u,l,c,p,d,h,v=[i||r],m=f.call(t,"type")?t.type:t,x=f.call(t,"namespace")?t.namespace.split("."):[];if(s=h=u=i=i||r,3!==i.nodeType&&8!==i.nodeType&&!wt.test(m+w.event.triggered)&&(m.indexOf(".")>-1&&(m=(x=m.split(".")).shift(),x.sort()),c=m.indexOf(":")<0&&"on"+m,t=t[w.expando]?t:new w.Event(m,"object"==typeof t&&t),t.isTrigger=o?2:3,t.namespace=x.join("."),t.rnamespace=t.namespace?new RegExp("(^|\\.)"+x.join("\\.(?:.*\\.|)")+"(\\.|$)"):null,t.result=void 0,t.target||(t.target=i),n=null==n?[t]:w.makeArray(n,[t]),d=w.event.special[m]||{},o||!d.trigger||!1!==d.trigger.apply(i,n))){if(!o&&!d.noBubble&&!y(i)){for(l=d.delegateType||m,wt.test(l+m)||(s=s.parentNode);s;s=s.parentNode)v.push(s),u=s;u===(i.ownerDocument||r)&&v.push(u.defaultView||u.parentWindow||e)}a=0;while((s=v[a++])&&!t.isPropagationStopped())h=s,t.type=a>1?l:d.bindType||m,(p=(J.get(s,"events")||{})[t.type]&&J.get(s,"handle"))&&p.apply(s,n),(p=c&&s[c])&&p.apply&&Y(s)&&(t.result=p.apply(s,n),!1===t.result&&t.preventDefault());return t.type=m,o||t.isDefaultPrevented()||d._default&&!1!==d._default.apply(v.pop(),n)||!Y(i)||c&&g(i[m])&&!y(i)&&((u=i[c])&&(i[c]=null),w.event.triggered=m,t.isPropagationStopped()&&h.addEventListener(m,Tt),i[m](),t.isPropagationStopped()&&h.removeEventListener(m,Tt),w.event.triggered=void 0,u&&(i[c]=u)),t.result}},simulate:function(e,t,n){var r=w.extend(new w.Event,n,{type:e,isSimulated:!0});w.event.trigger(r,null,t)}}),w.fn.extend({trigger:function(e,t){return this.each(function(){w.event.trigger(e,t,this)})},triggerHandler:function(e,t){var n=this[0];if(n)return w.event.trigger(e,t,n,!0)}}),h.focusin||w.each({focus:"focusin",blur:"focusout"},function(e,t){var n=function(e){w.event.simulate(t,e.target,w.event.fix(e))};w.event.special[t]={setup:function(){var r=this.ownerDocument||this,i=J.access(r,t);i||r.addEventListener(e,n,!0),J.access(r,t,(i||0)+1)},teardown:function(){var r=this.ownerDocument||this,i=J.access(r,t)-1;i?J.access(r,t,i):(r.removeEventListener(e,n,!0),J.remove(r,t))}}});var Ct=e.location,Et=Date.now(),kt=/\?/;w.parseXML=function(t){var n;if(!t||"string"!=typeof t)return null;try{n=(new e.DOMParser).parseFromString(t,"text/xml")}catch(e){n=void 0}return n&&!n.getElementsByTagName("parsererror").length||w.error("Invalid XML: "+t),n};var St=/\[\]$/,Dt=/\r?\n/g,Nt=/^(?:submit|button|image|reset|file)$/i,At=/^(?:input|select|textarea|keygen)/i;function jt(e,t,n,r){var i;if(Array.isArray(t))w.each(t,function(t,i){n||St.test(e)?r(e,i):jt(e+"["+("object"==typeof i&&null!=i?t:"")+"]",i,n,r)});else if(n||"object"!==x(t))r(e,t);else for(i in t)jt(e+"["+i+"]",t[i],n,r)}w.param=function(e,t){var n,r=[],i=function(e,t){var n=g(t)?t():t;r[r.length]=encodeURIComponent(e)+"="+encodeURIComponent(null==n?"":n)};if(Array.isArray(e)||e.jquery&&!w.isPlainObject(e))w.each(e,function(){i(this.name,this.value)});else for(n in e)jt(n,e[n],t,i);return r.join("&")},w.fn.extend({serialize:function(){return w.param(this.serializeArray())},serializeArray:function(){return this.map(function(){var e=w.prop(this,"elements");return e?w.makeArray(e):this}).filter(function(){var e=this.type;return this.name&&!w(this).is(":disabled")&&At.test(this.nodeName)&&!Nt.test(e)&&(this.checked||!pe.test(e))}).map(function(e,t){var n=w(this).val();return null==n?null:Array.isArray(n)?w.map(n,function(e){return{name:t.name,value:e.replace(Dt,"\r\n")}}):{name:t.name,value:n.replace(Dt,"\r\n")}}).get()}});var qt=/%20/g,Lt=/#.*$/,Ht=/([?&])_=[^&]*/,Ot=/^(.*?):[ \t]*([^\r\n]*)$/gm,Pt=/^(?:about|app|app-storage|.+-extension|file|res|widget):$/,Mt=/^(?:GET|HEAD)$/,Rt=/^\/\//,It={},Wt={},$t="*/".concat("*"),Bt=r.createElement("a");Bt.href=Ct.href;function Ft(e){return function(t,n){"string"!=typeof t&&(n=t,t="*");var r,i=0,o=t.toLowerCase().match(M)||[];if(g(n))while(r=o[i++])"+"===r[0]?(r=r.slice(1)||"*",(e[r]=e[r]||[]).unshift(n)):(e[r]=e[r]||[]).push(n)}}function _t(e,t,n,r){var i={},o=e===Wt;function a(s){var u;return i[s]=!0,w.each(e[s]||[],function(e,s){var l=s(t,n,r);return"string"!=typeof l||o||i[l]?o?!(u=l):void 0:(t.dataTypes.unshift(l),a(l),!1)}),u}return a(t.dataTypes[0])||!i["*"]&&a("*")}function zt(e,t){var n,r,i=w.ajaxSettings.flatOptions||{};for(n in t)void 0!==t[n]&&((i[n]?e:r||(r={}))[n]=t[n]);return r&&w.extend(!0,e,r),e}function Xt(e,t,n){var r,i,o,a,s=e.contents,u=e.dataTypes;while("*"===u[0])u.shift(),void 0===r&&(r=e.mimeType||t.getResponseHeader("Content-Type"));if(r)for(i in s)if(s[i]&&s[i].test(r)){u.unshift(i);break}if(u[0]in n)o=u[0];else{for(i in n){if(!u[0]||e.converters[i+" "+u[0]]){o=i;break}a||(a=i)}o=o||a}if(o)return o!==u[0]&&u.unshift(o),n[o]}function Ut(e,t,n,r){var i,o,a,s,u,l={},c=e.dataTypes.slice();if(c[1])for(a in e.converters)l[a.toLowerCase()]=e.converters[a];o=c.shift();while(o)if(e.responseFields[o]&&(n[e.responseFields[o]]=t),!u&&r&&e.dataFilter&&(t=e.dataFilter(t,e.dataType)),u=o,o=c.shift())if("*"===o)o=u;else if("*"!==u&&u!==o){if(!(a=l[u+" "+o]||l["* "+o]))for(i in l)if((s=i.split(" "))[1]===o&&(a=l[u+" "+s[0]]||l["* "+s[0]])){!0===a?a=l[i]:!0!==l[i]&&(o=s[0],c.unshift(s[1]));break}if(!0!==a)if(a&&e["throws"])t=a(t);else try{t=a(t)}catch(e){return{state:"parsererror",error:a?e:"No conversion from "+u+" to "+o}}}return{state:"success",data:t}}w.extend({active:0,lastModified:{},etag:{},ajaxSettings:{url:Ct.href,type:"GET",isLocal:Pt.test(Ct.protocol),global:!0,processData:!0,async:!0,contentType:"application/x-www-form-urlencoded; charset=UTF-8",accepts:{"*":$t,text:"text/plain",html:"text/html",xml:"application/xml, text/xml",json:"application/json, text/javascript"},contents:{xml:/\bxml\b/,html:/\bhtml/,json:/\bjson\b/},responseFields:{xml:"responseXML",text:"responseText",json:"responseJSON"},converters:{"* text":String,"text html":!0,"text json":JSON.parse,"text xml":w.parseXML},flatOptions:{url:!0,context:!0}},ajaxSetup:function(e,t){return t?zt(zt(e,w.ajaxSettings),t):zt(w.ajaxSettings,e)},ajaxPrefilter:Ft(It),ajaxTransport:Ft(Wt),ajax:function(t,n){"object"==typeof t&&(n=t,t=void 0),n=n||{};var i,o,a,s,u,l,c,f,p,d,h=w.ajaxSetup({},n),g=h.context||h,y=h.context&&(g.nodeType||g.jquery)?w(g):w.event,v=w.Deferred(),m=w.Callbacks("once memory"),x=h.statusCode||{},b={},T={},C="canceled",E={readyState:0,getResponseHeader:function(e){var t;if(c){if(!s){s={};while(t=Ot.exec(a))s[t[1].toLowerCase()]=t[2]}t=s[e.toLowerCase()]}return null==t?null:t},getAllResponseHeaders:function(){return c?a:null},setRequestHeader:function(e,t){return null==c&&(e=T[e.toLowerCase()]=T[e.toLowerCase()]||e,b[e]=t),this},overrideMimeType:function(e){return null==c&&(h.mimeType=e),this},statusCode:function(e){var t;if(e)if(c)E.always(e[E.status]);else for(t in e)x[t]=[x[t],e[t]];return this},abort:function(e){var t=e||C;return i&&i.abort(t),k(0,t),this}};if(v.promise(E),h.url=((t||h.url||Ct.href)+"").replace(Rt,Ct.protocol+"//"),h.type=n.method||n.type||h.method||h.type,h.dataTypes=(h.dataType||"*").toLowerCase().match(M)||[""],null==h.crossDomain){l=r.createElement("a");try{l.href=h.url,l.href=l.href,h.crossDomain=Bt.protocol+"//"+Bt.host!=l.protocol+"//"+l.host}catch(e){h.crossDomain=!0}}if(h.data&&h.processData&&"string"!=typeof h.data&&(h.data=w.param(h.data,h.traditional)),_t(It,h,n,E),c)return E;(f=w.event&&h.global)&&0==w.active++&&w.event.trigger("ajaxStart"),h.type=h.type.toUpperCase(),h.hasContent=!Mt.test(h.type),o=h.url.replace(Lt,""),h.hasContent?h.data&&h.processData&&0===(h.contentType||"").indexOf("application/x-www-form-urlencoded")&&(h.data=h.data.replace(qt,"+")):(d=h.url.slice(o.length),h.data&&(h.processData||"string"==typeof h.data)&&(o+=(kt.test(o)?"&":"?")+h.data,delete h.data),!1===h.cache&&(o=o.replace(Ht,"$1"),d=(kt.test(o)?"&":"?")+"_="+Et+++d),h.url=o+d),h.ifModified&&(w.lastModified[o]&&E.setRequestHeader("If-Modified-Since",w.lastModified[o]),w.etag[o]&&E.setRequestHeader("If-None-Match",w.etag[o])),(h.data&&h.hasContent&&!1!==h.contentType||n.contentType)&&E.setRequestHeader("Content-Type",h.contentType),E.setRequestHeader("Accept",h.dataTypes[0]&&h.accepts[h.dataTypes[0]]?h.accepts[h.dataTypes[0]]+("*"!==h.dataTypes[0]?", "+$t+"; q=0.01":""):h.accepts["*"]);for(p in h.headers)E.setRequestHeader(p,h.headers[p]);if(h.beforeSend&&(!1===h.beforeSend.call(g,E,h)||c))return E.abort();if(C="abort",m.add(h.complete),E.done(h.success),E.fail(h.error),i=_t(Wt,h,n,E)){if(E.readyState=1,f&&y.trigger("ajaxSend",[E,h]),c)return E;h.async&&h.timeout>0&&(u=e.setTimeout(function(){E.abort("timeout")},h.timeout));try{c=!1,i.send(b,k)}catch(e){if(c)throw e;k(-1,e)}}else k(-1,"No Transport");function k(t,n,r,s){var l,p,d,b,T,C=n;c||(c=!0,u&&e.clearTimeout(u),i=void 0,a=s||"",E.readyState=t>0?4:0,l=t>=200&&t<300||304===t,r&&(b=Xt(h,E,r)),b=Ut(h,b,E,l),l?(h.ifModified&&((T=E.getResponseHeader("Last-Modified"))&&(w.lastModified[o]=T),(T=E.getResponseHeader("etag"))&&(w.etag[o]=T)),204===t||"HEAD"===h.type?C="nocontent":304===t?C="notmodified":(C=b.state,p=b.data,l=!(d=b.error))):(d=C,!t&&C||(C="error",t<0&&(t=0))),E.status=t,E.statusText=(n||C)+"",l?v.resolveWith(g,[p,C,E]):v.rejectWith(g,[E,C,d]),E.statusCode(x),x=void 0,f&&y.trigger(l?"ajaxSuccess":"ajaxError",[E,h,l?p:d]),m.fireWith(g,[E,C]),f&&(y.trigger("ajaxComplete",[E,h]),--w.active||w.event.trigger("ajaxStop")))}return E},getJSON:function(e,t,n){return w.get(e,t,n,"json")},getScript:function(e,t){return w.get(e,void 0,t,"script")}}),w.each(["get","post"],function(e,t){w[t]=function(e,n,r,i){return g(n)&&(i=i||r,r=n,n=void 0),w.ajax(w.extend({url:e,type:t,dataType:i,data:n,success:r},w.isPlainObject(e)&&e))}}),w._evalUrl=function(e){return w.ajax({url:e,type:"GET",dataType:"script",cache:!0,async:!1,global:!1,"throws":!0})},w.fn.extend({wrapAll:function(e){var t;return this[0]&&(g(e)&&(e=e.call(this[0])),t=w(e,this[0].ownerDocument).eq(0).clone(!0),this[0].parentNode&&t.insertBefore(this[0]),t.map(function(){var e=this;while(e.firstElementChild)e=e.firstElementChild;return e}).append(this)),this},wrapInner:function(e){return g(e)?this.each(function(t){w(this).wrapInner(e.call(this,t))}):this.each(function(){var t=w(this),n=t.contents();n.length?n.wrapAll(e):t.append(e)})},wrap:function(e){var t=g(e);return this.each(function(n){w(this).wrapAll(t?e.call(this,n):e)})},unwrap:function(e){return this.parent(e).not("body").each(function(){w(this).replaceWith(this.childNodes)}),this}}),w.expr.pseudos.hidden=function(e){return!w.expr.pseudos.visible(e)},w.expr.pseudos.visible=function(e){return!!(e.offsetWidth||e.offsetHeight||e.getClientRects().length)},w.ajaxSettings.xhr=function(){try{return new e.XMLHttpRequest}catch(e){}};var Vt={0:200,1223:204},Gt=w.ajaxSettings.xhr();h.cors=!!Gt&&"withCredentials"in Gt,h.ajax=Gt=!!Gt,w.ajaxTransport(function(t){var n,r;if(h.cors||Gt&&!t.crossDomain)return{send:function(i,o){var a,s=t.xhr();if(s.open(t.type,t.url,t.async,t.username,t.password),t.xhrFields)for(a in t.xhrFields)s[a]=t.xhrFields[a];t.mimeType&&s.overrideMimeType&&s.overrideMimeType(t.mimeType),t.crossDomain||i["X-Requested-With"]||(i["X-Requested-With"]="XMLHttpRequest");for(a in i)s.setRequestHeader(a,i[a]);n=function(e){return function(){n&&(n=r=s.onload=s.onerror=s.onabort=s.ontimeout=s.onreadystatechange=null,"abort"===e?s.abort():"error"===e?"number"!=typeof s.status?o(0,"error"):o(s.status,s.statusText):o(Vt[s.status]||s.status,s.statusText,"text"!==(s.responseType||"text")||"string"!=typeof s.responseText?{binary:s.response}:{text:s.responseText},s.getAllResponseHeaders()))}},s.onload=n(),r=s.onerror=s.ontimeout=n("error"),void 0!==s.onabort?s.onabort=r:s.onreadystatechange=function(){4===s.readyState&&e.setTimeout(function(){n&&r()})},n=n("abort");try{s.send(t.hasContent&&t.data||null)}catch(e){if(n)throw e}},abort:function(){n&&n()}}}),w.ajaxPrefilter(function(e){e.crossDomain&&(e.contents.script=!1)}),w.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/\b(?:java|ecma)script\b/},converters:{"text script":function(e){return w.globalEval(e),e}}}),w.ajaxPrefilter("script",function(e){void 0===e.cache&&(e.cache=!1),e.crossDomain&&(e.type="GET")}),w.ajaxTransport("script",function(e){if(e.crossDomain){var t,n;return{send:function(i,o){t=w(" - - +
- "> + ">
<%+cbi/valuefooter%> @@ -199,8 +194,8 @@ var jq=$.noConflict(); <%+cbi/valueheader%>
- "> + ">
<%+cbi/valuefooter%> @@ -209,7 +204,7 @@ var jq=$.noConflict();
@@ -219,233 +214,171 @@ var jq=$.noConflict(); + \ No newline at end of file diff --git a/package/ctcgfw/luci-app-jd-dailybonus/root/lib/upgrade/keep.d/jd-dailybonus b/package/ctcgfw/luci-app-jd-dailybonus/root/lib/upgrade/keep.d/jd-dailybonus new file mode 100644 index 0000000000..ea3afe4c26 --- /dev/null +++ b/package/ctcgfw/luci-app-jd-dailybonus/root/lib/upgrade/keep.d/jd-dailybonus @@ -0,0 +1 @@ +/usr/share/jd-dailybonus/CookieSet.json \ No newline at end of file diff --git a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js index 467ff87d1b..fd9859fc68 100644 --- a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js +++ b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js @@ -2,7 +2,7 @@ 京东多合一签到脚本 -更新时间: 2021.01.07 17:00 v1.90 +更新时间: 2021.01.20 20:00 v1.91 有效接口: 40+ 脚本兼容: QuantumultX, Surge, Loon, JSBox, Node.js 电报频道: @NobyDa @@ -90,7 +90,7 @@ hostname = api.m.jd.com var LogDetails = false; //是否开启响应日志, true则开启 -var stop = 0; //自定义延迟签到,单位毫秒. 默认分批并发无延迟. 延迟作用于每个签到接口, 如填入延迟则切换顺序签到(耗时较长), VPN重启或越狱用户建议填写1, Surge用户请注意在SurgeUI界面调整脚本超时 +var stop = '0'; //自定义延迟签到, 单位毫秒. 默认分批并发无延迟; 该参数接受随机或指定延迟(例: '2000'则表示延迟2秒; '2000-5000'则表示延迟最小2秒,最大5秒内的随机延迟), 如填入延迟则切换顺序签到(耗时较长), Surge用户请注意在SurgeUI界面调整脚本超时; 注: 该参数Node.js或JSbox环境下已配置数据持久化, 留空(var stop = '')即可清除. var DeleteCookie = false; //是否清除Cookie, true则开启. @@ -121,7 +121,7 @@ async function all() { JingDongShake(stop), //京东摇一摇 JDSecKilling(stop), //京东秒杀 JRLuckyLottery(stop), //金融抽奖顶部签到 - JingDongBuyCar(stop, '5fc3c1f2e91f46f09ab2b722e10d92bf'), //京东汽车 + JingDongBuyCar(stop, '319fd268c5df469192d9420a2de4d8d2'), //京东汽车 JingRongDoll(stop, 'JRDoll', '京东金融-签壹', '4D25A6F482'), JingRongDoll(stop, 'JRTwoDoll', '京东金融-签贰', '3A3E839252'), JingRongDoll(stop, 'JRThreeDoll', '京东金融-签叁', '69F5EC743C'), @@ -135,7 +135,6 @@ async function all() { JDUserSignPre(stop, 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'), //京东母婴馆 JDUserSignPre(stop, 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'), //京东数码电器馆 // JDUserSignPre(stop, 'JDSubsidy', '京东晚市-补贴', 'xK148m4kWj5hBcTPuJUNNXH3AkJ'), //京东晚市补贴金 - // JDUserSignPre(stop, 'JDDrug', '京东商城-医药', '3tqTG5sF1xCUyC6vgEF5CLCxGn7w'), //京东医药馆 JDUserSignPre(stop, 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'), //京东女装馆 JDUserSignPre(stop, 'JDFineWine', '京东商城-酒饮', 'zGwAUzL3pVGjptBBGeYfpKjYdtX'), //京东酒饮馆 JDUserSignPre(stop, 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'), //京东图书 @@ -146,10 +145,10 @@ async function all() { JDUserSignPre(stop, 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'), //京东服饰 JDUserSignPre(stop, 'JDUnderwear', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'), //京东内衣馆 JDUserSignPre(stop, 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'), //京东箱包馆 - JDUserSignPre(stop, 'JDSchool', '京东商城-校园', '4812pn2PAcUyfNdWr7Cvpww5MCyW'), //京东校园 + JDUserSignPre(stop, 'JDSchool', '京东商城-校园', '2QUxWHx5BSCNtnBDjtt5gZTq7zdZ'), //京东校园 JDUserSignPre(stop, 'JDHealth', '京东商城-健康', 'w2oeK5yLdHqHvwef7SMMy4PL8LF'), //京东健康 // JDUserSignPre(stop, 'JDPet', '京东商城-宠物', '37ta5sh5ocrMZF3Fz5UMJbTsL42'), //京东宠物馆 - // JDUserSignPre(stop, 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'), //京东拍拍二手 + JDUserSignPre(stop, 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'), //京东拍拍二手 JDUserSignPre(stop, 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'), //京东清洁馆 JDUserSignPre(stop, 'JDCare', '京东商城-个护', 'NJ1kd1PJWhwvhtim73VPsD1HwY3'), //京东个人护理馆 JDUserSignPre(stop, 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'), //京东珠宝馆 @@ -161,53 +160,52 @@ async function all() { await JingRongDoll(stop, 'JDDouble', '金融京豆-双签', 'F68B2C3E71', '', '', '', 'jingdou'); //京东金融 京豆双签 break; default: - await JingDongBean(stop); //京东京豆 - await JingDongStore(stop); //京东超市 - await JingDongWebcasts(stop); //京东直播 - await JingRongBean(stop); //金融简单赚钱 - await JingRongSteel(stop); //金融钢镚 - await JingDongTurn(stop); //京东转盘 - await JDFlashSale(stop); //京东闪购 - await JingDongCash(stop); //京东现金红包 - await JDMagicCube(stop, 2); //京东小魔方 - await JingDongGetCash(stop); //京东领现金 - await JingDongSubsidy(stop); //京东金贴 - await JingDongShake(stop); //京东摇一摇 - await JDSecKilling(stop); //京东秒杀 - await JRLuckyLottery(stop); //金融抽奖顶部签到 - await JingDongBuyCar(stop, '5fc3c1f2e91f46f09ab2b722e10d92bf'); //京东汽车 - await JingRongDoll(stop, 'JRTwoDoll', '京东金融-签贰', '3A3E839252'); - await JingRongDoll(stop, 'JRThreeDoll', '京东金融-签叁', '69F5EC743C'); - await JingRongDoll(stop, 'JRFourDoll', '京东金融-签肆', '30C4F86264'); - await JingRongDoll(stop, 'JRFiveDoll', '京东金融-签伍', '1D06AA3B0F'); - await JingRongDoll(stop, 'JRDoll', '京东金融-签壹', '4D25A6F482'); - await JingRongDoll(stop, 'XJDouble', '金融现金-双签', 'F68B2C3E71', '', '', '', 'xianjin'); //京东金融 现金双签 - await JingRongDoll(stop, 'JTDouble', '京东金贴-双签', '1DF13833F7'); //京东金融 金贴双签 - await JDUserSignPre(stop, 'JDUnderwear', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'); //京东内衣馆 - await JDUserSignPre(stop, 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'); //京东箱包馆 - await JDUserSignPre(stop, 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'); //京东服饰 - await JDUserSignPre(stop, 'JDSchool', '京东商城-校园', '4812pn2PAcUyfNdWr7Cvpww5MCyW'); //京东校园 - await JDUserSignPre(stop, 'JDHealth', '京东商城-健康', 'w2oeK5yLdHqHvwef7SMMy4PL8LF'); //京东健康 - await JDUserSignPre(stop, 'JDShoes', '京东商城-鞋靴', '4RXyb1W4Y986LJW8ToqMK14BdTD'); //京东鞋靴 - await JDUserSignPre(stop, 'JDCalendar', '京东日历-翻牌', '36V2Qw59VPNsuLxY84vCFtxFzrFs'); //京东日历翻牌 - await JDUserSignPre(stop, 'JDChild', '京东商城-童装', '3Af6mZNcf5m795T8dtDVfDwWVNhJ'); //京东童装馆 - await JDUserSignPre(stop, 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'); //京东母婴馆 - await JDUserSignPre(stop, 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'); //京东数码电器馆 - // await JDUserSignPre(stop, 'JDSubsidy', '京东晚市-补贴', 'xK148m4kWj5hBcTPuJUNNXH3AkJ'); //京东晚市补贴金 - // await JDUserSignPre(stop, 'JDClocks', '京东商城-钟表', '2BcJPCVVzMEtMUynXkPscCSsx68W'); //京东钟表馆 - // await JDUserSignPre(stop, 'JDDrug', '京东商城-医药', '3tqTG5sF1xCUyC6vgEF5CLCxGn7w'); //京东医药馆 - await JDUserSignPre(stop, 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'); //京东女装馆 - // await JDUserSignPre(stop, 'JDPet', '京东商城-宠物', '37ta5sh5ocrMZF3Fz5UMJbTsL42'); //京东宠物馆 - await JDUserSignPre(stop, 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'); //京东图书 - // await JDUserSignPre(stop, 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'); //京东拍拍二手 - await JDUserSignPre(stop, 'JDMakeup', '京东商城-美妆', '2smCxzLNuam5L14zNJHYu43ovbAP'); //京东美妆馆 - await JDUserSignPre(stop, 'JDFineWine', '京东商城-酒饮', 'zGwAUzL3pVGjptBBGeYfpKjYdtX'); //京东酒饮馆 - await JDUserSignPre(stop, 'JDVege', '京东商城-菜场', 'Wcu2LVCFMkBP3HraRvb7pgSpt64'); //京东菜场 - await JDUserSignPre(stop, 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'); //京东清洁馆 - await JDUserSignPre(stop, 'JDCare', '京东商城-个护', 'NJ1kd1PJWhwvhtim73VPsD1HwY3'); //京东个人护理馆 - await JDUserSignPre(stop, 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'); //京东珠宝馆 - await JingRongDoll(stop, 'JDDouble', '金融京豆-双签', 'F68B2C3E71', '', '', '', 'jingdou'); //京东金融 京豆双签 - await JingDongSpeedUp(stop); //京东天天加速 + await JingDongBean(0); //京东京豆 + await JingDongStore(Wait(stop)); //京东超市 + await JingDongWebcasts(Wait(stop)); //京东直播 + await JingRongBean(Wait(stop)); //金融简单赚钱 + await JingRongSteel(Wait(stop)); //金融钢镚 + await JingDongTurn(Wait(stop)); //京东转盘 + await JDFlashSale(Wait(stop)); //京东闪购 + await JingDongCash(Wait(stop)); //京东现金红包 + await JDMagicCube(Wait(stop), 2); //京东小魔方 + await JingDongGetCash(Wait(stop)); //京东领现金 + await JingDongSubsidy(Wait(stop)); //京东金贴 + await JingDongShake(Wait(stop)); //京东摇一摇 + await JDSecKilling(Wait(stop)); //京东秒杀 + await JRLuckyLottery(Wait(stop)); //金融抽奖顶部签到 + await JingDongBuyCar(Wait(stop), '319fd268c5df469192d9420a2de4d8d2'); //京东汽车 + await JingRongDoll(Wait(stop), 'JRTwoDoll', '京东金融-签贰', '3A3E839252'); + await JingRongDoll(Wait(stop), 'JRThreeDoll', '京东金融-签叁', '69F5EC743C'); + await JingRongDoll(Wait(stop), 'JRFourDoll', '京东金融-签肆', '30C4F86264'); + await JingRongDoll(Wait(stop), 'JRFiveDoll', '京东金融-签伍', '1D06AA3B0F'); + await JingRongDoll(Wait(stop), 'JRDoll', '京东金融-签壹', '4D25A6F482'); + await JingRongDoll(Wait(stop), 'XJDouble', '金融现金-双签', 'F68B2C3E71', '', '', '', 'xianjin'); //京东金融 现金双签 + await JingRongDoll(Wait(stop), 'JTDouble', '京东金贴-双签', '1DF13833F7'); //京东金融 金贴双签 + await JDUserSignPre(Wait(stop), 'JDUnderwear', '京东商城-内衣', '4PgpL1xqPSW1sVXCJ3xopDbB1f69'); //京东内衣馆 + await JDUserSignPre(Wait(stop), 'JDSuitcase', '京东商城-箱包', 'ZrH7gGAcEkY2gH8wXqyAPoQgk6t'); //京东箱包馆 + await JDUserSignPre(Wait(stop), 'JDClothing', '京东商城-服饰', '4RBT3H9jmgYg1k2kBnHF8NAHm7m8'); //京东服饰 + await JDUserSignPre(Wait(stop), 'JDSchool', '京东商城-校园', '2QUxWHx5BSCNtnBDjtt5gZTq7zdZ'); //京东校园 + await JDUserSignPre(Wait(stop), 'JDHealth', '京东商城-健康', 'w2oeK5yLdHqHvwef7SMMy4PL8LF'); //京东健康 + await JDUserSignPre(Wait(stop), 'JDShoes', '京东商城-鞋靴', '4RXyb1W4Y986LJW8ToqMK14BdTD'); //京东鞋靴 + await JDUserSignPre(Wait(stop), 'JDCalendar', '京东日历-翻牌', '36V2Qw59VPNsuLxY84vCFtxFzrFs'); //京东日历翻牌 + await JDUserSignPre(Wait(stop), 'JDChild', '京东商城-童装', '3Af6mZNcf5m795T8dtDVfDwWVNhJ'); //京东童装馆 + await JDUserSignPre(Wait(stop), 'JDBaby', '京东商城-母婴', '3BbAVGQPDd6vTyHYjmAutXrKAos6'); //京东母婴馆 + await JDUserSignPre(Wait(stop), 'JD3C', '京东商城-数码', '4SWjnZSCTHPYjE5T7j35rxxuMTb6'); //京东数码电器馆 + // await JDUserSignPre(Wait(stop), 'JDSubsidy', '京东晚市-补贴', 'xK148m4kWj5hBcTPuJUNNXH3AkJ'); //京东晚市补贴金 + // await JDUserSignPre(Wait(stop), 'JDClocks', '京东商城-钟表', '2BcJPCVVzMEtMUynXkPscCSsx68W'); //京东钟表馆 + await JDUserSignPre(Wait(stop), 'JDWomen', '京东商城-女装', 'DpSh7ma8JV7QAxSE2gJNro8Q2h9'); //京东女装馆 + // await JDUserSignPre(Wait(stop), 'JDPet', '京东商城-宠物', '37ta5sh5ocrMZF3Fz5UMJbTsL42'); //京东宠物馆 + await JDUserSignPre(Wait(stop), 'JDBook', '京东商城-图书', '3SC6rw5iBg66qrXPGmZMqFDwcyXi'); //京东图书 + await JDUserSignPre(Wait(stop), 'JDShand', '京东拍拍-二手', '3S28janPLYmtFxypu37AYAGgivfp'); //京东拍拍二手 + await JDUserSignPre(Wait(stop), 'JDMakeup', '京东商城-美妆', '2smCxzLNuam5L14zNJHYu43ovbAP'); //京东美妆馆 + await JDUserSignPre(Wait(stop), 'JDFineWine', '京东商城-酒饮', 'zGwAUzL3pVGjptBBGeYfpKjYdtX'); //京东酒饮馆 + await JDUserSignPre(Wait(stop), 'JDVege', '京东商城-菜场', 'Wcu2LVCFMkBP3HraRvb7pgSpt64'); //京东菜场 + await JDUserSignPre(Wait(stop), 'JDClean', '京东商城-清洁', '2Tjm6ay1ZbZ3v7UbriTj6kHy9dn6'); //京东清洁馆 + await JDUserSignPre(Wait(stop), 'JDCare', '京东商城-个护', 'NJ1kd1PJWhwvhtim73VPsD1HwY3'); //京东个人护理馆 + await JDUserSignPre(Wait(stop), 'JDJewels', '京东商城-珠宝', 'zHUHpTHNTaztSRfNBFNVZscyFZU'); //京东珠宝馆 + await JingRongDoll(Wait(stop), 'JDDouble', '金融京豆-双签', 'F68B2C3E71', '', '', '', 'jingdou'); //京东金融 京豆双签 + await JingDongSpeedUp(Wait(stop)); //京东天天加速 break; } await Promise.all([ @@ -316,11 +314,12 @@ function ReadCookie() { if ($nobyda.isJSBox || $nobyda.isNode) { if (Key) $nobyda.write(Key, EnvInfo); if (DualKey) $nobyda.write(DualKey, EnvInfo2); + if (stop !== '0') $nobyda.write(stop, "JD_DailyBonusDelay"); } add = DualKey || $nobyda.read(EnvInfo2) ? true : false KEY = Key ? Key : $nobyda.read(EnvInfo) out = parseInt($nobyda.read("JD_DailyBonusTimeOut")) || out - stop = parseInt($nobyda.read("JD_DailyBonusDelay")) || stop + stop = Wait($nobyda.read("JD_DailyBonusDelay"), true) || Wait(stop, true) boxdis = $nobyda.read("JD_Crash_disable") === "false" || $nobyda.isNode || $nobyda.isJSBox ? false : boxdis LogDetails = $nobyda.read("JD_DailyBonusLog") === "true" || LogDetails ReDis = ReDis ? $nobyda.write("", "JD_DailyBonusDisables") : "" @@ -2189,6 +2188,21 @@ function disable(Val, name, way) { } } +function Wait(readDelay, ini) { + if (!readDelay || readDelay === '0') return 0 + if (typeof(readDelay) == 'string') { + var readDelay = readDelay.replace(/"|"|'|'/g, ''); //prevent novice + if (readDelay.indexOf('-') == -1) return parseInt(readDelay) || 0; + const raw = readDelay.split("-").map(Number); + const plan = parseInt(Math.random() * (raw[1] - raw[0] + 1) + raw[0], 10); + if (ini) console.log(`\n初始化随机延迟: 最小${raw[0]/1000}秒, 最大${raw[1]/1000}秒`); + // else console.log(`\n预计等待: ${(plan / 1000).toFixed(2)}秒`); + return ini ? readDelay : plan + } else if (typeof(readDelay) == 'number') { + return readDelay > 0 ? readDelay : 0 + } else return 0 +} + function GetCookie() { try { if ($request.headers && $request.url.match(/api\.m\.jd\.com.*=signBean/)) { diff --git a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/gen_cookieset.lua b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/gen_cookieset.lua new file mode 100644 index 0000000000..b988c6c787 --- /dev/null +++ b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/gen_cookieset.lua @@ -0,0 +1,19 @@ +#!/usr/bin/lua +local uci = require "luci.model.uci".cursor() +local json = require 'luci.jsonc' + +function write_json(file, content) + local json = require 'luci.jsonc' + local f = assert(io.open(file, 'w')) + f:write(json.stringify(content, 1)) + f:close() +end + +local data = { + CookieJD = uci:get('jd-dailybonus', '@global[0]', 'cookie'), + CookieJD2 = uci:get('jd-dailybonus', '@global[0]', 'cookie2'), + JD_DailyBonusDelay = uci:get('jd-dailybonus', '@global[0]', 'stop'), + JD_DailyBonusTimeOut = uci:get('jd-dailybonus', '@global[0]', 'out') +} + +write_json('/usr/share/jd-dailybonus/CookieSet.json', data) \ No newline at end of file diff --git a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/jd_cookie.lua b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/jd_cookie.lua deleted file mode 100644 index a1ddffac18..0000000000 --- a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/jd_cookie.lua +++ /dev/null @@ -1,168 +0,0 @@ --- Copyright (C) 2021 jerrykuku --- Licensed to the public under the GNU General Public License v3. - -local uci = require 'luci.model.uci'.cursor() -local config = 'jd-dailybonus' -package.path = package.path .. ';/usr/share/jd-dailybonus/?.lua' -local requests = require 'requests' -local socket = require 'socket' -local tinsert = table.insert -local ssub, slen, schar, sbyte, sformat, sgsub = string.sub, string.len, string.char, string.byte, string.format, string.gsub -local User_Agent = 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36' -local Host = 'plogin.m.jd.com' -local jd_cookie = {} - ---打印table -function print_r(t) - local print_r_cache = {} - local function sub_print_r(t, indent) - if (print_r_cache[tostring(t)]) then - print(indent .. '*' .. tostring(t)) - else - print_r_cache[tostring(t)] = true - if (type(t) == 'table') then - for pos, val in pairs(t) do - if (type(val) == 'table') then - print(indent .. '[' .. pos .. '] => ' .. tostring(t) .. ' {') - sub_print_r(val, indent .. string.rep(' ', string.len(pos) + 8)) - print(indent .. string.rep(' ', string.len(pos) + 6) .. '}') - elseif (type(val) == 'string') then - print(indent .. '[' .. pos .. '] => "' .. val .. '"') - else - print(indent .. '[' .. pos .. '] => ' .. tostring(val)) - end - end - else - print(indent .. tostring(t)) - end - end - end - if (type(t) == 'table') then - print(tostring(t) .. ' {') - sub_print_r(t, ' ') - print('}') - else - sub_print_r(t, ' ') - end - print() -end - --- 分割字符串 -local function split(full, sep) - full = full:gsub('%z', '') -- 这里不是很清楚 有时候结尾带个\0 - local off, result = 1, {} - while true do - local nStart, nEnd = full:find(sep, off) - if not nEnd then - local res = ssub(full, off, slen(full)) - if #res > 0 then -- 过滤掉 \0 - tinsert(result, res) - end - break - else - tinsert(result, ssub(full, off, nStart - 1)) - off = nEnd + 1 - end - end - return result -end - ---获取unix时间戳 -function jd_cookie.timestamp() - return math.floor(socket.gettime() * 1000) -end - ---延时函数 -function sleep(n) - os.execute('sleep ' .. n) -end - ---解析cookie -function praseSetCookies(rcookie) - local tbl = {} - for k, v in rcookie:gmatch('([^;%s]+)=([^;]+)') do - tbl[k] = v - end - return tbl -end - ---获取二维码链接和检测URL -function jd_cookie.get_qrcode() - local timeStamp = jd_cookie.timestamp() - local url = - 'https://plogin.m.jd.com/cgi-bin/mm/new_login_entrance?lang=chs&appid=300&returnurl=https://wq.jd.com/passport/LoginRedirect?state=' .. - timeStamp .. '&returnurl=https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport' - local xformHeaders = { - ['Content-Type'] = 'application/x-www-form-urlencoded', - ['Connection'] = 'Keep-Alive', - ['Accept'] = 'application/json, text/plain, */*', - ['Accept-Language'] = 'zh-cn', - ['Referer'] = 'https://plogin.m.jd.com/login/login?appid=300&returnurl=https://wq.jd.com/passport/LoginRedirect?state=' .. - timeStamp .. '&returnurl=https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport', - ['User-Agent'] = User_Agent, - ['Host'] = Host - } - local response = requests.get {url, headers = xformHeaders} - local s_token = response.json().s_token - local dat = split(string.gsub(response.headers['set-cookie'], ' DOMAIN=.plogin.m.jd.com', ''), ';') - local cookies = string.gsub(dat[1] .. dat[4] .. dat[6] .. dat[8], ',', ';') .. ';' - - local timeStamp = jd_cookie.timestamp() - local url = 'https://plogin.m.jd.com/cgi-bin/m/tmauthreflogurl?s_token=' .. s_token .. '&v=' .. timeStamp .. '&remember=true' - local xformHeaders = { - ['Content-Type'] = 'application/x-www-form-urlencoded', - ['Connection'] = 'Keep-Alive', - ['Accept'] = 'application/json, text/plain, */*', - ['Accept-Language'] = 'zh-cn', - ['Referer'] = 'https://plogin.m.jd.com/login/login?appid=300&returnurl=https://wq.jd.com/passport/LoginRedirect?state=' .. - timeStamp .. '&returnurl=https://home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action&source=wq_passport', - ['User-Agent'] = User_Agent, - ['Host'] = Host - } - local response = requests.post {url, cookies = cookies, headers = xformHeaders} - local json_body, error = response.json() - local token = json_body['token'] - local ou_state = json_body['ou_state'] - local okl_token = praseSetCookies(response.headers['set-cookie']).okl_token - local return_json = { - qrcode_url = 'https://plogin.m.jd.com/cgi-bin/m/tmauth?appid=300&client_type=m&token=' .. token, - check_url = 'https://plogin.m.jd.com/cgi-bin/m/tmauthchecktoken?&token=' .. token .. '&ou_state=' .. ou_state .. '&okl_token=' .. okl_token, - cookies = cookies - } - return return_json -end - ---检测扫码状态 并返回cookie -function jd_cookie.checkLogin(url, cookies) - local xformHeaders = { - ['Content-Type'] = 'application/x-www-form-urlencoded', - ['Connection'] = 'Keep-Alive', - ['Accept'] = 'application/json, text/plain, */*', - ['Accept-Language'] = 'zh-cn', - ['Referer'] = 'https://plogin.m.jd.com/login/login?appid=300&returnurl=https://wqlogin2.jd.com/passport/LoginRedirect?state=', - ['User-Agent'] = User_Agent, - ['Host'] = Host - } - local data = - 'lang=chs&appid=300&source=wq_passport&returnurl=https://wqlogin2.jd.com/passport/LoginRedirect?state=1100399130787&returnurl=//home.m.jd.com/myJd/newhome.action?sceneval=2&ufc=&/myJd/home.action' - local response = requests.post {url, data = data, cookies = cookies, headers = xformHeaders} - --local cookie = jd_cookie.praseSetCookies(response.headers['set-cookie']) - local json = response.json() - local return_json = {} - if json.errcode == 0 then - local ucookie = praseSetCookies(response.headers['set-cookie']) - return_json = { - error = 0, - cookie = ucookie - } - else - return_json = { - error = json.errcode, - msg = json.message - } - end - - return return_json -end - -return jd_cookie diff --git a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh index c91e838b4d..91a7f3fc7e 100755 --- a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh +++ b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh @@ -12,7 +12,7 @@ NAME=jd-dailybonus TEMP_SCRIPT=/tmp/JD_DailyBonus.js JD_SCRIPT=/usr/share/jd-dailybonus/JD_DailyBonus.js -LOG_HTM=/www/JD_DailyBonus.htm +LOG_FILE=/var/log/jd_dailybonus.log CRON_FILE=/etc/crontabs/root usage() { cat <<-EOF @@ -60,13 +60,13 @@ add_cron() { # Run Script notify() { - grep "Cookie失效" /www/JD_DailyBonus.htm >/dev/null + grep "Cookie失效" ${LOG_FILE} >/dev/null if [ $? -eq 0 ]; then title="$(date '+%Y年%m月%d日') 京东签到 Cookie 失效" else title="$(date '+%Y年%m月%d日') 京东签到" fi - desc=$(cat /www/JD_DailyBonus.htm | grep -E '签到号|签到概览|签到奖励|其他奖励|账号总计|其他总计' | sed 's/$/&\n/g') + desc=$(cat ${LOG_FILE} | grep -E '签到号|签到概览|签到奖励|其他奖励|账号总计|其他总计' | sed 's/$/&\n/g') #serverchan sckey=$(uci_get_by_type global serverchan) if [ ! -z $sckey ]; then @@ -95,12 +95,13 @@ notify() { } run() { - echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_HTM 2>/dev/null - [ ! -f "/usr/bin/node" ] && echo -e "未安装node.js,请安装后再试!\nNode.js is not installed, please try again after installation!" >>$LOG_HTM && exit 1 - node $JD_SCRIPT >>$LOG_HTM 2>/dev/null && notify & + echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_FILE 2>/dev/null + [ ! -f "/usr/bin/node" ] && echo -e "未安装node.js,请安装后再试!\nNode.js is not installed, please try again after installation!" >>$LOG_FILE && exit 1 + (cd /usr/share/jd-dailybonus/ && node $JD_SCRIPT >>$LOG_FILE 2>/dev/null && notify &) } save() { + lua /usr/share/jd-dailybonus/gen_cookieset.lua add_cron } diff --git a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/requests.lua b/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/requests.lua deleted file mode 100644 index c2fc4d702e..0000000000 --- a/package/ctcgfw/luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/requests.lua +++ /dev/null @@ -1,303 +0,0 @@ --- Lua Requests library for http ease - -local http_socket = require('socket.http') -local https_socket = require('ssl.https') -local url_parser = require('socket.url') -local ltn12 = require('ltn12') -local json = require('cjson.safe') -local md5sum = require('md5') -- TODO: Make modular? -local mime = require('mime') - -local requests = { - _DESCRIPTION = 'Http requests made simpler', - http_socket = http_socket, - https_socket = https_socket -} - -local _requests = {} - ---User facing function the make a request use Digest Authentication ---TODO: Determine what else should live in authentication -function requests.HTTPDigestAuth(user, password) - return { _type = 'digest', user = user, password = password} -end - ---User facing function the make a request use Basic Authentication ---TODO: Determine what else should live in authentication -function requests.HTTPBasicAuth(user, password) - return { _type = 'basic', user = user, password = password} -end - -function requests.post(url, args) - return requests.request("POST", url, args) -end - -function requests.get(url, args) - return requests.request("GET", url, args) -end - -function requests.delete(url, args) - return requests.request("DELETE", url, args) -end - -function requests.patch(url, args) - return requests.request("PATCH", url, args) -end - -function requests.put(url, args) - return requests.request("PUT", url, args) -end - -function requests.options(url, args) - return requests.request("OPTIONS", url, args) -end - -function requests.head(url, args) - return requests.request("HEAD", url, args) -end - -function requests.trace(url, args) - return requests.request("TRACE", url, args) -end - ---Sets up all the data for a request and makes the request -function requests.request(method, url, args) - local request - - if type(url) == "table" then - request = url - if not request.url and request[1] then - request.url = table.remove(request, 1) - end - else - request = args or {} - request.url = url - end - - request.method = method - _requests.parse_args(request) - - -- TODO: Find a better way to do this - if request.auth and request.auth._type == 'digest' then - local response = _requests.make_request(request) - return _requests.use_digest(response, request) - else - return _requests.make_request(request) - end -end - ---Makes a request -function _requests.make_request(request) - local response_body = {} - local full_request = { - method = request.method, - url = request.url, - headers = request.headers, - sink = ltn12.sink.table(response_body), - redirect = request.allow_redirects, - proxy = request.proxy - } - if request.data then - full_request.source = ltn12.source.string(request.data) - end - - local response = {} - local ok - local socket = string.find(full_request.url, '^https:') and not request.proxy and https_socket or http_socket - - ok, response.status_code, response.headers, response.status = socket.request(full_request) - - assert(ok, 'error in '..request.method..' request: '..response.status_code) - response.text = table.concat(response_body) - response.json = function () return json.decode(response.text) end - - return response -end - ---Parses through all the possible arguments for a request -function _requests.parse_args(request) - _requests.check_url(request) - _requests.check_data(request) - _requests.create_header(request) - _requests.check_timeout(request.timeout) - _requests.check_redirect(request.allow_redirects) -end - ---Format the the url based on the params argument -function _requests.format_params(url, params) -- TODO: Clean - if not params or next(params) == nil then return url end - - url = url..'?' - for key, value in pairs(params) do - if tostring(value) then - url = url..tostring(key)..'=' - - if type(value) == 'table' then - local val_string = '' - - for _, val in ipairs(value) do - val_string = val_string..tostring(val)..',' - end - - url = url..val_string:sub(0, -2) - else - url = url..tostring(value) - end - - url = url..'&' - end - end - - return url:sub(0, -2) -end - ---Check that there is a URL given and append to it if params are passed in. -function _requests.check_url(request) - assert(request.url, 'No url specified for request') - request.url = _requests.format_params(request.url, request.params) -end - --- Add to the HTTP header -function _requests.create_header(request) - request.headers = request.headers or {} - if request.data then - request.headers['Content-Length'] = request.data:len() - end - - if request.cookies then - if request.headers.cookie then - request.headers.cookie = request.headers.cookie..'; '..request.cookies - else - request.headers.cookie = request.cookies - end - end - - if request.auth then - _requests.add_auth_headers(request) - end -end - ---Makes sure that the data is in a format that can be sent -function _requests.check_data(request) - if type(request.data) == "table" then - request.data = json.encode(request.data) - elseif request.data then - request.data = tostring(request.data) - end -end - ---Set the timeout -function _requests.check_timeout(timeout) - http_socket.TIMEOUT = timeout or 5 - https_socket.TIMEOUT = timeout or 5 -end - ---Checks is allow_redirects parameter is set correctly -function _requests.check_redirect(allow_redirects) - if allow_redirects and type(allow_redirects) ~= "boolean" then - error("allow_redirects expects a boolean value. received type = "..type(allow_redirects)) - end -end - ---Create the Authorization header for Basic Auth -function _requests.basic_auth_header(request) - local encoded = mime.b64(request.auth.user..':'..request.auth.password) - request.headers.Authorization = 'Basic '..encoded -end - --- Create digest authorization string for request header TODO: Could be better, but it should work -function _requests.digest_create_header_string(auth) - local authorization = 'Digest username="'..auth.user..'", realm="'..auth.realm..'", nonce="'..auth.nonce - authorization = authorization..'", uri="'..auth.uri..'", qop='..auth.qop..', nc='..auth.nc - authorization = authorization..', cnonce="'..auth.cnonce..'", response="'..auth.response..'"' - - if auth.opaque then - authorization = authorization..', opaque="'..auth.opaque..'"' - end - - return authorization -end - ---MD5 hash all parameters -local function md5_hash(...) - return md5sum.sumhexa(table.concat({...}, ":")) -end - --- Creates response hash TODO: Add functionality -function _requests.digest_hash_response(auth_table) - return md5_hash( - md5_hash(auth_table.user, auth_table.realm, auth_table.password), - auth_table.nonce, - auth_table.nc, - auth_table.cnonce, - auth_table.qop, - md5_hash(auth_table.method, auth_table.uri) - ) -end - --- Add digest authentication to the request header -function _requests.digest_auth_header(request) - if not request.auth.nonce then return end - - request.auth.cnonce = request.auth.cnonce or string.format("%08x", os.time()) - - request.auth.nc_count = request.auth.nc_count or 0 - request.auth.nc_count = request.auth.nc_count + 1 - - request.auth.nc = string.format("%08x", request.auth.nc_count) - - local url = url_parser.parse(request.url) - request.auth.uri = url_parser.build{path = url.path, query = url.query} - request.auth.method = request.method - request.auth.qop = 'auth' - - request.auth.response = _requests.digest_hash_response(request.auth) - - request.headers.Authorization = _requests.digest_create_header_string(request.auth) -end - ---Checks the resonse code and adds additional headers for Digest Auth --- TODO: Rename this -function _requests.use_digest(response, request) - if response.status_code == 401 then - _requests.parse_digest_response_header(response,request) - _requests.create_header(request) - response = _requests.make_request(request) - response.auth = request.auth - response.cookies = request.headers.cookie - return response - else - response.auth = request.auth - response.cookies = request.headers.cookie - return response - end -end - ---Parse the first response from the host to make the Authorization header -function _requests.parse_digest_response_header(response, request) - for key, value in response.headers['www-authenticate']:gmatch('(%w+)="(%S+)"') do - request.auth[key] = value - end - - if request.headers.cookie then - request.headers.cookie = request.headers.cookie..'; '..response.headers['set-cookie'] - else - request.headers.cookie = response.headers['set-cookie'] - end - - request.auth.nc_count = 0 -end - --- Call the correct authentication header function -function _requests.add_auth_headers(request) - local auth_func = { - basic = _requests.basic_auth_header, - digest = _requests.digest_auth_header - } - - auth_func[request.auth._type](request) -end - ---Return public functions -requests._private = _requests -return requests From 2ebdd819366009a386b523491d8eb521a5ca7c15 Mon Sep 17 00:00:00 2001 From: xiaorouji <60100640+xiaorouji@users.noreply.github.com> Date: Sun, 24 Jan 2021 20:28:59 +0800 Subject: [PATCH 24/30] luci-app-passwall: bump to 4-12 Signed-off-by: CN_SZTL --- package/lienol/luci-app-passwall/Makefile | 6 +-- .../luasrc/controller/passwall.lua | 38 +++++++-------- .../luasrc/model/cbi/passwall/api/api.lua | 17 ++++++- .../model/cbi/passwall/client/app_update.lua | 1 - .../model/cbi/passwall/client/auto_switch.lua | 10 +--- .../model/cbi/passwall/client/global.lua | 17 ++++--- .../model/cbi/passwall/client/haproxy.lua | 2 +- .../luasrc/model/cbi/passwall/client/log.lua | 7 ++- .../model/cbi/passwall/client/node_config.lua | 5 +- .../model/cbi/passwall/client/node_list.lua | 11 ++--- .../cbi/passwall/client/node_subscribe.lua | 7 +-- .../model/cbi/passwall/client/other.lua | 4 +- .../luasrc/model/cbi/passwall/client/rule.lua | 6 +-- .../model/cbi/passwall/client/rule_list.lua | 3 +- .../model/cbi/passwall/client/shunt_rules.lua | 6 +-- .../model/cbi/passwall/server/api/app.lua | 8 ++-- .../model/cbi/passwall/server/index.lua | 11 ++--- .../luasrc/model/cbi/passwall/server/user.lua | 4 +- .../passwall/app_update/brook_version.htm | 7 +-- .../passwall/app_update/kcptun_version.htm | 7 +-- .../passwall/app_update/trojan_go_version.htm | 7 +-- .../view/passwall/app_update/xray_version.htm | 7 +-- .../luasrc/view/passwall/global/footer.htm | 8 ++-- .../luasrc/view/passwall/global/status.htm | 8 ++-- .../luasrc/view/passwall/global/status2.htm | 8 ++-- .../luasrc/view/passwall/global/tips.htm | 9 ++-- .../luasrc/view/passwall/haproxy/status.htm | 10 ++-- .../luasrc/view/passwall/log/log.htm | 7 ++- .../view/passwall/node_list/link_add_node.htm | 22 ++++----- .../passwall/node_list/link_share_man.htm | 4 +- .../view/passwall/node_list/node_list.htm | 22 ++++----- .../view/passwall/rule/rule_version.htm | 4 +- .../luasrc/view/passwall/server/log.htm | 7 ++- .../passwall/server/users_list_status.htm | 7 ++- .../luci-app-passwall/po/zh-cn/passwall.po | 4 +- .../root/etc/uci-defaults/luci-app-passwall | 2 - .../root/usr/share/passwall/app.sh | 46 ++++++++++--------- .../root/usr/share/passwall/iptables.sh | 23 +++++++--- .../root/usr/share/passwall/monitor.sh | 10 ++-- .../root/usr/share/passwall/subscribe.lua | 10 ---- .../root/usr/share/passwall/test.sh | 23 ++++++---- 41 files changed, 228 insertions(+), 197 deletions(-) diff --git a/package/lienol/luci-app-passwall/Makefile b/package/lienol/luci-app-passwall/Makefile index 8c22904f91..e5b806bf61 100644 --- a/package/lienol/luci-app-passwall/Makefile +++ b/package/lienol/luci-app-passwall/Makefile @@ -1,5 +1,5 @@ # Copyright (C) 2018-2020 L-WRT Team -# +# Copyright (C) 2021 xiaorouji # This is free software, licensed under the GNU General Public License v3. # @@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-passwall PKG_VERSION:=4 -PKG_RELEASE:=10 -PKG_DATE:=20210122 +PKG_RELEASE:=12 +PKG_DATE:=20210127 PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION) diff --git a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua index 8731d7d906..48bf69e309 100644 --- a/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua +++ b/package/lienol/luci-app-passwall/luasrc/controller/passwall.lua @@ -1,18 +1,20 @@ -- Copyright (C) 2018-2020 L-WRT Team +-- Copyright (C) 2021 xiaorouji + module("luci.controller.passwall", package.seeall) -local appname = "passwall" +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname local ucic = luci.model.uci.cursor() local http = require "luci.http" local util = require "luci.util" local i18n = require "luci.i18n" -local api = require "luci.model.cbi.passwall.api.api" -local kcptun = require "luci.model.cbi.passwall.api.kcptun" -local brook = require "luci.model.cbi.passwall.api.brook" -local xray = require "luci.model.cbi.passwall.api.xray" -local trojan_go = require "luci.model.cbi.passwall.api.trojan_go" +local kcptun = require("luci.model.cbi." .. appname ..".api.kcptun") +local brook = require("luci.model.cbi." .. appname ..".api.brook") +local xray = require("luci.model.cbi." .. appname ..".api.xray") +local trojan_go = require("luci.model.cbi." .. appname ..".api.trojan_go") function index() - appname = "passwall" + appname = require "luci.model.cbi.passwall.api.api".appname entry({"admin", "services", appname}).dependent = true entry({"admin", "services", appname, "reset_config"}, call("reset_config")).leaf = true entry({"admin", "services", appname, "show"}, call("show_menu")).leaf = true @@ -82,12 +84,12 @@ end function reset_config() luci.sys.call('[ -f "/usr/share/passwall/config.default" ] && cp -f /usr/share/passwall/config.default /etc/config/passwall && /etc/init.d/passwall reload') - luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname)) + luci.http.redirect(api.url()) end function show_menu() luci.sys.call("touch /etc/config/passwall_show") - luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname)) + luci.http.redirect(api.url()) end function hide_menu() @@ -170,14 +172,14 @@ function status() -- local dns_mode = ucic:get(appname, "@global[0]", "dns_mode") local e = {} e.dns_mode_status = luci.sys.call("netstat -apn | grep ':7913 ' >/dev/null") == 0 - e.haproxy_status = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 - e["kcptun_tcp_node_status"] = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/kcptun' | grep -i 'tcp' >/dev/null", appname)) == 0 - e["tcp_node_status"] = luci.sys.call(string.format("ps -w | grep -v -E 'grep|kcptun' | grep '%s/bin/' | grep -i 'TCP' >/dev/null", appname)) == 0 + e.haproxy_status = luci.sys.call(string.format("top -bn1 | grep -v grep | grep '%s/bin/' | grep haproxy >/dev/null", appname)) == 0 + e["kcptun_tcp_node_status"] = luci.sys.call(string.format("top -bn1 | grep -v grep | grep '%s/bin/kcptun' | grep -i 'tcp' >/dev/null", appname)) == 0 + e["tcp_node_status"] = luci.sys.call(string.format("top -bn1 | grep -v -E 'grep|kcptun' | grep '%s/bin/' | grep -i 'TCP' >/dev/null", appname)) == 0 if (ucic:get(appname, "@global[0]", "udp_node") or "nil") == "tcp" then e["udp_node_status"] = e["tcp_node_status"] else - e["udp_node_status"] = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep -i 'UDP' >/dev/null", appname)) == 0 + e["udp_node_status"] = luci.sys.call(string.format("top -bn1 | grep -v grep | grep '%s/bin/' | grep -i 'UDP' >/dev/null", appname)) == 0 end luci.http.prepare_content("application/json") luci.http.write_json(e) @@ -188,12 +190,12 @@ function socks_status() local index = luci.http.formvalue("index") local id = luci.http.formvalue("id") e.index = index - e.socks_status = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep '%s' | grep 'SOCKS_' > /dev/null", appname, id)) == 0 + e.socks_status = luci.sys.call(string.format("top -bn1 | grep -v grep | grep '%s/bin/' | grep '%s' | grep 'SOCKS_' > /dev/null", appname, id)) == 0 local use_http = ucic:get(appname, id, "http_port") or 0 e.use_http = 0 if tonumber(use_http) > 0 then e.use_http = 1 - e.http_status = luci.sys.call(string.format("ps -w | grep -v grep | grep '%s/bin/' | grep '%s' | grep -E 'HTTP_|HTTP2SOCKS' > /dev/null", appname, id)) == 0 + e.http_status = luci.sys.call(string.format("top -bn1 | grep -v grep | grep '%s/bin/' | grep '%s' | grep -E 'HTTP_|HTTP2SOCKS' > /dev/null", appname, id)) == 0 end luci.http.prepare_content("application/json") luci.http.write_json(e) @@ -241,7 +243,7 @@ function set_node() ucic:set(appname, "@global[0]", protocol .. "_node", section) ucic:commit(appname) luci.sys.call("/etc/init.d/passwall restart > /dev/null 2>&1 &") - luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname, "log")) + luci.http.redirect(api.url("log")) end function copy_node() @@ -260,7 +262,7 @@ function copy_node() end end ucic:commit(appname) - luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname, "node_config", uuid)) + luci.http.redirect(api.url("node_config", uuid)) end function clear_all_nodes() @@ -332,7 +334,7 @@ end function server_user_status() local e = {} e.index = luci.http.formvalue("index") - e.status = luci.sys.call(string.format("ps -w | grep -v 'grep' | grep '%s/bin/' | grep -i '%s' >/dev/null", appname .. "_server", luci.http.formvalue("id"))) == 0 + e.status = luci.sys.call(string.format("top -bn1 | grep -v 'grep' | grep '%s/bin/' | grep -i '%s' >/dev/null", appname .. "_server", luci.http.formvalue("id"))) == 0 http_write_json(e) end diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/api.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/api.lua index 7df868e616..3c04024cbd 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/api.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/api/api.lua @@ -9,12 +9,25 @@ local i18n = require "luci.i18n" appname = "passwall" curl = "/usr/bin/curl" curl_args = {"-skL", "--connect-timeout 3", "--retry 3", "-m 60"} -wget = "/usr/bin/wget" -wget_args = {"--no-check-certificate", "--quiet", "--timeout=100", "--tries=3"} command_timeout = 300 LEDE_BOARD = nil DISTRIB_TARGET = nil +function url(...) + local url = string.format("admin/services/%s", appname) + local args = { ... } + for i, v in pairs(args) do + if v ~= "" then + url = url .. "/" .. v + end + end + return require "luci.dispatcher".build_url(url) +end + +function trim(s) + return (s:gsub("^%s*(.-)%s*$", "%1")) +end + function is_exist(table, value) for index, k in ipairs(table) do if k == value then diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/app_update.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/app_update.lua index d7f7e7e2db..ca697b3cf8 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/app_update.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/app_update.lua @@ -1,4 +1,3 @@ -local d = require "luci.dispatcher" local appname = "passwall" m = Map(appname) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/auto_switch.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/auto_switch.lua index e17aa025d8..ab048d5eeb 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/auto_switch.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/auto_switch.lua @@ -1,6 +1,5 @@ -local uci = require"luci.model.uci".cursor() local api = require "luci.model.cbi.passwall.api.api" -local appname = "passwall" +local appname = api.appname local nodes_table = {} for k, e in ipairs(api.get_valid_nodes()) do @@ -23,12 +22,7 @@ o.rmempty = false ---- Testing Time o = s:option(Value, "testing_time", translate("How often is a diagnosis made"), translate("Units:minutes")) -o.default = "3" - -o = s:option(ListValue, "tcp_main", "TCP " .. translate("Main node")) -for k, v in pairs(nodes_table) do - o:value(v.id, v.remarks) -end +o.default = "1" o = s:option(DynamicList, "tcp_node", "TCP " .. translate("List of backup nodes")) for k, v in pairs(nodes_table) do diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua index 19e65ce419..f0dda34455 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/global.lua @@ -1,7 +1,6 @@ -local d = require "luci.dispatcher" local uci = require"luci.model.uci".cursor() local api = require "luci.model.cbi.passwall.api.api" -local appname = "passwall" +local appname = api.appname local has_xray = api.is_finded("xray") m = Map(appname) @@ -95,7 +94,7 @@ if current_node and current_node ~= "" and current_node ~= "nil" then if n then if tonumber(m:get("@auto_switch[0]", "enable") or 0) == 1 then local remarks = api.get_full_node_remarks(n) - local url = d.build_url("admin", "services", appname, "node_config", current_node) + local url = api.url("node_config", current_node) tcp_node.description = tcp_node.description .. translatef("Current node: %s", string.format('%s', url, remarks)) .. "
" end if n.protocol and n.protocol == "_shunt" then @@ -103,7 +102,7 @@ if current_node and current_node ~= "" and current_node ~= "nil" then local id = e[".name"] local remarks = translate(e.remarks) if n[id] and n[id] ~= "nil" then - local url = d.build_url("admin", "services", appname, "node_config", n[id]) + local url = api.url("node_config", n[id]) local r = api.get_full_node_remarks(uci:get_all(appname, n[id])) tcp_node.description = tcp_node.description .. remarks .. ":" .. string.format('%s', url, r) .. "
" end @@ -111,7 +110,7 @@ if current_node and current_node ~= "" and current_node ~= "nil" then local id = "default_node" local remarks = translate("Default") if n[id] and n[id] ~= "nil" then - local url = d.build_url("admin", "services", appname, "node_config", n[id]) + local url = api.url("node_config", n[id]) local r = api.get_full_node_remarks(uci:get_all(appname, n[id])) tcp_node.description = tcp_node.description .. remarks .. ":" .. string.format('%s', url, r) .. "
" end @@ -371,8 +370,12 @@ end for k, v in pairs(nodes_table) do tcp_node:value(v.id, v.remarks) tcp_node_socks:depends("tcp_node", v.id) - if has_xray then - tcp_node_http:depends("tcp_node", v.id) + if v.type == "Xray" then + if has_xray then + tcp_node_http:depends("tcp_node", v.id) + end + else + tcp_node_http:depends("tcp_node_socks", true) end udp_node:value(v.id, v.remarks) if v.type == "Socks" then diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/haproxy.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/haproxy.lua index fc4c4ae011..0d4a61beb9 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/haproxy.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/haproxy.lua @@ -1,7 +1,7 @@ local e = require "luci.sys" local net = require "luci.model.network".init() local api = require "luci.model.cbi.passwall.api.api" -local appname = "passwall" +local appname = api.appname local nodes_table = {} for k, e in ipairs(api.get_valid_nodes()) do diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/log.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/log.lua index 859079e9a1..5580e17aab 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/log.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/log.lua @@ -1,5 +1,8 @@ -f = SimpleForm("passwall") +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname + +f = SimpleForm(appname) f.reset = false f.submit = false -f:append(Template("passwall/log/log")) +f:append(Template(appname .. "/log/log")) return f diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua index 61186e3ce3..3f5be4a493 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_config.lua @@ -1,7 +1,6 @@ -local d = require "luci.dispatcher" local uci = require"luci.model.uci".cursor() local api = require "luci.model.cbi.passwall.api.api" -local appname = "passwall" +local appname = api.appname local ss_encrypt_method_list = { "rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr", @@ -54,7 +53,7 @@ local encrypt_methods_ss_aead = { } m = Map(appname, translate("Node Config")) -m.redirect = d.build_url("admin", "services", appname) +m.redirect = api.url() s = m:section(NamedSection, arg[1], "nodes", "") s.addremove = false diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua index f34553fac4..66d700880b 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_list.lua @@ -1,6 +1,5 @@ -local d = require "luci.dispatcher" -local _api = require "luci.model.cbi.passwall.api.api" -local appname = "passwall" +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname m = Map(appname) @@ -28,9 +27,9 @@ s = m:section(TypedSection, "nodes") s.anonymous = true s.addremove = true s.template = "cbi/tblsection" -s.extedit = d.build_url("admin", "services", appname, "node_config", "%s") +s.extedit = api.url("node_config", "%s") function s.create(e, t) - local uuid = _api.gen_uuid() + local uuid = api.gen_uuid() t = uuid TypedSection.create(e, t) luci.http.redirect(e.extedit:format(t)) @@ -39,7 +38,7 @@ end function s.remove(e, t) s.map.proceed = true s.map:del(t) - luci.http.redirect(d.build_url("admin", "services", appname, "node_list")) + luci.http.redirect(api.url("node_list")) end if nodes_display:find("show_group") then diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua index 3cd6757bf9..897490ee5e 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/node_subscribe.lua @@ -1,4 +1,5 @@ -local appname = "passwall" +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname m = Map(appname) @@ -36,7 +37,7 @@ o = s:option(Button, "_update", translate("Manual subscription")) o.inputstyle = "apply" function o.write(e, e) luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua start log > /dev/null 2>&1 &") - luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname, "log")) + luci.http.redirect(api.url("log")) end ---- Subscribe Delete All @@ -44,7 +45,7 @@ o = s:option(Button, "_stop", translate("Delete All Subscribe Node")) o.inputstyle = "remove" function o.write(e, e) luci.sys.call("lua /usr/share/" .. appname .. "/subscribe.lua truncate log > /dev/null 2>&1 &") - luci.http.redirect(luci.dispatcher.build_url("admin", "services", appname, "log")) + luci.http.redirect(api.url("log")) end filter_enabled = s:option(Flag, "filter_enabled", translate("Filter keyword switch"), translate("When checked, below options can only be take effect.")) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua index d7efef2c21..715f458c1d 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/other.lua @@ -1,5 +1,5 @@ -local uci = require"luci.model.uci".cursor() -local appname = "passwall" +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname m = Map(appname) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua index 7ae5807c99..bebcfb7ea0 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule.lua @@ -1,5 +1,5 @@ -local d = require "luci.dispatcher" -local appname = "passwall" +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname m = Map(appname) -- [[ Rule Settings ]]-- @@ -53,7 +53,7 @@ s = m:section(TypedSection, "shunt_rules", "Xray" .. translate("Shunt") .. trans s.template = "cbi/tblsection" s.anonymous = false s.addremove = true -s.extedit = d.build_url("admin", "services", appname, "shunt_rules", "%s") +s.extedit = api.url("shunt_rules", "%s") function s.create(e, t) TypedSection.create(e, t) luci.http.redirect(e.extedit:format(t)) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua index 20740f458a..db9e5a1772 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/rule_list.lua @@ -1,5 +1,6 @@ local fs = require "nixio.fs" -local appname = "passwall" +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname m = Map(appname) m.apply_on_parse=true diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua index 94af7757c6..4ddc363eda 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/client/shunt_rules.lua @@ -1,8 +1,8 @@ -local d = require "luci.dispatcher" -local appname = "passwall" +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname m = Map(appname, "Xray" .. translate("Shunt") .. translate("Rule")) -m.redirect = d.build_url("admin", "services", appname) +m.redirect = api.url() s = m:section(NamedSection, arg[1], "shunt_rules", "") s.addremove = false diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/api/app.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/api/app.lua index e7372f7e26..62200646c5 100755 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/api/app.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/api/app.lua @@ -4,7 +4,7 @@ local action = arg[1] local sys = require 'luci.sys' local jsonc = require "luci.jsonc" local ucic = require"luci.model.uci".cursor() -local _api = require "luci.model.cbi.passwall.api.api" +local api = require "luci.model.cbi.passwall.api.api" local CONFIG = "passwall_server" local CONFIG_PATH = "/var/etc/" .. CONFIG @@ -111,7 +111,7 @@ local function start() bin = ln_start("/usr/bin/" .. type .. "-server", type .. "-server", "-c " .. config_file .. " " .. udp_param, log_path) elseif type == "Xray" then config = require("luci.model.cbi.passwall.server.api.xray").gen_config(user) - bin = ln_start(_api.get_xray_path(), "xray", "-config=" .. config_file, log_path) + bin = ln_start(api.get_xray_path(), "xray", "-config=" .. config_file, log_path) elseif type == "Trojan" then config = require("luci.model.cbi.passwall.server.api.trojan").gen_config(user) bin = ln_start("/usr/sbin/trojan", "trojan", "-c " .. config_file, log_path) @@ -120,11 +120,11 @@ local function start() bin = ln_start("/usr/sbin/trojan-plus", "trojan-plus", "-c " .. config_file, log_path) elseif type == "Trojan-Go" then config = require("luci.model.cbi.passwall.server.api.trojan").gen_config(user) - bin = ln_start(_api.get_trojan_go_path(), "trojan-go", "-config " .. config_file, log_path) + bin = ln_start(api.get_trojan_go_path(), "trojan-go", "-config " .. config_file, log_path) elseif type == "Brook" then local brook_protocol = user.protocol local brook_password = user.password - bin = ln_start(_api.get_brook_path(), "brook_" .. id, string.format("%s -l :%s -p %s", brook_protocol, port, brook_password), log_path) + bin = ln_start(api.get_brook_path(), "brook_" .. id, string.format("%s -l :%s -p %s", brook_protocol, port, brook_password), log_path) end if next(config) then diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/index.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/index.lua index b452a89512..6d901135d4 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/index.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/index.lua @@ -1,6 +1,5 @@ -local d = require "luci.dispatcher" -local _api = require "luci.model.cbi.passwall.api.api" -local e = luci.model.uci.cursor() +local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname m = Map("passwall_server", translate("Server-Side")) @@ -16,9 +15,9 @@ t.anonymous = true t.addremove = true t.sortable = true t.template = "cbi/tblsection" -t.extedit = d.build_url("admin", "services", "passwall", "server_user", "%s") +t.extedit = api.url("server_user", "%s") function t.create(e, t) - local uuid = _api.gen_uuid() + local uuid = api.gen_uuid() t = uuid TypedSection.create(e, t) luci.http.redirect(e.extedit:format(t)) @@ -26,7 +25,7 @@ end function t.remove(e, t) e.map.proceed = true e.map:del(t) - luci.http.redirect(d.build_url("admin", "services", "passwall", "server")) + luci.http.redirect(api.url("server")) end e = t:option(Flag, "enable", translate("Enable")) diff --git a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua index bd2df888d8..14fda9b01a 100644 --- a/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua +++ b/package/lienol/luci-app-passwall/luasrc/model/cbi/passwall/server/user.lua @@ -1,5 +1,5 @@ -local d = require "luci.dispatcher" local api = require "luci.model.cbi.passwall.api.api" +local appname = api.appname local ss_encrypt_method_list = { "rc4-md5", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-ctr", @@ -48,7 +48,7 @@ local encrypt_methods_ss_aead = { } m = Map("passwall_server", translate("Server Config")) -m.redirect = d.build_url("admin", "services", "passwall", "server") +m.redirect = api.url("server") s = m:section(NamedSection, arg[1], "user", "") s.addremove = false diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/app_update/brook_version.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/app_update/brook_version.htm index 4fb2cfb9b4..9783e9b02c 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/app_update/brook_version.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/app_update/brook_version.htm @@ -1,5 +1,6 @@ <% -local brook_version = require "luci.model.cbi.passwall.api.api".get_brook_version() +local api = require "luci.model.cbi.passwall.api.api" +local brook_version = api.get_brook_version() -%> \ No newline at end of file diff --git a/package/lienol/luci-app-passwall/luasrc/view/passwall/log/log.htm b/package/lienol/luci-app-passwall/luasrc/view/passwall/log/log.htm index c9af2f6554..75e5783170 100644 --- a/package/lienol/luci-app-passwall/luasrc/view/passwall/log/log.htm +++ b/package/lienol/luci-app-passwall/luasrc/view/passwall/log/log.htm @@ -1,7 +1,10 @@ +<% +local api = require "luci.model.cbi.passwall.api.api" +-%>