Skip to content

Commit

Permalink
update@20201128
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Nov 28, 2020
1 parent 1ae06c1 commit cb9cb64
Show file tree
Hide file tree
Showing 25 changed files with 515 additions and 1,952 deletions.
8 changes: 4 additions & 4 deletions luci-app-jd-dailybonus/luasrc/controller/jd-dailybonus.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ function index()
if not nixio.fs.access("/etc/config/jd-dailybonus") then
return
end

entry({"admin", "services", "jd-dailybonus"}, alias("admin", "services", "jd-dailybonus", "client"), _("JD-DailyBonus"), 10).dependent = true -- 首页
entry({"admin", "services", "jd-dailybonus", "client"}, cbi("jd-dailybonus/client"),_("Client"), 10).leaf = true -- 基本设置
entry({"admin", "services", "jd-dailybonus", "log"},form("jd-dailybonus/log"),_("Log"), 30).leaf = true -- 日志页面
Expand All @@ -32,7 +32,7 @@ function run()
local failed = luci.http.formvalue("failed")
local name = ""
uci:foreach("vssr", "global", function(s) name = s[".name"] end)

if cookie ~= " " then
uci:set("jd-dailybonus", '@global[0]', 'auto_update', auto_update)
uci:set("jd-dailybonus", '@global[0]', 'auto_update_time', auto_update_time)
Expand All @@ -43,8 +43,8 @@ function run()
uci:set("jd-dailybonus", '@global[0]', 'cookie2', cookie2)
uci:set("jd-dailybonus", '@global[0]', 'serverchan', serverchan)
uci:set("jd-dailybonus", '@global[0]', 'failed', failed)
uci:save("jd-dailybonus")
uci:commit("jd-dailybonus")
uci:save("jd-dailybonus")
uci:commit("jd-dailybonus")
luci.sys.call("/usr/share/jd-dailybonus/newapp.sh -r")
luci.sys.call("/usr/share/jd-dailybonus/newapp.sh -a")
e.error = 0
Expand Down
2 changes: 1 addition & 1 deletion luci-app-jd-dailybonus/root/etc/config/jd-dailybonus
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
config global
option version '1.79'
option version '1.85'
option auto_run_time '1'
option auto_run '1'
option auto_update_time '1'
Expand Down
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
669 changes: 323 additions & 346 deletions luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/JD_DailyBonus.js

Large diffs are not rendered by default.

43 changes: 21 additions & 22 deletions luci-app-jd-dailybonus/root/usr/share/jd-dailybonus/newapp.sh
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,6 @@ cancel() {
exit 1
}

REMOTE_SCRIPT=$(uci_get_by_type global remote_url)

