Skip to content

Commit

Permalink
Merge pull request #334 from frainzy1477/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
frainzy1477 authored Aug 14, 2020
2 parents 9359f15 + ee969e9 commit 5f9594f
Show file tree
Hide file tree
Showing 57 changed files with 157 additions and 130 deletions.
23 changes: 4 additions & 19 deletions .github/workflows/x86-64_gcc.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
on:
push:
tags:
- 'v*.*.*.*'
branches:
- test

name: luci-app-clash
jobs:
Expand All @@ -14,15 +14,8 @@ jobs:

steps:
- name: Checkout - ${{ github.ref }}
uses: actions/checkout@v2

- name: Checkout tag
run: |
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
tag_name="${GITHUB_REF##*/}"
echo Tag $tag_name
git checkout $tag_name
uses: actions/checkout@v1

- name: Prepare SDK ENV
run: |
wget -q "${URL}"
Expand Down Expand Up @@ -63,19 +56,11 @@ jobs:
- name: Build target
env:
DEBIAN_FRONTEND: noninteractive
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
make package/${PKGN}/compile -j$(nproc) V=s
mkdir ../bin
find bin/ -type f -name "*${PKGN}*" | xargs -t -i mv -vf {} ../bin
assets=()
for asset in ../bin/*.ipk; do
assets+=("-a" "$asset")
done
tag_name="${GITHUB_REF##*/}"
hub release create -p -d "${assets[@]}" -m "$tag_name" "$tag_name"
- name: Upload - push to artifact file
uses: actions/upload-artifact@v1
with:
Expand Down
24 changes: 13 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
include $(TOPDIR)/rules.mk

PKG_NAME:=luci-app-clash
PKG_VERSION:=v1.7.5.5
PKG_VERSION:=v1.7.5.6
PKG_MAINTAINER:=frainzy1477

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
SECTION:=luci
CATEGORY:=LuCI
SUBMENU:=2. Clash
SUBMENU:=2. Clash For OpenWRT
TITLE:=LuCI app for clash
DEPENDS:=+luci-base +wget +iptables +coreutils-base64 +coreutils +coreutils-nohup +bash +ipset +libustream-openssl +curl +jsonfilter +ca-certificates +iptables-mod-tproxy +kmod-tun
PKGARCH:=all
Expand Down Expand Up @@ -39,12 +39,12 @@ define Package/$(PKG_NAME)/prerm
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Removing rc.d symlink for clash"
/etc/init.d/clash disable
/etc/init.d/clash stop
/etc/init.d/clash disable
/etc/init.d/clash stop
echo "Removing firewall rule for clash"
uci -q batch <<-EOF >/dev/null
delete firewall.clash
commit firewall
uci -q batch <<-EOF >/dev/null
delete firewall.clash
commit firewall
EOF
fi

Expand All @@ -53,7 +53,7 @@ endef

define Package/$(PKG_NAME)/preinst
#!/bin/sh

/etc/init.d/clash disable 2>/dev/null
if [ -z "$${IPKG_INSTROOT}" ]; then
rm -rf /tmp/dnsmasq.d/custom_list.conf 2>/dev/null
rm -rf /tmp/dnsmasq.clash 2>/dev/null
Expand All @@ -70,6 +70,7 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
mv /usr/share/clash/rule.yaml /usr/share/clashbackup/rule.bak 2>/dev/null
fi


exit 0
endef

Expand All @@ -85,6 +86,7 @@ if [ -z "$${IPKG_INSTROOT}" ]; then
mv /usr/share/clashbackup/rule.bak /usr/share/clash/rule.yaml 2>/dev/null
/etc/init.d/clash disable 2>/dev/null
fi
/etc/init.d/clash disable 2>/dev/null

exit 0
endef
Expand Down Expand Up @@ -147,10 +149,10 @@ define Package/$(PKG_NAME)/install
$(INSTALL_BIN) ./root/usr/share/clash/clash.txt $(1)/usr/share/clash

