Files
Leantime/.dev/remote-deploy/43_verify_hot.sh

50 lines
2.1 KiB
Bash
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

#!/bin/bash
set -u
cd /var/www/onebot
JAR=/tmp/ob43.txt
rm -f $JAR
echo "=== 登录 ==="
BODY=$(curl -s -c $JAR http://127.0.0.1:8081/auth/login)
CSRF=$(echo "$BODY" | grep -oE 'name="csrf-token" content="[^"]*"' | sed 's/.*content="//;s/"//')
curl -s -b $JAR -c $JAR -X POST http://127.0.0.1:8081/auth/login \
-d "username=ruiguo_wang@163.com" -d "password=wrg521113.." -d "_token=$CSRF" \
-H "X-CSRF-TOKEN: $CSRF" -o /dev/null -w "login HTTP=%{http_code}\n"
echo ""
echo "=== 详情页渲染 ==="
curl -s -b $JAR -o /tmp/ob43.html -w "bom/show/3 HTTP=%{http_code}\n" http://127.0.0.1:8081/bom/show/3
echo ""
echo "=== 关键元素检查 ==="
echo -n "Handsontable js 引入: "; grep -c 'handsontable.full.min.js' /tmp/ob43.html
echo -n "Handsontable css 引入: "; grep -c 'handsontable.full.min.css' /tmp/ob43.html
echo -n "bomHot 容器: "; grep -c 'id="bomHot"' /tmp/ob43.html
echo -n "imageRenderer: "; grep -c 'imageRenderer' /tmp/ob43.html
echo -n "fileRenderer: "; grep -c 'fileRenderer' /tmp/ob43.html
echo -n "new Handsontable: "; grep -c 'new Handsontable' /tmp/ob43.html
echo -n "附件 URL (attachments/read): "; grep -c 'attachments/read' /tmp/ob43.html
echo -n "图片缩略图 img 标签: "; grep -c '<img' /tmp/ob43.html
echo ""
echo "=== 明细 API 返回的附件字段(应为 JSON 数组含 url ==="
curl -s -b $JAR "http://127.0.0.1:8081/bom/api/3" | php -r '
$d=json_decode(stream_get_contents(STDIN),true);
$cols=$d["data"]["columns"] ?? [];
$img=$d["data"]["imageColumns"] ?? [];
$file=$d["data"]["fileColumns"] ?? [];
echo "imageColumns: ".json_encode($img,JSON_UNESCAPED_UNICODE)."\n";
echo "fileColumns: ".json_encode($file,JSON_UNESCAPED_UNICODE)."\n";
$it=$d["data"]["items"][0] ?? [];
foreach($img as $k){ echo "首行 $k = ".substr((string)($it[$k]??""),0,120)."\n"; }
'
echo ""
echo "=== Handsontable 静态资源可访问 ==="
curl -s -o /dev/null -w "js HTTP=%{http_code}\n" http://127.0.0.1:8081/dist/handsontable/handsontable.full.min.js
curl -s -o /dev/null -w "css HTTP=%{http_code}\n" http://127.0.0.1:8081/dist/handsontable/handsontable.full.min.css
echo ""
echo "=== 完成 ==="