Merge Mainline
This commit is contained in:
commit
dc0473eeec
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-unblockneteasemusic-mini
|
||||
PKG_VERSION:=1.2
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=9
|
||||
LUCI_TITLE:=LuCI support for UnblockNeteaseMusic(-Go)
|
||||
LUCI_DEPENDS:=+busybox +dnsmasq-full +ipset +iptables +wget
|
||||
LUCI_PKGARCH:=all
|
||||
|
||||
@ -17,8 +17,7 @@ enable.rmempty = false
|
||||
|
||||
select_server = s:option(ListValue, "select_server", translate("服务器位置"))
|
||||
select_server:value("tencent_shanghai_nodejs", translate("[CTCGFW] 腾讯云上海(高音质)"))
|
||||
select_server:value("aliyun_beijing_nodejs", translate("[hyird] 阿里云北京(高音质)"))
|
||||
select_server:value("aliyun_beijing_nodejs_2", translate("[Sunsky] 阿里云北京(高音质)"))
|
||||
select_server:value("ucloud_guangzhou_nodejs", translate("[CTCGFW] UCloud广州(高音质)"))
|
||||
select_server.description = translate("请合理使用本插件与各个服务器,请勿滥用")
|
||||
select_server.default = "tencent_shanghai_nodejs"
|
||||
select_server.rmempty = false
|
||||
|
||||
@ -13,13 +13,9 @@ if [ "${select_server}" = "tencent_shanghai_nodejs" ]; then
|
||||
[ -z "${unblock_server_ip}" ] && unblock_server_ip="122.51.88.18"
|
||||
unblock_server_http_port="30000"
|
||||
unblock_server_https_port="30001"
|
||||
elif [ "${select_server}" = "aliyun_beijing_nodejs" ]; then
|
||||
unblock_server_ip="$(ping "hyird.xyz" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')"
|
||||
[ -z "${unblock_server_ip}" ] && unblock_server_ip="182.92.84.98"
|
||||
unblock_server_http_port="30000"
|
||||
unblock_server_https_port="30001"
|
||||
elif [ "${select_server}" = "aliyun_beijing_nodejs_2" ]; then
|
||||
unblock_server_ip="39.96.56.58"
|
||||
elif [ "${select_server}" = "ucloud_guangzhou_nodejs" ]; then
|
||||
unblock_server_ip="$(ping "uc-gz.service.project-openwrt.eu.org" -c 1 | sed '1{s/[^(]*(//;s/).*//;q}')"
|
||||
[ -z "${unblock_server_ip}" ] && unblock_server_ip="106.75.156.183"
|
||||
unblock_server_http_port="30000"
|
||||
unblock_server_https_port="30001"
|
||||
fi
|
||||
|
||||
@ -12,7 +12,7 @@ LUCI_DEPENDS:=+bash +busybox +coreutils +coreutils-nohup +curl +dnsmasq-full +ip
|
||||
LUCI_PKGARCH:=all
|
||||
PKG_NAME:=luci-app-unblockneteasemusic
|
||||
PKG_VERSION:=2.8
|
||||
PKG_RELEASE:=7
|
||||
PKG_RELEASE:=8
|
||||
|
||||
PKG_MAINTAINER:=[CTCGFW]Project-OpenWrt
|
||||
|
||||
|
||||
@ -184,47 +184,52 @@ start()
|
||||
|
||||
[ "${enable}" -ne "1" ] && exit 0
|
||||
|
||||
sed -i '/unblockneteasemusic/d' /etc/crontabs/root
|
||||
[ "${auto_update}" -eq "1" ] && echo "0 ${update_time} * * * /usr/share/unblockneteasemusic/update.sh update_core" >> "/etc/crontabs/root"
|
||||
echo "*/5 * * * * /usr/share/unblockneteasemusic/log_check.sh" >> "/etc/crontabs/root"
|
||||
sed -i "/$NAME/d" /etc/crontabs/root
|
||||
[ "${auto_update}" -eq "1" ] && echo "0 ${update_time} * * * /usr/share/$NAME/update.sh update_core" >> "/etc/crontabs/root"
|
||||
echo "*/5 * * * * /usr/share/$NAME/log_check.sh" >> "/etc/crontabs/root"
|
||||
/etc/init.d/cron restart > "/dev/null" 2>&1
|
||||
|
||||
[ ! -e "/usr/share/unblockneteasemusic/core/app.js" ] && { rm -f "/usr/share/unblockneteasemusic/local_ver"; bash "/usr/share/unblockneteasemusic/update.sh" "update_core_non_restart"; }
|
||||
[ ! -e "/usr/share/unblockneteasemusic/core/app.js" ] && { echo "Core Not Found, please download it before starting." >> "/tmp/unblockneteasemusic.log"; exit 1; }
|
||||
[ ! -e "/usr/share/$NAME/core/app.js" ] && { rm -f "/usr/share/$NAME/local_ver"; bash "/usr/share/$NAME/update.sh" "update_core_non_restart"; }
|
||||
[ ! -e "/usr/share/$NAME/core/app.js" ] && { echo "Core Not Found, please download it before starting." >> "/tmp/$NAME.log"; exit 1; }
|
||||
|
||||
[ "${use_remote_qq_server}" -ne "1" ] && qq_server_mode="local" || qq_server_mode="remote"
|
||||
bash "/usr/share/unblockneteasemusic/gen_remote_qq_server.sh" "${qq_server_mode}" "${enable_flac}" > "/usr/share/unblockneteasemusic/core/src/provider/qq.js"
|
||||
bash "/usr/share/$NAME/gen_qq_provider.sh" "${qq_server_mode}" "${enable_flac}" > "/usr/share/$NAME/core/src/provider/qq.js"
|
||||
|
||||
[ -n "${neteasemusic_cookie}" ] && {
|
||||
ub_cookie_line="$(sed -n -e "/netease.path.includes('song\/enhance')/=" "/usr/share/unblockneteasemusic/core/src/hook.js")";
|
||||
[ -n "${ub_cookie_line}" ] && { let ub_cookie_endline="ub_cookie_line+6"; sed -i "${ub_cookie_line},${ub_cookie_endline}d" "/usr/share/unblockneteasemusic/core/src/hook.js"; }
|
||||
sed -i "/netease.path == '\/api\/song\/enhance\/download\/url'/i\\\t\\t\\t\\tif (netease.path.includes('song\/enhance')) {" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i "/if (netease.path.includes('song\/enhance')) {/a\\\t\\t\\t\\t\\treq.headers.cookie = [" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i "/req.headers.cookie = \[/a\\\t\\t\\t\\t\\t\\t'MUSIC_U=${neteasemusic_cookie}'," "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i "/'MUSIC_U=${neteasemusic_cookie}',/a\\\t\\t\\t\\t\\t\\treq.headers.cookie.replace(\/\\\s*MUSIC_\\\w=[^\\\s;]+;*\/g, '')" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i "/req.headers.cookie.replace(\/\\\s\\*MUSIC_\\\w=[^\\\s;]\\+/a\\\t\\t\\t\\t\\t].filter(line => line).join('; ')" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i "/].filter(line => line).join('; ')/a\\\t\\t\\t\\t}\\n" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
ub_cookie_line="$(sed -n -e "/netease.path.includes('song\/enhance')/=" "/usr/share/$NAME/core/src/hook.js")";
|
||||
[ -n "${ub_cookie_line}" ] && { let ub_cookie_endline="ub_cookie_line+6"; sed -i "${ub_cookie_line},${ub_cookie_endline}d" "/usr/share/$NAME/core/src/hook.js"; }
|
||||
sed -i "/netease.path == '\/api\/song\/enhance\/download\/url'/i\\\t\\t\\t\\tif (netease.path.includes('song\/enhance')) {" "/usr/share/$NAME/core/src/hook.js"
|
||||
sed -i "/if (netease.path.includes('song\/enhance')) {/a\\\t\\t\\t\\t\\treq.headers.cookie = [" "/usr/share/$NAME/core/src/hook.js"
|
||||
sed -i "/req.headers.cookie = \[/a\\\t\\t\\t\\t\\t\\t'MUSIC_U=${neteasemusic_cookie}'," "/usr/share/$NAME/core/src/hook.js"
|
||||
sed -i "/'MUSIC_U=${neteasemusic_cookie}',/a\\\t\\t\\t\\t\\t\\treq.headers.cookie.replace(\/\\\s*MUSIC_\\\w=[^\\\s;]+;*\/g, '')" "/usr/share/$NAME/core/src/hook.js"
|
||||
sed -i "/req.headers.cookie.replace(\/\\\s\\*MUSIC_\\\w=[^\\\s;]\\+/a\\\t\\t\\t\\t\\t].filter(line => line).join('; ')" "/usr/share/$NAME/core/src/hook.js"
|
||||
sed -i "/].filter(line => line).join('; ')/a\\\t\\t\\t\\t}\\n" "/usr/share/$NAME/core/src/hook.js"
|
||||
}
|
||||
|
||||
quality_check_line="$(awk "/target == 0 \|\| item.id == target/{print NR}" "/usr/share/unblockneteasemusic/core/src/hook.js")"
|
||||
sed -i "${quality_check_line}d" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
quality_check_line="$(awk "/target == 0 \|\| item.id == target/{print NR}" "/usr/share/$NAME/core/src/hook.js")"
|
||||
sed -i "${quality_check_line}d" "/usr/share/$NAME/core/src/hook.js"
|
||||
if [ "${replace_music_source}" = "dont_replace" ]; then
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif ((item.code != 200 || item.freeTrialInfo) && (target == 0 || item.id == target)) {" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif ((item.code != 200 || item.freeTrialInfo) && (target == 0 || item.id == target)) {" "/usr/share/$NAME/core/src/hook.js"
|
||||
elif [ "${replace_music_source}" = "lower_than_192kbps" ]; then
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif ((item.code != 200 || item.freeTrialInfo || item.br < 192000) && (target == 0 || item.id == target)) {" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif ((item.code != 200 || item.freeTrialInfo || item.br < 192000) && (target == 0 || item.id == target)) {" "/usr/share/$NAME/core/src/hook.js"
|
||||
elif [ "${replace_music_source}" = "lower_than_320kbps" ]; then
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif ((item.code != 200 || item.freeTrialInfo || item.br < 320000) && (target == 0 || item.id == target)) {" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif ((item.code != 200 || item.freeTrialInfo || item.br < 320000) && (target == 0 || item.id == target)) {" "/usr/share/$NAME/core/src/hook.js"
|
||||
elif [ "${replace_music_source}" = "lower_than_999kbps" ]; then
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif ((item.code != 200 || item.freeTrialInfo || item.br < 999000) && (target == 0 || item.id == target)) {" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif ((item.code != 200 || item.freeTrialInfo || item.br < 999000) && (target == 0 || item.id == target)) {" "/usr/share/$NAME/core/src/hook.js"
|
||||
elif [ "${replace_music_source}" = "replace_all" ]; then
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif (target == 0 || item.id == target) {" "/usr/share/unblockneteasemusic/core/src/hook.js"
|
||||
sed -i -e "${quality_check_line}i \\\t\\tif (target == 0 || item.id == target) {" "/usr/share/$NAME/core/src/hook.js"
|
||||
fi
|
||||
|
||||
{ [ -f "${self_issue_cert_crt}" ] && [ -f "${self_issue_cert_key}" ]; } && { ln -sf "${self_issue_cert_crt}" "/usr/share/unblockneteasemusic/core/server.crt"; ln -sf "${self_issue_cert_key}" "/usr/share/unblockneteasemusic/core/server.key"; }
|
||||
{ [ -f "${self_issue_cert_crt}" ] && [ -f "${self_issue_cert_key}" ]; } && {
|
||||
{ [ "${self_issue_cert_crt}" != "/usr/share/$NAME/core/server.crt" ] && [ "${self_issue_cert_key}" != "/usr/share/$NAME/core/server.key" ]; } && {
|
||||
ln -sf "${self_issue_cert_crt}" "/usr/share/$NAME/core/server.crt"
|
||||
ln -sf "${self_issue_cert_key}" "/usr/share/$NAME/core/server.key"
|
||||
}
|
||||
}
|
||||
|
||||
[ "${hijack_ways}" = "use_hosts" ] && { http_port="80"; https_port="443"; }
|
||||
[ "${music_source}" = "default" ] && music_source="" || music_source="-o ${music_source}"
|
||||
nohup node "/usr/share/unblockneteasemusic/core/app.js" -a "${addr}" -p "${http_port}":"${https_port}" ${music_source} -e "${endpoint_url}" ${netease_server_ip} ${proxy_server_ip} ${strict_mode} >> "/tmp/$NAME.log" 2>&1 &
|
||||
nohup node "/usr/share/$NAME/core/app.js" -a "${addr}" -p "${http_port}":"${https_port}" ${music_source} -e "${endpoint_url}" ${netease_server_ip} ${proxy_server_ip} ${strict_mode} >> "/tmp/$NAME.log" 2>&1 &
|
||||
|
||||
set_type="start"
|
||||
if [ "${hijack_ways}" = "use_ipset" ]; then
|
||||
@ -237,16 +242,24 @@ start()
|
||||
|
||||
stop()
|
||||
{
|
||||
{ ps |grep "unblockneteasemusic" |grep "app.js" |grep -v "grep" |awk '{print $1}' |xargs kill -9; } > "/dev/null" 2>&1
|
||||
{ ps |grep "$NAME" |grep "app.js" |grep -v "grep" |awk '{print $1}' |xargs kill -9; } > "/dev/null" 2>&1
|
||||
|
||||
sed -i '/unblockneteasemusic/d' "/etc/crontabs/root"
|
||||
sed -i "/$NAME/d" "/etc/crontabs/root"
|
||||
/etc/init.d/cron restart > "/dev/null" 2>&1
|
||||
|
||||
[ ! -f "${UPGRADE_CONF}" ] && touch "${UPGRADE_CONF}"
|
||||
sed -i '/unblockneteasemusic\/core/d;/unblockneteasemusic\/local_ver/d' "${UPGRADE_CONF}"
|
||||
[ "${keep_core_when_upgrade}" -eq "1" ] && { echo "/usr/share/unblockneteasemusic/core/" >> "${UPGRADE_CONF}"; echo "/usr/share/unblockneteasemusic/local_ver" >> "${UPGRADE_CONF}"; }
|
||||
[ -f "${self_issue_cert_crt}" ] && { sed -i "/${self_issue_cert_crt//\//\\/}/d"; echo "${self_issue_cert_crt}" >> "${UPGRADE_CONF}"; }
|
||||
[ -f "${self_issue_cert_key}" ] && { sed -i "/${self_issue_cert_key//\//\\/}/d"; echo "${self_issue_cert_key}" >> "${UPGRADE_CONF}"; }
|
||||
sed -i "/$NAME\/core/d;/$NAME\/local_ver/d" "${UPGRADE_CONF}"
|
||||
[ "${keep_core_when_upgrade}" -eq "1" ] && { echo "/usr/share/$NAME/core/" >> "${UPGRADE_CONF}"; echo "/usr/share/$NAME/local_ver" >> "${UPGRADE_CONF}"; }
|
||||
|
||||
{ [ -f "${self_issue_cert_crt}" ] && [ -f "${self_issue_cert_key}" ]; } && {
|
||||
{ [ "${self_issue_cert_crt}" != "/usr/share/$NAME/core/server.crt" ] && [ "${self_issue_cert_key}" != "/usr/share/$NAME/core/server.key" ]; } && {
|
||||
sed -i "/${self_issue_cert_crt//\//\\/}/d"
|
||||
echo "${self_issue_cert_crt}" >> "${UPGRADE_CONF}"
|
||||
|
||||
sed -i "/${self_issue_cert_key//\//\\/}/d"
|
||||
echo "${self_issue_cert_key}" >> "${UPGRADE_CONF}"
|
||||
}
|
||||
}
|
||||
|
||||
rm -f "/tmp/$NAME.log"
|
||||
|
||||
|
||||
@ -2,20 +2,16 @@
|
||||
# Created By [CTCGFW]Project OpenWRT
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
if [ "$1" == "local" ]
|
||||
then echo -e "// local_mode
|
||||
const cache = require('../cache')
|
||||
header="const cache = require('../cache')
|
||||
const insure = require('./insure')
|
||||
const select = require('./select')
|
||||
const request = require('../request')
|
||||
|
||||
const headers = {
|
||||
'origin': 'http://y.qq.com/',
|
||||
'referer': 'http://y.qq.com/',
|
||||
'cookie': process.env.QQ_COOKIE || null // 'uin=; qm_keyst=',
|
||||
}
|
||||
'origin': 'http://y.qq.com/',
|
||||
'referer': 'http://y.qq.com/',"
|
||||
|
||||
const playable = song => {
|
||||
body="const playable = song => {
|
||||
const switchFlag = song['switch'].toString(2).split('')
|
||||
switchFlag.pop()
|
||||
switchFlag.reverse()
|
||||
@ -36,7 +32,7 @@ const search = info => {
|
||||
const url =
|
||||
'https://c.y.qq.com/soso/fcgi-bin/client_search_cp?' +
|
||||
'ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.center&' +
|
||||
't=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=20&w='
|
||||
't=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=20&w=' +
|
||||
encodeURIComponent(info.keyword) + '&' +
|
||||
'g_tk=5381&jsonpCallback=MusicJsonCallback10005317669353331&loginUin=0&hostUin=0&' +
|
||||
'format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0'
|
||||
@ -48,8 +44,16 @@ const search = info => {
|
||||
const matched = select(list, info)
|
||||
return matched ? matched.id : Promise.reject()
|
||||
})
|
||||
}"
|
||||
|
||||
if [ "$1" == "local" ]
|
||||
then echo -e "// local_mode
|
||||
${header}
|
||||
'cookie': process.env.QQ_COOKIE || null // 'uin=; qm_keyst=',
|
||||
}
|
||||
|
||||
${body}
|
||||
|
||||
const single = (id, format) => {
|
||||
const uin = ((headers.cookie || '').match(/uin=(\d+)/) || [])[1] || '0'
|
||||
|
||||
@ -101,51 +105,11 @@ module.exports = {check, track}"
|
||||
elif [ "$1" == "remote" ]
|
||||
then [ "$2" == "1" ] && { flac_quality="'flac', "; loop_times="4"; } || loop_times="3"
|
||||
echo -e "// remote_mode
|
||||
const cache = require('../cache')
|
||||
const insure = require('./insure')
|
||||
const select = require('./select')
|
||||
const request = require('../request')
|
||||
|
||||
const headers = {
|
||||
'origin': 'http://y.qq.com/',
|
||||
'referer': 'http://y.qq.com/',
|
||||
${header}
|
||||
'cookie': null
|
||||
}
|
||||
|
||||
const playable = song => {
|
||||
const switchFlag = song['switch'].toString(2).split('')
|
||||
switchFlag.pop()
|
||||
switchFlag.reverse()
|
||||
const playFlag = switchFlag[0]
|
||||
const tryFlag = switchFlag[13]
|
||||
return ((playFlag == 1) || ((playFlag == 1) && (tryFlag == 1)))
|
||||
}
|
||||
|
||||
const format = song => ({
|
||||
id: {song: song.mid, file: song.file.media_mid},
|
||||
name: song.name,
|
||||
duration: song.interval * 1000,
|
||||
album: {id: song.album.mid, name: song.album.name},
|
||||
artists: song.singer.map(({mid, name}) => ({id: mid, name}))
|
||||
})
|
||||
|
||||
const search = info => {
|
||||
const url =
|
||||
'https://c.y.qq.com/soso/fcgi-bin/client_search_cp?' +
|
||||
'ct=24&qqmusic_ver=1298&new_json=1&remoteplace=txt.yqq.center&' +
|
||||
't=0&aggr=1&cr=1&catZhida=1&lossless=0&flag_qc=0&p=1&n=20&w=' +
|
||||
encodeURIComponent(info.keyword) + '&' +
|
||||
'g_tk=5381&jsonpCallback=MusicJsonCallback10005317669353331&loginUin=0&hostUin=0&' +
|
||||
'format=jsonp&inCharset=utf8&outCharset=utf-8¬ice=0&platform=yqq&needNewCode=0'
|
||||
|
||||
return request('GET', url)
|
||||
.then(response => response.jsonp())
|
||||
.then(jsonBody => {
|
||||
const list = jsonBody.data.song.list.map(format)
|
||||
const matched = select(list, info)
|
||||
return matched ? matched.id : Promise.reject()
|
||||
})
|
||||
}
|
||||
${body}
|
||||
|
||||
const track = id => {
|
||||
const typeObj = [${flac_quality}'320', '128', 'm4a']
|
||||
@ -164,7 +128,7 @@ const track = id => {
|
||||
if (res === 100) {
|
||||
let songUrl = jsonBody.data
|
||||
return songUrl
|
||||
} else if (i === 3) {
|
||||
} else if (i === $[${loop_times}-1]) {
|
||||
return Promise.reject()
|
||||
} else {
|
||||
return
|
||||
@ -2,10 +2,12 @@
|
||||
# Created By [CTCGFW]Project OpenWRT
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
NAME="unblockneteasemusic"
|
||||
|
||||
log_max_size="4" #使用KB计算
|
||||
log_file="/tmp/unblockneteasemusic.log"
|
||||
log_file="/tmp/$NAME.log"
|
||||
|
||||
(( log_size = "$(ls -l "${log_file}" | awk -F ' ' '{print $5}')" / "1024" ))
|
||||
(( "${log_size}" >= "${log_max_size}" )) && echo "" > "${log_file}"
|
||||
|
||||
[ "*$(uci get unblockneteasemusic.@unblockneteasemusic[0].daemon_enable 2>/dev/null)*" == "*1*" ] && { [ -z "$(ps |grep "unblockneteasemusic" |grep "app.js" |grep -v "grep")" ] && /etc/init.d/unblockneteasemusic restart; }
|
||||
[ "*$(uci get $NAME.@$NAME[0].daemon_enable 2>/dev/null)*" == "*1*" ] && { [ -z "$(ps |grep "$NAME" |grep "app.js" |grep -v "grep")" ] && /etc/init.d/$NAME restart; }
|
||||
|
||||
@ -2,36 +2,38 @@
|
||||
# Created By [CTCGFW]Project OpenWRT
|
||||
# https://github.com/project-openwrt
|
||||
|
||||
NAME="unblockneteasemusic"
|
||||
|
||||
function check_core_if_already_running(){
|
||||
running_tasks="$(ps |grep "unblockneteasemusic" |grep "update.sh" |grep "update_core" |grep -v "grep" |awk '{print $1}' |wc -l)"
|
||||
[ "${running_tasks}" -gt "2" ] && { echo -e "\nA task is already running." >> "/tmp/unblockneteasemusic.log"; exit 2; }
|
||||
running_tasks="$(ps |grep "$NAME" |grep "update.sh" |grep "update_core" |grep -v "grep" |awk '{print $1}' |wc -l)"
|
||||
[ "${running_tasks}" -gt "2" ] && { echo -e "\nA task is already running." >> "/tmp/$NAME.log"; exit 2; }
|
||||
}
|
||||
|
||||
function check_luci_if_already_running(){
|
||||
running_tasks="$(ps |grep "unblockneteasemusic" |grep "update.sh" |grep "update_luci" |grep -v "grep" |awk '{print $1}' |wc -l)"
|
||||
[ "${running_tasks}" -gt "2" ] && { echo -e "\nA task is already running." >> "/tmp/unblockneteasemusic.log"; exit 2; }
|
||||
running_tasks="$(ps |grep "$NAME" |grep "update.sh" |grep "update_luci" |grep -v "grep" |awk '{print $1}' |wc -l)"
|
||||
[ "${running_tasks}" -gt "2" ] && { echo -e "\nA task is already running." >> "/tmp/$NAME.log"; exit 2; }
|
||||
}
|
||||
|
||||
function clean_log(){
|
||||
echo "" > "/tmp/unblockneteasemusic.log"
|
||||
echo "" > "/tmp/$NAME.log"
|
||||
}
|
||||
|
||||
function check_luci_latest_version(){
|
||||
luci_latest_ver="$(curl -s 'https://github.com/project-openwrt/luci-app-unblockneteasemusic/releases/latest'| grep -Eo '[0-9\.]+\-[0-9]+')"
|
||||
[ -z "${luci_latest_ver}" ] && { echo -e "\nFailed to check latest LuCI version, please try again later." >> "/tmp/unblockneteasemusic.log"; exit 1; }
|
||||
[ -z "${luci_latest_ver}" ] && { echo -e "\nFailed to check latest LuCI version, please try again later." >> "/tmp/$NAME.log"; exit 1; }
|
||||
if [ "$(opkg info "luci-app-unblockneteasemusic" |sed -n "2p" |tr -d "Version: ")" != "${luci_latest_ver}" ]; then
|
||||
clean_log
|
||||
echo -e "Local LuCI version: $(opkg info "luci-app-unblockneteasemusic" |sed -n "2p" |tr -d "Version: "), cloud LuCI version: ${luci_latest_ver}." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Local LuCI version: $(opkg info "luci-app-unblockneteasemusic" |sed -n "2p" |tr -d "Version: "), cloud LuCI version: ${luci_latest_ver}." >> "/tmp/$NAME.log"
|
||||
update_luci
|
||||
else
|
||||
echo -e "\nLocal LuCI version: $(opkg info "luci-app-unblockneteasemusic" |sed -n "2p" |tr -d "Version: "), cloud LuCI version: ${luci_latest_ver}." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "You're already using the latest LuCI version." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "\nLocal LuCI version: $(opkg info "luci-app-unblockneteasemusic" |sed -n "2p" |tr -d "Version: "), cloud LuCI version: ${luci_latest_ver}." >> "/tmp/$NAME.log"
|
||||
echo -e "You're already using the latest LuCI version." >> "/tmp/$NAME.log"
|
||||
exit 3
|
||||
fi
|
||||
}
|
||||
|
||||
function update_luci(){
|
||||
echo -e "Updating LuCI..." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Updating LuCI..." >> "/tmp/$NAME.log"
|
||||
|
||||
mkdir -p "/tmp" > "/dev/null" 2>&1
|
||||
|
||||
@ -41,59 +43,59 @@ function update_luci(){
|
||||
rm -rf "/tmp/luci-indexcache" "/tmp/luci-modulecache"
|
||||
|
||||
if [ "$(opkg info 'luci-app-unblockneteasemusic' |sed -n '2p' |tr -d 'Version: ')" != "${luci_latest_ver}" ]; then
|
||||
echo -e "Failed to update LuCI." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Failed to update LuCI." >> "/tmp/$NAME.log"
|
||||
exit 1
|
||||
else
|
||||
touch "/usr/share/unblockneteasemusic/update_luci_successfully"
|
||||
touch "/usr/share/$NAME/update_luci_successfully"
|
||||
/etc/init.d/firewall restart > "/dev/null" 2>&1
|
||||
fi
|
||||
|
||||
echo -e "Succeeded in updating LuCI." > "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Current LuCI version: ${luci_latest_ver}.\n" >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Succeeded in updating LuCI." > "/tmp/$NAME.log"
|
||||
echo -e "Current LuCI version: ${luci_latest_ver}.\n" >> "/tmp/$NAME.log"
|
||||
}
|
||||
|
||||
function check_core_latest_version(){
|
||||
core_latest_ver="$(curl -s https://github.com/nondanee/UnblockNeteaseMusic/commits/master |tr -d '\n' |grep -Eo 'commit\/[0-9a-z]+' |sed -n 1p |sed 's#commit/##g')"
|
||||
[ -z "${core_latest_ver}" ] && { echo -e "\nFailed to check latest core version, please try again later." >> "/tmp/unblockneteasemusic.log"; exit 1; }
|
||||
if [ ! -e "/usr/share/unblockneteasemusic/core_local_ver" ]; then
|
||||
[ -z "${core_latest_ver}" ] && { echo -e "\nFailed to check latest core version, please try again later." >> "/tmp/$NAME.log"; exit 1; }
|
||||
if [ ! -e "/usr/share/$NAME/core_local_ver" ]; then
|
||||
clean_log
|
||||
echo -e "Local version: NOT FOUND, cloud version: ${core_latest_ver}." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Local version: NOT FOUND, cloud version: ${core_latest_ver}." >> "/tmp/$NAME.log"
|
||||
update_core
|
||||
else
|
||||
if [ "$(cat /usr/share/unblockneteasemusic/core_local_ver)" != "${core_latest_ver}" ]; then
|
||||
if [ "$(cat /usr/share/$NAME/core_local_ver)" != "${core_latest_ver}" ]; then
|
||||
clean_log
|
||||
echo -e "Local core version: $(cat /usr/share/unblockneteasemusic/core_local_ver 2>"/dev/null"), cloud core version: ${core_latest_ver}." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Local core version: $(cat /usr/share/$NAME/core_local_ver 2>"/dev/null"), cloud core version: ${core_latest_ver}." >> "/tmp/$NAME.log"
|
||||
update_core
|
||||
else
|
||||
echo -e "\nLocal core version: $(cat /usr/share/unblockneteasemusic/core_local_ver 2>"/dev/null"), cloud core version: ${core_latest_ver}." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "You're already using the latest core version." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "\nLocal core version: $(cat /usr/share/$NAME/core_local_ver 2>"/dev/null"), cloud core version: ${core_latest_ver}." >> "/tmp/$NAME.log"
|
||||
echo -e "You're already using the latest core version." >> "/tmp/$NAME.log"
|
||||
exit 3
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
function update_core(){
|
||||
echo -e "Updating core..." >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Updating core..." >> "/tmp/$NAME.log"
|
||||
|
||||
mkdir -p "/usr/share/unblockneteasemusic/core" > "/dev/null" 2>&1
|
||||
rm -rf /usr/share/unblockneteasemusic/core/* > "/dev/null" 2>&1
|
||||
mkdir -p "/usr/share/$NAME/core" > "/dev/null" 2>&1
|
||||
rm -rf /usr/share/$NAME/core/* > "/dev/null" 2>&1
|
||||
|
||||
curl -sL "https://github.com/nondanee/UnblockNeteaseMusic/archive/master.tar.gz" -o "/usr/share/unblockneteasemusic/core/core.tar.gz" > "/dev/null" 2>&1
|
||||
tar -zxf "/usr/share/unblockneteasemusic/core/core.tar.gz" -C "/usr/share/unblockneteasemusic/core/" > "/dev/null" 2>&1
|
||||
mv /usr/share/unblockneteasemusic/core/UnblockNeteaseMusic-master/* "/usr/share/unblockneteasemusic/core/"
|
||||
rm -rf "/usr/share/unblockneteasemusic/core/core.tar.gz" "/usr/share/unblockneteasemusic/core/UnblockNeteaseMusic-master" > "/dev/null" 2>&1
|
||||
curl -sL "https://github.com/nondanee/UnblockNeteaseMusic/archive/master.tar.gz" -o "/usr/share/$NAME/core/core.tar.gz" > "/dev/null" 2>&1
|
||||
tar -zxf "/usr/share/$NAME/core/core.tar.gz" -C "/usr/share/$NAME/core/" > "/dev/null" 2>&1
|
||||
mv /usr/share/$NAME/core/UnblockNeteaseMusic-master/* "/usr/share/$NAME/core/"
|
||||
rm -rf "/usr/share/$NAME/core/core.tar.gz" "/usr/share/$NAME/core/UnblockNeteaseMusic-master" > "/dev/null" 2>&1
|
||||
|
||||
if [ ! -e "/usr/share/unblockneteasemusic/core/app.js" ]; then
|
||||
echo -e "Failed to download core." >> "/tmp/unblockneteasemusic.log"
|
||||
if [ ! -e "/usr/share/$NAME/core/app.js" ]; then
|
||||
echo -e "Failed to download core." >> "/tmp/$NAME.log"
|
||||
exit 1
|
||||
else
|
||||
[ "${update_core_from_luci}" == "y" ] && touch "/usr/share/unblockneteasemusic/update_core_successfully"
|
||||
echo -e "${core_latest_ver}" > "/usr/share/unblockneteasemusic/core_local_ver"
|
||||
[ "${non_restart}" != "y" ] && /etc/init.d/unblockneteasemusic restart
|
||||
[ "${update_core_from_luci}" == "y" ] && touch "/usr/share/$NAME/update_core_successfully"
|
||||
echo -e "${core_latest_ver}" > "/usr/share/$NAME/core_local_ver"
|
||||
[ "${non_restart}" != "y" ] && /etc/init.d/$NAME restart
|
||||
fi
|
||||
|
||||
echo -e "Succeeded in updating core." > "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Current core version: ${core_latest_ver}.\n" >> "/tmp/unblockneteasemusic.log"
|
||||
echo -e "Succeeded in updating core." > "/tmp/$NAME.log"
|
||||
echo -e "Current core version: ${core_latest_ver}.\n" >> "/tmp/$NAME.log"
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
|
||||
@ -9,13 +9,13 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=v2ray
|
||||
PKG_VERSION:=4.29.0
|
||||
PKG_VERSION:=4.30.0
|
||||
PKG_RELEASE:=1
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/v2ray-core-$(PKG_VERSION)
|
||||
|
||||
PKG_SOURCE:=v2ray-core-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/v2fly/v2ray-core/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=cc8cb22b616c218a6de9de0bee80651f502344a907b696008ae7bd467ba05a17
|
||||
PKG_HASH:=ee7f615193708dcc5f0499c1918a3806b8dfb0a4aaada0dc3df62229c28220ed
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=LICENSE
|
||||
|
||||
@ -7,8 +7,8 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=luci-app-passwall
|
||||
PKG_VERSION:=3.9
|
||||
PKG_RELEASE:=64
|
||||
PKG_DATE:=20200925
|
||||
PKG_RELEASE:=65
|
||||
PKG_DATE:=20201003
|
||||
|
||||
PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
|
||||
@ -14,8 +14,11 @@ command_timeout = 300
|
||||
LEDE_BOARD = nil
|
||||
DISTRIB_TARGET = nil
|
||||
|
||||
function gen_uuid()
|
||||
local uuid = string.gsub(sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)"), "-", "")
|
||||
function gen_uuid(format)
|
||||
local uuid = sys.exec("echo -n $(cat /proc/sys/kernel/random/uuid)")
|
||||
if format == nil then
|
||||
uuid = string.gsub(uuid, "-", "")
|
||||
end
|
||||
return uuid
|
||||
end
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@ local function gen_outbound(node, tag)
|
||||
node.stream_security = "none"
|
||||
end
|
||||
|
||||
if node.transport == "mkcp" or node.transport == "ds" or node.transport == "quic" then
|
||||
if node.transport == "mkcp" or node.transport == "quic" then
|
||||
node.stream_security = "none"
|
||||
end
|
||||
|
||||
@ -54,23 +54,26 @@ local function gen_outbound(node, tag)
|
||||
concurrency = (node.mux_concurrency) and tonumber(node.mux_concurrency) or 8
|
||||
},
|
||||
-- 底层传输配置
|
||||
streamSettings = (node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks") and {
|
||||
streamSettings = (node.protocol == "vmess" or node.protocol == "vless" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan") and {
|
||||
network = node.transport,
|
||||
security = node.stream_security,
|
||||
xtlsSettings = (node.stream_security == "xtls") and {
|
||||
serverName = node.tls_serverName,
|
||||
allowInsecure = (node.tls_allowInsecure == "1") and true or false
|
||||
} or nil,
|
||||
tlsSettings = (node.stream_security == "tls") and {
|
||||
disableSessionResumption = node.sessionTicket ~= "1" and true or false,
|
||||
serverName = node.tls_serverName,
|
||||
allowInsecure = (node.tls_allowInsecure == "1") and true or false
|
||||
} or nil,
|
||||
tcpSettings = (node.transport == "tcp" and node.protocol ~= "socks") and {
|
||||
header = {
|
||||
type = node.tcp_guise,
|
||||
request = {
|
||||
request = (node.tcp_guise == "http") and {
|
||||
path = node.tcp_guise_http_path or {"/"},
|
||||
headers = {
|
||||
Host = node.tcp_guise_http_host or {}
|
||||
}
|
||||
} or {}
|
||||
} or nil
|
||||
}
|
||||
} or nil,
|
||||
kcpSettings = (node.transport == "mkcp") and {
|
||||
@ -110,19 +113,19 @@ local function gen_outbound(node, tag)
|
||||
id = node.uuid,
|
||||
alterId = tonumber(node.alter_id),
|
||||
level = node.level and tonumber(node.level) or 0,
|
||||
security = node.security,
|
||||
encryption = node.encryption or "none"
|
||||
security = (node.protocol == "vmess") and node.security or nil,
|
||||
encryption = node.encryption or "none",
|
||||
flow = (node.stream_security == "xtls") and node.flow or nil
|
||||
}
|
||||
}
|
||||
}
|
||||
} or nil,
|
||||
servers = (node.protocol == "socks" or node.protocol == "http" or node.protocol == "shadowsocks") and {
|
||||
servers = (node.protocol == "socks" or node.protocol == "http" or node.protocol == "shadowsocks" or node.protocol == "trojan") and {
|
||||
{
|
||||
address = node.address,
|
||||
port = tonumber(node.port),
|
||||
method = node.method or nil,
|
||||
password = node.password or "",
|
||||
ota = node.ota == '1' and true or false,
|
||||
users = (node.username and node.password) and
|
||||
{{user = node.username, pass = node.password}} or nil
|
||||
}
|
||||
|
||||
@ -106,6 +106,7 @@ protocol:value("vless", translate("VLESS"))
|
||||
protocol:value("http", translate("HTTP"))
|
||||
protocol:value("socks", translate("Socks"))
|
||||
protocol:value("shadowsocks", translate("Shadowsocks"))
|
||||
protocol:value("trojan", translate("Trojan"))
|
||||
protocol:value("_balancing", translate("Balancing"))
|
||||
protocol:value("_shunt", translate("Shunt"))
|
||||
protocol:depends("type", "V2ray")
|
||||
@ -176,16 +177,17 @@ address.rmempty = false
|
||||
address:depends("type", "Socks")
|
||||
address:depends("type", "SS")
|
||||
address:depends("type", "SSR")
|
||||
address:depends({ type = "V2ray", protocol = "vmess" })
|
||||
address:depends({ type = "V2ray", protocol = "vless" })
|
||||
address:depends({ type = "V2ray", protocol = "http" })
|
||||
address:depends({ type = "V2ray", protocol = "socks" })
|
||||
address:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
address:depends("type", "Brook")
|
||||
address:depends("type", "Trojan")
|
||||
address:depends("type", "Trojan-Plus")
|
||||
address:depends("type", "Trojan-Go")
|
||||
address:depends("type", "Naiveproxy")
|
||||
address:depends({ type = "V2ray", protocol = "vmess" })
|
||||
address:depends({ type = "V2ray", protocol = "vless" })
|
||||
address:depends({ type = "V2ray", protocol = "http" })
|
||||
address:depends({ type = "V2ray", protocol = "socks" })
|
||||
address:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
address:depends({ type = "V2ray", protocol = "trojan" })
|
||||
|
||||
--[[
|
||||
use_ipv6 = s:option(Flag, "use_ipv6", translate("Use IPv6"))
|
||||
@ -193,15 +195,16 @@ use_ipv6.default = 0
|
||||
use_ipv6:depends("type", "Socks")
|
||||
use_ipv6:depends("type", "SS")
|
||||
use_ipv6:depends("type", "SSR")
|
||||
use_ipv6:depends("type", "Brook")
|
||||
use_ipv6:depends("type", "Trojan")
|
||||
use_ipv6:depends("type", "Trojan-Plus")
|
||||
use_ipv6:depends("type", "Trojan-Go")
|
||||
use_ipv6:depends({ type = "V2ray", protocol = "vmess" })
|
||||
use_ipv6:depends({ type = "V2ray", protocol = "vless" })
|
||||
use_ipv6:depends({ type = "V2ray", protocol = "http" })
|
||||
use_ipv6:depends({ type = "V2ray", protocol = "socks" })
|
||||
use_ipv6:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
use_ipv6:depends("type", "Brook")
|
||||
use_ipv6:depends("type", "Trojan")
|
||||
use_ipv6:depends("type", "Trojan-Plus")
|
||||
use_ipv6:depends("type", "Trojan-Go")
|
||||
use_ipv6:depends({ type = "V2ray", protocol = "trojan" })
|
||||
--]]
|
||||
|
||||
port = s:option(Value, "port", translate("Port"))
|
||||
@ -210,22 +213,23 @@ port.rmempty = false
|
||||
port:depends("type", "Socks")
|
||||
port:depends("type", "SS")
|
||||
port:depends("type", "SSR")
|
||||
port:depends({ type = "V2ray", protocol = "vmess" })
|
||||
port:depends({ type = "V2ray", protocol = "vless" })
|
||||
port:depends({ type = "V2ray", protocol = "http" })
|
||||
port:depends({ type = "V2ray", protocol = "socks" })
|
||||
port:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
port:depends("type", "Brook")
|
||||
port:depends("type", "Trojan")
|
||||
port:depends("type", "Trojan-Plus")
|
||||
port:depends("type", "Trojan-Go")
|
||||
port:depends("type", "Naiveproxy")
|
||||
port:depends({ type = "V2ray", protocol = "vmess" })
|
||||
port:depends({ type = "V2ray", protocol = "vless" })
|
||||
port:depends({ type = "V2ray", protocol = "http" })
|
||||
port:depends({ type = "V2ray", protocol = "socks" })
|
||||
port:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
port:depends({ type = "V2ray", protocol = "trojan" })
|
||||
|
||||
username = s:option(Value, "username", translate("Username"))
|
||||
username:depends("type", "Socks")
|
||||
username:depends("type", "Naiveproxy")
|
||||
username:depends("protocol", "http")
|
||||
username:depends("protocol", "socks")
|
||||
username:depends({ type = "V2ray", protocol = "http" })
|
||||
username:depends({ type = "V2ray", protocol = "socks" })
|
||||
|
||||
password = s:option(Value, "password", translate("Password"))
|
||||
password.password = true
|
||||
@ -237,9 +241,10 @@ password:depends("type", "Trojan")
|
||||
password:depends("type", "Trojan-Plus")
|
||||
password:depends("type", "Trojan-Go")
|
||||
password:depends("type", "Naiveproxy")
|
||||
password:depends("protocol", "http")
|
||||
password:depends("protocol", "socks")
|
||||
password:depends("protocol", "shadowsocks")
|
||||
password:depends({ type = "V2ray", protocol = "http" })
|
||||
password:depends({ type = "V2ray", protocol = "socks" })
|
||||
password:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
password:depends({ type = "V2ray", protocol = "trojan" })
|
||||
|
||||
ss_encrypt_method = s:option(ListValue, "ss_encrypt_method", translate("Encrypt Method"))
|
||||
for a, t in ipairs(ss_encrypt_method_list) do ss_encrypt_method:value(t) end
|
||||
@ -263,11 +268,11 @@ end
|
||||
|
||||
security = s:option(ListValue, "security", translate("Encrypt Method"))
|
||||
for a, t in ipairs(security_list) do security:value(t) end
|
||||
security:depends("protocol", "vmess")
|
||||
security:depends({ type = "V2ray", protocol = "vmess" })
|
||||
|
||||
encryption = s:option(Value, "encryption", translate("Encrypt Method"))
|
||||
encryption.default = "none"
|
||||
encryption:depends("protocol", "vless")
|
||||
encryption:depends({ type = "V2ray", protocol = "vless" })
|
||||
|
||||
v_ss_encrypt_method = s:option(ListValue, "v_ss_encrypt_method", translate("Encrypt Method"))
|
||||
for a, t in ipairs(v_ss_encrypt_method_list) do v_ss_encrypt_method:value(t) end
|
||||
@ -279,16 +284,6 @@ function v_ss_encrypt_method.write(self, section, value)
|
||||
m:set(section, "method", value)
|
||||
end
|
||||
|
||||
ss_ota = s:option(Flag, "ss_ota", translate("OTA"), translate("When OTA is enabled, V2Ray will reject connections that are not OTA enabled. This option is invalid when using AEAD encryption."))
|
||||
ss_ota.default = "0"
|
||||
ss_ota:depends("protocol", "shadowsocks")
|
||||
function ss_ota.cfgvalue(self, section)
|
||||
return m:get(section, "ota")
|
||||
end
|
||||
function ss_ota.write(self, section, value)
|
||||
m:set(section, "ota", value)
|
||||
end
|
||||
|
||||
ssr_protocol = s:option(ListValue, "ssr_protocol", translate("Protocol"))
|
||||
for a, t in ipairs(ssr_protocol_list) do ssr_protocol:value(t) end
|
||||
ssr_protocol:depends("type", "SSR")
|
||||
@ -367,25 +362,28 @@ kcp_opts:depends("use_kcp", "1")
|
||||
|
||||
uuid = s:option(Value, "uuid", translate("ID"))
|
||||
uuid.password = true
|
||||
uuid:depends("protocol", "vmess")
|
||||
uuid:depends("protocol", "vless")
|
||||
uuid:depends({ type = "V2ray", protocol = "vmess" })
|
||||
uuid:depends({ type = "V2ray", protocol = "vless" })
|
||||
|
||||
alter_id = s:option(Value, "alter_id", translate("Alter ID"))
|
||||
alter_id:depends("protocol", "vmess")
|
||||
|
||||
level = s:option(Value, "level", translate("User Level"))
|
||||
level.default = 1
|
||||
level:depends("protocol", "vmess")
|
||||
level:depends("protocol", "vless")
|
||||
level:depends({ type = "V2ray", protocol = "vmess" })
|
||||
level:depends({ type = "V2ray", protocol = "vless" })
|
||||
level:depends({ type = "V2ray", protocol = "trojan" })
|
||||
|
||||
stream_security = s:option(ListValue, "stream_security", translate("Transport Layer Encryption"), translate('Whether or not transport layer encryption is enabled, the supported options are "none" for unencrypted and "TLS" for using TLS.'))
|
||||
stream_security = s:option(ListValue, "stream_security", translate("Transport Layer Encryption"), translate('Whether or not transport layer encryption is enabled, "none" for unencrypted, "tls" for using TLS, "xtls" for using XTLS.'))
|
||||
stream_security:value("none", "none")
|
||||
stream_security:value("tls", "tls")
|
||||
stream_security:value("xtls", "xtls")
|
||||
stream_security.default = "tls"
|
||||
stream_security:depends("protocol", "vmess")
|
||||
stream_security:depends("protocol", "vless")
|
||||
stream_security:depends("protocol", "socks")
|
||||
stream_security:depends("protocol", "shadowsocks")
|
||||
stream_security:depends({ type = "V2ray", protocol = "vmess" })
|
||||
stream_security:depends({ type = "V2ray", protocol = "vless" })
|
||||
stream_security:depends({ type = "V2ray", protocol = "socks" })
|
||||
stream_security:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
stream_security:depends({ type = "V2ray", protocol = "trojan" })
|
||||
stream_security:depends("type", "Trojan")
|
||||
stream_security:depends("type", "Trojan-Plus")
|
||||
stream_security:depends("type", "Trojan-Go")
|
||||
@ -396,10 +394,18 @@ stream_security.validate = function(self, value)
|
||||
return value
|
||||
end
|
||||
|
||||
flow = s:option(Value, "flow", translate("flow"))
|
||||
flow.default = "xtls-rprx-origin"
|
||||
flow:value("xtls-rprx-origin")
|
||||
flow:value("xtls-rprx-origin-udp443")
|
||||
flow:depends("stream_security", "xtls")
|
||||
|
||||
-- [[ TLS部分 ]] --
|
||||
tls_sessionTicket = s:option(Flag, "tls_sessionTicket", translate("Session Ticket"))
|
||||
tls_sessionTicket.default = "0"
|
||||
tls_sessionTicket:depends("stream_security", "tls")
|
||||
tls_sessionTicket:depends({ type = "Trojan", stream_security = "tls" })
|
||||
tls_sessionTicket:depends({ type = "Trojan-Plus", stream_security = "tls" })
|
||||
tls_sessionTicket:depends({ type = "Trojan-Go", stream_security = "tls" })
|
||||
|
||||
-- [[ Trojan TLS ]]--
|
||||
trojan_force_fp = s:option(ListValue, "fingerprint", translate("Finger Print"))
|
||||
@ -409,10 +415,12 @@ trojan_force_fp:depends({ type = "Trojan-Go", stream_security = "tls" })
|
||||
|
||||
tls_serverName = s:option(Value, "tls_serverName", translate("Domain"))
|
||||
tls_serverName:depends("stream_security", "tls")
|
||||
tls_serverName:depends("stream_security", "xtls")
|
||||
|
||||
tls_allowInsecure = s:option(Flag, "tls_allowInsecure", translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."))
|
||||
tls_allowInsecure.default = "0"
|
||||
tls_allowInsecure:depends("stream_security", "tls")
|
||||
tls_allowInsecure:depends("stream_security", "xtls")
|
||||
|
||||
-- [[ Trojan Cert ]]--
|
||||
trojan_cert_path = s:option(Value, "trojan_cert_path", translate("Trojan Cert Path"))
|
||||
@ -456,17 +464,18 @@ transport:value("ws", "WebSocket")
|
||||
transport:value("h2", "HTTP/2")
|
||||
transport:value("ds", "DomainSocket")
|
||||
transport:value("quic", "QUIC")
|
||||
transport:depends("protocol", "vmess")
|
||||
transport:depends("protocol", "vless")
|
||||
transport:depends("protocol", "socks")
|
||||
transport:depends("protocol", "shadowsocks")
|
||||
transport:depends({ type = "V2ray", protocol = "vmess" })
|
||||
transport:depends({ type = "V2ray", protocol = "vless" })
|
||||
transport:depends({ type = "V2ray", protocol = "socks" })
|
||||
transport:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
transport:depends({ type = "V2ray", protocol = "trojan" })
|
||||
|
||||
--[[
|
||||
ss_transport = s:option(ListValue, "ss_transport", translate("Transport"))
|
||||
ss_transport:value("ws", "WebSocket")
|
||||
ss_transport:value("h2", "HTTP/2")
|
||||
ss_transport:value("h2+ws", "HTTP/2 & WebSocket")
|
||||
ss_transport:depends("protocol", "shadowsocks")
|
||||
ss_transport:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
]]--
|
||||
|
||||
-- [[ TCP部分 ]]--
|
||||
|
||||
@ -14,6 +14,7 @@ function gen_config(user)
|
||||
for i = 1, #user.uuid do
|
||||
clients[i] = {
|
||||
id = user.uuid[i],
|
||||
flow = (user.stream_security == "xtls") and user.flow or nil,
|
||||
level = tonumber(user.level),
|
||||
alterId = tonumber(user.alter_id)
|
||||
}
|
||||
@ -48,9 +49,21 @@ function gen_config(user)
|
||||
method = user.method,
|
||||
password = user.password,
|
||||
level = tonumber(user.level) or 1,
|
||||
network = user.ss_network or "TCP,UDP",
|
||||
ota = (user.ss_ota == '1') and true or false
|
||||
network = user.ss_network or "TCP,UDP"
|
||||
}
|
||||
elseif user.protocol == "trojan" then
|
||||
if user.uuid then
|
||||
local clients = {}
|
||||
for i = 1, #user.uuid do
|
||||
clients[i] = {
|
||||
password = user.uuid[i],
|
||||
level = tonumber(user.level)
|
||||
}
|
||||
end
|
||||
settings = {
|
||||
clients = clients
|
||||
}
|
||||
end
|
||||
elseif user.protocol == "mtproto" then
|
||||
settings = {
|
||||
users = {
|
||||
@ -76,7 +89,7 @@ function gen_config(user)
|
||||
if user.transit_node and user.transit_node ~= "nil" then
|
||||
local node = ucic:get_all("passwall", user.transit_node)
|
||||
if node and node ~= "nil" and node.type and node.type == "V2ray" then
|
||||
if node.transport == "mkcp" or node.transport == "ds" or node.transport == "quic" then
|
||||
if node.transport == "mkcp" or node.transport == "quic" then
|
||||
node.stream_security = "none"
|
||||
end
|
||||
local transit_node = {
|
||||
@ -90,6 +103,10 @@ function gen_config(user)
|
||||
streamSettings = {
|
||||
network = node.transport,
|
||||
security = node.stream_security,
|
||||
xtlsSettings = (node.stream_security == "xtls") and {
|
||||
serverName = node.tls_serverName,
|
||||
allowInsecure = (node.tls_allowInsecure == "1") and true or false
|
||||
} or nil,
|
||||
tlsSettings = (node.stream_security == "tls") and {
|
||||
disableSessionResumption = node.sessionTicket ~= "1" and true or false,
|
||||
serverName = node.tls_serverName,
|
||||
@ -98,12 +115,12 @@ function gen_config(user)
|
||||
tcpSettings = (node.transport == "tcp") and {
|
||||
header = {
|
||||
type = node.tcp_guise,
|
||||
request = {
|
||||
request = (node.tcp_guise == "http") and {
|
||||
path = node.tcp_guise_http_path or {"/"},
|
||||
headers = {
|
||||
Host = node.tcp_guise_http_host or {}
|
||||
}
|
||||
} or {}
|
||||
} or nil
|
||||
}
|
||||
} or nil,
|
||||
kcpSettings = (node.transport == "mkcp") and {
|
||||
@ -143,19 +160,19 @@ function gen_config(user)
|
||||
id = node.uuid,
|
||||
alterId = tonumber(node.alter_id),
|
||||
level = node.level and tonumber(node.level) or 0,
|
||||
security = node.security,
|
||||
encryption = node.encryption or "none"
|
||||
security = (node.protocol == "vmess") and node.security or nil,
|
||||
encryption = node.encryption or "none",
|
||||
flow = (node.stream_security == "xtls") and node.flow or nil
|
||||
}
|
||||
}
|
||||
}
|
||||
} or nil,
|
||||
servers = (node.protocol == "http" or node.protocol == "socks" or node.protocol == "shadowsocks") and {
|
||||
servers = (node.protocol == "http" or node.protocol == "socks" or node.protocol == "shadowsocks" or node.protocol == "trojan") and {
|
||||
{
|
||||
address = node.address,
|
||||
port = tonumber(node.port),
|
||||
method = node.v_ss_encrypt_method,
|
||||
password = node.password or "",
|
||||
ota = (node.ss_ota == '1') and true or false,
|
||||
users = (node.username and node.password) and
|
||||
{
|
||||
{
|
||||
@ -185,10 +202,18 @@ function gen_config(user)
|
||||
settings = settings,
|
||||
streamSettings = {
|
||||
network = user.transport,
|
||||
security = (user.stream_security == 'tls') and "tls" or "none",
|
||||
security = user.stream_security,
|
||||
xtlsSettings = (user.stream_security == 'xtls') and {
|
||||
--alpn = {"http/1.1"},
|
||||
disableSystemRoot = false,
|
||||
certificates = {
|
||||
{
|
||||
certificateFile = user.tls_certificateFile,
|
||||
keyFile = user.tls_keyFile
|
||||
}
|
||||
}
|
||||
} or nil,
|
||||
tlsSettings = (user.stream_security == 'tls') and {
|
||||
disableSessionResumption = user.sessionTicket ~= "1" and true or false,
|
||||
allowInsecure = false,
|
||||
disableSystemRoot = false,
|
||||
certificates = {
|
||||
{
|
||||
@ -200,12 +225,12 @@ function gen_config(user)
|
||||
tcpSettings = (user.transport == "tcp") and {
|
||||
header = {
|
||||
type = user.tcp_guise,
|
||||
request = {
|
||||
request = (user.tcp_guise == "http") and {
|
||||
path = user.tcp_guise_http_path or {"/"},
|
||||
headers = {
|
||||
Host = user.tcp_guise_http_host or {}
|
||||
}
|
||||
} or {}
|
||||
} or nil
|
||||
}
|
||||
} or nil,
|
||||
kcpSettings = (user.transport == "mkcp") and {
|
||||
@ -220,6 +245,7 @@ function gen_config(user)
|
||||
header = {type = user.mkcp_guise}
|
||||
} or nil,
|
||||
wsSettings = (user.transport == "ws") and {
|
||||
acceptProxyProtocol = false,
|
||||
headers = (user.ws_host) and {Host = user.ws_host} or nil,
|
||||
path = user.ws_path
|
||||
} or nil,
|
||||
@ -242,7 +268,7 @@ function gen_config(user)
|
||||
routing = routing
|
||||
}
|
||||
|
||||
if user.transport == "mkcp" or user.transport == "ds" or user.transport == "quic" then
|
||||
if user.transport == "mkcp" or user.transport == "quic" then
|
||||
config.inbounds[1].streamSettings.security = "none"
|
||||
config.inbounds[1].streamSettings.tlsSettings = nil
|
||||
end
|
||||
|
||||
@ -44,6 +44,16 @@ e.width = "15%"
|
||||
|
||||
---- Type
|
||||
e = t:option(DummyValue, "type", translate("Type"))
|
||||
e.cfgvalue = function(t, n)
|
||||
local v = Value.cfgvalue(t, n)
|
||||
if v then
|
||||
if v == "V2ray" then
|
||||
local protocol = m:get(n, "protocol")
|
||||
return v .. " -> " .. protocol
|
||||
end
|
||||
return v
|
||||
end
|
||||
end
|
||||
|
||||
e = t:option(DummyValue, "port", translate("Port"))
|
||||
|
||||
|
||||
@ -102,6 +102,7 @@ protocol:value("vless", "VLESS")
|
||||
protocol:value("http", "HTTP")
|
||||
protocol:value("socks", "Socks")
|
||||
protocol:value("shadowsocks", "Shadowsocks")
|
||||
protocol:value("trojan", "Trojan")
|
||||
protocol:value("mtproto", "MTProto")
|
||||
protocol:depends("type", "V2ray")
|
||||
|
||||
@ -133,9 +134,9 @@ username.validate = function(self, value, t)
|
||||
end
|
||||
return value
|
||||
end
|
||||
username:depends("protocol", "http")
|
||||
username:depends("protocol", "socks")
|
||||
username:depends("type", "Socks")
|
||||
username:depends({ type = "V2ray", protocol = "http" })
|
||||
username:depends({ type = "V2ray", protocol = "socks" })
|
||||
|
||||
password = s:option(Value, "password", translate("Password"))
|
||||
password.password = true
|
||||
@ -169,7 +170,7 @@ end
|
||||
|
||||
decryption = s:option(Value, "decryption", translate("Encrypt Method"))
|
||||
decryption.default = "none"
|
||||
decryption:depends("protocol", "vless")
|
||||
decryption:depends({ type = "V2ray", protocol = "vless" })
|
||||
|
||||
ss_encrypt_method = s:option(ListValue, "ss_encrypt_method", translate("Encrypt Method"))
|
||||
for a, t in ipairs(ss_encrypt_method_list) do ss_encrypt_method:value(t) end
|
||||
@ -193,7 +194,7 @@ end
|
||||
|
||||
v_ss_encrypt_method = s:option(ListValue, "v_ss_encrypt_method", translate("Encrypt Method"))
|
||||
for a, t in ipairs(v_ss_encrypt_method_list) do v_ss_encrypt_method:value(t) end
|
||||
v_ss_encrypt_method:depends("protocol", "shadowsocks")
|
||||
v_ss_encrypt_method:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
function v_ss_encrypt_method.cfgvalue(self, section)
|
||||
return m:get(section, "method")
|
||||
end
|
||||
@ -206,17 +207,7 @@ ss_network.default = "tcp,udp"
|
||||
ss_network:value("tcp", "TCP")
|
||||
ss_network:value("udp", "UDP")
|
||||
ss_network:value("tcp,udp", "TCP,UDP")
|
||||
ss_network:depends("protocol", "shadowsocks")
|
||||
|
||||
ss_ota = s:option(Flag, "ss_ota", translate("OTA"), translate("When OTA is enabled, a connection that is not OTA enabled is rejected. This option is invalid when using AEAD encryption."))
|
||||
ss_ota.default = "0"
|
||||
ss_ota:depends("protocol", "shadowsocks")
|
||||
function ss_ota.cfgvalue(self, section)
|
||||
return m:get(section, "ota")
|
||||
end
|
||||
function ss_ota.write(self, section, value)
|
||||
m:set(section, "ota", value)
|
||||
end
|
||||
ss_network:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
|
||||
ssr_protocol = s:option(ListValue, "ssr_protocol", translate("Protocol"))
|
||||
for a, t in ipairs(ssr_protocol_list) do ssr_protocol:value(t) end
|
||||
@ -258,12 +249,13 @@ udp_forward.default = "1"
|
||||
udp_forward.rmempty = false
|
||||
udp_forward:depends("type", "SSR")
|
||||
|
||||
uuid = s:option(DynamicList, "uuid", translate("ID"))
|
||||
uuid = s:option(DynamicList, "uuid", translate("ID") .. "/" .. translate("Password"))
|
||||
for i = 1, 3 do
|
||||
uuid:value(api.gen_uuid())
|
||||
uuid:value(api.gen_uuid(1))
|
||||
end
|
||||
uuid:depends({ type = "V2ray", protocol = "vmess" })
|
||||
uuid:depends({ type = "V2ray", protocol = "vless" })
|
||||
uuid:depends({ type = "V2ray", protocol = "trojan" })
|
||||
uuid:depends("type", "Trojan-Go")
|
||||
|
||||
alter_id = s:option(Value, "alter_id", translate("Alter ID"))
|
||||
@ -275,16 +267,19 @@ level.default = 1
|
||||
level:depends({ type = "V2ray", protocol = "vmess" })
|
||||
level:depends({ type = "V2ray", protocol = "vless" })
|
||||
level:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
level:depends({ type = "V2ray", protocol = "trojan" })
|
||||
level:depends({ type = "V2ray", protocol = "mtproto" })
|
||||
|
||||
stream_security = s:option(ListValue, "stream_security", translate("Transport Layer Encryption"), translate('Whether or not transport layer encryption is enabled, the supported options are "none" for unencrypted and "TLS" for using TLS.'))
|
||||
stream_security = s:option(ListValue, "stream_security", translate("Transport Layer Encryption"), translate('Whether or not transport layer encryption is enabled, "none" for unencrypted, "tls" for using TLS, "xtls" for using XTLS.'))
|
||||
stream_security:value("none", "none")
|
||||
stream_security:value("tls", "tls")
|
||||
stream_security:value("xtls", "xtls")
|
||||
stream_security.default = "none"
|
||||
stream_security:depends({ type = "V2ray", protocol = "vmess" })
|
||||
stream_security:depends({ type = "V2ray", protocol = "vless" })
|
||||
stream_security:depends({ type = "V2ray", protocol = "socks" })
|
||||
stream_security:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
stream_security:depends({ type = "V2ray", protocol = "trojan" })
|
||||
stream_security:depends("type", "Trojan")
|
||||
stream_security:depends("type", "Trojan-Plus")
|
||||
stream_security:depends("type", "Trojan-Go")
|
||||
@ -294,24 +289,37 @@ stream_security.validate = function(self, value)
|
||||
end
|
||||
return value
|
||||
end
|
||||
|
||||
flow = s:option(Value, "flow", translate("flow"))
|
||||
flow.default = "xtls-rprx-origin"
|
||||
flow:value("xtls-rprx-origin")
|
||||
flow:value("xtls-rprx-origin-udp443")
|
||||
flow:depends("stream_security", "xtls")
|
||||
|
||||
-- [[ TLS部分 ]] --
|
||||
|
||||
tls_sessionTicket = s:option(Flag, "tls_sessionTicket", translate("Session Ticket"))
|
||||
tls_sessionTicket.default = "0"
|
||||
tls_sessionTicket:depends("stream_security", "tls")
|
||||
tls_sessionTicket:depends({ type = "Trojan", stream_security = "tls" })
|
||||
tls_sessionTicket:depends({ type = "Trojan-Plus", stream_security = "tls" })
|
||||
tls_sessionTicket:depends({ type = "Trojan-Go", stream_security = "tls" })
|
||||
|
||||
tls_serverName = s:option(Value, "tls_serverName", translate("Domain"))
|
||||
tls_serverName:depends("stream_security", "tls")
|
||||
tls_serverName:depends("stream_security", "xtls")
|
||||
|
||||
tls_allowInsecure = s:option(Flag, "tls_allowInsecure", translate("allowInsecure"), translate("Whether unsafe connections are allowed. When checked, Certificate validation will be skipped."))
|
||||
tls_allowInsecure.default = "0"
|
||||
tls_allowInsecure:depends("stream_security", "tls")
|
||||
tls_allowInsecure:depends("stream_security", "xtls")
|
||||
|
||||
tls_certificateFile = s:option(Value, "tls_certificateFile", translate("Public key absolute path"), translate("as:") .. "/etc/ssl/fullchain.pem")
|
||||
tls_certificateFile:depends("stream_security", "tls")
|
||||
tls_certificateFile:depends("stream_security", "xtls")
|
||||
|
||||
tls_keyFile = s:option(Value, "tls_keyFile", translate("Private key absolute path"), translate("as:") .. "/etc/ssl/private.key")
|
||||
tls_keyFile:depends("stream_security", "tls")
|
||||
tls_keyFile:depends("stream_security", "xtls")
|
||||
|
||||
transport = s:option(ListValue, "transport", translate("Transport"))
|
||||
transport:value("tcp", "TCP")
|
||||
@ -324,6 +332,7 @@ transport:depends({ type = "V2ray", protocol = "vmess" })
|
||||
transport:depends({ type = "V2ray", protocol = "vless" })
|
||||
transport:depends({ type = "V2ray", protocol = "socks" })
|
||||
transport:depends({ type = "V2ray", protocol = "shadowsocks" })
|
||||
transport:depends({ type = "V2ray", protocol = "trojan" })
|
||||
|
||||
trojan_transport = s:option(ListValue, "trojan_transport", translate("Transport"))
|
||||
trojan_transport:value("original", "Original")
|
||||
|
||||
@ -931,8 +931,8 @@ msgstr "伪装类型"
|
||||
msgid "Transport Layer Encryption"
|
||||
msgstr "传输层加密"
|
||||
|
||||
msgid "Whether or not transport layer encryption is enabled, the supported options are \"none\" for unencrypted and \"TLS\" for using TLS."
|
||||
msgstr "是否启入传输层加密,支持的选项有 \"none\" 表示不加密,\"tls\" 表示使用 TLS。"
|
||||
msgid "Whether or not transport layer encryption is enabled, \"none\" for unencrypted, \"tls\" for using TLS, \"xtls\" for using XTLS."
|
||||
msgstr "是否启入传输层加密,支持的选项有 \"none\" 表示不加密,\"tls\" 表示使用 TLS,\"xtls\" 表示使用 XTLS。"
|
||||
|
||||
msgid "'none' not supported for original Trojan, please choose 'tls'."
|
||||
msgstr "原版Trojan不支持'none',请选择TLS。"
|
||||
@ -1003,9 +1003,6 @@ msgstr "当你隐藏后想再次显示,地址栏输入例:"
|
||||
msgid "The MTProto protocol must be 32 characters and can only contain characters from 0 to 9 and a to f."
|
||||
msgstr "MTProto 协议必须为 32 个字符,仅可包含 0 到 9 和 a 到 f 之间的字符。"
|
||||
|
||||
msgid "When OTA is enabled, a connection that is not OTA enabled is rejected. This option is invalid when using AEAD encryption."
|
||||
msgstr "开启 OTA 后,将拒绝未启用 OTA 的连接。当使用 AEAD 加密时,该选项无效。"
|
||||
|
||||
msgid "transit node"
|
||||
msgstr "中转到此节点"
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user