Skip to content

Commit

Permalink
Merge pull request #1 from coolsnowwolf/master
Browse files Browse the repository at this point in the history
同步上游
  • Loading branch information
tossp authored Sep 29, 2017
2 parents 287575f + c1f979d commit 78b9b34
Show file tree
Hide file tree
Showing 38 changed files with 3,441 additions and 10 deletions.
4 changes: 2 additions & 2 deletions include/kernel-version.mk
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ LINUX_RELEASE?=1

LINUX_VERSION-3.18 = .71
LINUX_VERSION-4.4 = .88
LINUX_VERSION-4.9 = .51
LINUX_VERSION-4.9 = .52

LINUX_KERNEL_HASH-3.18.71 = 5abc9778ad44ce02ed6c8ab52ece8a21c6d20d21f6ed8a19287b4a38a50c1240
LINUX_KERNEL_HASH-4.4.88 = 144fe8dd773ec317fa06109b8d7bd04141bf1941daa03799fb4f437bbbb919b4
LINUX_KERNEL_HASH-4.9.51 = 83faa66102d8a4c164857014c5304e08ca6c16f1697851862af17ba61378aa8a
LINUX_KERNEL_HASH-4.9.52 = ffdd034f1bf32fa41d1a66a347388c0dc4c3cff6f578a1e29d88b20fbae1048a

ifdef KERNEL_PATCHVER
LINUX_VERSION:=$(KERNEL_PATCHVER)$(strip $(LINUX_VERSION-$(KERNEL_PATCHVER)))
Expand Down
2 changes: 1 addition & 1 deletion package/lean/default-settings/files/zzz-default-settings
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ sed -i '/set wireless.radio${devidx}.disabled/d' /lib/wifi/mac80211.sh
wifi up

sed -i '/DISTRIB_REVISION/d' /etc/openwrt_release
echo "DISTRIB_REVISION='R7.4 By Lean'" >> /etc/openwrt_release
echo "DISTRIB_REVISION='R7.4.1 By Lean'" >> /etc/openwrt_release
sed -i '/DISTRIB_DESCRIPTION/d' /etc/openwrt_release
echo "DISTRIB_DESCRIPTION='LEDE 17.01.2'" >> /etc/openwrt_release

Expand Down
2 changes: 1 addition & 1 deletion package/lean/luci-app-adbyby-plus/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ LUCI_DEPENDS:=+adbyby +wget +ipset +coreutils +coreutils-nohup +dnsmasq-full
LUCI_PKGARCH:=all
PKG_NAME:=luci-app-adbyby-plus
PKG_VERSION:=2.0
PKG_RELEASE:=19
PKG_RELEASE:=20

include $(TOPDIR)/feeds/luci/luci.mk

Expand Down
9 changes: 7 additions & 2 deletions package/lean/luci-app-adbyby-plus/luasrc/model/cbi/adbyby.lua
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ o.description = translate(string.format("%s<br /><br />", Status))
o.description = translate(string.format("<strong>Lazy Rule:</strong>%s <strong>&nbsp;&nbsp;Video Rule:</strong>%s<br /><strong>Third Party Subscription Rule:</strong>%d lines&nbsp;&nbsp;<strong>User-defined Rule:</strong>%d lines", DL, DV, math.abs(NR-NU), NR))
o.inputstyle = "reload"
o.write = function()
SYS.call("/etc/init.d/adbyby restart")
SYS.call("nohup sh /usr/share/adbyby/adupdate.sh > /tmp/adupdate.log 2>&1 &")
SYS.call("sleep 4")
HTTP.redirect(DISP.build_url("admin", "services", "adbyby"))
end

Expand All @@ -82,14 +83,18 @@ o.default = 0
o.rmempty = false
o.description = translate(string.format("<strong><font color=blue>Adblock Plus Host List:</font></strong> %s Lines<br /><br />", ND))


updatead = s:taboption("advanced", Button, "updatead", translate("Manually force update<br />Adblock Plus Host List"), translate("Note: It needs to download and convert the rules. The background process may takes 60-120 seconds to run. <br / > After completed it would automatically refresh, please do not duplicate click!"))
updatead.inputtitle = translate("Manually force update")
updatead.inputstyle = "apply"
updatead.write = function()
SYS.call("nohup sh /usr/share/adbyby/adblock.sh > /tmp/adupdate.log 2>&1 &")
end

o = s:taboption("advanced", Flag, "update_source")
o.title = translate("Update adbyby rules form official website first")
o.default = 1
o.rmempty = false

o = s:taboption("advanced", Flag, "block_ios")
o.title = translate("Block Apple iOS OTA update")
o.default = 0
Expand Down
7 changes: 7 additions & 0 deletions package/lean/luci-app-adbyby-plus/po/zh-cn/adbyby.po
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,12 @@ msgstr "<strong><font color=blue>Adblock Plus Host 列表:</font></strong>"
msgid "Note: It needs to download and convert the rules. The background process may takes 60-120 seconds to run. <br / > After completed it would automatically refresh, please do not duplicate click!"
msgstr "注意:需要下载并转换规则。后台进程可能需要60-120秒运行。完成后会自动刷新,请不要重复点击!"

msgid "No filter"
msgstr "不过滤"

msgid "Global filter"
msgstr "全局过滤"

msgid "Update adbyby rules form official website first"
msgstr "优先从官方网站更新规则"

Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
#!/bin/sh

wget -t 1 -T 10 -O /tmp/lazy.txt http://update.adbyby.com/rule3/lazy.jpg
wget -t 1 -T 10 -O /tmp/video.txt http://update.adbyby.com/rule3/video.jpg
wget -t 1 -T 10 -O /tmp/user.action http://update.adbyby.com/rule3/user.action
update_source=$(uci get adbyby.@adbyby[0].update_source 2>/dev/null)