fill_cookie() {
cookie1=$(uci_get_by_type global cookie)
if [ ! "$cookie1" = "" ]; then
Expand All @@ -77,18 +75,6 @@ fill_cookie() {
fi
}

if [ -e $TEMP_SCRIPT ]; then
remote_ver=$(cat $TEMP_SCRIPT | sed -n '/更新时间/p' | awk '{for (i=1;i<=NF;i++){if ($i ~/v/) {print $i}}}' | sed 's/v//')
else
remote_ver=$(cat $JD_SCRIPT | sed -n '/更新时间/p' | awk '{for (i=1;i<=NF;i++){if ($i ~/v/) {print $i}}}' | sed 's/v//')
fi
## local_ver=$(uci_get_by_type global version)
if [ -e $JD_SCRIPT ]; then
local_ver=$(cat $JD_SCRIPT | sed -n '/更新时间/p' | awk '{for (i=1;i<=NF;i++){if ($i ~/v/) {print $i}}}' | sed 's/v//')
else
local_ver='1'
fi

add_cron() {
sed -i '/jd-dailybonus/d' $CRON_FILE
[ $(uci_get_by_type global auto_run 0) -eq 1 ] && echo '5 '$(uci_get_by_type global auto_run_time)' * * * sleep '$(expr $(head -n 128 /dev/urandom | tr -dc "0123456789" | head -c4) % 180)'s; /usr/share/jd-dailybonus/newapp.sh -w' >>$CRON_FILE
Expand Down Expand Up @@ -123,15 +109,12 @@ serverchan() {
run() {
fill_cookie
echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_HTM 2>/dev/null
[ ! -f "/usr/bin/node" ] && echo "未安装node,请安装后再试!">>$LOG_HTM && exit 1
[ ! -f "/usr/bin/node" ] && echo -e "未安装node.js,请安装后再试!\nNode.js is not installed, please try again after installation!">>$LOG_HTM && exit 1
node $JD_SCRIPT >>$LOG_HTM 2>&1 &
}

back_run() {
fill_cookie
echo -e $(date '+%Y-%m-%d %H:%M:%S %A') >$LOG_HTM 2>/dev/null
[ ! -f "/usr/bin/node" ] && echo "未安装node,请安装后再试!">>$LOG_HTM && exit 1
node $JD_SCRIPT >>$LOG_HTM 2>/dev/null
run
serverchan
}

Expand All @@ -141,22 +124,38 @@ save() {
}

# Update Script From Server
download() {
REMOTE_SCRIPT=$(uci_get_by_type global remote_url)
wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT
return $?
}

get_ver() {
echo $(cat $1 | sed -n '/更新时间/p' | awk '{for (i=1;i<=NF;i++){if ($i ~/v/) {print $i}}}' | sed 's/v//')
}

check_ver() {
wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT
download
if [ $? -ne 0 ]; then
cancel "501"
else
remote_ver=$(get_ver $TEMP_SCRIPT)
echo $remote_ver
fi
}

update() {
wget-ssl --user-agent="Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/77.0.3865.90 Safari/537.36" --no-check-certificate -t 3 -T 10 -q $REMOTE_SCRIPT -O $TEMP_SCRIPT
download
if [ $? -ne 0 ]; then
cancel "501"
fi
if [ $(expr $local_ver \< $remote_ver) -eq 1 ]; then
if [ -e $JD_SCRIPT ]; then
local_ver=$(get_ver $JD_SCRIPT)
else
local_ver=0
fi
remote_ver=$(get_ver $TEMP_SCRIPT)
if [ $(expr "$local_ver" \< "$remote_ver") -eq 1 ]; then
cp -r $TEMP_SCRIPT $JD_SCRIPT
fill_cookie
uci set jd-dailybonus.@global[0].version=$remote_ver
Expand Down
109 changes: 56 additions & 53 deletions luci-app-openclash/root/etc/init.d/openclash
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,19 @@ yml_check()
cp "$1" "$2"
fi

#检查DNS服务
dns_port="$(ruby_read "$1" "['dns']['listen'].split(':')[1]")"
if [ -z "$dns_port" ] || [ "$dns_port" -eq 53 ]; then
dns_port=7874
fi

#保存DNS端口方便后续调用
uci set openclash.config.dns_port="$dns_port" && uci commit openclash

}

yml_dns_check()
{
#检查DNS服务
if [ -z "$(ruby_read "$1" "['dns']['nameserver']")" ]; then
echo "检测到DNS选项下的Nameserver未设置服务器,开始补全..." >$START_LOG
echo " nameserver:" > "$DNS_FILE" 2>/dev/null
Expand All @@ -156,15 +168,32 @@ EOF
ruby_merge "$1" "['dns']" "$DNS_FILE"
fi
fi

dns_port="$(ruby_read "$1" "['dns']['listen'].split(':')[1]")"
if [ -z "$dns_port" ] || [ "$dns_port" -eq 53 ]; then
dns_port=7874

#fallback-filter
if [ -n "$(ruby_read "$CONFIG_FILE" "['dns']['fallback']")" ] && [ -z "$(ruby_read "$CONFIG_FILE" "['dns']['fallback-filter']")" ]; then
cat >> "$2" <<-EOF
fallback-filter:
geoip: true
ipcidr:
- 0.0.0.0/8
- 10.0.0.0/8
- 100.64.0.0/10
- 127.0.0.0/8
- 169.254.0.0/16
- 172.16.0.0/12
- 192.0.0.0/24
- 192.0.2.0/24
- 192.88.99.0/24
- 192.168.0.0/16
- 198.18.0.0/15
- 198.51.100.0/24
- 203.0.113.0/24
- 224.0.0.0/4
- 240.0.0.0/4
- 255.255.255.255/32
EOF
fi

#保存DNS端口方便后续调用
uci set openclash.config.dns_port="$dns_port" && uci commit openclash

ruby_merge "$CONFIG_FILE" "['dns']" "$2"
}

#修改集路径
Expand Down Expand Up @@ -195,8 +224,7 @@ yml_provider_path()
File.open('$1','w') {|f| YAML.dump(Value, f)}
end
rescue Exception => e
print '${LOGTIME} Edit Provider Path Error: '
puts e.message
puts '${LOGTIME} Edit Provider Path Error: ' + e.message
end
" 2>/dev/null >> $LOG_FILE
}
Expand Down Expand Up @@ -318,42 +346,21 @@ yml_dns_custom()
config_load "openclash"
config_foreach yml_dns_get "dns_servers"
if [ -f "/tmp/yaml_config.namedns.yaml" ]; then
ruby_edit "$CONFIG_FILE" "['dns']['nameserver'].clear"
ruby_edit "$CONFIG_FILE" "['dns']['fallback'].clear"
ruby_merge "$CONFIG_FILE" "['dns']" "/tmp/yaml_config.namedns.yaml"
ruby_merge "$CONFIG_FILE" "['dns']" "/tmp/yaml_config.falldns.yaml"
if [ -z "$(ruby_read "$CONFIG_FILE" "['dns']")" ]; then
ruby_cover "$CONFIG_FILE" "['dns']" "/tmp/yaml_config.namedns.yaml"
ruby_merge "$CONFIG_FILE" "['dns']" "/tmp/yaml_config.falldns.yaml"
else
ruby_edit "$CONFIG_FILE" "['dns']['nameserver'].clear"
ruby_edit "$CONFIG_FILE" "['dns']['fallback'].clear"
ruby_merge "$CONFIG_FILE" "['dns']" "/tmp/yaml_config.namedns.yaml"
ruby_merge "$CONFIG_FILE" "['dns']" "/tmp/yaml_config.falldns.yaml"
fi
else
echo "错误: 配置文件DNS选项下的Nameserver必须设置服务器,已停止设置自定义DNS服务器!" >$START_LOG
echo "${LOGTIME} Error: Nameserver Option Must Be Setted, Stop Customing DNS Servers" >>$LOG_FILE
sleep 3
sleep 2
fi
fi

#fallback-filter
if [ -n "$(ruby_read "$CONFIG_FILE" "['dns']['fallback']")" ] && [ -z "$(ruby_read "$CONFIG_FILE" "['dns']['fallback-filter']")" ]; then
cat >> "$3" <<-EOF
fallback-filter:
geoip: true
ipcidr:
- 0.0.0.0/8
- 10.0.0.0/8
- 100.64.0.0/10
- 127.0.0.0/8
- 169.254.0.0/16
- 172.16.0.0/12
- 192.0.0.0/24
- 192.0.2.0/24
- 192.88.99.0/24
- 192.168.0.0/16
- 198.18.0.0/15
- 198.51.100.0/24
- 203.0.113.0/24
- 224.0.0.0/4
- 240.0.0.0/4
- 255.255.255.255/32
EOF
fi
ruby_merge "$CONFIG_FILE" "['dns']" "$3"
}

#获取认证信息
Expand Down Expand Up @@ -474,8 +481,7 @@ else
end;
File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)}
rescue Exception => e
print '${LOGTIME} Game Rule Merge Error: '
puts e.message
puts '${LOGTIME} Game Rule Merge Error: ' + e.message
end
" 2>/dev/null >> $LOG_FILE
}
Expand Down Expand Up @@ -516,8 +522,7 @@ if File::exist?('/tmp/yaml_provider.yaml') then
end;
File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)}
rescue Exception => e
print '${LOGTIME} Game Proxy Merge Error: '
puts e.message
puts '${LOGTIME} Game Proxy Merge Error: ' + e.message
end" 2>/dev/null >> $LOG_FILE
}

