Chevereto upload pass key in body

This commit is contained in:
xiaomlove
2025-05-26 16:26:53 +07:00
parent d4109f8279
commit 9de0963595
+4 -2
View File
@@ -10,8 +10,6 @@ class Chevereto extends Storage {
{ {
$api = get_setting("image_hosting_chevereto.upload_api_endpoint"); $api = get_setting("image_hosting_chevereto.upload_api_endpoint");
$token = get_setting("image_hosting_chevereto.upload_token"); $token = get_setting("image_hosting_chevereto.upload_token");
$apiQueryString = parse_url($api, PHP_URL_QUERY);
$api .= (!empty($apiQueryString) ? "&" : "?") . "key=$token";
$logPrefix = "filepath: $filepath, api: $api, token: $token"; $logPrefix = "filepath: $filepath, api: $api, token: $token";
$httpClient = new \GuzzleHttp\Client(); $httpClient = new \GuzzleHttp\Client();
$response = $httpClient->request('POST', $api, [ $response = $httpClient->request('POST', $api, [
@@ -22,6 +20,10 @@ class Chevereto extends Storage {
[ [
'name' => 'source', 'name' => 'source',
'contents' => Psr7\Utils::tryFopen($filepath, 'r') 'contents' => Psr7\Utils::tryFopen($filepath, 'r')
],
[
'name' => 'key',
'contents' => $token
] ]
] ]
]); ]);