Merge branch 'master' of github.com:appwrite/appwrite into feat-move-deletion-to-worker
This commit is contained in:
commit
8322749c2c
5 changed files with 35 additions and 34 deletions
|
@ -267,7 +267,7 @@ App::get('/v1/health/anti-virus')
|
||||||
'status' => (@$antiVirus->ping()) ? 'online' : 'offline',
|
'status' => (@$antiVirus->ping()) ? 'online' : 'offline',
|
||||||
'version' => @$antiVirus->version(),
|
'version' => @$antiVirus->version(),
|
||||||
]);
|
]);
|
||||||
} catch( RuntimeException $e) {
|
} catch( \Exception $e) {
|
||||||
$response->json([
|
$response->json([
|
||||||
'status' => 'offline',
|
'status' => 'offline',
|
||||||
'version' => '',
|
'version' => '',
|
||||||
|
|
|
@ -242,6 +242,7 @@ App::get('/v1/storage/files/:fileId/preview')
|
||||||
->param('fileId', '', new UID(), 'File unique ID')
|
->param('fileId', '', new UID(), 'File unique ID')
|
||||||
->param('width', 0, new Range(0, 4000), 'Resize preview image width, Pass an integer between 0 to 4000.', true)
|
->param('width', 0, new Range(0, 4000), 'Resize preview image width, Pass an integer between 0 to 4000.', true)
|
||||||
->param('height', 0, new Range(0, 4000), 'Resize preview image height, Pass an integer between 0 to 4000.', true)
|
->param('height', 0, new Range(0, 4000), 'Resize preview image height, Pass an integer between 0 to 4000.', true)
|
||||||
|
->param('gravity', Image::GRAVITY_CENTER, new WhiteList([Image::GRAVITY_CENTER, Image::GRAVITY_NORTH, Image::GRAVITY_NORTHWEST, Image::GRAVITY_NORTHEAST, Image::GRAVITY_WEST, Image::GRAVITY_EAST, Image::GRAVITY_SOUTHWEST, Image::GRAVITY_SOUTH, Image::GRAVITY_SOUTHEAST]), 'Image crop gravity', true)
|
||||||
->param('quality', 100, new Range(0, 100), 'Preview image quality. Pass an integer between 0 to 100. Defaults to 100.', true)
|
->param('quality', 100, new Range(0, 100), 'Preview image quality. Pass an integer between 0 to 100. Defaults to 100.', true)
|
||||||
->param('borderWidth', 0, new Range(0, 100), 'Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.', true)
|
->param('borderWidth', 0, new Range(0, 100), 'Preview image border in pixels. Pass an integer between 0 to 100. Defaults to 0.', true)
|
||||||
->param('borderColor', '', new HexColor(), 'Preview image border color. Use a valid HEX color, no # is needed for prefix.', true)
|
->param('borderColor', '', new HexColor(), 'Preview image border color. Use a valid HEX color, no # is needed for prefix.', true)
|
||||||
|
@ -254,7 +255,7 @@ App::get('/v1/storage/files/:fileId/preview')
|
||||||
->inject('response')
|
->inject('response')
|
||||||
->inject('project')
|
->inject('project')
|
||||||
->inject('projectDB')
|
->inject('projectDB')
|
||||||
->action(function ($fileId, $width, $height, $quality, $borderWidth, $borderColor, $borderRadius, $opacity, $rotation, $background, $output, $request, $response, $project, $projectDB) {
|
->action(function ($fileId, $width, $height, $gravity, $quality, $borderWidth, $borderColor, $borderRadius, $opacity, $rotation, $background, $output, $request, $response, $project, $projectDB) {
|
||||||
/** @var Utopia\Swoole\Request $request */
|
/** @var Utopia\Swoole\Request $request */
|
||||||
/** @var Appwrite\Utopia\Response $response */
|
/** @var Appwrite\Utopia\Response $response */
|
||||||
/** @var Appwrite\Database\Document $project */
|
/** @var Appwrite\Database\Document $project */
|
||||||
|
@ -342,7 +343,7 @@ App::get('/v1/storage/files/:fileId/preview')
|
||||||
|
|
||||||
$image = new Image($source);
|
$image = new Image($source);
|
||||||
|
|
||||||
$image->crop((int) $width, (int) $height);
|
$image->crop((int) $width, (int) $height, $gravity);
|
||||||
|
|
||||||
if (!empty($opacity) || $opacity==0) {
|
if (!empty($opacity) || $opacity==0) {
|
||||||
$image->setOpacity($opacity);
|
$image->setOpacity($opacity);
|
||||||
|
|
|
@ -51,7 +51,7 @@
|
||||||
"utopia-php/domains": "1.1.*",
|
"utopia-php/domains": "1.1.*",
|
||||||
"utopia-php/swoole": "0.2.*",
|
"utopia-php/swoole": "0.2.*",
|
||||||
"utopia-php/storage": "0.5.*",
|
"utopia-php/storage": "0.5.*",
|
||||||
"utopia-php/image": "0.2.*",
|
"utopia-php/image": "0.3.*",
|
||||||
"resque/php-resque": "1.3.6",
|
"resque/php-resque": "1.3.6",
|
||||||
"matomo/device-detector": "4.2.2",
|
"matomo/device-detector": "4.2.2",
|
||||||
"dragonmantank/cron-expression": "3.1.0",
|
"dragonmantank/cron-expression": "3.1.0",
|
||||||
|
|
16
composer.lock
generated
16
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "6704f7df5ffe0baac3633dc8e683ed78",
|
"content-hash": "399d2426ca92e04b6d6fb84a91c316c3",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "adhocore/jwt",
|
"name": "adhocore/jwt",
|
||||||
|
@ -1742,16 +1742,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/image",
|
"name": "utopia-php/image",
|
||||||
"version": "0.2.1",
|
"version": "0.3.2",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/utopia-php/image.git",
|
"url": "https://github.com/utopia-php/image.git",
|
||||||
"reference": "0754955a165483852184d1215cc3bf659432d23a"
|
"reference": "2044fdd44d87c4253cfe929cca975fd037461b00"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/utopia-php/image/zipball/0754955a165483852184d1215cc3bf659432d23a",
|
"url": "https://api.github.com/repos/utopia-php/image/zipball/2044fdd44d87c4253cfe929cca975fd037461b00",
|
||||||
"reference": "0754955a165483852184d1215cc3bf659432d23a",
|
"reference": "2044fdd44d87c4253cfe929cca975fd037461b00",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -1789,9 +1789,9 @@
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"issues": "https://github.com/utopia-php/image/issues",
|
"issues": "https://github.com/utopia-php/image/issues",
|
||||||
"source": "https://github.com/utopia-php/image/tree/0.2.1"
|
"source": "https://github.com/utopia-php/image/tree/0.3.2"
|
||||||
},
|
},
|
||||||
"time": "2021-04-13T07:47:24+00:00"
|
"time": "2021-06-10T09:16:11+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "utopia-php/locale",
|
"name": "utopia-php/locale",
|
||||||
|
@ -6025,5 +6025,5 @@
|
||||||
"platform-overrides": {
|
"platform-overrides": {
|
||||||
"php": "8.0"
|
"php": "8.0"
|
||||||
},
|
},
|
||||||
"plugin-api-version": "2.0.0"
|
"plugin-api-version": "2.1.0"
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,33 +94,33 @@ class HTTPTest extends Scope
|
||||||
$this->assertStringContainsString('# robotstxt.org/', $response['body']);
|
$this->assertStringContainsString('# robotstxt.org/', $response['body']);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testSpecSwagger2()
|
// public function testSpecSwagger2()
|
||||||
{
|
// {
|
||||||
$response = $this->client->call(Client::METHOD_GET, '/specs/swagger2?platform=client', [
|
// $response = $this->client->call(Client::METHOD_GET, '/specs/swagger2?platform=client', [
|
||||||
'content-type' => 'application/json',
|
// 'content-type' => 'application/json',
|
||||||
], []);
|
// ], []);
|
||||||
|
|
||||||
if(!file_put_contents(__DIR__ . '/../../resources/swagger2.json', json_encode($response['body']))) {
|
// if(!file_put_contents(__DIR__ . '/../../resources/swagger2.json', json_encode($response['body']))) {
|
||||||
throw new Exception('Failed to save spec file');
|
// throw new Exception('Failed to save spec file');
|
||||||
}
|
// }
|
||||||
|
|
||||||
$client = new Client();
|
// $client = new Client();
|
||||||
$client->setEndpoint('https://validator.swagger.io');
|
// $client->setEndpoint('https://validator.swagger.io');
|
||||||
|
|
||||||
/**
|
// /**
|
||||||
* Test for SUCCESS
|
// * Test for SUCCESS
|
||||||
*/
|
// */
|
||||||
$response = $client->call(Client::METHOD_POST, '/validator/debug', [
|
// $response = $client->call(Client::METHOD_POST, '/validator/debug', [
|
||||||
'content-type' => 'application/json',
|
// 'content-type' => 'application/json',
|
||||||
], json_decode(file_get_contents(realpath(__DIR__ . '/../../resources/swagger2.json')), true));
|
// ], json_decode(file_get_contents(realpath(__DIR__ . '/../../resources/swagger2.json')), true));
|
||||||
|
|
||||||
$response['body'] = json_decode($response['body'], true);
|
// $response['body'] = json_decode($response['body'], true);
|
||||||
|
|
||||||
$this->assertEquals(200, $response['headers']['status-code']);
|
// $this->assertEquals(200, $response['headers']['status-code']);
|
||||||
$this->assertTrue(empty($response['body']));
|
// $this->assertTrue(empty($response['body']));
|
||||||
|
|
||||||
unlink(realpath(__DIR__ . '/../../resources/swagger2.json'));
|
// unlink(realpath(__DIR__ . '/../../resources/swagger2.json'));
|
||||||
}
|
// }
|
||||||
|
|
||||||
public function testSpecOpenAPI3()
|
public function testSpecOpenAPI3()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue