1
0
mirror of https://github.com/flextype/flextype.git synced 2025-08-26 06:24:32 +02:00

refactor(core): fix path for images tokens

This commit is contained in:
Awilum
2020-04-14 20:11:46 +03:00
parent 7f296a8dd9
commit eae97b1fd0

View File

@@ -49,10 +49,11 @@ $app->get('/api/delivery/images/{path:.+}', function (Request $request, Response
// Validate delivery image token
if (validate_delivery_images_token($token)) {
$delivery_images_token_file_path = PATH['site'] . '/site/delivery/images/' . $token . '/token.yaml';
$delivery_images_token_file_path = PATH['site'] . '/tokens/delivery/images/' . $token . '/token.yaml';
// Set delivery token file
if ($delivery_images_token_file_data = $flextype['parser']->decode(Filesystem::read($delivery_images_token_file_path), 'yaml')) {
if ($delivery_images_token_file_data['state'] === 'disabled' ||
($delivery_images_token_file_data['limit_calls'] !== 0 && $delivery_images_token_file_data['calls'] >= $delivery_images_token_file_data['limit_calls'])) {
return $response->withJson(['detail' => 'Incorrect authentication credentials.'], 401);