From 6d874586334476929b5b73103ced68e49552ed36 Mon Sep 17 00:00:00 2001
From: woniuzfb <47843848+woniuzfb@users.noreply.github.com>
Date: Tue, 19 Mar 2024 20:53:06 +0800
Subject: [PATCH] fix
---
core | 2 +-
docs/iptv.sh | 45 +--
iptv.sh | 45 +--
..._lua_resp_get_headers_key_whitespace.patch | 6 +-
scripts/node-libcurl-impersonate.patch | 12 +-
src/iptv/menu_monitor | 2 +-
src/lhh | 6 +-
src/nginx/add_domain | 278 +++++++++---------
src/nginx/config_server | 37 +--
src/nx | 47 +--
src/or | 16 +-
utils/curl | 34 ++-
12 files changed, 268 insertions(+), 262 deletions(-)
diff --git a/core b/core
index 8651122..8ee0b0b 100644
--- a/core
+++ b/core
@@ -93,7 +93,7 @@ CurlFake()
"${CURL_IMPERSONATE_FILE}-$service_name" "$@"
return 0
fi
- curl-impersonate "$@"
+ $CURL_IMPERSONATE_FILE "$@"
}
SetDelimiters()
diff --git a/docs/iptv.sh b/docs/iptv.sh
index 375bc4e..6fa0697 100755
--- a/docs/iptv.sh
+++ b/docs/iptv.sh
@@ -84,6 +84,8 @@ dim_underlined='\033[37;4;2m'
indent_6='\r\033[6C'
indent_20='\r\033[20C'
+shopt -s extglob
+
Println()
{
printf '\n%b\n' "$1"
@@ -22537,7 +22539,7 @@ TsMenu()
AntiDDoSSet()
{
- if [ -x "$(command -v ufw)" ] && [ -s "$nginx_prefix/logs/access.log" ] && ls -A $LIVE_ROOT/* > /dev/null 2>&1
+ if [[ -x "$(command -v ufw)" ]] && [ -s "$nginx_prefix/logs/access.log" ] && ls -A $LIVE_ROOT/* > /dev/null 2>&1
then
sleep 1
@@ -27716,7 +27718,7 @@ OpenrestyInstall()
mv $openssl_name $openssl_name-patched
cd $openssl_name-patched
curl -s -L "$FFMPEG_MIRROR_LINK/openssl-1.1.1f-sess_set_get_cb_yield.patch" -o openssl-1.1.1f-sess_set_get_cb_yield.patch
- patch -p1 < openssl-1.1.1f-sess_set_get_cb_yield.patch >/dev/null 2>&1
+ patch -p1 < openssl-1.1.1f-sess_set_get_cb_yield.patch >/dev/null 2>&1 || true
cd ~
fi
@@ -27725,7 +27727,7 @@ OpenrestyInstall()
cd "$openresty_package_name/bundle/ngx_lua-"*
curl -s -L "$FFMPEG_MIRROR_LINK/fix_ngx_lua_resp_get_headers_key_whitespace.patch" -o fix_ngx_lua_resp_get_headers_key_whitespace.patch
- patch -p1 < fix_ngx_lua_resp_get_headers_key_whitespace.patch >/dev/null 2>&1
+ patch -p1 < fix_ngx_lua_resp_get_headers_key_whitespace.patch >/dev/null 2>&1 || true
cd ../..
@@ -27896,30 +27898,31 @@ NginxInstall()
fi
fi
- while IFS= read -r line
- do
- if [ "$openssl_options_index" -eq 0 ]
- then
- if [[ $line == *"openssl-1."* ]]
- then
- openssl_name=${line#*\K[^<]+'))
+
+ for openssl_ver in "${openssl_vers[@]}"
+ do
+ if [ "${openssl_ver%%.*}" -eq 1 ]
then
- openssl_name=${line#* /dev/null)
+ done
+ openssl_url="$openssl_url/$openssl_ver"
+ else
+ openssl_url="https://www.openssl.org/source"
+ fi
+
+ openssl_packs=($(curl -s -Lm 20 $openssl_url/ | grep -oP '
\K[^<]+'))
+ openssl_pack="${openssl_packs[0]}"
+ openssl_name=${openssl_pack%.tar*}
if [ ! -d "./$openssl_name" ]
then
- curl -s -L "https://www.openssl.org/source/$openssl_name.tar.gz" -o "$openssl_name.tar.gz"
- tar xzf "$openssl_name.tar.gz"
+ curl -s -L "$openssl_url/$openssl_pack" -o "$openssl_pack"
+ tar xzf "$openssl_pack"
fi
echo -n "...60%..."
diff --git a/iptv.sh b/iptv.sh
index 375bc4e..6fa0697 100755
--- a/iptv.sh
+++ b/iptv.sh
@@ -84,6 +84,8 @@ dim_underlined='\033[37;4;2m'
indent_6='\r\033[6C'
indent_20='\r\033[20C'
+shopt -s extglob
+
Println()
{
printf '\n%b\n' "$1"
@@ -22537,7 +22539,7 @@ TsMenu()
AntiDDoSSet()
{
- if [ -x "$(command -v ufw)" ] && [ -s "$nginx_prefix/logs/access.log" ] && ls -A $LIVE_ROOT/* > /dev/null 2>&1
+ if [[ -x "$(command -v ufw)" ]] && [ -s "$nginx_prefix/logs/access.log" ] && ls -A $LIVE_ROOT/* > /dev/null 2>&1
then
sleep 1
@@ -27716,7 +27718,7 @@ OpenrestyInstall()
mv $openssl_name $openssl_name-patched
cd $openssl_name-patched
curl -s -L "$FFMPEG_MIRROR_LINK/openssl-1.1.1f-sess_set_get_cb_yield.patch" -o openssl-1.1.1f-sess_set_get_cb_yield.patch
- patch -p1 < openssl-1.1.1f-sess_set_get_cb_yield.patch >/dev/null 2>&1
+ patch -p1 < openssl-1.1.1f-sess_set_get_cb_yield.patch >/dev/null 2>&1 || true
cd ~
fi
@@ -27725,7 +27727,7 @@ OpenrestyInstall()
cd "$openresty_package_name/bundle/ngx_lua-"*
curl -s -L "$FFMPEG_MIRROR_LINK/fix_ngx_lua_resp_get_headers_key_whitespace.patch" -o fix_ngx_lua_resp_get_headers_key_whitespace.patch
- patch -p1 < fix_ngx_lua_resp_get_headers_key_whitespace.patch >/dev/null 2>&1
+ patch -p1 < fix_ngx_lua_resp_get_headers_key_whitespace.patch >/dev/null 2>&1 || true
cd ../..
@@ -27896,30 +27898,31 @@ NginxInstall()
fi
fi
- while IFS= read -r line
- do
- if [ "$openssl_options_index" -eq 0 ]
- then
- if [[ $line == *"openssl-1."* ]]
- then
- openssl_name=${line#*\K[^<]+'))
+
+ for openssl_ver in "${openssl_vers[@]}"
+ do
+ if [ "${openssl_ver%%.*}" -eq 1 ]
then
- openssl_name=${line#* /dev/null)
+ done
+ openssl_url="$openssl_url/$openssl_ver"
+ else
+ openssl_url="https://www.openssl.org/source"
+ fi
+
+ openssl_packs=($(curl -s -Lm 20 $openssl_url/ | grep -oP ' | \K[^<]+'))
+ openssl_pack="${openssl_packs[0]}"
+ openssl_name=${openssl_pack%.tar*}
if [ ! -d "./$openssl_name" ]
then
- curl -s -L "https://www.openssl.org/source/$openssl_name.tar.gz" -o "$openssl_name.tar.gz"
- tar xzf "$openssl_name.tar.gz"
+ curl -s -L "$openssl_url/$openssl_pack" -o "$openssl_pack"
+ tar xzf "$openssl_pack"
fi
echo -n "...60%..."
diff --git a/scripts/fix_ngx_lua_resp_get_headers_key_whitespace.patch b/scripts/fix_ngx_lua_resp_get_headers_key_whitespace.patch
index 0ba8f23..4b118d2 100644
--- a/scripts/fix_ngx_lua_resp_get_headers_key_whitespace.patch
+++ b/scripts/fix_ngx_lua_resp_get_headers_key_whitespace.patch
@@ -1,8 +1,8 @@
diff --git a/src/ngx_http_lua_headers.c b/src/ngx_http_lua_headers.c
-index d8d5edc8..5466ae47 100644
+index 85836a1..ea526af 100644
--- a/src/ngx_http_lua_headers.c
+++ b/src/ngx_http_lua_headers.c
-@@ -417,7 +417,7 @@ ngx_http_lua_ngx_resp_get_headers(lua_State *L)
+@@ -429,7 +429,7 @@ ngx_http_lua_ngx_resp_get_headers(lua_State *L)
ngx_http_lua_ctx_t *ctx;
u_char *lowcase_key = NULL;
size_t lowcase_key_sz = 0;
@@ -11,7 +11,7 @@ index d8d5edc8..5466ae47 100644
int n;
int max;
int raw = 0;
-@@ -556,6 +556,29 @@ ngx_http_lua_ngx_resp_get_headers(lua_State *L)
+@@ -568,6 +568,29 @@ ngx_http_lua_ngx_resp_get_headers(lua_State *L)
continue;
}
diff --git a/scripts/node-libcurl-impersonate.patch b/scripts/node-libcurl-impersonate.patch
index 9c41cec..1b978fa 100644
--- a/scripts/node-libcurl-impersonate.patch
+++ b/scripts/node-libcurl-impersonate.patch
@@ -12,7 +12,7 @@ index a12448b..3ee0452 100644
tsconfig.tsbuildinfo
website/
diff --git a/lib/Curl.ts b/lib/Curl.ts
-index d2a419c..5d44ba3 100644
+index 14013df..7f89018 100644
--- a/lib/Curl.ts
+++ b/lib/Curl.ts
@@ -69,7 +69,7 @@ import { CurlReadFunc } from './enum/CurlReadFunc'
@@ -64,22 +64,22 @@ index 9bba413..bccbb1e 100644
/**
* This is a Node.js wrapper around the binding {@link EasyNativeBinding | native Easy class}.
diff --git a/package.json b/package.json
-index 15071fd..49350a8 100644
+index 4d392fc..633a602 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
- "name": "node-libcurl",
+ "name": "node-libcurl-impersonate",
- "version": "3.0.0",
+ "version": "4.0.0",
- "description": "The fastest http(s) client (and much more) for Node.js - Node.js bindings for libcurl",
+ "description": "The fastest http(s) client (and much more) for Node.js - Node.js bindings for libcurl (curl-impersonate)",
"keywords": [
"node-curl",
"curl",
-@@ -23,7 +23,7 @@
- "main": "./dist/index.js",
- "types": "./dist/index.d.ts",
+@@ -30,7 +30,7 @@
+ "LIBCURL_VERSION_WIN_DEPS"
+ ],
"binary": {
- "module_name": "node_libcurl",
+ "module_name": "node_libcurl-impersonate",
diff --git a/src/iptv/menu_monitor b/src/iptv/menu_monitor
index 2e63b9b..bcf6c91 100644
--- a/src/iptv/menu_monitor
+++ b/src/iptv/menu_monitor
@@ -20,7 +20,7 @@ MonitorMenu()
AntiDDoSSet()
{
- if [ -x "$(command -v ufw)" ] && [ -s "$nginx_prefix/logs/access.log" ] && ls -A $LIVE_ROOT/* > /dev/null 2>&1
+ if [[ -x "$(command -v ufw)" ]] && [ -s "$nginx_prefix/logs/access.log" ] && ls -A $LIVE_ROOT/* > /dev/null 2>&1
then
sleep 1
diff --git a/src/lhh b/src/lhh
index 456d20e..bc0e527 100644
--- a/src/lhh
+++ b/src/lhh
@@ -22,7 +22,7 @@ LhhDownload()
ZhLhhDownload()
{
local book_url="$1" title="$2" i j
- local book_path="$save_dir/$title"
+ local book_path="$save_dir/${title//\//_}"
i=2
until [ ! -d "$book_path" ]
@@ -465,7 +465,7 @@ reduce ({adapter,addtime,bookname,category_id,cover,drawing,m,muludir,original,p
HdlzZhihuDownload()
{
local id=$1 title=$2 i j
- local book_path="$save_dir/$title"
+ local book_path="$save_dir/${title//\//_}"
shift 2
i=2
@@ -548,7 +548,7 @@ HdlzZhihuDownload()
HdlzToutiaoDownload()
{
local id=$1 title=$2 i j
- local book_path="$save_dir/$title"
+ local book_path="$save_dir/${title//\//_}"
i=2
until [ ! -d "$book_path" ]
diff --git a/src/nginx/add_domain b/src/nginx/add_domain
index 0a59ba2..2db41da 100644
--- a/src/nginx/add_domain
+++ b/src/nginx/add_domain
@@ -3,179 +3,169 @@ NginxAddDomain()
NginxListDomains
Println "$tip 多个域名用空格分隔"
- read -p "输入指向本机的IP或域名: " domains
-
- if [ -n "$domains" ]
- then
- NginxCheckLocalhost
- NginxAddHttp
-
- IFS=" " read -ra new_domains <<< "$domains"
- for server_domain in "${new_domains[@]}"
- do
- if [ -e "$nginx_prefix/conf/sites_available/$server_domain.conf" ]
- then
- Println "$error $server_domain 已存在"
- continue
- fi
-
- if [[ $server_domain =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] || [[ ! $server_domain =~ ^([a-zA-Z0-9](([a-zA-Z0-9-]){0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$ ]]
- then
- server_num=1
- else
- Println "选择网站类型
-
- ${green}1.${normal} http
- ${green}2.${normal} http => https
- ${green}3.${normal} http + https
- \n"
- read -p "`gettext \"输入序号\"` [1-3]: " server_num
- fi
-
- case $server_num in
- 1)
+ ExitOnText "输入指向本机的IP或域名" domains
+
+ NginxCheckLocalhost
+ NginxAddHttp
+
+ new_domains=( $domains )
+ domain_options=( http 'http => https' 'http + https' )
+
+ for server_domain in "${new_domains[@]}"
+ do
+ if [ -e "$nginx_prefix/conf/sites_available/$server_domain.conf" ]
+ then
+ Println "$error $server_domain 已存在"
+ continue
+ fi
+
+ if [[ $server_domain =~ ^[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]] || [[ ! $server_domain =~ ^([a-zA-Z0-9](([a-zA-Z0-9-]){0,61}[a-zA-Z0-9])?\.)+[a-zA-Z]{2,}$ ]]
+ then
+ domain_options_index=0
+ else
+ echo
+ inquirer list_input_index "选择网站 $server_domain 类型" domain_options domain_options_index
+ fi
+
+ case $domain_options_index in
+ 0)
+ NginxConfigServerHttpPort
+ echo
+ inquirer list_input "是否设置跳转到其它网址" ny_options http_redirect_yn
+
+ if [ "$http_redirect_yn" == "$i18n_yes" ]
+ then
+ NginxAppendHttpRedirectConf
+ else
+ NginxConfigServerRoot
+ NginxConfigServerLiveRoot
+ NginxAppendHttpConf
+ fi
+
+ updated=0
+ NginxAddCorsHost
+ [ "$updated" -eq 1 ] && NginxBuildConf parse_out
+
+ NginxEnableDomain
+ Println "$info $server_domain 配置成功\n"
+ ;;
+ 1)
+ NginxDomainInstallCert "$server_domain"
+ echo
+ inquirer list_input "是否设置 http 跳转 https" yn_options http_to_https_yn
+
+ if [ "$http_to_https_yn" == "$i18n_yes" ]
+ then
+ Println "$info 设置 $server_domain http 配置"
+ NginxConfigServerHttpPort
+ NginxAppendHttpRedirectToHttpsConf
+ fi
+
+ NginxConfigServerHttpsPort
+ echo
+ inquirer list_input "是否设置 https 跳转到其它网址" ny_options https_redirect_yn
+
+ if [ "$https_redirect_yn" == "$i18n_yes" ]
+ then
+ NginxAppendHttpsRedirectConf
+ else
+ NginxConfigServerRoot
+ NginxConfigServerLiveRoot
+ NginxAppendHttpsConf
+ fi
+
+ updated=0
+ NginxAddCorsHost
+ [ "$updated" -eq 1 ] && NginxBuildConf parse_out
+
+ NginxEnableDomain
+ Println "$info $server_domain 配置成功\n"
+ ;;
+ 2)
+ NginxDomainInstallCert "$server_domain"
+ echo
+ inquirer list_input "http 和 https 是否使用相同的目录" yn_options http_https_same_dir_yn
+
+ if [ "$http_https_same_dir_yn" == "$i18n_yes" ]
+ then
NginxConfigServerHttpPort
- echo
- inquirer list_input "是否设置跳转到其它网址" ny_options http_redirect_yn
-
- if [ "$http_redirect_yn" == "$i18n_yes" ]
- then
- NginxAppendHttpRedirectConf
- else
- NginxConfigServerRoot
- NginxConfigServerLiveRoot
- NginxAppendHttpConf
- fi
-
- updated=0
- NginxAddCorsHost
- [ "$updated" -eq 1 ] && NginxBuildConf parse_out
-
- NginxEnableDomain
- Println "$info $server_domain 配置成功\n"
- ;;
- 2)
- NginxDomainInstallCert "$server_domain"
- echo
- inquirer list_input "是否设置 http 跳转 https" yn_options http_to_https_yn
-
- if [ "$http_to_https_yn" == "$i18n_yes" ]
- then
- Println "$info 设置 $server_domain http 配置"
- NginxConfigServerHttpPort
- NginxAppendHttpRedirectToHttpsConf
- fi
-
NginxConfigServerHttpsPort
echo
- inquirer list_input "是否设置 https 跳转到其它网址" ny_options https_redirect_yn
-
- if [ "$https_redirect_yn" == "$i18n_yes" ]
+ inquirer list_input "是否设置跳转到其它网址" ny_options http_https_redirect_yn
+ if [ "$http_https_redirect_yn" == "$i18n_yes" ]
then
- NginxAppendHttpsRedirectConf
+ NginxAppendHttpHttpsRedirectConf
else
NginxConfigServerRoot
NginxConfigServerLiveRoot
- NginxAppendHttpsConf
+ NginxAppendHttpHttpsConf
fi
-
- updated=0
- NginxAddCorsHost
- [ "$updated" -eq 1 ] && NginxBuildConf parse_out
-
- NginxEnableDomain
- Println "$info $server_domain 配置成功\n"
- ;;
- 3)
- NginxDomainInstallCert "$server_domain"
+ else
+ NginxConfigServerHttpPort
echo
- inquirer list_input "http 和 https 是否使用相同的目录" yn_options http_https_same_dir_yn
-
- if [ "$http_https_same_dir_yn" == "$i18n_yes" ]
+ inquirer list_input "是否设置 http 跳转到其它网址" ny_options http_redirect_yn
+ if [ "$http_redirect_yn" == "$i18n_yes" ]
then
- NginxConfigServerHttpPort
+ NginxAppendHttpRedirectConf
NginxConfigServerHttpsPort
+
echo
- inquirer list_input "是否设置跳转到其它网址" ny_options http_https_redirect_yn
- if [ "$http_https_redirect_yn" == "$i18n_yes" ]
+ inquirer list_input "是否设置 https 跳转到其它网址" yn_options https_redirect_yn
+
+ if [ "$https_redirect_yn" == "$i18n_yes" ]
then
- NginxAppendHttpHttpsRedirectConf
+ NginxAppendHttpsRedirectConf
else
NginxConfigServerRoot
NginxConfigServerLiveRoot
- NginxAppendHttpHttpsConf
+ NginxAppendHttpsConf
fi
else
- NginxConfigServerHttpPort
- echo
- inquirer list_input "是否设置 http 跳转到其它网址" ny_options http_redirect_yn
- if [ "$http_redirect_yn" == "$i18n_yes" ]
- then
- NginxAppendHttpRedirectConf
- NginxConfigServerHttpsPort
+ NginxConfigServerRoot
+ NginxConfigServerLiveRoot
- echo
- inquirer list_input "是否设置 https 跳转到其它网址" yn_options https_redirect_yn
+ server_http_root="$server_root"
+ server_http_live_root="$server_live_root"
+ server_http_deny="$deny_aliyun"
- if [ "$https_redirect_yn" == "$i18n_yes" ]
- then
- NginxAppendHttpsRedirectConf
- else
- NginxConfigServerRoot
- NginxConfigServerLiveRoot
- NginxAppendHttpsConf
- fi
+ NginxConfigServerHttpsPort
+
+ echo
+ inquirer list_input "是否设置 https 跳转到其它网址" yn_options https_redirect_yn
+
+ if [ "$https_redirect_yn" == "$i18n_yes" ]
+ then
+ NginxAppendHttpConf
+ NginxAppendHttpsRedirectConf
else
+ server_root=""
+ server_live_root=""
+ deny_aliyun=""
NginxConfigServerRoot
NginxConfigServerLiveRoot
- server_http_root="$server_root"
- server_http_live_root="$server_live_root"
- server_http_deny="$deny_aliyun"
-
- NginxConfigServerHttpsPort
+ server_https_root="$server_root"
+ server_https_live_root="$server_live_root"
+ server_https_deny="$deny_aliyun"
- echo
- inquirer list_input "是否设置 https 跳转到其它网址" yn_options https_redirect_yn
-
- if [ "$https_redirect_yn" == "$i18n_yes" ]
+ if [ "$server_http_root" == "$server_https_root" ] && [ "$server_http_live_root" == "$server_https_live_root" ] && [ "$server_http_deny" == "$server_https_deny" ]
then
- NginxAppendHttpConf
- NginxAppendHttpsRedirectConf
+ NginxAppendHttpHttpsConf
else
- server_root=""
- server_live_root=""
- deny_aliyun=""
- NginxConfigServerRoot
- NginxConfigServerLiveRoot
-
- server_https_root="$server_root"
- server_https_live_root="$server_live_root"
- server_https_deny="$deny_aliyun"
-
- if [ "$server_http_root" == "$server_https_root" ] && [ "$server_http_live_root" == "$server_https_live_root" ] && [ "$server_http_deny" == "$server_https_deny" ]
- then
- NginxAppendHttpHttpsConf
- else
- NginxAppendHttpConf
- NginxAppendHttpsConf
- fi
+ NginxAppendHttpConf
+ NginxAppendHttpsConf
fi
fi
fi
+ fi
+
+ updated=0
+ NginxAddCorsHost
+ [ "$updated" -eq 1 ] && NginxBuildConf parse_out
- updated=0
- NginxAddCorsHost
- [ "$updated" -eq 1 ] && NginxBuildConf parse_out
-
- NginxEnableDomain
- Println "$info $server_domain 配置成功\n"
- ;;
- *) Println "$i18n_canceled...\n" && exit 1
- ;;
- esac
- done
- else
- Println "$i18n_canceled...\n" && exit 1
- fi
+ NginxEnableDomain
+ Println "$info $server_domain 配置成功\n"
+ ;;
+ esac
+ done
}
diff --git a/src/nginx/config_server b/src/nginx/config_server
index 07388c6..d804a8b 100644
--- a/src/nginx/config_server
+++ b/src/nginx/config_server
@@ -12,21 +12,16 @@ NginxConfigServerHttpsPort()
NginxConfigServerRoot()
{
- Println "设置公开的根目录"
- while read -p "(默认: $nginx_prefix/html): " server_root
+ while true
do
- if [ -z "$server_root" ]
- then
- server_root="$nginx_prefix/html"
- break
- elif [ "${server_root:0:1}" != "/" ]
+ echo
+ inquirer text_input "设置公开的根目录" server_root "$nginx_prefix/html"
+
+ if [ "${server_root:0:1}" != "/" ]
then
Println "$error 输入错误\n"
else
- if [ "${server_root: -1}" == "/" ]
- then
- server_root=${server_root:0:-1}
- fi
+ server_root="${server_root%/}"
mkdir -p "$server_root"
break
@@ -36,25 +31,23 @@ NginxConfigServerRoot()
NginxConfigServerLiveRoot()
{
- Println "设置公开目录下的(live目录 - HLS输出目录)位置"
- while read -p "(默认: $server_root/): " server_live_root
+ while true
do
- if [ -z "$server_live_root" ]
- then
- server_live_root="$server_root"
- ln -sf "$LIVE_ROOT" "$server_live_root/"
- break
- elif [ "${server_live_root:0:1}" != "/" ]
+ echo
+ inquirer text_input "设置公开目录下的(live目录 - HLS输出目录)位置" server_live_root "$server_root"
+
+ if [ "${server_live_root:0:1}" != "/" ]
then
Println "$error 输入错误\n"
else
- if [ "${server_live_root: -1}" == "/" ]
+ server_live_root="${server_live_root%/}"
+
+ if [ -d "$LIVE_ROOT" ]
then
- server_live_root=${server_live_root:0:-1}
+ ln -sf "$LIVE_ROOT" "$server_live_root/"
fi
mkdir -p "$server_live_root"
- ln -sf "$LIVE_ROOT" "$server_live_root/"
break
fi
done
diff --git a/src/nx b/src/nx
index 41d5465..0112d49 100644
--- a/src/nx
+++ b/src/nx
@@ -130,7 +130,7 @@ NginxInstall()
if [ "$dist" == "mac" ] && [ ! -d /usr/local/nginx ]
then
- Println "$info 建立目录 /usr/local/nginx\n"
+ Println "$info 建立目录 /usr/local/nginx, 可能需要输入密码\n"
sudo mkdir /usr/local/nginx
sudo chown $USER /usr/local/nginx
fi
@@ -261,30 +261,31 @@ NginxInstall()
fi
fi
- while IFS= read -r line
- do
- if [ "$openssl_options_index" -eq 0 ]
- then
- if [[ $line == *"openssl-1."* ]]
- then
- openssl_name=${line#*\K[^<]+'))
+
+ for openssl_ver in "${openssl_vers[@]}"
+ do
+ if [ "${openssl_ver%%.*}" -eq 1 ]
then
- openssl_name=${line#* /dev/null)
+ done
+ openssl_url="$openssl_url/$openssl_ver"
+ else
+ openssl_url="https://www.openssl.org/source"
+ fi
+
+ openssl_packs=($(curl -s -Lm 20 $openssl_url/ | grep -oP ' | \K[^<]+'))
+ openssl_pack="${openssl_packs[0]}"
+ openssl_name=${openssl_pack%.tar*}
if [ ! -d "./$openssl_name" ]
then
- curl -s -L "https://www.openssl.org/source/$openssl_name.tar.gz" -o "$openssl_name.tar.gz"
- tar xzf "$openssl_name.tar.gz"
+ curl -s -L "$openssl_url/$openssl_pack" -o "$openssl_pack"
+ tar xzf "$openssl_pack"
fi
echo -n "...60%..."
@@ -469,7 +470,7 @@ Println " nginx 管理面板 ${normal}${red}[v$sh_ver]${normal}
${green}11.${normal} 开关
${green}12.${normal} 重启
————————————
- ${green}13.${normal} 配置 日志切割
+ ${green}13.${normal} 配置 vim
${green}14.${normal} 配置 nodejs
${green}15.${normal} 配置 mongodb
${green}16.${normal} 配置 postfix
@@ -477,6 +478,7 @@ Println " nginx 管理面板 ${normal}${red}[v$sh_ver]${normal}
${green}18.${normal} 配置 dnscrypt proxy
${green}19.${normal} 识别 cloudflare/ibm ip
${green}20.${normal} 删除域名
+ ${green}21.${normal} 日志切割
${tip} 输入: nx 打开面板
@@ -529,7 +531,7 @@ case "$nginx_num" in
NginxRestart
;;
13)
- NginxLogRotate
+ VimConfig
;;
14)
NodejsMenu
@@ -552,6 +554,9 @@ case "$nginx_num" in
20)
NginxDeleteDomain
;;
+ 21)
+ NginxLogRotate
+ ;;
*) Println "$error $i18n_input_correct_number [1-20]\n"
;;
esac
diff --git a/src/or b/src/or
index a94eeb0..37946c8 100644
--- a/src/or
+++ b/src/or
@@ -122,7 +122,7 @@ OpenrestyInstall()
if [ "$dist" == "mac" ] && [ ! -d /usr/local/openresty ]
then
- Println "$info 建立目录 /usr/local/openresty\n"
+ Println "$info 建立目录 /usr/local/openresty, 可能需要输入密码\n"
sudo mkdir /usr/local/openresty
sudo chown $USER /usr/local/openresty
fi
@@ -178,7 +178,7 @@ OpenrestyInstall()
cd "$openresty_package_name/bundle/ngx_lua-"*
curl -s -L "$FFMPEG_MIRROR_LINK/fix_ngx_lua_resp_get_headers_key_whitespace.patch" -o fix_ngx_lua_resp_get_headers_key_whitespace.patch
- patch -p1 < fix_ngx_lua_resp_get_headers_key_whitespace.patch >/dev/null 2>&1
+ patch -p1 < fix_ngx_lua_resp_get_headers_key_whitespace.patch >/dev/null 2>&1 || true
cd ../../
@@ -309,12 +309,12 @@ OpenrestyInstall()
then
rm -rf ${openssl_name}
rm -rf ${openssl_name}-patched
- curl -s -L https://www.openssl.org/source/$openssl_name.tar.gz -o $openssl_name.tar.gz
- tar xzf $openssl_name.tar.gz
- mv $openssl_name $openssl_name-patched
- cd $openssl_name-patched
+ curl -s -L https://www.openssl.org/source/old/1.1.1/${openssl_name}.tar.gz -o ${openssl_name}.tar.gz
+ tar xzf ${openssl_name}.tar.gz
+ mv ${openssl_name} ${openssl_name}-patched
+ cd ${openssl_name}-patched
curl -s -L "$FFMPEG_MIRROR_LINK/openssl-1.1.1f-sess_set_get_cb_yield.patch" -o openssl-1.1.1f-sess_set_get_cb_yield.patch
- patch -p1 < openssl-1.1.1f-sess_set_get_cb_yield.patch >/dev/null 2>&1
+ patch -p1 < openssl-1.1.1f-sess_set_get_cb_yield.patch >/dev/null 2>&1 || true
cd ~
fi
@@ -323,7 +323,7 @@ OpenrestyInstall()
cd "$openresty_package_name/bundle/ngx_lua-"*
curl -s -L "$FFMPEG_MIRROR_LINK/fix_ngx_lua_resp_get_headers_key_whitespace.patch" -o fix_ngx_lua_resp_get_headers_key_whitespace.patch
- patch -p1 < fix_ngx_lua_resp_get_headers_key_whitespace.patch >/dev/null 2>&1
+ patch -p1 < fix_ngx_lua_resp_get_headers_key_whitespace.patch >/dev/null 2>&1 || true
cd ../..
diff --git a/utils/curl b/utils/curl
index 4f89c97..b5a7565 100644
--- a/utils/curl
+++ b/utils/curl
@@ -213,6 +213,7 @@ CurlImpersonateCompile()
mkdir build && cd build
../configure --prefix="$curl_impersonate_prefix"
gmake chrome-build
+ Println "$tip 可能需要输入密码建立安装路径 $curl_impersonate_prefix"
sudo gmake chrome-install
else
if [ "$dist" == "rpm" ]
@@ -233,23 +234,25 @@ CurlImpersonateCompile()
sudo ldconfig
fi
+ if [ "$dist" == "mac" ]
+ then
+ Println "$tip 可能需要输入密码建立安装路径 ${curl_impersonate_prefix}/include/curl/"
+ fi
+
sudo mkdir -p "$curl_impersonate_prefix"/include/curl/
- cp -f curl-*/include/curl/* "$curl_impersonate_prefix"/include/curl/
- cp -f curl-*/curl-impersonate-chrome-config "$curl_impersonate_prefix"/bin/
- chmod +x "$curl_impersonate_prefix"/bin/curl-impersonate-chrome-config
+ sudo cp -f curl-*/include/curl/* "$curl_impersonate_prefix"/include/curl/
+ # sudo cp -f curl-*/curl-impersonate-chrome-config "$curl_impersonate_prefix"/bin/
+ # sudo chmod +x "$curl_impersonate_prefix"/bin/curl-impersonate-chrome-config
# rm -f /usr/local/bin/curl-config
- # ln -s "$curl_impersonate_prefix"/bin/curl-impersonate-chrome-config /usr/local/bin/curl-config
+ # sudo ln -s "$curl_impersonate_prefix"/bin/curl-impersonate-chrome-config /usr/local/bin/curl-config
Println "$info curl impersonate 编译成功\n"
}
NodeLibcurlImpersonateCompile()
{
- if [[ ! -x $(command -v node) ]] || [[ ! -x $(command -v npm) ]]
- then
- NodejsInstall
- fi
+ NodejsInstall
echo
inquirer text_input "输入编译安装好的 curl impersonate 路径" curl_impersonate_prefix /usr/local/curl-impersonate
@@ -271,10 +274,19 @@ NodeLibcurlImpersonateCompile()
git clone https://github.com/JCMais/node-libcurl.git node-libcurl-impersonate
cd node-libcurl-impersonate
curl -s -Lm 20 "$FFMPEG_MIRROR_LINK/node-libcurl-impersonate.patch" -o node-libcurl-impersonate.patch
- patch -p1 < node-libcurl-impersonate.patch
+ patch -p1 < node-libcurl-impersonate.patch || true
+
+ if [ "$dist" == "mac" ]
+ then
+ Println "$tip 可能需要输入密码创建链接 ln -s ${curl_impersonate_prefix}/bin/curl-impersonate-chrome-config /usr/local/bin/curl-config"
+ sudo ln -s "${curl_impersonate_prefix}"/lib/libcurl-impersonate-chrome.*.dylib /usr/local/curl-impersonate/lib/libcurl.dylib
+ fi
rm -f /usr/local/bin/curl-config
- ln -s "$curl_impersonate_prefix"/bin/curl-impersonate-chrome-config /usr/local/bin/curl-config
- npm install --force --unsafe-perm
+ sudo ln -s "$curl_impersonate_prefix"/bin/curl-impersonate-chrome-config /usr/local/bin/curl-config
+ npm run clean:dist
+ npm install --force --build-from-source --unsafe-perm
npm run build:dist
+
+ Println "$info 查看 $HOME/node-libcurl-impersonate/lib/binding/node_libcurl-impersonate.node\n可以这样使用 const { Curl, CurlFeature, CurlHttpVersion, CurlSslVersion } = require('$HOME/node-libcurl-impersonate/dist')\n详见 https://github.com/JCMais/node-libcurl/\n"
}
|