finished uploading image

This commit is contained in:
Penguin-71630
2025-12-12 00:27:45 +08:00
parent 85faf9d2ec
commit 1081d6b07c
15 changed files with 734 additions and 219 deletions

5
tests/cookies.txt Normal file
View File

@@ -0,0 +1,5 @@
# Netscape HTTP Cookie File
# https://curl.se/docs/http-cookies.html
# This file was generated by libcurl! Edit at your own risk.
localhost FALSE / FALSE 1765468235 refresh_token eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjU0NjgyMzUsImlhdCI6MTc2NTQ2NDYzNSwidXNlcl9pZCI6IjYyNzQ1OTI4MDA0MzM3NjY4OSJ9.lOYJVE1GSOmDozP55xLQwa2bFEpzJUHt4vzJKGdzNec

22
tests/ping-get-aliases.bash Executable file
View File

@@ -0,0 +1,22 @@
#!/bin/bash
# Check if TOKEN is provided
if [ -z "$TOKEN" ]; then
echo "Error: TOKEN environment variable is required"
echo "Usage: TOKEN=your_token_here ./ping-get-aliases.bash"
exit 1
fi
curl -X POST http://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d "{\"token\":\"$TOKEN\"}" \
-c cookies.txt \
-v > test.log 2>&1
# Parse refresh_token from cookies.txt
REFRESH_TOKEN=$(grep refresh_token cookies.txt | awk '{print $7}')
curl -b "refresh_token=$REFRESH_TOKEN" http://localhost:8080/api/aliases -v >> test.log 2>&1
# Display the result
echo "Test completed. Check test.log for details."

26
tests/ping-post-image.bash Executable file
View File

@@ -0,0 +1,26 @@
#!/bin/bash
# Check if TOKEN is provided
if [ -z "$TOKEN" ]; then
echo "Error: TOKEN environment variable is required"
echo "Usage: TOKEN=your_token_here ./ping-get-aliases.bash"
exit 1
fi
curl -X POST http://localhost:8080/auth/login \
-H "Content-Type: application/json" \
-d "{\"token\":\"$TOKEN\"}" \
-c cookies.txt \
-v > test.log 2>&1
# Parse refresh_token from cookies.txt
REFRESH_TOKEN=$(grep refresh_token cookies.txt | awk '{print $7}')
curl \
-X POST http://localhost:8080/api/image \
-b "refresh_token=$REFRESH_TOKEN" \
-v \
>> test.log 2>&1
# Display the result
echo "Test completed. Check test.log for details."

54
tests/test.log Normal file
View File

@@ -0,0 +1,54 @@
Note: Unnecessary use of -X or --request, POST is already inferred.
* Host localhost:8080 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> POST /auth/login HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.7.1
> Accept: */*
> Content-Type: application/json
> Content-Length: 36
>
} [36 bytes data]
* upload completely sent off: 36 bytes
< HTTP/1.1 200 OK
< Access-Control-Allow-Credentials: true
< Access-Control-Allow-Origin: http://localhost:48763
* Added cookie refresh_token="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjU0NjgyMzUsImlhdCI6MTc2NTQ2NDYzNSwidXNlcl9pZCI6IjYyNzQ1OTI4MDA0MzM3NjY4OSJ9.lOYJVE1GSOmDozP55xLQwa2bFEpzJUHt4vzJKGdzNec" for domain localhost, path /, expire 1765468235
< Set-Cookie: refresh_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjU0NjgyMzUsImlhdCI6MTc2NTQ2NDYzNSwidXNlcl9pZCI6IjYyNzQ1OTI4MDA0MzM3NjY4OSJ9.lOYJVE1GSOmDozP55xLQwa2bFEpzJUHt4vzJKGdzNec; Path=/; Expires=Thu, 11 Dec 2025 15:50:35 GMT
< Date: Thu, 11 Dec 2025 14:50:35 GMT
< Content-Length: 35
< Content-Type: text/plain; charset=utf-8
<
{ [35 bytes data]
100 71 100 35 100 36 1724 1773 --:--:-- --:--:-- --:--:-- 3550
* Connection #0 to host localhost left intact
{"code":200, "message": "success"}
* Host localhost:8080 was resolved.
* IPv6: ::1
* IPv4: 127.0.0.1
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0* Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> POST /api/image HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.7.1
> Accept: */*
> Cookie: refresh_token=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJleHAiOjE3NjU0NjgyMzUsImlhdCI6MTc2NTQ2NDYzNSwidXNlcl9pZCI6IjYyNzQ1OTI4MDA0MzM3NjY4OSJ9.lOYJVE1GSOmDozP55xLQwa2bFEpzJUHt4vzJKGdzNec
>
* Request completely sent off
< HTTP/1.1 404 Not Found
< Content-Type: text/plain; charset=utf-8
< X-Content-Type-Options: nosniff
< Date: Thu, 11 Dec 2025 14:50:35 GMT
< Content-Length: 19
<
{ [19 bytes data]