Expand All @@ -540,8 +545,7 @@ else
end;
File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)}
rescue Exception => e
print '${LOGTIME} Rule Set Add Error: '
puts e.message
puts '${LOGTIME} Rule Set Add Error: ' + e.message
end
" 2>/dev/null >> $LOG_FILE
}
Expand Down Expand Up @@ -692,8 +696,7 @@ yml_custom_rule_provider()
end;
File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value, f)}
rescue Exception => e
print '${LOGTIME} Custom Rule Provider Merge Error: '
puts e.message
puts '${LOGTIME} Custom Rule Provider Merge Error: ' + e.message
end
" 2>/dev/null >> $LOG_FILE
fi
Expand Down Expand Up @@ -1013,8 +1016,7 @@ try_restore_start()
end;
File.open('$CONFIG_FILE','w') {|f| YAML.dump(Value_1, f)}
rescue Exception => e
print '${LOGTIME} Restore Backup Rules Error: '
puts e.message
puts '${LOGTIME} Restore Backup Rules Error: ' + e.message
end
" 2>/dev/null >> $LOG_FILE
start_run_core
Expand Down Expand Up @@ -1507,13 +1509,14 @@ start()
config_load "openclash"
config_foreach yml_auth_get "authentication"
yml_auth_custom "$CONFIG_FILE"
yml_dns_custom "$enable_custom_dns" "$CONFIG_FILE" "$FALLBACK_FILTER_FILE"
yml_dns_custom "$enable_custom_dns" "$CONFIG_FILE"
/usr/share/openclash/yml_change.sh 2>/dev/null "$LOGTIME" "$en_mode" "$enable_custom_dns" "$da_password" "$cn_port" "$proxy_port" "$CONFIG_FILE" "$ipv6_enable" "$http_port" "$socks_port" "$lan_ip" "$log_level" "$proxy_mode" "$intranet_allowed" "$en_mode_tun" "$stack_type" "$dns_port" "$core_type" "$mixed_port"
/usr/share/openclash/yml_rules_change.sh 2>/dev/null "$LOGTIME" "$rule_source" "$enable_custom_clash_rules" "$CONFIG_FILE" "$set_rule_file" "$en_mode" "$enable_rule_proxy" "$RAW_CONFIG_FILE" "$RULE_PROVIDER_FILE"
yml_custom_rule_provider
yml_game_custom
yml_provider_path "$CONFIG_FILE" "proxy-providers" "proxy_provider"
yml_provider_path "$CONFIG_FILE" "rule-providers" "rule_provider"
yml_dns_check "$CONFIG_FILE" "$FALLBACK_FILTER_FILE"

echo "第四步: 启动主程序..." >$START_LOG
start_run_core
Expand Down
Loading

0 comments on commit cb9cb64

Please sign in to comment.