OpenClash: bump to v0.34.0-beta
This commit is contained in:
parent
0dbdf49d3b
commit
72418399c9
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-openclash
|
||||
PKG_VERSION:=0.33.7
|
||||
PKG_VERSION:=0.34.0
|
||||
PKG_RELEASE:=beta
|
||||
PKG_MAINTAINER:=vernesong <https://github.com/vernesong/OpenClash>
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -18,8 +18,9 @@ function index()
|
||||
entry({"admin", "services", "openclash", "opupdate"},call("action_opupdate"))
|
||||
entry({"admin", "services", "openclash", "coreupdate"},call("action_coreupdate"))
|
||||
entry({"admin", "services", "openclash", "settings"},cbi("openclash/settings"),_("Takeover Settings"), 30).leaf = true
|
||||
entry({"admin", "services", "openclash", "config"},form("openclash/config"),_("Server Config"), 40).leaf = true
|
||||
entry({"admin", "services", "openclash", "log"},form("openclash/log"),_("Logs"), 50).leaf = true
|
||||
entry({"admin", "services", "openclash", "servers"}, arcombine(cbi("openclash/servers"), cbi("openclash/servers-config")),_("Severs Nodes"), 40).leaf = true
|
||||
entry({"admin", "services", "openclash", "config"},form("openclash/config"),_("Server Config"), 50).leaf = true
|
||||
entry({"admin", "services", "openclash", "log"},form("openclash/log"),_("Logs"), 60).leaf = true
|
||||
|
||||
|
||||
end
|
||||
|
||||
@ -0,0 +1,181 @@
|
||||
-- Copyright (C) 2017 yushi studio <ywb94@qq.com> github.com/ywb94
|
||||
-- Licensed to the public under the GNU General Public License v3.
|
||||
|
||||
local m, s, o
|
||||
local openclash = "openclash"
|
||||
local uci = luci.model.uci.cursor()
|
||||
local ipkg = require("luci.model.ipkg")
|
||||
local fs = require "nixio.fs"
|
||||
local sys = require "luci.sys"
|
||||
local sid = arg[1]
|
||||
local uuid = luci.sys.exec("cat /proc/sys/kernel/random/uuid")
|
||||
|
||||
|
||||
local server_table = {}
|
||||
|
||||
local encrypt_methods_ss = {
|
||||
-- aead
|
||||
"AEAD_AES_128_GCM",
|
||||
"AEAD_AES_192_GCM",
|
||||
"AEAD_AES_256_GCM",
|
||||
"AEAD_CHACHA20_POLY1305",
|
||||
|
||||
-- stream
|
||||
"rc4-md5",
|
||||
"aes-128-cfb",
|
||||
"aes-192-cfb",
|
||||
"aes-256-cfb",
|
||||
"aes-128-ctr",
|
||||
"aes-192-ctr",
|
||||
"aes-256-ctr",
|
||||
"aes-128-gcm",
|
||||
"aes-192-gcm",
|
||||
"aes-256-gcm",
|
||||
"chacha20",
|
||||
"chacha20-ietf",
|
||||
"chacha20-ietf-poly1305",
|
||||
"xchacha20-ietf-poly1305",
|
||||
}
|
||||
|
||||
local securitys = {
|
||||
"auto",
|
||||
"none",
|
||||
"aes-128-gcm",
|
||||
"chacha20-poly1305"
|
||||
}
|
||||
|
||||
m = Map(openclash, translate("Edit Server"))
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/openclash/servers")
|
||||
if m.uci:get(openclash, sid) ~= "servers" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
-- [[ Servers Setting ]]--
|
||||
s = m:section(NamedSection, sid, "servers")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o = s:option(ListValue, "type", translate("Server Node Type"))
|
||||
o:value("ss", translate("Shadowsocks"))
|
||||
o:value("vmess", translate("Vmess"))
|
||||
o:value("socks5", translate("Socks5"))
|
||||
o:value("http", translate("HTTP(S)"))
|
||||
|
||||
o.description = translate("Using incorrect encryption mothod may causes service fail to start")
|
||||
|
||||
o = s:option(Value, "name", translate("Alias"))
|
||||
o.default = "Server"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "server", translate("Server Address"))
|
||||
o.datatype = "host"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "port", translate("Server Port"))
|
||||
o.datatype = "port"
|
||||
o.rmempty = false
|
||||
|
||||
o = s:option(Value, "password", translate("Password"))
|
||||
o.password = true
|
||||
o.rmempty = true
|
||||
o:depends("type", "ss")
|
||||
|
||||
o = s:option(ListValue, "cipher", translate("Encrypt Method"))
|
||||
for _, v in ipairs(encrypt_methods_ss) do o:value(v) end
|
||||
o.rmempty = true
|
||||
o:depends("type", "ss")
|
||||
|
||||
o = s:option(ListValue, "securitys", translate("Encrypt Method"))
|
||||
for _, v in ipairs(securitys) do o:value(v, v:upper()) end
|
||||
o.rmempty = true
|
||||
o:depends("type", "vmess")
|
||||
|
||||
o = s:option(ListValue, "udp", translate("UDP Enable"))
|
||||
o.rmempty = false
|
||||
o.default = "false"
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("type", "ss")
|
||||
|
||||
o = s:option(ListValue, "obfs", translate("obfs-mode"))
|
||||
o.rmempty = false
|
||||
o.default = "none"
|
||||
o:value("none")
|
||||
o:value("tls")
|
||||
o:value("http")
|
||||
o:value("websocket", translate("websocket (ws)"))
|
||||
o:depends("type", "ss")
|
||||
|
||||
o = s:option(ListValue, "obfs_vmess", translate("obfs-mode"))
|
||||
o.rmempty = false
|
||||
o.default = "none"
|
||||
o:value("none")
|
||||
o:value("websocket", translate("websocket (ws)"))
|
||||
o:depends("type", "vmess")
|
||||
|
||||
o = s:option(Value, "host", translate("obfs-hosts"))
|
||||
o.datatype = "host"
|
||||
o.rmempty = true
|
||||
o:depends("obfs", "tls")
|
||||
o:depends("obfs", "http")
|
||||
|
||||
o = s:option(Value, "custom", translate("ws-headers"))
|
||||
o.rmempty = true
|
||||
o:depends("obfs", "websocket")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
|
||||
-- [[ WS部分 ]]--
|
||||
|
||||
-- WS路径
|
||||
o = s:option(Value, "path", translate("ws-Path"))
|
||||
o.rmempty = true
|
||||
o:depends("obfs", "websocket")
|
||||
o:depends("obfs_vmess", "websocket")
|
||||
|
||||
-- AlterId
|
||||
o = s:option(Value, "alterId", translate("AlterId"))
|
||||
o.datatype = "port"
|
||||
o.default = 16
|
||||
o.rmempty = true
|
||||
o:depends("type", "vmess")
|
||||
|
||||
-- VmessId
|
||||
o = s:option(Value, "uuid", translate("VmessId (UUID)"))
|
||||
o.rmempty = true
|
||||
o.default = uuid
|
||||
o:depends("type", "vmess")
|
||||
|
||||
-- 验证用户名
|
||||
o = s:option(Value, "auth_name", translate("Auth Username"))
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
o.rmempty = true
|
||||
|
||||
-- 验证密码
|
||||
o = s:option(Value, "auth_pass", translate("Auth Password"))
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
o.rmempty = true
|
||||
|
||||
-- [[ skip-cert-verify ]]--
|
||||
o = s:option(ListValue, "skip_cert_verify", translate("Skip Cert Verify"))
|
||||
o.rmempty = true
|
||||
o.default = "false"
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("type", "vmess")
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
|
||||
-- [[ TLS ]]--
|
||||
o = s:option(ListValue, "tls", translate("TLS"))
|
||||
o.rmempty = true
|
||||
o.default = "false"
|
||||
o:value("true")
|
||||
o:value("false")
|
||||
o:depends("type", "vmess")
|
||||
o:depends("type", "socks5")
|
||||
o:depends("type", "http")
|
||||
|
||||
return m
|
||||
@ -0,0 +1,99 @@
|
||||
-- Licensed to the public under the GNU General Public License v3.
|
||||
|
||||
local m, s, o
|
||||
local openclash = "openclash"
|
||||
|
||||
local uci = luci.model.uci.cursor()
|
||||
|
||||
m = Map(openclash, translate("Servers manage and Config create"))
|
||||
m.pageaction = false
|
||||
|
||||
s = m:section(TypedSection, "openclash")
|
||||
s.anonymous = true
|
||||
|
||||
o = s:option(ListValue, "rule_sources", translate("Choose Template For Create Config"))
|
||||
o.description = translate("Use Other Rules To Create Config")
|
||||
o.default = "0"
|
||||
o:value("0", translate("Disable Create Config"))
|
||||
o:value("lhie1", translate("lhie1 Rules"))
|
||||
o:value("ConnersHua", translate("ConnersHua Rules"))
|
||||
o:value("ConnersHua_return", translate("ConnersHua Return Rules"))
|
||||
|
||||
local t = {
|
||||
{Commit, Apply, Load_Severs, Delete_Severs}
|
||||
}
|
||||
|
||||
a = m:section(Table, t)
|
||||
|
||||
o = a:option(Button, "Commit")
|
||||
o.inputtitle = translate("Commit Configurations")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
uci:commit("openclash")
|
||||
end
|
||||
|
||||
o = a:option(Button, "Apply")
|
||||
o.inputtitle = translate("Apply Configurations")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
uci:set("openclash", "config", "enable", 1)
|
||||
uci:commit("openclash")
|
||||
luci.sys.call("/usr/share/openclash/yml_proxys_set.sh >/dev/null 2>&1 &")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash"))
|
||||
end
|
||||
|
||||
o = a:option(Button,"Load_Severs")
|
||||
o.inputtitle = translate("Load Config Severs")
|
||||
o.inputstyle = "apply"
|
||||
o.write = function()
|
||||
uci:delete_all("openclash", "servers", function(s) return true end)
|
||||
luci.sys.call("sh /usr/share/openclash/yml_proxys_get.sh 2>/dev/null")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
|
||||
end
|
||||
|
||||
o = a:option(Button,"Delete_Severs")
|
||||
o.inputtitle = translate("Delete severs")
|
||||
o.inputstyle = "reset"
|
||||
o.write = function()
|
||||
uci:delete_all("openclash", "servers", function(s) return true end)
|
||||
luci.sys.call("uci commit openclash")
|
||||
luci.http.redirect(luci.dispatcher.build_url("admin", "services", "openclash", "servers"))
|
||||
end
|
||||
|
||||
-- [[ Servers Manage ]]--
|
||||
s = m:section(TypedSection, "servers")
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.sortable = false
|
||||
s.template = "cbi/tblsection"
|
||||
s.extedit = luci.dispatcher.build_url("admin/services/openclash/servers/%s")
|
||||
function s.create(...)
|
||||
local sid = TypedSection.create(...)
|
||||
if sid then
|
||||
luci.http.redirect(s.extedit % sid)
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "type", translate("Type"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "name", translate("Alias"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "server", translate("Server Address"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
o = s:option(DummyValue, "port", translate("Server Port"))
|
||||
function o.cfgvalue(...)
|
||||
return Value.cfgvalue(...) or translate("None")
|
||||
end
|
||||
|
||||
|
||||
return m
|
||||
@ -141,7 +141,7 @@ o:value("lhie1", translate("lhie1 Rules"))
|
||||
o:value("ConnersHua", translate("ConnersHua Rules"))
|
||||
o:value("ConnersHua_return", translate("ConnersHua Return Rules"))
|
||||
|
||||
SYS.call("awk '/Proxy Group:/,/Rule:/{print}' /etc/openclash/config.yaml 2>/dev/null |egrep '^ {0,}-' |grep name: |sed 's/,.*//' |awk -F 'name: ' '{print $2}' |sed 's/\"//g' >/tmp/Proxy_Group 2>&1")
|
||||
SYS.call("awk '/Proxy Group:/,/Rule:/{print}' /etc/openclash/config.yaml 2>/dev/null |egrep '^ {0,}-' |grep name: |awk -F 'name: ' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' >/tmp/Proxy_Group 2>&1")
|
||||
SYS.call("echo 'DIRECT' >>/tmp/Proxy_Group")
|
||||
SYS.call("echo 'REJECT' >>/tmp/Proxy_Group")
|
||||
file = io.open("/tmp/Proxy_Group", "r");
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -21,20 +21,20 @@
|
||||
<meta property="og:description" content="Yet Another Clash Dashboard">
|
||||
|
||||
|
||||
<link href="app.5a1265735d78e67da9fe.css" rel="stylesheet">
|
||||
<link href="app.26d9ccafb71b5570736d.css" rel="stylesheet">
|
||||
|
||||
|
||||
<body>
|
||||
<div id="app"></div>
|
||||
|
||||
|
||||
<script src="runtime~app.dc7b6d94c7fe054b4bce.js" type="text/javascript"></script>
|
||||
<script src="runtime~app.271c0a96fd4712ee7d81.js" type="text/javascript"></script>
|
||||
|
||||
<script src="core-js~app.b0e192aa2040bbc66d02.js" type="text/javascript"></script>
|
||||
<script src="core-js~app.2bafdc22a68f45914da2.js" type="text/javascript"></script>
|
||||
|
||||
<script src="react~app.6097406f382313d294e3.js" type="text/javascript"></script>
|
||||
<script src="react~app.69171d2b5aa5144a2a86.js" type="text/javascript"></script>
|
||||
|
||||
<script src="app.6cc7f04cc66718dd2c90.js" type="text/javascript"></script>
|
||||
<script src="app.326175ee257418d645a5.js" type="text/javascript"></script>
|
||||
|
||||
|
||||
</body>
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
!function(e){function t(t){for(var n,o,i=t[0],l=t[1],f=t[2],s=t[3]||[],d=0,h=[];d<i.length;d++)o=i[d],Object.prototype.hasOwnProperty.call(a,o)&&a[o]&&h.push(a[o][0]),a[o]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(t),c.push.apply(c,s);h.length;)h.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var f=r[o];0!==a[f]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return 0===u.length&&(c.forEach(function(e){if(void 0===a[e]){a[e]=null;var t=document.createElement("link");l.nc&&t.setAttribute("nonce",l.nc),t.rel="prefetch",t.as="script",t.href=i(e),document.head.appendChild(t)}}),c.length=0),e}var n={},o={5:0},a={5:0},u=[],c=[];function i(e){return l.p+""+({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"e224f2407be3c35c1eb8",4:"5a42cf2d599e6ae44097",6:"1bf4142c0531e8a79fdd",7:"6347f82f57f293361a76"}[e]+".js"}function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{2:1,4:1}[e]&&t.push(o[e]=new Promise(function(t,r){for(var n=({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"b42d1d5155bdec5e6c11",4:"fd22590d9542ad5fc200",6:"063030943ce194cc3bd3",7:"bf6de3d705889f2069d2"}[e]+".css",a=l.p+n,u=document.getElementsByTagName("link"),c=0;c<u.length;c++){var i=(s=u[c]).getAttribute("data-href")||s.getAttribute("href");if("stylesheet"===s.rel&&(i===n||i===a))return t()}var f=document.getElementsByTagName("style");for(c=0;c<f.length;c++){var s;if((i=(s=f[c]).getAttribute("data-href"))===n||i===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)}).then(function(){o[e]=0}));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=a[e]=[t,n]});t.push(r[2]=n);var u,c=document.createElement("script");c.charset="utf-8",c.timeout=120,l.nc&&c.setAttribute("nonce",l.nc),c.src=i(e);var f=new Error;u=function(t){c.onerror=c.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var s=setTimeout(function(){u({type:"timeout",target:c})},12e4);c.onerror=c.onload=u,document.head.appendChild(c)}return Promise.all(t)},l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="",l.oe=function(e){throw console.error(e),e};var f=window.webpackJsonp=window.webpackJsonp||[],s=f.push.bind(f);f.push=t,f=f.slice();for(var d=0;d<f.length;d++)t(f[d]);var p=s;r()}([]);
|
||||
@ -1 +0,0 @@
|
||||
!function(e){function t(t){for(var n,o,c=t[0],l=t[1],f=t[2],s=t[3]||[],d=0,h=[];d<c.length;d++)o=c[d],a[o]&&h.push(a[o][0]),a[o]=0;for(n in l)Object.prototype.hasOwnProperty.call(l,n)&&(e[n]=l[n]);for(p&&p(t),i.push.apply(i,s);h.length;)h.shift()();return u.push.apply(u,f||[]),r()}function r(){for(var e,t=0;t<u.length;t++){for(var r=u[t],n=!0,o=1;o<r.length;o++){var f=r[o];0!==a[f]&&(n=!1)}n&&(u.splice(t--,1),e=l(l.s=r[0]))}return 0===u.length&&(i.forEach(function(e){if(void 0===a[e]){a[e]=null;var t=document.createElement("link");l.nc&&t.setAttribute("nonce",l.nc),t.rel="prefetch",t.as="script",t.href=c(e),document.head.appendChild(t)}}),i.length=0),e}var n={},o={5:0},a={5:0},u=[],i=[];function c(e){return l.p+""+({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"993826afdebb153e0805",4:"6f76e629fb04fefe588a",6:"429cb8fa2f4d9b575993",7:"a322784ecacd704a28c6"}[e]+".js"}function l(t){if(n[t])return n[t].exports;var r=n[t]={i:t,l:!1,exports:{}};return e[t].call(r.exports,r,r.exports,l),r.l=!0,r.exports}l.e=function(e){var t=[];o[e]?t.push(o[e]):0!==o[e]&&{2:1,4:1}[e]&&t.push(o[e]=new Promise(function(t,r){for(var n=({2:"proxies",4:"rules",6:"vendors~chartjs"}[e]||e)+"."+{2:"9022775a13e050c1509f",4:"1fba3c440f97fe0e3bb1",6:"7d5d6ed1822d5d0495fb",7:"80c51b1d7a5a45aaeac0"}[e]+".css",a=l.p+n,u=document.getElementsByTagName("link"),i=0;i<u.length;i++){var c=(s=u[i]).getAttribute("data-href")||s.getAttribute("href");if("stylesheet"===s.rel&&(c===n||c===a))return t()}var f=document.getElementsByTagName("style");for(i=0;i<f.length;i++){var s;if((c=(s=f[i]).getAttribute("data-href"))===n||c===a)return t()}var d=document.createElement("link");d.rel="stylesheet",d.type="text/css",d.onload=t,d.onerror=function(t){var n=t&&t.target&&t.target.src||a,u=new Error("Loading CSS chunk "+e+" failed.\n("+n+")");u.code="CSS_CHUNK_LOAD_FAILED",u.request=n,delete o[e],d.parentNode.removeChild(d),r(u)},d.href=a,document.getElementsByTagName("head")[0].appendChild(d)}).then(function(){o[e]=0}));var r=a[e];if(0!==r)if(r)t.push(r[2]);else{var n=new Promise(function(t,n){r=a[e]=[t,n]});t.push(r[2]=n);var u,i=document.createElement("script");i.charset="utf-8",i.timeout=120,l.nc&&i.setAttribute("nonce",l.nc),i.src=c(e);var f=new Error;u=function(t){i.onerror=i.onload=null,clearTimeout(s);var r=a[e];if(0!==r){if(r){var n=t&&("load"===t.type?"missing":t.type),o=t&&t.target&&t.target.src;f.message="Loading chunk "+e+" failed.\n("+n+": "+o+")",f.name="ChunkLoadError",f.type=n,f.request=o,r[1](f)}a[e]=void 0}};var s=setTimeout(function(){u({type:"timeout",target:i})},12e4);i.onerror=i.onload=u,document.head.appendChild(i)}return Promise.all(t)},l.m=e,l.c=n,l.d=function(e,t,r){l.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},l.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},l.t=function(e,t){if(1&t&&(e=l(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(l.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)l.d(r,n,function(t){return e[t]}.bind(null,n));return r},l.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return l.d(t,"a",t),t},l.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},l.p="",l.oe=function(e){throw console.error(e),e};var f=window.webpackJsonp=window.webpackJsonp||[],s=f.push.bind(f);f.push=t,f=f.slice();for(var d=0;d<f.length;d++)t(f[d]);var p=s;r()}([]);
|
||||
@ -27,7 +27,7 @@
|
||||
if [ ! -z "$(grep "^ \{0,\}redir-port:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}redir-port:/c\redir-port: ${6}" "$7"
|
||||
else
|
||||
sed -i "3i\redir-port: ${6}" "$7"
|
||||
sed -i "/^dns:/i\redir-port: ${6}" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
if [ ! -z "$(grep "^ \{0,\}port:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}port:/c\port: ${9}" "$7"
|
||||
else
|
||||
sed -i "3i\port: ${9}" "$7"
|
||||
sed -i "/^dns:/i\port: ${9}" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -43,7 +43,23 @@
|
||||
if [ ! -z "$(grep "^ \{0,\}socks-port:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}socks-port:/c\socks-port: ${10}" "$7"
|
||||
else
|
||||
sed -i "3i\socks-port: ${10}" "$7"
|
||||
sed -i "/^dns:/i\socks-port: ${10}" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$(grep '^mode:' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^ \{0,\}mode:" "$7")" ]; then
|
||||
sed -i "s/^ \{0,\}mode:/mode:/" "$7"
|
||||
else
|
||||
sed -i "/^dns:/i\mode: Rule" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "$(grep '^log-level:' "$7")" ]; then
|
||||
if [ ! -z "$(grep "^ \{0,\}log-level:" "$7")" ]; then
|
||||
sed -i "s/^ \{0,\}log-level:/log-level:/" "$7"
|
||||
else
|
||||
sed -i "/^dns:/i\log-level: silent" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -51,7 +67,7 @@
|
||||
if [ ! -z "$(grep "^ \{0,\}external-controller:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}external-controller:/c\external-controller: 0.0.0.0:${5}" "$7"
|
||||
else
|
||||
sed -i "3i\external-controller: 0.0.0.0:${5}" "$7"
|
||||
sed -i "/^dns:/i\external-controller: 0.0.0.0:${5}" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -59,7 +75,7 @@
|
||||
if [ ! -z "$(grep "^ \{0,\}secret:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}secret:/c\secret: \"${4}\"" "$7"
|
||||
else
|
||||
sed -i "3i\secret: \"${4}\"" "$7"
|
||||
sed -i "/^dns:/i\secret: \"${4}\"" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -75,7 +91,7 @@
|
||||
if [ ! -z "$(grep "^ \{0,\}allow-lan:" "$7")" ]; then
|
||||
sed -i "/^ \{0,\}allow-lan:/c\allow-lan: true" "$7"
|
||||
else
|
||||
sed -i "3i\allow-lan: true" "$7"
|
||||
sed -i "/^dns:/i\allow-lan: true" "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -86,7 +102,7 @@
|
||||
if [ ! -z "$(grep "^ \{0,\}external-ui:" "$7")" ]; then
|
||||
sed -i '/^ \{0,\}external-ui:/c\external-ui: "/usr/share/openclash/dashboard"' "$7"
|
||||
else
|
||||
sed -i '3i\external-ui: "/usr/share/openclash/dashboard"' "$7"
|
||||
sed -i '/^dns:/i\external-ui: "/usr/share/openclash/dashboard"' "$7"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
125
package/cnsztl/luci-app-openclash/files/usr/share/openclash/yml_proxys_get.sh
Executable file
125
package/cnsztl/luci-app-openclash/files/usr/share/openclash/yml_proxys_get.sh
Executable file
@ -0,0 +1,125 @@
|
||||
#!/bin/sh
|
||||
status=$(ps|grep -c /usr/share/openclash/yml_proxys_get.sh)
|
||||
[ "$status" -gt "3" ] && exit 0
|
||||
|
||||
if [ ! -f "/etc/openclash/config.yml" ] && [ ! -f "/etc/openclash/config.yaml" ]; then
|
||||
exit 0
|
||||
elif [ ! -f "/etc/openclash/config.yaml" ] && [ "$(ls -l /etc/openclash/config.yml 2>/dev/null |awk '{print int($5/1024)}')" -gt 0 ]; then
|
||||
mv "/etc/openclash/config.yml" "/etc/openclash/config.yaml"
|
||||
fi
|
||||
|
||||
awk '/^ {0,}Proxy:/,/^ {0,}Proxy Group:/{print}' /etc/openclash/config.yaml 2>/dev/null >/tmp/yaml_proxy.yaml 2>&1
|
||||
server_file="/tmp/yaml_proxy.yaml"
|
||||
single_server="/tmp/servers.yaml"
|
||||
count=1
|
||||
line=$(sed -n '/^ \{0,\}-/=' $server_file)
|
||||
num=$(grep -c "^ \{0,\}-" $server_file)
|
||||
|
||||
for n in $line
|
||||
do
|
||||
|
||||
[ "$count" -eq 1 ] && {
|
||||
startLine="$n"
|
||||
}
|
||||
|
||||
count=$(expr "$count" + 1)
|
||||
if [ "$count" -gt "$num" ]; then
|
||||
endLine=$(sed -n '$=' $server_file)
|
||||
else
|
||||
endLine=$(expr $(echo "$line" | sed -n "${count}p") - 1)
|
||||
fi
|
||||
|
||||
sed -n "${startLine},${endLine}p" $server_file >$single_server
|
||||
startLine=$(expr "$endLine" + 1)
|
||||
|
||||
#type
|
||||
server_type=$(grep "type:" $single_server |awk -F 'type:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#name
|
||||
server_name=$(grep "name:" $single_server |awk -F 'name:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#server
|
||||
server=$(grep "server:" $single_server |awk -F 'server:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#port
|
||||
port=$(grep "port:" $single_server |awk -F 'port:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#cipher
|
||||
cipher=$(grep "cipher:" $single_server |awk -F 'cipher:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#password
|
||||
password=$(grep "password:" $single_server |awk -F 'password:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#udp
|
||||
udp=$(grep "udp:" $single_server |awk -F 'udp:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#plugin:
|
||||
plugin=$(grep "plugin:" $single_server |awk -F 'plugin:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#plugin-opts:
|
||||
plugin_opts=$(grep "plugin-opts:" $single_server |awk -F 'plugin-opts:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#obfs:
|
||||
obfs=$(grep "obfs:" $single_server |awk -F 'obfs:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#obfs-host:
|
||||
obfs_host=$(grep "obfs-host:" $single_server |awk -F 'obfs-host:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#mode:
|
||||
mode=$(grep "mode:" $single_server |awk -F 'mode:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#tls:
|
||||
tls=$(grep "tls:" $single_server |sed 's/,.*//' |awk -F 'tls:' '{print $2}' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#skip-cert-verify:
|
||||
verify=$(grep "skip-cert-verify:" $single_server |awk -F 'skip-cert-verify:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#host:
|
||||
host=$(grep "host:" $single_server |awk -F 'host:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#Host:
|
||||
Host=$(grep "Host:" $single_server |awk -F 'Host:' '{print $2}' |sed 's/}.*//' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g' |sed 's/ \{0,\}$//g')
|
||||
#path:
|
||||
path=$(grep "path:" $single_server |awk -F 'path:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#ws-path:
|
||||
ws_path=$(grep "ws-path:" $single_server |awk -F 'ws-path:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#headers_custom:
|
||||
headers=$(grep "custom:" $single_server |awk -F 'custom:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#uuid:
|
||||
uuid=$(grep "uuid:" $single_server |awk -F 'uuid:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#alterId:
|
||||
alterId=$(grep "alterId:" $single_server |awk -F 'alterId:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#network
|
||||
network=$(grep "network:" $single_server |awk -F 'network:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
#username
|
||||
username=$(grep "username:" $single_server |awk -F 'username:' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' |sed 's/^ \{0,\}//g')
|
||||
|
||||
name=openclash
|
||||
uci_name_tmp=$(uci add $name servers)
|
||||
|
||||
uci_set="uci -q set $name.$uci_name_tmp."
|
||||
${uci_set}name="$server_name"
|
||||
${uci_set}type="$server_type"
|
||||
${uci_set}server="$server"
|
||||
${uci_set}port="$port"
|
||||
if [ "$server_type" = "vmess" ]; then
|
||||
${uci_set}securitys="$cipher"
|
||||
else
|
||||
${uci_set}cipher="$cipher"
|
||||
fi
|
||||
${uci_set}udp="$udp"
|
||||
${uci_set}obfs="$obfs"
|
||||
${uci_set}host="$obfs_host"
|
||||
[ -z "$obfs" ] && ${uci_set}obfs="$mode"
|
||||
[ -z "$mode" ] && [ ! -z "$network" ] && ${uci_set}obfs="websocket"
|
||||
[ -z "$obfs_host" ] && ${uci_set}host="$host"
|
||||
${uci_set}tls="$tls"
|
||||
${uci_set}skip_cert_verify="$verify"
|
||||
${uci_set}path="$path"
|
||||
[ -z "$path" ] && ${uci_set}path="$ws_path"
|
||||
${uci_set}custom="$headers"
|
||||
[ -z "$headers" ] && ${uci_set}custom="$Host"
|
||||
|
||||
if [ "$server_type" = "vmess" ]; then
|
||||
#v2ray
|
||||
${uci_set}alterId="$alterId"
|
||||
${uci_set}uuid="$uuid"
|
||||
fi
|
||||
|
||||
if [ "$server_type" = "socks5" ] || [ "$server_type" = "http" ]; then
|
||||
${uci_set}auth_name="$username"
|
||||
${uci_set}auth_pass="$password"
|
||||
else
|
||||
${uci_set}password="$password"
|
||||
fi
|
||||
|
||||
done
|
||||
|
||||
uci commit openclash
|
||||
rm -rf /tmp/servers.yaml
|
||||
rm -rf /tmp/yaml_proxy.yaml
|
||||
362
package/cnsztl/luci-app-openclash/files/usr/share/openclash/yml_proxys_set.sh
Executable file
362
package/cnsztl/luci-app-openclash/files/usr/share/openclash/yml_proxys_set.sh
Executable file
@ -0,0 +1,362 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
status=$(ps|grep -c /usr/share/openclash/yml_proxys_set.sh)
|
||||
[ "$status" -gt "3" ] && exit 0
|
||||
|
||||
START_LOG="/tmp/openclash_start.log"
|
||||
SERVER_FILE="/tmp/yaml_servers.yaml"
|
||||
|
||||
#写入服务器节点到配置文件
|
||||
yml_servers_set()
|
||||
{
|
||||
|
||||
local section="$1"
|
||||
config_get "type" "$section" "type" ""
|
||||
config_get "name" "$section" "name" ""
|
||||
config_get "server" "$section" "server" ""
|
||||
config_get "port" "$section" "port" ""
|
||||
config_get "cipher" "$section" "cipher" ""
|
||||
config_get "password" "$section" "password" ""
|
||||
config_get "securitys" "$section" "securitys" ""
|
||||
config_get "udp" "$section" "udp" ""
|
||||
config_get "obfs" "$section" "obfs" ""
|
||||
config_get "obfs_vmess" "$section" "obfs_vmess" ""
|
||||
config_get "host" "$section" "host" ""
|
||||
config_get "custom" "$section" "custom" ""
|
||||
config_get "tls" "$section" "securitys" ""
|
||||
config_get "skip_cert_verify" "$section" "skip_cert_verify" ""
|
||||
config_get "path" "$section" "path" ""
|
||||
config_get "alterId" "$section" "alterId" ""
|
||||
config_get "uuid" "$section" "uuid" ""
|
||||
config_get "auth_name" "$section" "auth_name" ""
|
||||
config_get "auth_pass" "$section" "auth_pass" ""
|
||||
|
||||
|
||||
if [ -z "$type" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$server" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ -z "$name" ]; then
|
||||
name="Server"
|
||||
fi
|
||||
|
||||
if [ -z "$port" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
if [ ! -z "$udp" ] && [ -z "$obfs" ]; then
|
||||
udp=", udp: $udp"
|
||||
fi
|
||||
|
||||
if [ "$obfs" != "none" ]; then
|
||||
if [ "$obfs" = "websocket" ]; then
|
||||
obfss="plugin: v2ray-plugin"
|
||||
else
|
||||
obfss="plugin: obfs"
|
||||
fi
|
||||
else
|
||||
obfs=""
|
||||
fi
|
||||
|
||||
if [ "$obfs_vmess" != "none" ]; then
|
||||
if [ "$type" = "vmess" ] && [ "$obfs" = "websocket" ]; then
|
||||
obfs_vmess=", network: ws"
|
||||
else
|
||||
obfs_vmess=""
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
if [ ! -z "$host" ]; then
|
||||
host="host: $host"
|
||||
fi
|
||||
|
||||
if [ ! -z "$custom" ] && [ "$type" = "vmess" ]; then
|
||||
custom=", ws-headers: { Host: $custom }"
|
||||
fi
|
||||
|
||||
if [ ! -z "$tls" ] && [ "$type" != "ss" ]; then
|
||||
tls=", tls: $tls"
|
||||
elif [ ! -z "$tls" ]; then
|
||||
tls="tls: $tls"
|
||||
fi
|
||||
|
||||
if [ ! -z "$path" ]; then
|
||||
if [ "$type" != "vmess" ]; then
|
||||
path="path: '$path'"
|
||||
else
|
||||
path="ws-path: /$path"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -z "$skip_cert_verify" ] && [ "$type" != "ss" ]; then
|
||||
skip_cert_verify=", skip-cert-verify: $skip_cert_verify"
|
||||
elif [ ! -z "$skip_cert_verify" ]; then
|
||||
skip_cert_verify="skip-cert-verify: $skip_cert_verify"
|
||||
fi
|
||||
|
||||
if [ "$type" = "ss" ] && [ "$obfs" = "none" ]; then
|
||||
echo "- { name: \"$name\", type: $type, server: $server, port: $port, cipher: $cipher, password: "$password"$udp }" >>$SERVER_FILE
|
||||
elif [ "$type" = "ss" ] && [ "$obfs" != "none" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: "$name"
|
||||
type: $type
|
||||
server: $server
|
||||
port: $port
|
||||
cipher: $cipher
|
||||
password: "$password"
|
||||
EOF
|
||||
if [ ! -z "$udp" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
udp: $udp
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$obfss" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$obfss
|
||||
plugin-opts:
|
||||
mode: $obfs
|
||||
$host
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$path" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
$path
|
||||
EOF
|
||||
fi
|
||||
if [ ! -z "$custom" ]; then
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
headers:
|
||||
custom: $custom
|
||||
EOF
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ "$type" = "vmess" ]; then
|
||||
echo "- { name: \"$name\", type: $type, server: $server, port: $port, uuid: $uuid, alterId: $alterId, cipher: $securitys$skip_cert_verify$obfs_vmess$path$custom$tls }" >>$SERVER_FILE
|
||||
fi
|
||||
|
||||
if [ "$type" = "socks5" ] || [ "$type" = "http" ]; then
|
||||
echo "- { name: \"$name\", type: $type, server: $server, port: $port, username: $auth_name, password: $auth_pass$skip_cert_verify$tls }" >>$SERVER_FILE
|
||||
fi
|
||||
|
||||
}
|
||||
|
||||
yml_servers_change()
|
||||
{
|
||||
num=$(grep -c "^ \{0,\}" /tmp/Proxy_Server)
|
||||
nums=$(grep -c "^ \{0,\}" /tmp/Proxy_Servers)
|
||||
count=1
|
||||
while [ "$count" -le "$num" ]
|
||||
do
|
||||
Server=$(sed -n "${count}p" /tmp/Proxy_Server |sed 's/\\/#d#/g' 2>/dev/null)
|
||||
Servers=$(sed -n "${count}p" /tmp/Proxy_Servers |sed 's/\\/#d#/g' 2>/dev/null)
|
||||
sed -i 's/\\/#d#/g' /etc/openclash/config.yaml 2>/dev/null
|
||||
|
||||
if [ "$Server" != "$Servers" ] && [ ! -z "$Servers" ]; then
|
||||
sed -i "s/${Servers}/${Server}/g" /etc/openclash/config.yaml 2>/dev/null
|
||||
elif [ -z "$Servers" ]; then
|
||||
space_num=$(grep "$last_server" /etc/openclash/config.yaml |sed -n '$p' |awk -F '-' '{print $1}' |sed 's/ /#spas#/g' 2>/dev/null |sed 's/\t/#tab#/g' 2>/dev/null)
|
||||
sed -i "/${last_server}/a${space_num}- \"${Server}\"" /etc/openclash/config.yaml 2>/dev/null
|
||||
fi
|
||||
last_server="$Server"
|
||||
count=$(expr "$count" + 1)
|
||||
done
|
||||
|
||||
if [ "$num" -lt "$nums" ]; then
|
||||
while [ "$count" -le "$nums" ]
|
||||
do
|
||||
Servers=$(sed -n "${count}p" /tmp/Proxy_Servers |sed 's/\\/#d#/g' 2>/dev/null)
|
||||
sed -i "/${Servers}/d" "/etc/openclash/config.yaml" 2>/dev/null
|
||||
count=$(expr "$count" + 1)
|
||||
done
|
||||
fi
|
||||
sed -i 's/#d#/\\/g' /etc/openclash/config.yaml 2>/dev/null
|
||||
sed -i 's/#spas#/ /g' /etc/openclash/config.yaml 2>/dev/null
|
||||
sed -i 's/#tab#/ /g' /etc/openclash/config.yaml 2>/dev/null
|
||||
}
|
||||
|
||||
#创建配置文件
|
||||
echo "开始更新配置文件..." >$START_LOG
|
||||
echo "Proxy:" >$SERVER_FILE
|
||||
config_load "openclash"
|
||||
config_foreach yml_servers_set "servers"
|
||||
echo "Proxy Group:" >>$SERVER_FILE
|
||||
rule_sources=$(uci get openclash.config.rule_sources 2>/dev/null)
|
||||
egrep '^ {0,}-' $SERVER_FILE |grep name: |awk -F 'name: ' '{print $2}' |sed 's/,.*//' >/tmp/Proxy_Server 2>&1
|
||||
sed -i "s/^ \{0,\}/ - /" /tmp/Proxy_Server 2>/dev/null #添加参数
|
||||
|
||||
if [ -z "$(grep "^ \{0,\}Proxy:" /etc/openclash/config.yaml)" ] || [ -z "$(grep "^ \{0,\}Proxy Group:" /etc/openclash/config.yaml)" ]; then
|
||||
echo "未找到配置文件,开始使用ConnersHua规则创建..." >$START_LOG
|
||||
uci set openclash.config.rule_sources="ConnersHua"
|
||||
uci set openclash.config.rule_source="ConnersHua"
|
||||
uci commit openclash
|
||||
rule_sources="ConnersHua"
|
||||
fi
|
||||
|
||||
if [ "$rule_sources" = "ConnersHua" ]; then
|
||||
echo "使用ConnersHua规则创建中..." >$START_LOG
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
proxies:
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
url: http://www.gstatic.com/generate_204
|
||||
interval: "600"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Domestic
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- Domestic
|
||||
- name: AdBlock
|
||||
type: select
|
||||
proxies:
|
||||
- REJECT
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Apple
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: AsianTV
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: GlobalTV
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
uci set openclash.config.GlobalTV="GlobalTV"
|
||||
uci set openclash.config.AsianTV="AsianTV"
|
||||
uci set openclash.config.Proxy="Proxy"
|
||||
uci set openclash.config.Apple="Apple"
|
||||
uci set openclash.config.AdBlock="AdBlock"
|
||||
uci set openclash.config.Domestic="Domestic"
|
||||
uci set openclash.config.Others="Others"
|
||||
elif [ "$rule_sources" = "lhie1" ]; then
|
||||
echo "使用lhie1规则创建中..." >$START_LOG
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
proxies:
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
url: http://www.gstatic.com/generate_204
|
||||
interval: "600"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Domestic
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
- Domestic
|
||||
- name: AsianTV
|
||||
type: select
|
||||
proxies:
|
||||
- DIRECT
|
||||
- Proxy
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: GlobalTV
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
uci set openclash.config.GlobalTV="GlobalTV"
|
||||
uci set openclash.config.AsianTV="AsianTV"
|
||||
uci set openclash.config.Proxy="Proxy"
|
||||
uci set openclash.config.Domestic="Domestic"
|
||||
uci set openclash.config.Others="Others"
|
||||
elif [ "$rule_sources" = "ConnersHua_return" ]; then
|
||||
echo "使用ConnersHua回国规则创建中..." >$START_LOG
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Auto - UrlTest
|
||||
type: url-test
|
||||
proxies:
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
url: http://www.gstatic.com/generate_204
|
||||
interval: "600"
|
||||
- name: Proxy
|
||||
type: select
|
||||
proxies:
|
||||
- Auto - UrlTest
|
||||
- DIRECT
|
||||
EOF
|
||||
cat /tmp/Proxy_Server >> $SERVER_FILE 2>/dev/null
|
||||
cat >> "$SERVER_FILE" <<-EOF
|
||||
- name: Others
|
||||
type: select
|
||||
proxies:
|
||||
- Proxy
|
||||
- DIRECT
|
||||
EOF
|
||||
uci set openclash.config.Proxy="Proxy"
|
||||
uci set openclash.config.Others="Others"
|
||||
fi
|
||||
if [ "$rule_sources" != "0" ]; then
|
||||
echo "Rule:" >>$SERVER_FILE
|
||||
uci commit openclash
|
||||
cat $SERVER_FILE > "/etc/openclash/config.yaml" 2>/dev/null
|
||||
else
|
||||
echo "正在更新配置文件服务器节点信息..." >$START_LOG
|
||||
awk '/Proxy:/,/Proxy Group:/{print}' /etc/openclash/config.yaml 2>/dev/null |egrep '^ {0,}-' |grep name: |awk -F 'name: ' '{print $2}' |sed 's/,.*//' |sed 's/\"//g' >/tmp/Proxy_Servers 2>&1
|
||||
sed -i 's/\"//g' /tmp/Proxy_Server |sed 's/^ \{0,\}- //g' 2>/dev/null
|
||||
|
||||
sed -i '/^ \{0,\}Proxy:/i\#change server#' "/etc/openclash/config.yaml" 2>/dev/null
|
||||
sed -i '/^ \{0,\}Proxy:/,/^ \{0,\}Proxy Group:/d' "/etc/openclash/config.yaml" 2>/dev/null
|
||||
|
||||
yml_servers_change
|
||||
|
||||
sed -i '/#change server#/r/tmp/yaml_servers.yaml' "/etc/openclash/config.yaml" 2>/dev/null
|
||||
sed -i '/#change server#/d' "/etc/openclash/config.yaml" 2>/dev/null
|
||||
fi
|
||||
echo "配置文件更新完成!" >$START_LOG
|
||||
rm -rf $SERVER_FILE 2>/dev/null
|
||||
rm -rf /tmp/Proxy_Server 2>/dev/null
|
||||
rm -rf /tmp/Proxy_Servers 2>/dev/null
|
||||
/etc/init.d/openclash restart >/dev/null 2>&1 &
|
||||
@ -102,4 +102,6 @@ fi
|
||||
sed -i '/^Rule:/a\##Custom Rules End' "$4" 2>/dev/null
|
||||
sed -i '/^Rule:/a\##Custom Rules' "$4" 2>/dev/null
|
||||
sed -i '/^##Custom Rules$/r/etc/config/openclash_custom_rules.list' "$4" 2>/dev/null
|
||||
}
|
||||
sed -i "s/^ \{0,\}- /- /" "$4" 2>/dev/null #修改参数空格
|
||||
sed -i "s/^\t\{0,\}- /- /" "$4" 2>/dev/null #修改参数tab
|
||||
}
|
||||
@ -404,3 +404,86 @@ msgstr "更新客户端"
|
||||
msgid "Only For IPK Install Type Or Not Release Memory"
|
||||
msgstr ""
|
||||
"只支持通过IPK安装的版本进行更新,因为随系统编译的版本更新后不会释放旧版本的闪存空间"
|
||||
|
||||
msgid "Severs Nodes"
|
||||
msgstr "服务器节点"
|
||||
|
||||
msgid "Load Config Severs"
|
||||
msgstr "读取节点"
|
||||
|
||||
msgid "Delete severs"
|
||||
msgstr "清空节点"
|
||||
|
||||
msgid "Servers manage and Config create"
|
||||
msgstr "服务器节点管理(支持配置文件一键生成)"
|
||||
|
||||
msgid "Choose Template For Create Config"
|
||||
msgstr "选择配置文件模板"
|
||||
|
||||
msgid "Use Other Rules To Create Config"
|
||||
msgstr "使用第三方规则快速创建配置文件(创建后可在接管设置页面调整参数)"
|
||||
|
||||
msgid "Disable Create Config"
|
||||
msgstr "只更新配置文件服务器节点信息"
|
||||
|
||||
msgid "Type"
|
||||
msgstr "节点类型"
|
||||
|
||||
msgid "Alias"
|
||||
msgstr "节点别名"
|
||||
|
||||
msgid "Server Address"
|
||||
msgstr "服务器地址"
|
||||
|
||||
msgid "Server Port"
|
||||
msgstr "服务器端口"
|
||||
|
||||
msgid "Edit Server"
|
||||
msgstr "编辑服务器配置"
|
||||
|
||||
msgid "Server Node Type"
|
||||
msgstr "服务器节点类型"
|
||||
|
||||
msgid "Using incorrect encryption mothod may causes service fail to start"
|
||||
msgstr "输入不正确的参数组合可能会导致服务无法启动"
|
||||
|
||||
msgid "Password"
|
||||
msgstr "密码"
|
||||
|
||||
msgid "Encrypt Method"
|
||||
msgstr "加密方式"
|
||||
|
||||
msgid "UDP Enable"
|
||||
msgstr "UDP支持"
|
||||
|
||||
msgid "obfs-mode"
|
||||
msgstr "传输协议"
|
||||
|
||||
msgid "obfs-hosts"
|
||||
msgstr "混淆参数"
|
||||
|
||||
msgid "Auth Username"
|
||||
msgstr "登录用户名"
|
||||
|
||||
msgid "Auth Password"
|
||||
msgstr "登录密码"
|
||||
|
||||
msgid "Skip Cert Verify"
|
||||
msgstr "忽略许可验证(skip-cert-verify)"
|
||||
|
||||
msgid "None"
|
||||
msgstr "未配置"
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user