Skip to content

Commit

Permalink
修复单文件订阅代理无效
Browse files Browse the repository at this point in the history
  • Loading branch information
whyour committed Jun 13, 2024
1 parent 46e71d8 commit 7d0cae7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 13 deletions.
2 changes: 1 addition & 1 deletion back/api/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ export default (app: Router) => {
} else {
return res.send({
code: 400,
message: '文件缺少name或者value字段,参考导出文件格式',
message: '每条数据 name 或者 value 字段不能为空,参考导出文件格式',
});
}
} catch (e) {
Expand Down
4 changes: 3 additions & 1 deletion back/config/subscription.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@ export function formatCommand(doc: Subscription, url?: string) {
autoDelCron,
} = doc;
if (type === 'file') {
command += `raw "${_url}"`;
command += `raw "${_url}" "${proxy || ''}" "${
isNil(autoAddCron) ? true : Boolean(autoAddCron)
}" "${isNil(autoDelCron) ? true : Boolean(autoDelCron)}"`;
} else {
command += `repo "${_url}" "${whitelist || ''}" "${blacklist || ''}" "${
dependences || ''
Expand Down
16 changes: 5 additions & 11 deletions shell/update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -156,21 +156,15 @@ update_raw() {
autoDelCron=${AutoDelCron}
fi

local proxyStr=""
if [[ $proxy ]]; then
if [[ $url == http:* ]]; then
proxyStr="-e \"http_proxy=${proxy}\""
elif [[ $url == https:* ]]; then
proxyStr="-e \"https_proxy=${proxy}\""
fi
fi

local raw_url="$url"
local suffix="${raw_url##*.}"
local raw_file_name="${uniq_path}.${suffix}"
echo -e "开始下载:${raw_url} \n\n保存路径:$dir_raw/${raw_file_name}\n"

wget -q --no-check-certificate $proxyStr -O "$dir_raw/${raw_file_name}.new" ${raw_url}
set_proxy "$proxy"
wget -q --no-check-certificate -O "$dir_raw/${raw_file_name}.new" ${raw_url}
exit_status=$?
unset_proxy

if [[ $? -eq 0 ]]; then
mv "$dir_raw/${raw_file_name}.new" "$dir_raw/${raw_file_name}"
Expand Down Expand Up @@ -527,7 +521,7 @@ main() {
raw)
get_uniq_path "$p2"
if [[ -n $p2 ]]; then
update_raw "$p2" "$p3" "$p4"
update_raw "$p2" "$p3" "$p4" "$p5"
else
eval echo -e "命令输入错误...\\\n" $cmd
eval usage $cmd
Expand Down

0 comments on commit 7d0cae7

Please sign in to comment.