Merge branch '0.7.x' of github.com:appwrite/appwrite into 0.7.x

This commit is contained in:
Eldad Fux
2021-01-11 15:38:41 +02:00
8 changed files with 61 additions and 13 deletions
+8 -3
View File
@@ -383,8 +383,9 @@ App::get('/v1/avatars/qr')
$download = ($download === '1' || $download === 'true' || $download === 1 || $download === true);
$options = new QROptions([
'quietzone' => $size,
'outputType' => QRCode::OUTPUT_IMAGICK
'addQuietzone' => true,
'quietzoneSize' => $margin,
'outputType' => QRCode::OUTPUT_IMAGICK,
]);
$qrcode = new QRCode($options);
@@ -393,10 +394,14 @@ App::get('/v1/avatars/qr')
$response->addHeader('Content-Disposition', 'attachment; filename="qr.png"');
}
$resize = new Resize($qrcode->render($text));
$resize->crop((int) $size, (int) $size);
$response
->addHeader('Expires', \date('D, d M Y H:i:s', \time() + (60 * 60 * 24 * 45)).' GMT') // 45 days cache
->setContentType('image/png')
->send($qrcode->render($text))
->send($resize->output('png', 9))
;
});
+1 -1
View File
@@ -52,7 +52,7 @@
"domnikl/statsd": "3.0.2",
"influxdb/influxdb-php": "1.15.1",
"phpmailer/phpmailer": "6.1.7",
"chillerlan/php-qrcode": "4.2.0"
"chillerlan/php-qrcode": "4.3.0"
},
"require-dev": {
"swoole/ide-helper": "4.5.5",
Generated
+11 -7
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "025317bd1e05b735b2c4897f9cb6db4a",
"content-hash": "249dc088c5f9f74a1c0e91661f93f96b",
"packages": [
{
"name": "appwrite/php-clamav",
@@ -57,16 +57,16 @@
},
{
"name": "chillerlan/php-qrcode",
"version": "4.2.0",
"version": "4.3.0",
"source": {
"type": "git",
"url": "https://github.com/chillerlan/php-qrcode.git",
"reference": "1972af7af51b203bc239d8fb94243f6ed2a1067a"
"reference": "4968063fb3baeedb658293f89f9673fbf2499a3e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/1972af7af51b203bc239d8fb94243f6ed2a1067a",
"reference": "1972af7af51b203bc239d8fb94243f6ed2a1067a",
"url": "https://api.github.com/repos/chillerlan/php-qrcode/zipball/4968063fb3baeedb658293f89f9673fbf2499a3e",
"reference": "4968063fb3baeedb658293f89f9673fbf2499a3e",
"shasum": ""
},
"require": {
@@ -119,15 +119,19 @@
],
"support": {
"issues": "https://github.com/chillerlan/php-qrcode/issues",
"source": "https://github.com/chillerlan/php-qrcode/tree/4.2.0"
"source": "https://github.com/chillerlan/php-qrcode/tree/4.3.0"
},
"funding": [
{
"url": "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4",
"type": "custom"
},
{
"url": "https://ko-fi.com/codemasher",
"type": "ko_fi"
}
],
"time": "2020-10-07T14:41:07+00:00"
"time": "2020-11-18T20:49:20+00:00"
},
{
"name": "chillerlan/php-settings-container",
@@ -336,6 +336,13 @@ trait AvatarsBase
$this->assertEquals('image/png', $response['headers']['content-type']);
$this->assertNotEmpty($response['body']);
$image = new \Imagick();
$image->readImageBlob($response['body']);
$this->assertEquals(400, $image->getImageWidth());
$this->assertEquals(400, $image->getImageHeight());
$this->assertEquals('PNG', $image->getImageFormat());
$this->assertEquals(strlen(\file_get_contents(__DIR__ . '/../../../resources/qr/qr-default.png')), strlen($response['body']));
$response = $this->client->call(Client::METHOD_GET, '/avatars/qr', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
@@ -347,6 +354,13 @@ trait AvatarsBase
$this->assertEquals('image/png', $response['headers']['content-type']);
$this->assertNotEmpty($response['body']);
$image = new \Imagick();
$image->readImageBlob($response['body']);
$this->assertEquals(200, $image->getImageWidth());
$this->assertEquals(200, $image->getImageHeight());
$this->assertEquals('PNG', $image->getImageFormat());
$this->assertEquals(strlen(\file_get_contents(__DIR__ . '/../../../resources/qr/qr-size-200.png')), strlen($response['body']));
$response = $this->client->call(Client::METHOD_GET, '/avatars/qr', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
@@ -359,6 +373,13 @@ trait AvatarsBase
$this->assertEquals('image/png', $response['headers']['content-type']);
$this->assertNotEmpty($response['body']);
$image = new \Imagick();
$image->readImageBlob($response['body']);
$this->assertEquals(200, $image->getImageWidth());
$this->assertEquals(200, $image->getImageHeight());
$this->assertEquals('PNG', $image->getImageFormat());
$this->assertEquals(strlen(\file_get_contents(__DIR__ . '/../../../resources/qr/qr-size-200-margin-10.png')), strlen($response['body']));
$response = $this->client->call(Client::METHOD_GET, '/avatars/qr', [
'x-appwrite-project' => $this->getProject()['$id'],
], [
@@ -368,6 +389,13 @@ trait AvatarsBase
'download' => 1,
]);
$image = new \Imagick();
$image->readImageBlob($response['body']);
$this->assertEquals(200, $image->getImageWidth());
$this->assertEquals(200, $image->getImageHeight());
$this->assertEquals('PNG', $image->getImageFormat());
$this->assertEquals(strlen(\file_get_contents(__DIR__ . '/../../../resources/qr/qr-size-200-margin-10.png')), strlen($response['body']));
$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals('attachment; filename="qr.png"', $response['headers']['content-disposition']);
$this->assertEquals('image/png', $response['headers']['content-type']);
+13 -2
View File
@@ -125,12 +125,12 @@ trait UsersBase
/**
* @depends testGetUser
*/
public function testUpdateUserPrefs(array $data):array
public function testUpdateAndGetUserPrefs(array $data):array
{
/**
* Test for SUCCESS
*/
$user = $this->client->call(Client::METHOD_PATCH, '/users/' . $data['userId'] . '/prefs', array_merge([
$user = $this->client->call(Client::METHOD_PATCH, '/users/'.$data['userId'].'/prefs', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()), [
@@ -144,6 +144,17 @@ trait UsersBase
$this->assertEquals($user['body']['funcKey1'], 'funcValue1');
$this->assertEquals($user['body']['funcKey2'], 'funcValue2');
$user = $this->client->call(Client::METHOD_GET, '/users/'.$data['userId'].'/prefs', array_merge([
'content-type' => 'application/json',
'x-appwrite-project' => $this->getProject()['$id'],
], $this->getHeaders()));
$this->assertEquals($user['headers']['status-code'], 200);
$this->assertEquals($user['body'], [
'funcKey1' => 'funcValue1',
'funcKey2' => 'funcValue2',
]);
/**
* Test for FAILURE
*/
Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.9 KiB