mirror of
https://github.com/everett7623/nodeloc_vps_test.git
synced 2024-11-10 10:05:18 +00:00
Update Nlbench.sh
This commit is contained in:
parent
514909f411
commit
688c07899d
33
Nlbench.sh
33
Nlbench.sh
@ -452,23 +452,22 @@ generate_markdown_output() {
|
|||||||
local file_suffixes=("yabs" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "route")
|
local file_suffixes=("yabs" "fusion" "ip_quality" "streaming" "response" "multi_thread" "single_thread" "route")
|
||||||
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
|
local empty_tabs=("去程路由" "Ping.pe" "哪吒 ICMP" "其他")
|
||||||
|
|
||||||
echo "[tabs]" | iconv -f UTF-8 -t UTF-8//IGNORE > "$temp_output_file"
|
# 生成 Markdown 文件内容并确保使用 UTF-8 编码
|
||||||
|
echo "[tabs]" > "$temp_output_file"
|
||||||
|
|
||||||
# 输出有内容的标签
|
|
||||||
for i in "${!sections[@]}"; do
|
for i in "${!sections[@]}"; do
|
||||||
section="${sections[$i]}"
|
section="${sections[$i]}"
|
||||||
suffix="${file_suffixes[$i]}"
|
suffix="${file_suffixes[$i]}"
|
||||||
if [ -f "${base_output_file}_${suffix}" ]; then
|
if [ -f "${base_output_file}_${suffix}" ]; then
|
||||||
echo "[tab=\"$section\"]" | iconv -f UTF-8 -t UTF-8//IGNORE >> "$temp_output_file"
|
echo "[tab=\"$section\"]" >> "$temp_output_file"
|
||||||
echo "\`\`\`" >> "$temp_output_file"
|
echo "\`\`\`" >> "$temp_output_file"
|
||||||
cat "${base_output_file}_${suffix}" | iconv -f UTF-8 -t UTF-8//IGNORE >> "$temp_output_file"
|
cat "${base_output_file}_${suffix}" >> "$temp_output_file"
|
||||||
echo "\`\`\`" >> "$temp_output_file"
|
echo "\`\`\`" >> "$temp_output_file"
|
||||||
echo "[/tab]" >> "$temp_output_file"
|
echo "[/tab]" >> "$temp_output_file"
|
||||||
rm "${base_output_file}_${suffix}"
|
rm "${base_output_file}_${suffix}"
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# 添加保留的空白标签
|
|
||||||
for tab in "${empty_tabs[@]}"; do
|
for tab in "${empty_tabs[@]}"; do
|
||||||
echo "[tab=\"$tab\"]" >> "$temp_output_file"
|
echo "[tab=\"$tab\"]" >> "$temp_output_file"
|
||||||
echo "[/tab]" >> "$temp_output_file"
|
echo "[/tab]" >> "$temp_output_file"
|
||||||
@ -476,29 +475,25 @@ generate_markdown_output() {
|
|||||||
|
|
||||||
echo "[/tabs]" >> "$temp_output_file"
|
echo "[/tabs]" >> "$temp_output_file"
|
||||||
|
|
||||||
# 生成包含时间戳和随机字符的文件名
|
# 确保文件以 UTF-8 编码保存,防止乱码
|
||||||
|
iconv -f UTF-8 -t UTF-8//IGNORE "$temp_output_file" -o "${temp_output_file}.utf8"
|
||||||
|
mv "${temp_output_file}.utf8" "$temp_output_file"
|
||||||
|
|
||||||
|
# 生成时间戳和随机字符串文件名
|
||||||
local timestamp=$(date +"%Y%m%d%H%M%S")
|
local timestamp=$(date +"%Y%m%d%H%M%S")
|
||||||
local random_chars=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
|
local random_chars=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 6 | head -n 1)
|
||||||
local filename="${timestamp}-${random_chars}"
|
local filename="${timestamp}-${random_chars}.txt"
|
||||||
local txt_filename="${filename}.txt"
|
local txt_url="http://nodeloc.uukk.de/test/${filename}"
|
||||||
local html_filename="${filename}.html"
|
|
||||||
|
|
||||||
# 构造完整的URL
|
# 上传文件到 VPS,确保使用 UTF-8 编码
|
||||||
local txt_url="http://nodeloc.uukk.de/test/${txt_filename}"
|
if curl -H "Content-Type: text/plain; charset=utf-8" -s -X PUT --data-binary @"$temp_output_file" "$txt_url"; then
|
||||||
local html_url="http://nodeloc.uukk.de/test/${html_filename}"
|
|
||||||
|
|
||||||
# 创建HTML文件内容
|
|
||||||
local html_content="<html><head><meta http-equiv=\"refresh\" content=\"0; url=${txt_url}\"></head></html>"
|
|
||||||
|
|
||||||
# 上传文件
|
|
||||||
if curl -H "Content-Type: text/plain; charset=utf-8" -s -X PUT --data-binary @"$temp_output_file" "$txt_url" && \
|
|
||||||
echo "$html_content" | curl -H "Content-Type: text/html; charset=utf-8" -s -X PUT --data-binary @- "$html_url"; then
|
|
||||||
echo "测试结果已上传。您可以在以下链接查看:"
|
echo "测试结果已上传。您可以在以下链接查看:"
|
||||||
echo "$txt_url"
|
echo "$txt_url"
|
||||||
else
|
else
|
||||||
echo "上传失败。结果已保存在本地文件 $temp_output_file"
|
echo "上传失败。结果已保存在本地文件 $temp_output_file"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# 删除本地的 Markdown 文件
|
||||||
rm "$temp_output_file"
|
rm "$temp_output_file"
|
||||||
read -p "按回车键继续..."
|
read -p "按回车键继续..."
|
||||||
clear
|
clear
|
||||||
|
Loading…
Reference in New Issue
Block a user