$(INSTALL_BIN) ./root/usr/share/clash/dashboard/index.html $(1)/etc/clash/dashboard
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/main.3f7e8457ba9e97b6d7c9.css $(1)/etc/clash/dashboard
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/main.658aa6a6e3feec8f168b.css $(1)/etc/clash/dashboard
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/img/ffac0fa1d89f15922b4594863b8b32e9.png $(1)/etc/clash/dashboard/img
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/1.bundle.3f7e8457ba9e97b6d7c9.min.js $(1)/etc/clash/dashboard/js
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/bundle.3f7e8457ba9e97b6d7c9.min.js $(1)/etc/clash/dashboard/js
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/1.bundle.658aa6a6e3feec8f168b.min.js $(1)/etc/clash/dashboard/js
$(INSTALL_BIN) ./root/usr/share/clash/dashboard/js/bundle.658aa6a6e3feec8f168b.min.js $(1)/etc/clash/dashboard/js
$(INSTALL_BIN) ./root/usr/share/clash/yacd/* $(1)/usr/share/clash/yacd

$(INSTALL_DATA) ./luasrc/clash.lua $(1)/usr/lib/lua/luci
Expand Down
27 changes: 14 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<h2 align="center">
<img src="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png" alt="Clash" width="200">
<br>Luci For Clash <br>
<br>Luci App For Clash <br>
</h2>

<p align="center">
A rule based custom proxy for Openwrt based on <a href="https://github.com/Dreamacro/clash" target="_blank">Clash</a>.
A rule based custom proxy client for Openwrt based on <a href="https://github.com/Dreamacro/clash" target="_blank">Clash</a>.
</p>
<p align="center">
<a target="_blank" href="https://github.com/frainzy1477/luci-app-clash/releases/tag/v1.7.5.5">
<img src="https://img.shields.io/badge/luci%20for%20clash-v1.7.5.5-blue.svg">
<a target="_blank" href="https://github.com/frainzy1477/luci-app-clash/releases/tag/v1.7.5.6">
<img src="https://img.shields.io/badge/luci%20for%20clash-v1.7.5.6-blue.svg">
</a>
<a href="https://github.com/frainzy1477/luci-app-clash/releases" target="_blank">
<img src="https://img.shields.io/github/downloads/frainzy1477/luci-app-clash/total.svg?style=flat-square"/>
Expand All @@ -20,30 +20,32 @@
- Upload ipk file to tmp folder
- cd /tmp
- opkg update
- opkg install luci-app-clash_v1.7.5.5_all.ipk
- opkg install luci-app-clash_v1.7.5.5_all.ipk --force-depends
- opkg install luci-app-clash_v1.7.5.6_all.ipk
- opkg install luci-app-clash_v1.7.5.6_all.ipk --force-depends

## Uninstall
- opkg remove luci-app-clash
- opkg remove luci-app-clash --force-remove

## Features
- Suport Subscription Config
- Support Config Upload
- Support Create Config
- Subscription Config
- Config Upload
- Create Config
- GeoIP Database Update
- TProxy UDP
- IP Query
- DNS Forwarding
- Support Trojan
- Support Trojan(Trojan-GFW & Trojan-Go)
- Support SSR
- Support SS
- Support V2ray
- Support Snell
- Ping Custom Proxy Servers
- Tun Support
- Access Control
- Support Provider,
- Game Rules
- Auto Restore Config
- Restore Config

## Dependency

Expand All @@ -57,7 +59,6 @@
- luci-base
- wget
- libustream-openssl
- libopenssl
- curl
- jsonfilter
- ca-certificates
Expand Down Expand Up @@ -98,6 +99,6 @@
```

## License
Luci For Clash - OpenWrt is released under the GPL v3.0 License - see detailed [LICENSE](https://github.com/frainzy1477/luci-app-clash/blob/master/LICENSE) .
Luci App For Clash - OpenWrt is released under the GPL v3.0 License - see detailed [LICENSE](https://github.com/frainzy1477/luci-app-clash/blob/master/LICENSE) .


12 changes: 7 additions & 5 deletions luasrc/controller/clash.lua
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function index()
entry({"admin", "services", "clash", "doupdate"}, call("do_update")).leaf=true
entry({"admin", "services", "clash", "start"}, call("do_start")).leaf=true
entry({"admin", "services", "clash", "stop"}, call("do_stop")).leaf=true
entry({"admin", "services", "clash", "reload"}, call("do_reload")).leaf=true
entry({"admin", "services", "clash", "geo"}, call("geoip_check")).leaf=true
entry({"admin", "services", "clash", "geoipupdate"}, call("geoip_update")).leaf=true
entry({"admin", "services", "clash", "check_geoip"}, call("check_geoip_log")).leaf=true
Expand Down Expand Up @@ -121,11 +122,6 @@ local function in_use()
end


local function ping_enable()
return luci.sys.exec("uci get clash.config.ping_enable")
end


local function conf_path()
if nixio.fs.access(string.sub(luci.sys.exec("uci get clash.config.use_config"), 1, -2)) then
return fss.basename(string.sub(luci.sys.exec("uci get clash.config.use_config"), 1, -2))
Expand Down Expand Up @@ -389,6 +385,12 @@ function do_stop()
luci.sys.exec("/etc/init.d/clash stop 2>&1 &")
end

function do_reload()
if luci.sys.call("pidof clash >/dev/null") == 0 then
luci.sys.exec("/etc/init.d/clash reload 2>&1 &")
end
end

function check_update_log()
luci.http.prepare_content("text/plain; charset=utf-8")
local fdp=tonumber(fs.readfile("/var/run/clashlog")) or 0
Expand Down
2 changes: 1 addition & 1 deletion luasrc/model/cbi/clash/client/client.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ o:value("1", translate("Enable"))
o.description = translate("Set rules under Setting=>Game Rules, will take effect when client start")


o = s:option(ListValue, "append_rules", translate("Append Customs Rules"))
o = s:option(ListValue, "append_rules", translate("Customs Rules"))
o.default = "0"
o:value("0", translate("Disable"))
o:value("1", translate("Enable"))
Expand Down
1 change: 1 addition & 0 deletions luasrc/model/cbi/clash/config/servers-config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ local encrypt_methods_ssr = {
"aes-256-ctr",
"rc4-md5",
"chacha20-ietf",
"xchacha20",

}

Expand Down
8 changes: 5 additions & 3 deletions luasrc/model/cbi/clash/geoip/geoip.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,7 @@ o.description = translate("NB: Upload GEOIP Database file Country.mmdb")
.."<br />"
..translate("https://github.com/Dreamacro/maxmind-geoip/releases")
.."<br />"
..translate("https://static.clash.to/GeoIP2/GeoIP2-Country.tar.gz")
.."<br />"
..translate("https://geolite.clash.dev/Country.mmdb")
..translate("https://raw.githubusercontent.com/alecthw/mmdb_china_ip_list/release/Country.mmdb")

o.title = translate(" ")
o.template = "clash/clash_upload"
Expand Down Expand Up @@ -118,11 +116,15 @@ update_time = SYS.exec("ls -l --full-time /etc/clash/Country.mmdb|awk '{print $6
o.description = translate("Update Time")..'- ' ..font_red..bold_on..update_time..bold_off..font_off..' '
o:depends("up_time", "monthly")

o = s:option(ListValue, "geoip_source", translate("GeoIP Source"))
o:value("1", translate("MaxMind"))
o:value("2", translate("Github"))

o = s:option(Value, "license_key")
o.title = translate("License Key")
o.description = translate("MaxMind License Key")..translate(" https://www.maxmind.com/en/geolite2/signup")
o.rmempty = true
o:depends("geoip_source", "1")

o=s:option(Button,"update_geoip")
o.inputtitle = translate("Save & Apply")
Expand Down
13 changes: 11 additions & 2 deletions luasrc/view/clash/start_stop.htm
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<%+cbi/valueheader%>

<input type="button" class="cbi-button cbi-button-apply" value="<%:Start Client%>" onclick=" return start() "/>
<input type="button" class="cbi-button cbi-button-apply" style="background-color:#ea4368;" value="<%:Stop Client%>" onclick=" return stop() "/>
<input type="button" class="cbi-button cbi-button-apply" value="<%:Start%>" onclick=" return start() "/>
<input type="button" class="cbi-button cbi-button-apply" value="<%:Stop%>" onclick=" return stop() "/>
<input type="button" class="cbi-button cbi-button-apply" value="<%:Reload%>" onclick=" return reload() "/>

<script type="text/javascript">
//<![CDATA[
Expand All @@ -19,6 +20,14 @@
window.setTimeout("location.href='/cgi-bin/luci/admin/services/clash/'", 500);
return
}

function reload(){
XHR.get('<%=url([[admin]], [[services]], [[clash]], [[reload]])%>',null,function(x, data){}
);
window.setTimeout("location.href='/cgi-bin/luci/admin/services/clash/'", 500);
return
}

//]]>
</script>

Expand Down
16 changes: 11 additions & 5 deletions po/zh-cn/clash.po
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,15 @@ msgstr "启用/启动/重新启动客户端"
msgid "Disable/Stop Client"
msgstr "禁用/停止客户端"

msgid "Stop Client"
msgid "Stop"
msgstr "停用客户端"

msgid "Start Client"
msgid "Start"
msgstr "启用客户端"

msgid "Reload"
msgstr "重装客户端"

msgid "enabled"
msgstr "启用"

Expand Down Expand Up @@ -990,8 +993,8 @@ msgstr "选择类型"
msgid "Set custom rules under Setting=>Others , will take effect when client start"
msgstr "在“设置”=>“其他”下设置自定义规则,将在客户端启动时生效"

msgid "Append Customs Rules"
msgstr "附加自定义规则"
msgid "Customs Rules"
msgstr "自定义规则"

msgid "Edit Custom Rule & Group"
msgstr "编辑自定义规则组"
Expand Down Expand Up @@ -1270,4 +1273,7 @@ msgid "Download Update"
msgstr "下载最新版本客户端"

msgid "No Protocol"
msgstr "不带协议"
msgstr "不带协议"

msgid "GeoIP Source"
msgstr "GeoIP下载连接"
15 changes: 10 additions & 5 deletions root/etc/init.d/clash
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,6 @@ if [ -f $CONFIG_YAML ] && [ "$(ls -l $CONFIG_YAML|awk '{print int($5)}')" -ne
echo "设置 Clash iptables" >$REAL_LOG
fi


rules >/dev/null 2>&1

if [ "${lang}" == "en" ] || [ $lang == "auto" ];then
Expand Down Expand Up @@ -928,16 +927,22 @@ restart(){
if pidof clash >/dev/null; then
stop >/dev/null 2>&1
start >/dev/null 2>&1
echo "Clash Successfully Restarted"
else
start >/dev/null 2>&1
echo "Clash Successfully Started"
fi
#===========================================================================================================================
}

reload()
{
if pidof clash >/dev/null; then
if pidof clash >/dev/null; then
remove_mark 2>/dev/null
rules 2>/dev/null
fi
}
yml_dns_change 2>/dev/null
rules 2>/dev/null
sleep 5
echo "Clash for OpenWRT" >$REAL_LOG
echo "Clash Reload Completed"
fi
}
2 changes: 1 addition & 1 deletion root/usr/share/clash/dashboard/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!doctype html><html lang="en" dir="ltr"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png"/><title>Clash</title><link href="main.3f7e8457ba9e97b6d7c9.css" rel="stylesheet"></head><body><div id="root"></div><script src="js/1.bundle.3f7e8457ba9e97b6d7c9.min.js"></script><script src="js/bundle.3f7e8457ba9e97b6d7c9.min.js"></script></body></html>
<!doctype html><html lang="en" dir="ltr"><head><meta charset="UTF-8"/><meta name="viewport" content="width=device-width,initial-scale=1,shrink-to-fit=no"><link rel="icon" type="image/x-icon" href="https://cdn.jsdelivr.net/gh/Dreamacro/clash/docs/logo.png"/><title>Clash Dashboard</title><link href="main.658aa6a6e3feec8f168b.css" rel="stylesheet"></head><body><div id="root"></div><script src="js/1.bundle.658aa6a6e3feec8f168b.min.js"></script><script src="js/bundle.658aa6a6e3feec8f168b.min.js"></script></body></html>

This file was deleted.

Large diffs are not rendered by default.

This file was deleted.

Large diffs are not rendered by default.

Loading

0 comments on commit 5f9594f

Please sign in to comment.