rm -f /usr/share/adbyby/data/*.bak

if [ $update_source -eq 1 ]; then
wget -t 1 -T 10 -O /tmp/lazy.txt http://update.adbyby.com/rule3/lazy.jpg
wget -t 1 -T 10 -O /tmp/video.txt http://update.adbyby.com/rule3/video.jpg
wget -t 1 -T 10 -O /tmp/user.action http://update.adbyby.com/rule3/user.action
fi

[ ! -s "/tmp/lazy.txt" ] && wget --no-check-certificate -O /tmp/lazy.txt https://raw.githubusercontent.com/adbyby/xwhyc-rules/master/lazy.txt
[ ! -s "/tmp/video.txt" ] && wget --no-check-certificate -O /tmp/video.txt https://raw.githubusercontent.com/adbyby/xwhyc-rules/master/video.txt
Expand Down
35 changes: 35 additions & 0 deletions package/lean/luci-app-kcptun/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#
# Copyright 2016-2017 Xingwang Liao <[email protected]>
# Licensed to the public under the Apache License 2.0.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-kcptun
PKG_VERSION:=1.4.3
PKG_RELEASE:=1

PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Xingwang Liao <[email protected]>

LUCI_TITLE:=LuCI support for Kcptun
LUCI_DEPENDS:=+jshn +wget +luci-lib-jsonc
LUCI_PKGARCH:=all

define Package/$(PKG_NAME)/conffiles
/etc/config/kcptun
endef

include $(TOPDIR)/feeds/luci/luci.mk

define Package/$(PKG_NAME)/postinst
#!/bin/sh
if [ -z "$${IPKG_INSTROOT}" ]; then
( . /etc/uci-defaults/40_luci-kcptun ) && rm -f /etc/uci-defaults/40_luci-kcptun
fi
chmod 755 $${IPKG_INSTROOT}/etc/init.d/kcptun >/dev/null 2>&1
$${IPKG_INSTROOT}/etc/init.d/kcptun enable >/dev/null 2>&1
exit 0
endef

# call BuildPackage - OpenWrt buildroot signature
120 changes: 120 additions & 0 deletions package/lean/luci-app-kcptun/luasrc/controller/kcptun.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
-- Copyright 2016-2017 Xingwang Liao <[email protected]>
-- Licensed to the public under the Apache License 2.0.

module("luci.controller.kcptun", package.seeall)

local http = require "luci.http"
local kcp = require "luci.model.kcptun"

function index()
if not nixio.fs.access("/etc/config/kcptun") then
return
end

entry({"admin", "services", "kcptun"},
firstchild(), _("Kcptun Client")).dependent = false

entry({"admin", "services", "kcptun", "settings"},
cbi("kcptun/settings"), _("Settings"), 1)

entry({"admin", "services", "kcptun", "servers"},
arcombine(cbi("kcptun/servers"), cbi("kcptun/servers-detail")),
_("Server Manage"), 2).leaf = true

entry({"admin", "services", "kcptun", "log"},
template("kcptun/log_view"), _("Log"), 3)

entry({"admin", "services", "kcptun", "status"}, call("action_status"))

entry({"admin", "services", "kcptun", "check"}, call("action_check")).leaf = true

entry({"admin", "services", "kcptun", "update"}, call("action_update")).leaf = true

entry({"admin", "services", "kcptun", "log", "data"}, call("action_log_data"))

entry({"admin", "services", "kcptun", "log", "clear"}, call("action_log_clear")).leaf = true
end

local function http_write_json(content)
http.prepare_content("application/json")
http.write_json(content or { code = 1 })
end

function action_status()
local client_file = kcp.get_config_option("client_file")

http_write_json({
client = kcp.is_running(client_file)
})
end

function action_check(type)
local json = nil
if type == "kcptun" then
json = kcp.check_kcptun(http.formvalue("arch"))
elseif type == "luci" then
json = kcp.check_luci()
else
http.status(500, "Bad address")
return
end

http_write_json(json)
end

function action_update(type)
local json = nil
if type == "kcptun" then
local task = http.formvalue("task")
if task == "extract" then
json = kcp.extract_kcptun(http.formvalue("file"), http.formvalue("subfix"))
elseif task == "move" then
json = kcp.move_kcptun(http.formvalue("file"))
else
json = kcp.download_kcptun(http.formvalue("url"))
end
elseif type == "luci" then
json = kcp.update_luci(http.formvalue("url"), http.formvalue("save"))
else
http.status(500, "Bad address")
return
end

http_write_json(json)
end

function action_log_data()
local util = require "luci.util"

local log_data = { }

local enable_logging = kcp.get_config_option("enable_logging", "0") == "1"

if enable_logging then
local client_log_file = kcp.get_current_log_file("client")
log_data.client = util.trim(
util.exec("tail -n 50 %s 2>/dev/null | sed 'x;1!H;$!d;x'" % client_log_file))
end

log_data.syslog = util.trim(
util.exec("logread | grep kcptun | tail -n 50 | sed 'x;1!H;$!d;x'"))

http_write_json(log_data)
end

function action_log_clear(type)
if type and type ~= "" then
local log_file = kcp.get_current_log_file(type)

local fs = require "nixio.fs"

if fs.access(log_file) then
fs.writefile(log_file, "")
else
http.status(404, "Not found")
return
end
end

http_write_json({ code = 0 })
end
Loading

0 comments on commit 78b9b34

Please sign in to comment.